# proto - oracle

# Table of Contents

Top

# nibiru/oracle/v1/event.proto

# EventAggregatePrevote

Emitted by MsgAggregateExchangePrevote when an aggregate prevote is added to state

Field Type Label Description
validator string Validator is the Bech32 address to which the vote will be credited.
feeder string Feeder is the delegate or representative that will send vote and prevote transaction messages on behalf of the voting validator.

# EventAggregateVote

Emitted by MsgAggregateExchangeVote when an aggregate vote is added to state

Field Type Label Description
validator string Validator is the Bech32 address to which the vote will be credited.
feeder string Feeder is the delegate or representative that will send vote and prevote transaction messages on behalf of the voting validator.
prices ExchangeRateTuple repeated

# EventDelegateFeederConsent

Emitted when a valoper delegates oracle voting rights to a feeder address.

Field Type Label Description
validator string Validator is the Bech32 address that is delegating voting rights.
feeder string Feeder is the delegate or representative that will be able to send vote and prevote transaction messages.

# EventPriceUpdate

Emitted when a price is posted

Field Type Label Description
pair string
price string
timestamp_ms int64

Top

# nibiru/oracle/v1/genesis.proto

# FeederDelegation

FeederDelegation is the address for where oracle feeder authority are delegated to. By default this struct is only used at genesis to feed in default feeder addresses.

Field Type Label Description
feeder_address string
validator_address string

# GenesisState

GenesisState defines the oracle module's genesis state.

Field Type Label Description
params Params
feeder_delegations FeederDelegation repeated
exchange_rates ExchangeRateTuple repeated
miss_counters MissCounter repeated
aggregate_exchange_rate_prevotes AggregateExchangeRatePrevote repeated
aggregate_exchange_rate_votes AggregateExchangeRateVote repeated
pairs string repeated
rewards Rewards repeated

# MissCounter

MissCounter defines an miss counter and validator address pair used in oracle module's genesis state

Field Type Label Description
validator_address string
miss_counter uint64

Top

# nibiru/oracle/v1/oracle.proto

# AggregateExchangeRatePrevote

Struct for aggregate prevoting on the ExchangeRateVote. The purpose of aggregate prevote is to hide vote exchange rates with hash which is formatted as hex string in SHA256("{salt}😦{pair},{exchange_rate})|...|({pair},{exchange_rate}):{voter}")

Field Type Label Description
hash string
voter string
submit_block uint64

# AggregateExchangeRateVote

MsgAggregateExchangeRateVote - struct for voting on the exchange rates different assets.

Field Type Label Description
exchange_rate_tuples ExchangeRateTuple repeated
voter string

# DatedPrice

Field Type Label Description
exchange_rate string
created_block uint64

# ExchangeRateTuple

ExchangeRateTuple - struct to store interpreted exchange rates data to store

Field Type Label Description
pair string
exchange_rate string

# Params

Params defines the module parameters for the x/oracle module.

Field Type Label Description
vote_period uint64 VotePeriod defines the number of blocks during which voting takes place.
vote_threshold string VoteThreshold specifies the minimum proportion of votes that must be received for a ballot to pass.
reward_band string RewardBand defines a maxium divergence that a price vote can have from the weighted median in the ballot. If a vote lies within the valid range defined by: μ := weightedMedian, validRange := μ ± (μ * rewardBand / 2), then rewards are added to the validator performance. Note that if the reward band is smaller than 1 standard deviation, the band is taken to be 1 standard deviation.a price
whitelist string repeated The set of whitelisted markets, or asset pairs, for the module. Ex. '["unibi:uusd","ubtc:uusd"]'
slash_fraction string SlashFraction returns the proportion of an oracle's stake that gets slashed in the event of slashing. SlashFraction specifies the exact penalty for failing a voting period.
slash_window uint64 SlashWindow returns the number of voting periods that specify a "slash window". After each slash window, all oracles that have missed more than the penalty threshold are slashed. Missing the penalty threshold is synonymous with submitting fewer valid votes than MinValidPerWindow.
min_valid_per_window string
twap_lookback_window google.protobuf.Duration Amount of time to look back for TWAP calculations
min_voters uint64 The minimum number of voters (i.e. oracle validators) per pair for it to be considered a passing ballot. Recommended at least 4.
validator_fee_ratio string The validator fee ratio that is given to validators every epoch.
expiration_blocks uint64

