Documentation ¶
Index ¶
- func MigrateProposals(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) types.QueryServer
- type IterateExchangeRateVote
- type IterateFeederDelegationHandler
- type Keeper
- func (k Keeper) AcceptList(ctx sdk.Context) (res types.DenomList)
- func (k Keeper) AddHistoricPrice(ctx sdk.Context, denom string, exchangeRate math.LegacyDec)
- func (k Keeper) AllHistoricPrices(ctx sdk.Context) types.PriceStamps
- func (k Keeper) AllMedianDeviationPrices(ctx sdk.Context) types.PriceStamps
- func (k Keeper) AllMedianPrices(ctx sdk.Context) types.PriceStamps
- func (k Keeper) AverageOfHistoricMedians(ctx sdk.Context, denom string, numStamps uint64) (math.LegacyDec, uint32, error)
- func (k Keeper) CalcAndSetHistoricMedian(ctx sdk.Context, denom string) error
- func (k Keeper) ClearBallots(ctx sdk.Context, votePeriod uint64)
- func (k Keeper) ClearExchangeRates(ctx sdk.Context)
- func (k Keeper) ClearParamUpdatePlan(ctx sdk.Context, planHeight uint64) error
- func (k Keeper) CurrencyDeviationThresholds(ctx sdk.Context) (res types.CurrencyDeviationThresholdList)
- func (k Keeper) CurrencyPairProviders(ctx sdk.Context) (res types.CurrencyPairProvidersList)
- func (k Keeper) DeleteAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress)
- func (k Keeper) DeleteAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress)
- func (k Keeper) DeleteHistoricMedian(ctx sdk.Context, denom string, blockNum uint64)
- func (k Keeper) DeleteHistoricMedianDeviation(ctx sdk.Context, denom string, blockNum uint64)
- func (k Keeper) DeleteHistoricPrice(ctx sdk.Context, denom string, blockNum uint64)
- func (k Keeper) DeleteMissCounter(ctx sdk.Context, operator sdk.ValAddress)
- func (k Keeper) ExecuteParamUpdatePlan(ctx sdk.Context, plan types.ParamUpdatePlan) error
- func (k Keeper) GetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) (types.AggregateExchangeRatePrevote, error)
- func (k Keeper) GetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) (types.AggregateExchangeRateVote, error)
- func (k Keeper) GetExchangeRate(ctx sdk.Context, symbol string) (math.LegacyDec, error)
- func (k Keeper) GetExchangeRateBase(ctx sdk.Context, denom string) (math.LegacyDec, error)
- func (k Keeper) GetExponent(ctx sdk.Context, denom string) (uint32, error)
- func (k Keeper) GetFeederDelegation(ctx sdk.Context, vAddr sdk.ValAddress) (sdk.AccAddress, error)
- func (k Keeper) GetMissCounter(ctx sdk.Context, operator sdk.ValAddress) uint64
- func (k Keeper) GetOracleAccount(ctx sdk.Context) sdk.ModuleAccountI
- func (k Keeper) GetParamUpdatePlans(ctx sdk.Context) (plans []types.ParamUpdatePlan)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRewardPool(ctx sdk.Context, denom string) sdk.Coin
- func (k Keeper) GetValidatorRewardSet(ctx sdk.Context) types.ValidatorRewardSet
- func (k Keeper) HasAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) bool
- func (k Keeper) HistoricDeviations(ctx sdk.Context, denom string, numStamps uint64) types.PriceStamps
- func (k Keeper) HistoricMedianDeviation(ctx sdk.Context, denom string) (*types.PriceStamp, error)
- func (k Keeper) HistoricMedians(ctx sdk.Context, denom string, numStamps uint64) types.PriceStamps
- func (k Keeper) HistoricStampPeriod(ctx sdk.Context) (res uint64)
- func (k *Keeper) IsPeriodLastBlock(ctx sdk.Context, blocksPerPeriod uint64) bool
- func (k Keeper) IterateAggregateExchangeRatePrevotes(ctx sdk.Context, ...)
- func (k Keeper) IterateAggregateExchangeRateVotes(ctx sdk.Context, handler IterateExchangeRateVote)
- func (k Keeper) IterateAllHistoricPrices(ctx sdk.Context, handler func(types.PriceStamp) bool)
- func (k Keeper) IterateAllMedianDeviationPrices(ctx sdk.Context, handler func(types.PriceStamp) bool)
- func (k Keeper) IterateAllMedianPrices(ctx sdk.Context, handler func(types.PriceStamp) bool)
- func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(string, math.LegacyDec) bool)
- func (k Keeper) IterateFeederDelegations(ctx sdk.Context, handler IterateFeederDelegationHandler)
- func (k Keeper) IterateHistoricDeviations(ctx sdk.Context, denom string, numStamps uint, ...)
- func (k Keeper) IterateHistoricMedians(ctx sdk.Context, denom string, numStamps uint, ...)
- func (k Keeper) IterateHistoricPrices(ctx sdk.Context, denom string, numStamps uint, ...)
- func (k Keeper) IterateMissCounters(ctx sdk.Context, handler func(sdk.ValAddress, uint64) bool)
- func (k Keeper) IterateParamUpdatePlans(ctx sdk.Context, handler func(types.ParamUpdatePlan) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MandatoryList(ctx sdk.Context) (res types.DenomList)
- func (k Keeper) MaxOfHistoricMedians(ctx sdk.Context, denom string, numStamps uint64) (math.LegacyDec, uint32, error)
- func (k Keeper) MaximumMedianStamps(ctx sdk.Context) (res uint64)
- func (k Keeper) MaximumPriceStamps(ctx sdk.Context) (res uint64)
- func (k Keeper) MedianOfHistoricMedians(ctx sdk.Context, denom string, numStamps uint64) (math.LegacyDec, uint32, error)
- func (k Keeper) MedianStampPeriod(ctx sdk.Context) (res uint64)
- func (k Keeper) MinOfHistoricMedians(ctx sdk.Context, denom string, numStamps uint64) (math.LegacyDec, uint32, error)
- func (k Keeper) MinValidPerWindow(ctx sdk.Context) (res math.LegacyDec)
- func (k Keeper) OrganizeBallotByDenom(ctx sdk.Context, validatorClaimMap map[string]types.Claim) []types.BallotDenom
- func (k Keeper) PossibleWinsPerSlashWindow(ctx sdk.Context) int64
- func (k *Keeper) PruneAllPrices(ctx sdk.Context)
- func (k Keeper) PruneHistoricPricesBeforeBlock(ctx sdk.Context, blockNum uint64)
- func (k Keeper) PruneMedianDeviationsBeforeBlock(ctx sdk.Context, blockNum uint64)
- func (k Keeper) PruneMediansBeforeBlock(ctx sdk.Context, blockNum uint64)
- func (k *Keeper) RecordEndBlockMetrics(ctx sdk.Context)
- func (k Keeper) RewardBallotWinners(ctx sdk.Context, votePeriod int64, rewardDistributionWindow int64, ...)
- func (k Keeper) RewardBands(ctx sdk.Context) (res types.RewardBandList)
- func (k Keeper) RewardDistributionWindow(ctx sdk.Context) (res uint64)
- func (k Keeper) ScheduleParamUpdatePlan(ctx sdk.Context, plan types.ParamUpdatePlan) error
- func (k Keeper) SetAcceptList(ctx sdk.Context, acceptList types.DenomList)
- func (k Keeper) SetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress, ...)
- func (k Keeper) SetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress, vote types.AggregateExchangeRateVote)
- func (k Keeper) SetCurrencyDeviationThresholds(ctx sdk.Context, ...)
- func (k Keeper) SetCurrencyPairProviders(ctx sdk.Context, currencyPairProviders types.CurrencyPairProvidersList)
- func (k Keeper) SetExchangeRate(ctx sdk.Context, denom string, exchangeRate math.LegacyDec)
- func (k Keeper) SetExchangeRateWithEvent(ctx sdk.Context, denom string, exchangeRate math.LegacyDec) error
- func (k Keeper) SetFeederDelegation(ctx sdk.Context, operator sdk.ValAddress, delegatedFeeder sdk.AccAddress)
- func (k Keeper) SetHistoricMedian(ctx sdk.Context, denom string, blockNum uint64, median math.LegacyDec)
- func (k Keeper) SetHistoricMedianDeviation(ctx sdk.Context, denom string, blockNum uint64, medianDeviation math.LegacyDec)
- func (k Keeper) SetHistoricPrice(ctx sdk.Context, denom string, blockNum uint64, exchangeRate math.LegacyDec)
- func (k Keeper) SetHistoricStampPeriod(ctx sdk.Context, historicPriceStampPeriod uint64)
- func (k Keeper) SetMandatoryList(ctx sdk.Context, mandatoryList types.DenomList)
- func (k Keeper) SetMaximumMedianStamps(ctx sdk.Context, maximumMedianStamps uint64)
- func (k Keeper) SetMaximumPriceStamps(ctx sdk.Context, maximumPriceStamps uint64)
- func (k Keeper) SetMedianStampPeriod(ctx sdk.Context, medianStampPeriod uint64)
- func (k Keeper) SetMinValidPerWindow(ctx sdk.Context, minValidPerWindow math.LegacyDec)
- func (k Keeper) SetMissCounter(ctx sdk.Context, operator sdk.ValAddress, missCounter uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetRewardBand(ctx sdk.Context, rewardBands types.RewardBandList)
- func (k Keeper) SetRewardDistributionWindow(ctx sdk.Context, rewardDistributionWindow uint64)
- func (k Keeper) SetSlashFraction(ctx sdk.Context, slashFraction math.LegacyDec)
- func (k Keeper) SetSlashWindow(ctx sdk.Context, slashWindow uint64)
- func (k Keeper) SetValidatorRewardSet(ctx sdk.Context) error
- func (k Keeper) SetVotePeriod(ctx sdk.Context, votePeriod uint64)
- func (k Keeper) SetVoteThreshold(ctx sdk.Context, voteThreshold math.LegacyDec)
- func (k Keeper) SlashAndResetMissCounters(ctx sdk.Context)
- func (k Keeper) SlashFraction(ctx sdk.Context) (res math.LegacyDec)
- func (k Keeper) SlashWindow(ctx sdk.Context) (res uint64)
- func (k Keeper) ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (k Keeper) ValidateParamChanges(ctx sdk.Context, keys []string, changes types.Params) error
- func (k Keeper) VotePeriod(ctx sdk.Context) (res uint64)
- func (k Keeper) VoteThreshold(ctx sdk.Context) (res math.LegacyDec)
- func (k Keeper) WithinHistoricMedianDeviation(ctx sdk.Context, denom string) (bool, error)
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MigrateProposals ¶ added in v0.4.1
func MigrateProposals(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error
MigrateProposals migrates all legacy MsgUpgateGovParam proposals into non legacy param update versions.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the oracle MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(keeper Keeper) types.QueryServer
NewQuerier returns an implementation of the oracle QueryServer interface for the provided Keeper.
Types ¶
type IterateExchangeRateVote ¶
type IterateExchangeRateVote = func( voterAddr sdk.ValAddress, aggregateVote types.AggregateExchangeRateVote, ) (stop bool)
type IterateFeederDelegationHandler ¶
type IterateFeederDelegationHandler func(delegator sdk.ValAddress, delegate sdk.AccAddress) (stop bool)
type Keeper ¶
type Keeper struct { StakingKeeper types.StakingKeeper GasEstimateKeeper types.GasEstimateKeeper PriceFeeder *pricefeeder.PriceFeeder // contains filtered or unexported fields }
Keeper of the oracle store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramspace paramstypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, distrKeeper types.DistributionKeeper, stakingKeeper types.StakingKeeper, gasEstimateKeeper types.GasEstimateKeeper, distrName string, telemetryEnabled bool, authority string, ) Keeper
NewKeeper constructs a new keeper for oracle
func (Keeper) AcceptList ¶
AcceptList returns the denom list that can be activated
func (Keeper) AddHistoricPrice ¶
AddHistoricPrice adds the historic price of a denom at the current block height.
func (Keeper) AllHistoricPrices ¶ added in v0.1.2
func (k Keeper) AllHistoricPrices(ctx sdk.Context) types.PriceStamps
AllHistoricPrices is a helper function that collects and returns all median prices using the IterateAllHistoricPrices iterator
func (Keeper) AllMedianDeviationPrices ¶ added in v0.1.2
func (k Keeper) AllMedianDeviationPrices(ctx sdk.Context) types.PriceStamps
AllMedianDeviationPrices is a helper function that collects and returns all median prices using the IterateAllMedianDeviationPrices iterator
func (Keeper) AllMedianPrices ¶ added in v0.1.2
func (k Keeper) AllMedianPrices(ctx sdk.Context) types.PriceStamps
AllMedianPrices is a helper function that collects and returns all median prices using the IterateAllMedianPrices iterator
func (Keeper) AverageOfHistoricMedians ¶
func (k Keeper) AverageOfHistoricMedians( ctx sdk.Context, denom string, numStamps uint64, ) (math.LegacyDec, uint32, error)
AverageOfHistoricMedians calculates and returns the average of the last stampNum historic medians as well as the amount of medians used to calculate that average. If no medians are available, all returns are zero and error is nil.
func (Keeper) CalcAndSetHistoricMedian ¶
CalcAndSetHistoricMedian uses all the historic prices of a given denom to calculate its median price at the current block and set it to the store. It will also call setMedianDeviation with the calculated median.
func (Keeper) ClearBallots ¶
ClearBallots clears all tallied prevotes and votes from the store.
func (Keeper) ClearExchangeRates ¶
func (Keeper) ClearParamUpdatePlan ¶ added in v0.2.1
ClearParamUpdatePlan will clear an upcoming param update plan if one exists and return an error if one isn't found.
func (Keeper) CurrencyDeviationThresholds ¶ added in v0.2.2
func (k Keeper) CurrencyDeviationThresholds(ctx sdk.Context) (res types.CurrencyDeviationThresholdList)
CurrencyDeviationThresholds returns the current Currency Deviation Thesholds the price feeder will query when starting up.
func (Keeper) CurrencyPairProviders ¶ added in v0.2.2
func (k Keeper) CurrencyPairProviders(ctx sdk.Context) (res types.CurrencyPairProvidersList)
CurrencyPairProviders returns the current Currency Pair Providers the price feeder will query when starting up.
func (Keeper) DeleteAggregateExchangeRatePrevote ¶
func (k Keeper) DeleteAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress)
DeleteAggregateExchangeRatePrevote deletes an oracle prevote from the store.
func (Keeper) DeleteAggregateExchangeRateVote ¶
func (k Keeper) DeleteAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress)
DeleteAggregateExchangeRateVote deletes an oracle prevote from the store.
func (Keeper) DeleteHistoricMedian ¶
DeleteHistoricMedian deletes a given denom's median price at a given block.
func (Keeper) DeleteHistoricMedianDeviation ¶
DeleteHistoricMedianDeviation deletes a given denom's standard deviation around its median price at a given block.
func (Keeper) DeleteHistoricPrice ¶
DeleteHistoricPrice deletes the historic price of a denom at a given block.
func (Keeper) DeleteMissCounter ¶
func (k Keeper) DeleteMissCounter(ctx sdk.Context, operator sdk.ValAddress)
DeleteMissCounter removes miss counter for the validator.
func (Keeper) ExecuteParamUpdatePlan ¶ added in v0.2.1
ExecuteParamUpdatePlan will execute a given param update plan and emit a param update event.
func (Keeper) GetAggregateExchangeRatePrevote ¶
func (k Keeper) GetAggregateExchangeRatePrevote( ctx sdk.Context, voter sdk.ValAddress, ) (types.AggregateExchangeRatePrevote, error)
GetAggregateExchangeRatePrevote retrieves an oracle prevote from the store.
func (Keeper) GetAggregateExchangeRateVote ¶
func (k Keeper) GetAggregateExchangeRateVote( ctx sdk.Context, voter sdk.ValAddress, ) (types.AggregateExchangeRateVote, error)
GetAggregateExchangeRateVote retrieves an oracle prevote from the store.
func (Keeper) GetExchangeRate ¶
GetExchangeRate gets the consensus exchange rate of USD denominated in the denom asset from the store.
func (Keeper) GetExchangeRateBase ¶
GetExchangeRateBase gets the consensus exchange rate of an asset in the base denom (e.g. ATOM -> uatom)
func (Keeper) GetExponent ¶ added in v0.3.0
func (Keeper) GetFeederDelegation ¶
func (k Keeper) GetFeederDelegation(ctx sdk.Context, vAddr sdk.ValAddress) (sdk.AccAddress, error)
GetFeederDelegation gets the account address to which the validator operator delegated oracle vote rights.
func (Keeper) GetMissCounter ¶
GetMissCounter retrieves the # of vote periods missed in this oracle slash window.
func (Keeper) GetOracleAccount ¶
func (k Keeper) GetOracleAccount(ctx sdk.Context) sdk.ModuleAccountI
GetOracleAccount returns oracle ModuleAccount.
func (Keeper) GetParamUpdatePlans ¶ added in v0.2.2
func (k Keeper) GetParamUpdatePlans(ctx sdk.Context) (plans []types.ParamUpdatePlan)
GetParamUpdatePlans returns all the param update plans in the store.
func (Keeper) GetRewardPool ¶
GetRewardPool retrieves the balance of the oracle module account.
func (Keeper) GetValidatorRewardSet ¶ added in v0.1.4
func (k Keeper) GetValidatorRewardSet(ctx sdk.Context) types.ValidatorRewardSet
CurrentValidatorRewardSet returns the latest ValidatorRewardSet in the store.
func (Keeper) HasAggregateExchangeRatePrevote ¶
HasAggregateExchangeRatePrevote checks if a validator has an existing prevote.
func (Keeper) HistoricDeviations ¶ added in v0.3.0
func (Keeper) HistoricMedianDeviation ¶
func (k Keeper) HistoricMedianDeviation( ctx sdk.Context, denom string, ) (*types.PriceStamp, error)
HistoricMedianDeviation returns a given denom's most recently stamped standard deviation around its median price at a given block.
func (Keeper) HistoricMedians ¶
func (k Keeper) HistoricMedians( ctx sdk.Context, denom string, numStamps uint64, ) types.PriceStamps
HistoricMedians returns a list of a given denom's last numStamps medians.
func (Keeper) HistoricStampPeriod ¶
HistoricStampPeriod returns the amount of blocks the oracle module waits before recording a new historic price.
func (*Keeper) IsPeriodLastBlock ¶ added in v0.1.2
IsPeriodLastBlock returns true if we are at the last block of the period
func (Keeper) IterateAggregateExchangeRatePrevotes ¶
func (k Keeper) IterateAggregateExchangeRatePrevotes( ctx sdk.Context, handler func(sdk.ValAddress, types.AggregateExchangeRatePrevote) bool, )
IterateAggregateExchangeRatePrevotes iterates rate over prevotes in the store
func (Keeper) IterateAggregateExchangeRateVotes ¶
func (k Keeper) IterateAggregateExchangeRateVotes( ctx sdk.Context, handler IterateExchangeRateVote, )
IterateAggregateExchangeRateVotes iterates rate over prevotes in the store.
func (Keeper) IterateAllHistoricPrices ¶
IterateAllHistoricPrices iterates over all historic prices. Iterator stops when exhausting the source, or when the handler returns `true`.
func (Keeper) IterateAllMedianDeviationPrices ¶
func (k Keeper) IterateAllMedianDeviationPrices( ctx sdk.Context, handler func(types.PriceStamp) bool, )
IterateAllMedianDeviationPrices iterates over all median deviation prices. Iterator stops when exhausting the source, or when the handler returns `true`.
func (Keeper) IterateAllMedianPrices ¶
IterateAllMedianPrices iterates over all median prices. Iterator stops when exhausting the source, or when the handler returns `true`.
func (Keeper) IterateExchangeRates ¶
IterateExchangeRates iterates over USD rates in the store.
func (Keeper) IterateFeederDelegations ¶
func (k Keeper) IterateFeederDelegations(ctx sdk.Context, handler IterateFeederDelegationHandler)
IterateFeederDelegations iterates over the feed delegates and performs a callback function.
func (Keeper) IterateHistoricDeviations ¶ added in v0.3.0
func (k Keeper) IterateHistoricDeviations( ctx sdk.Context, denom string, numStamps uint, handler func(types.PriceStamp) bool, )
IterateHistoricDeviations iterates over medians of a given denom in the store in reverse. Iterator stops when exhausting the source, or when the handler returns `true`.
func (Keeper) IterateHistoricMedians ¶
func (k Keeper) IterateHistoricMedians( ctx sdk.Context, denom string, numStamps uint, handler func(types.PriceStamp) bool, )
IterateHistoricMedians iterates over medians of a given denom in the store in reverse. Iterator stops when exhausting the source, or when the handler returns `true`.
func (Keeper) IterateHistoricPrices ¶
func (k Keeper) IterateHistoricPrices( ctx sdk.Context, denom string, numStamps uint, handler func(math.LegacyDec) bool, )
IterateHistoricPrices iterates over historic prices of a given denom in the store in reverse. Iterator stops when exhausting the source, or when the handler returns `true`.
func (Keeper) IterateMissCounters ¶
IterateMissCounters iterates over the miss counters and performs a callback function.
func (Keeper) IterateParamUpdatePlans ¶ added in v0.2.2
func (k Keeper) IterateParamUpdatePlans( ctx sdk.Context, handler func(types.ParamUpdatePlan) bool, )
IterateParamUpdatePlans iterates rate over param update plans in the store
func (Keeper) MandatoryList ¶
MandatoryList returns the denom list that are mandatory
func (Keeper) MaxOfHistoricMedians ¶
func (k Keeper) MaxOfHistoricMedians( ctx sdk.Context, denom string, numStamps uint64, ) (math.LegacyDec, uint32, error)
MaxOfHistoricMedians calculates and returns the maximum value of the last stampNum historic medians as well as the amount of medians used to calculate that maximum. If no medians are available, all returns are zero and error is nil.
func (Keeper) MaximumMedianStamps ¶
MaximumMedianStamps returns the maximum amount of medians the oracle module will hold.
func (Keeper) MaximumPriceStamps ¶
MaximumPriceStamps returns the maximum amount of historic prices the oracle module will hold.
func (Keeper) MedianOfHistoricMedians ¶
func (k Keeper) MedianOfHistoricMedians( ctx sdk.Context, denom string, numStamps uint64, ) (math.LegacyDec, uint32, error)
MedianOfHistoricMedians calculates and returns the median of the last stampNum historic medians as well as the amount of medians used to calculate that median. If no medians are available, all returns are zero and error is nil.
func (Keeper) MedianStampPeriod ¶
MedianStampPeriod returns the amount blocks the oracle module waits between calculating a new median and standard deviation of that median.
func (Keeper) MinOfHistoricMedians ¶
func (k Keeper) MinOfHistoricMedians( ctx sdk.Context, denom string, numStamps uint64, ) (math.LegacyDec, uint32, error)
MinOfHistoricMedians calculates and returns the minimum value of the last stampNum historic medians as well as the amount of medians used to calculate that minimum. If no medians are available, all returns are zero and error is nil.
func (Keeper) MinValidPerWindow ¶
MinValidPerWindow returns the oracle slashing threshold.
func (Keeper) OrganizeBallotByDenom ¶
func (k Keeper) OrganizeBallotByDenom( ctx sdk.Context, validatorClaimMap map[string]types.Claim, ) []types.BallotDenom
OrganizeBallotByDenom collects all oracle votes for the current vote period, categorized by the votes' denom parameter.
func (Keeper) PossibleWinsPerSlashWindow ¶
PossibleWinsPerSlashWindow returns the total number of possible correct votes that a validator can have per asset multiplied by the number of vote periods in the slash window
func (*Keeper) PruneAllPrices ¶ added in v0.1.2
PruneAllPrices deletes all historic prices, medians, and median deviations outside pruning period determined by the stamp period multiplied by the maximum stamps.
func (Keeper) PruneHistoricPricesBeforeBlock ¶ added in v0.1.2
func (Keeper) PruneMedianDeviationsBeforeBlock ¶ added in v0.1.2
func (Keeper) PruneMediansBeforeBlock ¶ added in v0.1.2
func (*Keeper) RecordEndBlockMetrics ¶ added in v0.1.3
RecordEndBlockMetrics records miss counter and price metrics at the end of the block
func (Keeper) RewardBallotWinners ¶
func (k Keeper) RewardBallotWinners( ctx sdk.Context, votePeriod int64, rewardDistributionWindow int64, voteTargets []string, ballotWinners []types.Claim, )
RewardBallotWinners is executed at the end of every voting period, where we give out a portion of seigniorage reward(reward-weight) to the oracle voters that voted correctly.
func (Keeper) RewardBands ¶ added in v0.1.3
func (k Keeper) RewardBands(ctx sdk.Context) (res types.RewardBandList)
RewardBand returns the ratio of allowable exchange rate error that a validator can be rewarded.
func (Keeper) RewardDistributionWindow ¶
RewardDistributionWindow returns the number of vote periods during which seigniorage reward comes in and then is distributed.
func (Keeper) ScheduleParamUpdatePlan ¶ added in v0.2.1
ScheduleParamUpdatePlan schedules a param update plan.
func (Keeper) SetAcceptList ¶
SetAcceptList updates the accepted list of assets supported by the x/oracle module.
func (Keeper) SetAggregateExchangeRatePrevote ¶
func (k Keeper) SetAggregateExchangeRatePrevote( ctx sdk.Context, voter sdk.ValAddress, prevote types.AggregateExchangeRatePrevote, )
SetAggregateExchangeRatePrevote set an oracle aggregate prevote to the store.
func (Keeper) SetAggregateExchangeRateVote ¶
func (k Keeper) SetAggregateExchangeRateVote( ctx sdk.Context, voter sdk.ValAddress, vote types.AggregateExchangeRateVote, )
SetAggregateExchangeRateVote adds an oracle aggregate prevote to the store.
func (Keeper) SetCurrencyDeviationThresholds ¶ added in v0.2.2
func (k Keeper) SetCurrencyDeviationThresholds( ctx sdk.Context, currencyDeviationThresholds types.CurrencyDeviationThresholdList, )
SetCurrencyDeviationThresholds updates the current Currency Deviation Thesholds the price feeder will query when starting up.
func (Keeper) SetCurrencyPairProviders ¶ added in v0.2.2
func (k Keeper) SetCurrencyPairProviders( ctx sdk.Context, currencyPairProviders types.CurrencyPairProvidersList, )
SetCurrencyPairProviders updates the current Currency Pair Providers the price feeder will query when starting up.
func (Keeper) SetExchangeRate ¶
SetExchangeRate sets the consensus exchange rate of USD denominated in the denom asset to the store.
func (Keeper) SetExchangeRateWithEvent ¶
func (k Keeper) SetExchangeRateWithEvent(ctx sdk.Context, denom string, exchangeRate math.LegacyDec) error
SetExchangeRateWithEvent sets an consensus exchange rate to the store with ABCI event
func (Keeper) SetFeederDelegation ¶
func (k Keeper) SetFeederDelegation(ctx sdk.Context, operator sdk.ValAddress, delegatedFeeder sdk.AccAddress)
SetFeederDelegation sets the account address to which the validator operator delegated oracle vote rights.
func (Keeper) SetHistoricMedian ¶
func (Keeper) SetHistoricMedianDeviation ¶
func (Keeper) SetHistoricPrice ¶
func (Keeper) SetHistoricStampPeriod ¶
SetHistoricStampPeriod updates the amount of blocks the oracle module waits before recording a new historic price.
func (Keeper) SetMandatoryList ¶
SetMandatoryList updates the mandatory list of assets supported by the x/oracle module.
func (Keeper) SetMaximumMedianStamps ¶
SetMaximumMedianStamps updates the the maximum amount of medians the oracle module will hold.
func (Keeper) SetMaximumPriceStamps ¶
SetMaximumPriceStamps updates the the maximum amount of historic prices the oracle module will hold.
func (Keeper) SetMedianStampPeriod ¶
SetMedianStampPeriod updates the amount blocks the oracle module waits between calculating a new median and standard deviation of that median.
func (Keeper) SetMinValidPerWindow ¶ added in v0.1.3
MinValidPerWindow updates the oracle slashing threshold.
func (Keeper) SetMissCounter ¶
SetMissCounter updates the # of vote periods missed in this oracle slash window.
func (Keeper) SetRewardBand ¶ added in v0.1.3
func (k Keeper) SetRewardBand(ctx sdk.Context, rewardBands types.RewardBandList)
VoteThreshold updates the ratio of allowable exchange rate error that a validator can be rewarded.
func (Keeper) SetRewardDistributionWindow ¶ added in v0.1.3
SetRewardDistributionWindow updates the number of vote periods during which seigniorage reward comes in and then is distributed.
func (Keeper) SetSlashFraction ¶ added in v0.1.3
SetSlashFraction updates the oracle voting penalty rate.
func (Keeper) SetSlashWindow ¶ added in v0.1.3
SetSlashWindow updates the number of total blocks in a slash window.
func (Keeper) SetValidatorRewardSet ¶ added in v0.1.3
SetValidatorRewardSet will take all the current validators and store them in the ValidatorRewardSet to earn rewards in the current Slash Window.
func (Keeper) SetVotePeriod ¶ added in v0.1.3
SetVotePeriod updates the number of blocks during which voting takes place.
func (Keeper) SetVoteThreshold ¶ added in v0.1.3
SetVoteThreshold updates the minimum percentage of votes that must be received for a ballot to pass.
func (Keeper) SlashAndResetMissCounters ¶
SlashAndResetMissCounters iterates over all the current missed counters and calculates the "valid vote rate" as: (possibleWinsPerSlashWindow - missCounter)/possibleWinsPerSlashWindow.
If the valid vote rate is below the minValidPerWindow, the validator will be slashed and jailed.
func (Keeper) SlashFraction ¶
SlashFraction returns the oracle voting penalty rate.
func (Keeper) SlashWindow ¶
SlashWindow returns the number of total blocks in a slash window.
func (Keeper) ValidateFeeder ¶
func (k Keeper) ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, valAddr sdk.ValAddress) error
ValidateFeeder returns error if the given feeder is not allowed to feed the message.
func (Keeper) ValidateParamChanges ¶ added in v0.2.1
ValidateParamChanges validates parameter changes against the existing oracle parameters.
func (Keeper) VotePeriod ¶
VotePeriod returns the number of blocks during which voting takes place.
func (Keeper) VoteThreshold ¶
VoteThreshold returns the minimum percentage of votes that must be received for a ballot to pass.
type Migrator ¶ added in v0.1.4
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶ added in v0.1.4
NewMigrator creates a Migrator.
func (Migrator) MigrateCurrencyDeviationThresholds ¶ added in v0.2.2
MigrateCurrencyDeviationThresholds adds the price feeder currency deviation threshold list.
func (Migrator) MigrateCurrencyPairProviders ¶ added in v0.2.2
MigrateCurrencyPairProviders adds the price feeder currency pair provider list.