Documentation ¶
Index ¶
- func CalculateSignalTotalPowersFromVotes(votes []types.Vote) []types.Signal
- func CheckMissReport(feed types.Feed, lastUpdateTimestamp int64, lastUpdateBlock int64, ...) bool
- func NewMsgServerImpl(k Keeper) types.MsgServer
- func NewQueryServer(k Keeper) types.QueryServer
- type Keeper
- func (k Keeper) CalculateNewCurrentFeeds(ctx sdk.Context) []types.Feed
- func (k Keeper) CalculatePrice(ctx sdk.Context, feed types.Feed, ...) (types.Price, error)
- func (k Keeper) CalculatePrices(ctx sdk.Context) error
- func (k Keeper) DeleteAllPrices(ctx sdk.Context)
- func (k Keeper) DeleteVote(ctx sdk.Context, voter sdk.AccAddress)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllPrices(ctx sdk.Context) (prices []types.Price)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetCurrentFeeds(ctx sdk.Context) (sp types.CurrentFeeds)
- func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k Keeper) GetPrice(ctx sdk.Context, signalID string) types.Price
- func (k Keeper) GetPrices(ctx sdk.Context, signalIDs []string) []types.Price
- func (k Keeper) GetPricesIterator(ctx sdk.Context) dbm.Iterator
- func (k Keeper) GetReferenceSourceConfig(ctx sdk.Context) (rs types.ReferenceSourceConfig)
- func (k Keeper) GetSignalTotalPower(ctx sdk.Context, signalID string) (types.Signal, error)
- func (k Keeper) GetSignalTotalPowersByPower(ctx sdk.Context, limit uint64) []types.Signal
- func (k Keeper) GetValidatorPriceList(ctx sdk.Context, val sdk.ValAddress) (types.ValidatorPriceList, error)
- func (k Keeper) GetVote(ctx sdk.Context, voter sdk.AccAddress) []types.Signal
- func (k Keeper) GetVoteIterator(ctx sdk.Context) dbm.Iterator
- func (k Keeper) GetVotes(ctx sdk.Context) (votes []types.Vote)
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) IsBondedValidator(ctx sdk.Context, addr sdk.ValAddress) bool
- func (k Keeper) IsFeeder(ctx sdk.Context, validator sdk.ValAddress, feeder sdk.AccAddress) bool
- func (k Keeper) LockVoterPower(ctx sdk.Context, voter sdk.AccAddress, signals []types.Signal) error
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) SetCurrentFeeds(ctx sdk.Context, feeds []types.Feed)
- func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error
- func (k Keeper) SetPrice(ctx sdk.Context, price types.Price)
- func (k Keeper) SetPrices(ctx sdk.Context, prices []types.Price)
- func (k Keeper) SetReferenceSourceConfig(ctx sdk.Context, rs types.ReferenceSourceConfig) error
- func (k Keeper) SetSignalTotalPower(ctx sdk.Context, signal types.Signal)
- func (k Keeper) SetSignalTotalPowers(ctx sdk.Context, signalTotalPowersList []types.Signal)
- func (k Keeper) SetValidatorPriceList(ctx sdk.Context, valAddress sdk.ValAddress, valPrices []types.ValidatorPrice) error
- func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote)
- func (k Keeper) SetVotes(ctx sdk.Context, votes []types.Vote)
- func (k Keeper) SignalTotalPowersByPowerStoreIterator(ctx sdk.Context) dbm.Iterator
- func (k Keeper) UpdateVoteAndReturnPowerDiff(ctx sdk.Context, voter sdk.AccAddress, signals []types.Signal) map[string]int64
- func (k Keeper) ValidateValidatorRequiredToSend(ctx sdk.Context, val sdk.ValAddress) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateSignalTotalPowersFromVotes ¶
CalculateSignalTotalPowersFromVotes calculates the new signal-total-powers from the given votes using on init genesis process.
func CheckMissReport ¶
func CheckMissReport( feed types.Feed, lastUpdateTimestamp int64, lastUpdateBlock int64, valPrice types.ValidatorPrice, valInfo types.ValidatorInfo, blockTime time.Time, blockHeight int64, gracePeriod int64, ) bool
CheckMissReport checks if a validator has missed a report based on the given parameters. And returns a boolean indication whether the validator has price feed.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the x/feeds MsgServer interface.
func NewQueryServer ¶
func NewQueryServer(k Keeper) types.QueryServer
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, oracleKeeper types.OracleKeeper, stakingKeeper types.StakingKeeper, restakeKeeper types.RestakeKeeper, authzKeeper types.AuthzKeeper, authority string, ) Keeper
NewKeeper creates a new feeds Keeper instance.
func (Keeper) CalculateNewCurrentFeeds ¶
CalculateNewCurrentFeeds calculates new supported feeds from current signal-total-powers.
func (Keeper) CalculatePrice ¶
func (k Keeper) CalculatePrice( ctx sdk.Context, feed types.Feed, validatorPriceInfos []types.ValidatorPriceInfo, powerQuorum sdkmath.Int, ) (types.Price, error)
CalculatePrice calculates the final price from validator prices and punishes validators who did not report.
func (Keeper) CalculatePrices ¶
CalculatePrices calculates final prices for all supported feeds.
func (Keeper) DeleteAllPrices ¶
DeleteAllPrices deletes all prices.
func (Keeper) DeleteVote ¶
func (k Keeper) DeleteVote(ctx sdk.Context, voter sdk.AccAddress)
DeleteVote deletes all signals voted by a voter.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the module's exported genesis
func (Keeper) GetAllPrices ¶
GetAllPrices returns a list of all prices.
func (Keeper) GetAuthority ¶
GetAuthority returns the x/feeds module's authority.
func (Keeper) GetCurrentFeeds ¶
func (k Keeper) GetCurrentFeeds(ctx sdk.Context) (sp types.CurrentFeeds)
GetCurrentFeeds gets the current supported feeds.
func (Keeper) GetPricesIterator ¶
GetPricesIterator returns an iterator for prices store.
func (Keeper) GetReferenceSourceConfig ¶
func (k Keeper) GetReferenceSourceConfig(ctx sdk.Context) (rs types.ReferenceSourceConfig)
GetReferenceSourceConfig gets the current reference source config.
func (Keeper) GetSignalTotalPower ¶
GetSignalTotalPower gets a signal-total-power from specified signal id.
func (Keeper) GetSignalTotalPowersByPower ¶
GetSignalTotalPowersByPower gets the current signal-total-power sorted by power-rank.
func (Keeper) GetValidatorPriceList ¶
func (k Keeper) GetValidatorPriceList(ctx sdk.Context, val sdk.ValAddress) (types.ValidatorPriceList, error)
GetValidatorPriceList gets a validator price by validator address.
func (Keeper) GetVoteIterator ¶
GetVoteIterator returns an iterator of the vote store.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the module's state from a provided genesis state.
func (Keeper) IsBondedValidator ¶
IsBondedValidator checks is the validator is in the bonded validators.
func (Keeper) IsFeeder ¶
func (k Keeper) IsFeeder(ctx sdk.Context, validator sdk.ValAddress, feeder sdk.AccAddress) bool
IsFeeder checks if the given address has been granted as a feeder by the given validator
func (Keeper) LockVoterPower ¶
func (k Keeper) LockVoterPower( ctx sdk.Context, voter sdk.AccAddress, signals []types.Signal, ) error
LockVoterPower locks the voter's power equal to the sum of the signal powers. It returns an error if the voter does not have enough power to lock.
func (Keeper) SetCurrentFeeds ¶
SetCurrentFeeds sets new supported feeds to the store.
func (Keeper) SetPrice ¶
SetPRice sets a new price to the prices store or replace if price with the same signal id existed.
func (Keeper) SetReferenceSourceConfig ¶
SetReferenceSourceConfig sets new reference source config to the store.
func (Keeper) SetSignalTotalPower ¶
SetSignalTotalPower sets signal-total-power to the store.
func (Keeper) SetSignalTotalPowers ¶
SetSignalTotalPowers sets multiple signal-total-powers.
func (Keeper) SetValidatorPriceList ¶
func (k Keeper) SetValidatorPriceList( ctx sdk.Context, valAddress sdk.ValAddress, valPrices []types.ValidatorPrice, ) error
SetValidatorPrices sets validator prices list.
func (Keeper) SignalTotalPowersByPowerStoreIterator ¶
SignalTotalPowersByPowerStoreIterator returns an iterator for signal-total-powers by power index store.
func (Keeper) UpdateVoteAndReturnPowerDiff ¶
func (k Keeper) UpdateVoteAndReturnPowerDiff( ctx sdk.Context, voter sdk.AccAddress, signals []types.Signal, ) map[string]int64
UpdateVoteAndReturnPowerDiff delete previous signals and add new signals. It also calculates feed power differences from voter's previous signals and new signals.
func (Keeper) ValidateValidatorRequiredToSend ¶
ValidateValidatorRequiredToSend validates validator is required for price submission.