# Rewards

Rewards defines a credit object towards validators which provide prices faithfully for different pairs.

Field Type Label Description
id uint64 id uniquely identifies the rewards instance of the pair
vote_periods uint64 vote_periods defines the vote periods left in which rewards will be distributed.
coins cosmos.base.v1beta1.Coin repeated Coins defines the amount of coins to distribute in a single vote period.

Top

# nibiru/oracle/v1/query.proto

# QueryActivesRequest

QueryActivesRequest is the request type for the Query/Actives RPC method.

# QueryActivesResponse

QueryActivesResponse is response type for the Query/Actives RPC method.

Field Type Label Description
actives string repeated actives defines a list of the pair which oracle prices agreed upon.

# QueryAggregatePrevoteRequest

QueryAggregatePrevoteRequest is the request type for the Query/AggregatePrevote RPC method.

Field Type Label Description
validator_addr string validator defines the validator address to query for.

# QueryAggregatePrevoteResponse

QueryAggregatePrevoteResponse is response type for the Query/AggregatePrevote RPC method.

Field Type Label Description
aggregate_prevote AggregateExchangeRatePrevote aggregate_prevote defines oracle aggregate prevote submitted by a validator in the current vote period

# QueryAggregatePrevotesRequest

QueryAggregatePrevotesRequest is the request type for the Query/AggregatePrevotes RPC method.

# QueryAggregatePrevotesResponse

QueryAggregatePrevotesResponse is response type for the Query/AggregatePrevotes RPC method.

Field Type Label Description
aggregate_prevotes AggregateExchangeRatePrevote repeated aggregate_prevotes defines all oracle aggregate prevotes submitted in the current vote period

# QueryAggregateVoteRequest

QueryAggregateVoteRequest is the request type for the Query/AggregateVote RPC method.

Field Type Label Description
validator_addr string validator defines the validator address to query for.

# QueryAggregateVoteResponse

QueryAggregateVoteResponse is response type for the Query/AggregateVote RPC method.

Field Type Label Description
aggregate_vote AggregateExchangeRateVote aggregate_vote defines oracle aggregate vote submitted by a validator in the current vote period

# QueryAggregateVotesRequest

QueryAggregateVotesRequest is the request type for the Query/AggregateVotes RPC method.

# QueryAggregateVotesResponse

QueryAggregateVotesResponse is response type for the Query/AggregateVotes RPC method.

Field Type Label Description
aggregate_votes AggregateExchangeRateVote repeated aggregate_votes defines all oracle aggregate votes submitted in the current vote period

# QueryExchangeRateRequest

QueryExchangeRateRequest is the request type for the Query/ExchangeRate RPC method.

Field Type Label Description
pair string pair defines the pair to query for.

# QueryExchangeRateResponse

QueryExchangeRateResponse is response type for the Query/ExchangeRate RPC method.

Field Type Label Description
exchange_rate string exchange_rate defines the exchange rate of assets voted by validators

# QueryExchangeRatesRequest

QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC method.

# QueryExchangeRatesResponse

QueryExchangeRatesResponse is response type for the Query/ExchangeRates RPC method.

Field Type Label Description
exchange_rates ExchangeRateTuple repeated exchange_rates defines a list of the exchange rate for all whitelisted pairs.

# QueryFeederDelegationRequest

QueryFeederDelegationRequest is the request type for the Query/FeederDelegation RPC method.

Field Type Label Description
validator_addr string validator defines the validator address to query for.

# QueryFeederDelegationResponse

QueryFeederDelegationResponse is response type for the Query/FeederDelegation RPC method.

Field Type Label Description
feeder_addr string feeder_addr defines the feeder delegation of a validator

# QueryMissCounterRequest

QueryMissCounterRequest is the request type for the Query/MissCounter RPC method.

Field Type Label Description
validator_addr string validator defines the validator address to query for.

# QueryMissCounterResponse

QueryMissCounterResponse is response type for the Query/MissCounter RPC method.

Field Type Label Description
miss_counter uint64 miss_counter defines the oracle miss counter of a validator

# QueryParamsRequest

QueryParamsRequest is the request type for the Query/Params RPC method.

# QueryParamsResponse

QueryParamsResponse is the response type for the Query/Params RPC method.

Field Type Label Description
params Params params defines the parameters of the module.

