Oracle

API

class terra_sdk.client.lcd.api.oracle.OracleAPI(c)[source]
active_denoms()[source]

Fetches current active denoms.

Returns

active denoms

Return type

List[str]

aggregate_prevote(validator)[source]

Fetches active aggregate prevote for a validator.

Parameters

validator (ValAddress) – validator operator address

Returns

current aggegate prevote (if any).

Return type

Optional[AggregateExchangeRatePrevote]

aggregate_vote(validator)[source]

Fetches active aggregate vote for a validator.

Parameters

validator (ValAddress) – validator operator address

Returns

current aggegate vote (if any).

Return type

Optional[AggregateExchangeRatePrevote]

exchange_rate(denom)[source]

Fetches registered exchange rate of Luna in a specific denom.

Parameters

denom (str) – denom

Returns

exchange rate of Luna

Return type

Coin

exchange_rates()[source]

Fetches registered exchange rates of Luna in all available denoms.

Returns

exchange rates of Luna

Return type

Coins

feeder_address(validator)[source]

Fetches current active denoms.

Returns

active denoms

Return type

List[str]

misses(validator)[source]

Fetches current value of miss counter for a validator.

Parameters

validator (ValAddress) – validator operator address

Returns

current number of misses

Return type

int

parameters()[source]

Fetches Oracle module parameters.

Returns

Oracle module parameters

Return type

dict

prevotes(denom=None, validator=None)[source]

Fetches active oracle prevotes, filtering by denom, or validator, or both.

Parameters
  • denom (Optional[str], optional) – denom.

  • validator (Optional[ValAddress], optional) – validator operator address.

Raises

TypeError – if both denom and validator are None

Returns

prevotes

Return type

List[ExchangeRatePrevote]

votes(denom=None, validator=None)[source]

Fetches active oracle votes, filtering by denom, or validator, or both.

Parameters
  • denom (Optional[str], optional) – denom.

  • validator (Optional[ValAddress], optional) – validator operator address.

Raises

TypeError – if both denom and validator are None

Returns

votes

Return type

List[ExchangeRateVote]

Data

Oracle module data objects.

class terra_sdk.core.oracle.data.AggregateExchangeRatePrevote(hash, voter, submit_block)[source]

Contains information about a validator’s aggregate prevote.

hash: str

Aggregate vote hash for the upcoming aggregate vote.

submit_block: int

Block height at which the aggregate prevote was submitted.

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

voter: ValAddress

Validator that submitted the aggregate prevote.

class terra_sdk.core.oracle.data.AggregateExchangeRateVote(exchange_rate_tuples, voter)[source]

Contains information about a validator’s aggregate vote.

exchange_rate_tuples: terra_sdk.core.coins.Coins

Reported exchange rates by validator.

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

voter: ValAddress

Validator that sent the aggregate vote.

class terra_sdk.core.oracle.data.ExchangeRatePrevote(hash, denom, voter, submit_block)[source]

Contains information about a validator’s prevote.

denom: str

Stablecoin variant for which the prevote corresponds to.

hash: str

Vote hash for the upcoming vote.

submit_block: int

Block height at which the prevote was submitted.

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

Dict[str, str]

voter: ValAddress

Validator that submitted the prevote.

class terra_sdk.core.oracle.data.ExchangeRateVote(exchange_rate, denom, voter)[source]

Contains information about a validator’s vote for price of LUNA.

denom: str

Stablecoin variant in which reported exchange rate is denominated in.

exchange_rate: terra_sdk.core.coin.Coin

Exchange rate of LUNA reported.

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

voter: ValAddress

Validator that submitted vote.

Functions

terra_sdk.core.oracle.msgs.vote_hash(denom, exchange_rate, salt, validator)[source]

Calculates vote hash for submitting MsgExchangeRatePrevote.

Parameters
  • denom (str) – denom to vote for

  • exchange_rate (Dec) – exchange rate of LUNA

  • salt (str) – salt

  • validator (str) – validator operator address

Returns

vote hash

Return type

str

terra_sdk.core.oracle.msgs.aggregate_vote_hash(salt, exchange_rates, validator)[source]

Calculates aggregate vote hash for submitting MsgAggregateExchangeRatePrevote.

Parameters
  • salt (str) – salt

  • exchange_rates (Coins.Input) – exchange rates in various denominations

  • validator (str) – validator operator address

Returns

aggregate vote hash

Return type

str

Messages

Oracle module messages.

class terra_sdk.core.oracle.msgs.MsgAggregateExchangeRatePrevote(hash, feeder, validator)[source]

Submit an aggregate vote for the current vote period.

Parameters
  • hash (str) – aggregate vote hash

  • feeder (AccAddress) – account submitting the aggregate prevote

  • validator (ValAddress) – validator to which the aggregate prevote corresponds

type: str = 'oracle/MsgAggregateExchangeRatePrevote'
class terra_sdk.core.oracle.msgs.MsgAggregateExchangeRateVote(exchange_rates, salt, feeder, validator)[source]

Submit an aggregate prevote for the current vote.

Parameters
  • exchange_rates (Coins.Input) – exchange rates to use

  • salt (str) – aggregate vote salt

  • feeder (AccAddress) – feeder account submitting aggregate prevote

  • validator (ValAddress) – validator vote corresponds to

get_aggregate_prevote()[source]

Generates the associated MsgAggregateExchangeRatePrevote object with the correct prepopulated fields.

Returns

associated aggregate prevote

Return type

MsgAggregateExchangeRatePrevote

get_aggregate_vote_hash()[source]

Vote hash required for message’s associated prevote.

Returns

aggregate vote hash

Return type

str

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

type: str = 'oracle/MsgAggregateExchangeRateVote'
class terra_sdk.core.oracle.msgs.MsgDelegateFeedConsent(operator, delegate)[source]

Re-assign oracle feeder account for a validator.

Parameters
  • operator (ValAddress) – validator to change feeder for

  • delegate (AccAddress) – new feeder address

action = 'delegatefeeder'
type: str = 'oracle/MsgDelegateFeedConsent'
class terra_sdk.core.oracle.msgs.MsgExchangeRatePrevote(hash, denom, feeder, validator)[source]

Submit a prevote for the current vote period.

Parameters
  • hash (str) – vote hash

  • denom (str) – denom for which the prevote is submitted

  • feeder (AccAddress) – delegated feeder account submitting vote

  • validator (ValAddress) – validator for which the prevote is submitted

class terra_sdk.core.oracle.msgs.MsgExchangeRateVote(exchange_rate, salt, denom, feeder, validator)[source]

Submit a vote for the current vote period.

Parameters
  • exchange_rate (Dec) – current exchange rate of LUNA

  • salt (str) – salt for vote hash

  • denom (str) – denom vote corresponds to

  • feeder (AccAddress) – delegated feeder account submitting vote

  • validator (ValAddress) – validator for which the vote is submitted

action = 'exchangeratevote'
get_prevote()[source]

Generates the associated MsgExchangeRatePrevote object with the correct prepopulated fields.

Returns

associated prevote

Return type

MsgExchangeRatePrevote

get_vote_hash()[source]

Vote hash required for the associated prevote.

Returns

vote hash

Return type

str

type: str = 'oracle/MsgExchangeRateVote'