Documentation ¶
Overview ¶
nolint:deadcode unused noalias
Index ¶
- Variables
- func NewQuerier(keeper Keeper) sdk.Querier
- func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) staking.MsgCreateValidator
- func NewTestMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delAmount sdk.Int) staking.MsgDelegate
- func ParamKeyTable() params.KeyTable
- type Keeper
- func (k Keeper) AddExchangeRatePrevote(ctx sdk.Context, prevote types.ExchangeRatePrevote)
- func (k Keeper) AddExchangeRateVote(ctx sdk.Context, vote types.ExchangeRateVote)
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) DeleteExchangeRatePrevote(ctx sdk.Context, prevote types.ExchangeRatePrevote)
- func (k Keeper) DeleteExchangeRateVote(ctx sdk.Context, vote types.ExchangeRateVote)
- func (k Keeper) DeleteLunaExchangeRate(ctx sdk.Context, denom string)
- func (k Keeper) GetExchangeRatePrevote(ctx sdk.Context, denom string, voter sdk.ValAddress) (prevote types.ExchangeRatePrevote, err sdk.Error)
- func (k Keeper) GetLunaExchangeRate(ctx sdk.Context, denom string) (exchangeRate sdk.Dec, err sdk.Error)
- func (k Keeper) GetMissCounter(ctx sdk.Context, operator sdk.ValAddress) (missCounter int64)
- func (k Keeper) GetOracleDelegate(ctx sdk.Context, operator sdk.ValAddress) (delegate sdk.AccAddress)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) IterateExchangeRatePrevotes(ctx sdk.Context, handler func(prevote types.ExchangeRatePrevote) (stop bool))
- func (k Keeper) IterateExchangeRateVotes(ctx sdk.Context, handler func(vote types.ExchangeRateVote) (stop bool))
- func (k Keeper) IterateLunaExchangeRates(ctx sdk.Context, handler func(denom string, exchangeRate sdk.Dec) (stop bool))
- func (k Keeper) IterateMissCounters(ctx sdk.Context, ...)
- func (k Keeper) IterateOracleDelegates(ctx sdk.Context, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MinValidPerWindow(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) OrganizeBallotByDenom(ctx sdk.Context) (votes map[string]types.ExchangeRateBallot)
- func (k Keeper) RewardBallotWinners(ctx sdk.Context, ballotWinners map[string]types.Claim)
- func (k Keeper) RewardBand(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) RewardDistributionWindow(ctx sdk.Context) (res int64)
- func (k Keeper) SetLunaExchangeRate(ctx sdk.Context, denom string, exchangeRate sdk.Dec)
- func (k Keeper) SetMissCounter(ctx sdk.Context, operator sdk.ValAddress, missCounter int64)
- func (k Keeper) SetOracleDelegate(ctx sdk.Context, operator sdk.ValAddress, delegatedFeeder sdk.AccAddress)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SlashFraction(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) SlashWindow(ctx sdk.Context) (res int64)
- func (k Keeper) VotePeriod(ctx sdk.Context) (res int64)
- func (k Keeper) VoteThreshold(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) Whitelist(ctx sdk.Context) (res types.DenomList)
- type TestInput
Constants ¶
This section is empty.
Variables ¶
var ( PubKeys = []crypto.PubKey{ secp256k1.GenPrivKey().PubKey(), secp256k1.GenPrivKey().PubKey(), secp256k1.GenPrivKey().PubKey(), } Addrs = []sdk.AccAddress{ sdk.AccAddress(PubKeys[0].Address()), sdk.AccAddress(PubKeys[1].Address()), sdk.AccAddress(PubKeys[2].Address()), } ValAddrs = []sdk.ValAddress{ sdk.ValAddress(PubKeys[0].Address()), sdk.ValAddress(PubKeys[1].Address()), sdk.ValAddress(PubKeys[2].Address()), } InitTokens = sdk.TokensFromConsensusPower(200) InitCoins = sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens)) OracleDecPrecision = 8 )
Functions ¶
func NewQuerier ¶
NewQuerier is the module level router for state queries
func NewTestMsgCreateValidator ¶
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) staking.MsgCreateValidator
func NewTestMsgDelegate ¶
func NewTestMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, delAmount sdk.Int) staking.MsgDelegate
Types ¶
type Keeper ¶
type Keeper struct { StakingKeeper types.StakingKeeper // contains filtered or unexported fields }
Keeper of the oracle store
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, paramspace params.Subspace, distrKeeper types.DistributionKeeper, stakingKeeper types.StakingKeeper, supplyKeeper types.SupplyKeeper, distrName string, codespace sdk.CodespaceType) Keeper
NewKeeper constructs a new keeper for oracle
func (Keeper) AddExchangeRatePrevote ¶
func (k Keeper) AddExchangeRatePrevote(ctx sdk.Context, prevote types.ExchangeRatePrevote)
AddExchangeRatePrevote adds an oracle prevote to the store
func (Keeper) AddExchangeRateVote ¶
func (k Keeper) AddExchangeRateVote(ctx sdk.Context, vote types.ExchangeRateVote)
AddExchangeRateVote adds an oracle vote to the store
func (Keeper) Codespace ¶
func (k Keeper) Codespace() sdk.CodespaceType
Codespace returns a codespace of keeper
func (Keeper) DeleteExchangeRatePrevote ¶
func (k Keeper) DeleteExchangeRatePrevote(ctx sdk.Context, prevote types.ExchangeRatePrevote)
DeleteExchangeRatePrevote deletes an oracle prevote from the store
func (Keeper) DeleteExchangeRateVote ¶
func (k Keeper) DeleteExchangeRateVote(ctx sdk.Context, vote types.ExchangeRateVote)
DeleteExchangeRateVote deletes an oracle vote from the store
func (Keeper) DeleteLunaExchangeRate ¶
DeleteLunaExchangeRate deletes the consensus exchange rate of Luna denominated in the denom asset from the store.
func (Keeper) GetExchangeRatePrevote ¶
func (k Keeper) GetExchangeRatePrevote(ctx sdk.Context, denom string, voter sdk.ValAddress) (prevote types.ExchangeRatePrevote, err sdk.Error)
GetExchangeRatePrevote retrieves an oracle prevote from the store
func (Keeper) GetLunaExchangeRate ¶
func (k Keeper) GetLunaExchangeRate(ctx sdk.Context, denom string) (exchangeRate sdk.Dec, err sdk.Error)
GetLunaExchangeRate gets the consensus exchange rate of Luna denominated in the denom asset from the store.
func (Keeper) GetMissCounter ¶
GetMissCounter retrives the # of vote periods missed in this oracle slash window
func (Keeper) GetOracleDelegate ¶
func (k Keeper) GetOracleDelegate(ctx sdk.Context, operator sdk.ValAddress) (delegate sdk.AccAddress)
GetOracleDelegate gets the account address that the validator operator delegated oracle vote rights to
func (Keeper) IterateExchangeRatePrevotes ¶
func (k Keeper) IterateExchangeRatePrevotes(ctx sdk.Context, handler func(prevote types.ExchangeRatePrevote) (stop bool))
IterateExchangeRatePrevotes iterates rate over prevotes in the store
func (Keeper) IterateExchangeRateVotes ¶
func (k Keeper) IterateExchangeRateVotes(ctx sdk.Context, handler func(vote types.ExchangeRateVote) (stop bool))
IterateExchangeRateVotes iterates over votes in the store
func (Keeper) IterateLunaExchangeRates ¶
func (k Keeper) IterateLunaExchangeRates(ctx sdk.Context, handler func(denom string, exchangeRate sdk.Dec) (stop bool))
IterateLunaExchangeRates iterates over luna rates in the store
func (Keeper) IterateMissCounters ¶
func (k Keeper) IterateMissCounters(ctx sdk.Context, handler func(operator sdk.ValAddress, missCounter int64) (stop bool))
IterateMissCounters iterates over the miss counters and performs a callback function.
func (Keeper) IterateOracleDelegates ¶
func (k Keeper) IterateOracleDelegates(ctx sdk.Context, handler func(delegator sdk.ValAddress, delegatee sdk.AccAddress) (stop bool))
IterateOracleDelegates iterates over the feed delegates and performs a callback function.
func (Keeper) MinValidPerWindow ¶
MinValidPerWindow returns oracle slashing threshold
func (Keeper) OrganizeBallotByDenom ¶
OrganizeBallotByDenom collects all oracle votes for the period, categorized by the votes' denom parameter
func (Keeper) RewardBallotWinners ¶
RewardBallotWinners implements at the end of every VotePeriod, we give out portion of seigniorage reward(reward-weight) to the oracle voters that voted faithfully.
func (Keeper) RewardBand ¶
RewardBand returns the ratio of allowable exchange rate error that a validator can be rewared
func (Keeper) RewardDistributionWindow ¶
RewardDistributionWindow returns the number of vote periods during which seigiornage reward comes in and then is distributed.
func (Keeper) SetLunaExchangeRate ¶
SetLunaExchangeRate sets the consensus exchange rate of Luna denominated in the denom asset to the store.
func (Keeper) SetMissCounter ¶
SetMissCounter updates the # of vote periods missed in this oracle slash window
func (Keeper) SetOracleDelegate ¶
func (k Keeper) SetOracleDelegate(ctx sdk.Context, operator sdk.ValAddress, delegatedFeeder sdk.AccAddress)
SetOracleDelegate sets the account address that the validator operator delegated oracle vote rights to
func (Keeper) SlashFraction ¶
SlashFraction returns oracle voting penalty rate
func (Keeper) SlashWindow ¶
SlashWindow returns # of vote period for oracle slashing
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.