# QueryVoteTargetsRequest

QueryVoteTargetsRequest is the request type for the Query/VoteTargets RPC method.

# QueryVoteTargetsResponse

QueryVoteTargetsResponse is response type for the Query/VoteTargets RPC method.

Field Type Label Description
vote_targets string repeated vote_targets defines a list of the pairs in which everyone should vote in the current vote period.

# Query

Query defines the gRPC querier service.

Method Name Request Type Response Type Description
ExchangeRate QueryExchangeRateRequest QueryExchangeRateResponse ExchangeRate returns exchange rate of a pair
ExchangeRateTwap QueryExchangeRateRequest QueryExchangeRateResponse ExchangeRateTwap returns twap exchange rate of a pair
ExchangeRates QueryExchangeRatesRequest QueryExchangeRatesResponse ExchangeRates returns exchange rates of all pairs
Actives QueryActivesRequest QueryActivesResponse Actives returns all active pairs
VoteTargets QueryVoteTargetsRequest QueryVoteTargetsResponse VoteTargets returns all vote target for pairs
FeederDelegation QueryFeederDelegationRequest QueryFeederDelegationResponse FeederDelegation returns feeder delegation of a validator
MissCounter QueryMissCounterRequest QueryMissCounterResponse MissCounter returns oracle miss counter of a validator
AggregatePrevote QueryAggregatePrevoteRequest QueryAggregatePrevoteResponse AggregatePrevote returns an aggregate prevote of a validator
AggregatePrevotes QueryAggregatePrevotesRequest QueryAggregatePrevotesResponse AggregatePrevotes returns aggregate prevotes of all validators
AggregateVote QueryAggregateVoteRequest QueryAggregateVoteResponse AggregateVote returns an aggregate vote of a validator
AggregateVotes QueryAggregateVotesRequest QueryAggregateVotesResponse AggregateVotes returns aggregate votes of all validators
Params QueryParamsRequest QueryParamsResponse Params queries all parameters.

Top

# nibiru/oracle/v1/state.proto

# PriceSnapshot

a snapshot of the prices at a given point in time

Field Type Label Description
pair string
price string
timestamp_ms int64 milliseconds since unix epoch

Top

# nibiru/oracle/v1/tx.proto

# MsgAggregateExchangeRatePrevote

MsgAggregateExchangeRatePrevote represents a message to submit aggregate exchange rate prevote.

Field Type Label Description
hash string
feeder string Feeder is the Bech32 address of the price feeder. A validator may specify multiple price feeders by delegating them consent. The validator address is also a valid feeder by default.
validator string Validator is the Bech32 address to which the prevote will be credited.

# MsgAggregateExchangeRatePrevoteResponse

MsgAggregateExchangeRatePrevoteResponse defines the Msg/AggregateExchangeRatePrevote response type.

# MsgAggregateExchangeRateVote

MsgAggregateExchangeRateVote represents a message to submit aggregate exchange rate vote.

Field Type Label Description
salt string
exchange_rates string
feeder string Feeder is the Bech32 address of the price feeder. A validator may specify multiple price feeders by delegating them consent. The validator address is also a valid feeder by default.
validator string Validator is the Bech32 address to which the vote will be credited.

# MsgAggregateExchangeRateVoteResponse

MsgAggregateExchangeRateVoteResponse defines the Msg/AggregateExchangeRateVote response type.

# MsgDelegateFeedConsent

MsgDelegateFeedConsent represents a message to delegate oracle voting rights to another address.

Field Type Label Description
operator string
delegate string

# MsgDelegateFeedConsentResponse

MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response type.

# Msg

Msg defines the oracle Msg service.

Method Name Request Type Response Type Description
AggregateExchangeRatePrevote MsgAggregateExchangeRatePrevote MsgAggregateExchangeRatePrevoteResponse AggregateExchangeRatePrevote defines a method for submitting aggregate exchange rate prevote
AggregateExchangeRateVote MsgAggregateExchangeRateVote MsgAggregateExchangeRateVoteResponse AggregateExchangeRateVote defines a method for submitting aggregate exchange rate vote
DelegateFeedConsent MsgDelegateFeedConsent MsgDelegateFeedConsentResponse DelegateFeedConsent defines a method for delegating oracle voting rights to another address known as a price feeder. See https://github.com/NibiruChain/pricefeeder.

# Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)