Documentation ¶
Overview ¶
nolint
Index ¶
- Variables
- func FundAccount(input TestInput, addr sdk.AccAddress, amounts sdk.Coins) error
- func HandleRegisterTargetProposal(ctx sdk.Context, k Keeper, p *types.RegisterTargetProposal) error
- func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig
- func MakeTestCodec(t *testing.T) codec.Codec
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator
- type Keeper
- func (k Keeper) Actives(c context.Context, req *types.QueryActivesRequest) (*types.QueryActivesResponse, error)
- func (k Keeper) AggregatePrevote(c context.Context, req *types.QueryAggregatePrevoteRequest) (*types.QueryAggregatePrevoteResponse, error)
- func (k Keeper) AggregatePrevotes(c context.Context, req *types.QueryAggregatePrevotesRequest) (*types.QueryAggregatePrevotesResponse, error)
- func (k Keeper) AggregateVote(c context.Context, req *types.QueryAggregateVoteRequest) (*types.QueryAggregateVoteResponse, error)
- func (k Keeper) AggregateVotes(c context.Context, req *types.QueryAggregateVotesRequest) (*types.QueryAggregateVotesResponse, error)
- func (k Keeper) ClearBallots(ctx sdk.Context, votePeriod uint64)
- func (k Keeper) ClearVoteTargets(ctx sdk.Context)
- func (k Keeper) DeleteAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress)
- func (k Keeper) DeleteAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress)
- func (k Keeper) DeleteExchangeRate(ctx sdk.Context, denom string)
- func (k Keeper) DeleteMissCounter(ctx sdk.Context, operator sdk.ValAddress)
- func (k Keeper) ExchangeRate(c context.Context, req *types.QueryExchangeRateRequest) (*types.QueryExchangeRateResponse, error)
- func (k Keeper) ExchangeRates(c context.Context, req *types.QueryExchangeRatesRequest) (*types.QueryExchangeRatesResponse, error)
- func (k Keeper) FeederDelegation(c context.Context, req *types.QueryFeederDelegationRequest) (*types.QueryFeederDelegationResponse, error)
- func (k Keeper) GetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) (aggregatePrevote types.AggregateExchangeRatePrevote, err error)
- func (k Keeper) GetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) (aggregateVote types.AggregateExchangeRateVote, err error)
- func (k Keeper) GetExchangeRate(ctx sdk.Context, denom string) (sdk.Dec, error)
- func (k Keeper) GetFeederDelegation(ctx sdk.Context, operator sdk.ValAddress) sdk.AccAddress
- func (k Keeper) GetMissCounter(ctx sdk.Context, operator sdk.ValAddress) uint64
- func (k Keeper) GetOracleAccount(ctx sdk.Context) authtypes.ModuleAccountI
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRewardPool(ctx sdk.Context, denom string) sdk.Coin
- func (k Keeper) GetTargets(ctx sdk.Context) (targets []string)
- func (k Keeper) GetVoteTargets(ctx sdk.Context) (voteTargets []string)
- func (k Keeper) IsTarget(ctx sdk.Context, denom string) bool
- func (k Keeper) IsVoteTarget(ctx sdk.Context, denom string) bool
- func (k Keeper) IterateAggregateExchangeRatePrevotes(ctx sdk.Context, ...)
- func (k Keeper) IterateAggregateExchangeRateVotes(ctx sdk.Context, ...)
- func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(denom string, exchangeRate sdk.Dec) (stop bool))
- func (k Keeper) IterateFeederDelegations(ctx sdk.Context, ...)
- func (k Keeper) IterateMissCounters(ctx sdk.Context, ...)
- func (k Keeper) IterateTargets(ctx sdk.Context, handler func(denom string) (stop bool))
- func (k Keeper) IterateVoteTargets(ctx sdk.Context, handler func(denom string) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MinValidPerWindow(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) MissCounter(c context.Context, req *types.QueryMissCounterRequest) (*types.QueryMissCounterResponse, error)
- func (k Keeper) OrganizeBallotByDenom(ctx sdk.Context, validatorClaimMap map[string]types.Claim) (votes map[string]types.ExchangeRateBallot)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) RewardBallotWinners(ctx sdk.Context, votePeriod int64, rewardDistributionWindow int64, ...)
- func (k Keeper) RewardBand(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) RewardDistributionWindow(ctx sdk.Context) (res uint64)
- 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) SetExchangeRate(ctx sdk.Context, denom string, exchangeRate sdk.Dec)
- func (k Keeper) SetExchangeRateWithEvent(ctx sdk.Context, denom string, exchangeRate sdk.Dec)
- func (k Keeper) SetFeederDelegation(ctx sdk.Context, operator sdk.ValAddress, delegatedFeeder sdk.AccAddress)
- 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) SetStakingKeeper(sk types.StakingKeeper)
- func (k Keeper) SetTarget(ctx sdk.Context, denom string)
- func (k Keeper) SetVoteTarget(ctx sdk.Context, denom string)
- func (k Keeper) SlashAndResetMissCounters(ctx sdk.Context)
- func (k Keeper) SlashFraction(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) SlashWindow(ctx sdk.Context) (res uint64)
- func (k Keeper) StakingKeeper() types.StakingKeeper
- func (k Keeper) Targets(c context.Context, req *types.QueryTargetsRequest) (*types.QueryTargetsResponse, error)
- func (k Keeper) ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, validatorAddr sdk.ValAddress) error
- func (k Keeper) VotePeriod(ctx sdk.Context) (res uint64)
- func (k Keeper) VoteTargets(c context.Context, req *types.QueryVoteTargetsRequest) (*types.QueryVoteTargetsResponse, error)
- func (k Keeper) VoteThreshold(ctx sdk.Context) (res sdk.Dec)
- type TestInput
Constants ¶
This section is empty.
Variables ¶
var ( ValPubKeys = simapp.CreateTestPubKeys(5) Addrs = []sdk.AccAddress{ sdk.AccAddress(pubKeys[0].Address()), sdk.AccAddress(pubKeys[1].Address()), sdk.AccAddress(pubKeys[2].Address()), sdk.AccAddress(pubKeys[3].Address()), sdk.AccAddress(pubKeys[4].Address()), } ValAddrs = []sdk.ValAddress{ sdk.ValAddress(pubKeys[0].Address()), sdk.ValAddress(pubKeys[1].Address()), sdk.ValAddress(pubKeys[2].Address()), sdk.ValAddress(pubKeys[3].Address()), sdk.ValAddress(pubKeys[4].Address()), } InitTokens = sdk.TokensFromConsensusPower(200, sdk.DefaultPowerReduction) InitCoins = sdk.NewCoins(sdk.NewCoin(warmage.AttoMageDenom, InitTokens)) OracleDecPrecision = 8 )
Test addresses
var ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, bank.AppModuleBasic{}, distr.AppModuleBasic{}, customstaking.AppModuleBasic{}, params.AppModuleBasic{}, )
ModuleBasics nolint
Functions ¶
func FundAccount ¶
FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!
func MakeEncodingConfig ¶
func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig
MakeEncodingConfig nolint
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func NewTestMsgCreateValidator ¶
func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator
NewTestMsgCreateValidator test msg creator
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey sdk.StoreKey, ps paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, distrKeeper types.DistrKeeper, stakingKeeper types.StakingKeeper, distrName string, ) *Keeper
func (Keeper) Actives ¶
func (k Keeper) Actives(c context.Context, req *types.QueryActivesRequest) (*types.QueryActivesResponse, error)
func (Keeper) AggregatePrevote ¶
func (k Keeper) AggregatePrevote(c context.Context, req *types.QueryAggregatePrevoteRequest) (*types.QueryAggregatePrevoteResponse, error)
func (Keeper) AggregatePrevotes ¶
func (k Keeper) AggregatePrevotes(c context.Context, req *types.QueryAggregatePrevotesRequest) (*types.QueryAggregatePrevotesResponse, error)
func (Keeper) AggregateVote ¶
func (k Keeper) AggregateVote(c context.Context, req *types.QueryAggregateVoteRequest) (*types.QueryAggregateVoteResponse, error)
func (Keeper) AggregateVotes ¶
func (k Keeper) AggregateVotes(c context.Context, req *types.QueryAggregateVotesRequest) (*types.QueryAggregateVotesResponse, error)
func (Keeper) ClearBallots ¶
ClearBallots clears all tallied prevotes and votes from the store.
func (Keeper) ClearVoteTargets ¶
ClearVoteTargets clears vote targets
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 vote from the store.
func (Keeper) DeleteExchangeRate ¶
DeleteExchangeRate deletes the consensus exchange rate of denom denominated in uUSD from the store.
func (Keeper) DeleteMissCounter ¶
func (k Keeper) DeleteMissCounter(ctx sdk.Context, operator sdk.ValAddress)
DeleteMissCounter removes miss counter for the validator.
func (Keeper) ExchangeRate ¶
func (k Keeper) ExchangeRate(c context.Context, req *types.QueryExchangeRateRequest) (*types.QueryExchangeRateResponse, error)
func (Keeper) ExchangeRates ¶
func (k Keeper) ExchangeRates(c context.Context, req *types.QueryExchangeRatesRequest) (*types.QueryExchangeRatesResponse, error)
func (Keeper) FeederDelegation ¶
func (k Keeper) FeederDelegation(c context.Context, req *types.QueryFeederDelegationRequest) (*types.QueryFeederDelegationResponse, error)
func (Keeper) GetAggregateExchangeRatePrevote ¶
func (k Keeper) GetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) (aggregatePrevote types.AggregateExchangeRatePrevote, err error)
GetAggregateExchangeRatePrevote retrieves an oracle prevote from the store.
func (Keeper) GetAggregateExchangeRateVote ¶
func (k Keeper) GetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) (aggregateVote types.AggregateExchangeRateVote, err error)
GetAggregateExchangeRateVote retrieves an oracle vote from the store.
func (Keeper) GetExchangeRate ¶
GetExchangeRate gets the consensus exchange rate of denom denominated in uUSD from the store.
func (Keeper) GetFeederDelegation ¶
func (k Keeper) GetFeederDelegation(ctx sdk.Context, operator sdk.ValAddress) sdk.AccAddress
GetFeederDelegation gets the account address that the validator operator delegated oracle vote rights to.
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) authtypes.ModuleAccountI
GetOracleAccount returns oracle ModuleAccount
func (Keeper) GetRewardPool ¶
GetRewardPool retrieves the balance of the oracle module account
func (Keeper) GetTargets ¶
GetTargets returns the target list on current vote period.
func (Keeper) GetVoteTargets ¶
GetVoteTargets returns the voting target list on current vote period.
func (Keeper) IsVoteTarget ¶
IsVoteTarget returns existence of a denom in the voting target list.
func (Keeper) IterateAggregateExchangeRatePrevotes ¶
func (k Keeper) IterateAggregateExchangeRatePrevotes(ctx sdk.Context, handler func(voterAddr sdk.ValAddress, aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool))
IterateAggregateExchangeRatePrevotes iterates rate over prevotes in the store.
func (Keeper) IterateAggregateExchangeRateVotes ¶
func (k Keeper) IterateAggregateExchangeRateVotes(ctx sdk.Context, handler func(voterAddr sdk.ValAddress, aggregateVote types.AggregateExchangeRateVote) (stop bool))
IterateAggregateExchangeRateVotes iterates rate over votes in the store.
func (Keeper) IterateExchangeRates ¶
func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(denom string, exchangeRate sdk.Dec) (stop bool))
IterateExchangeRates iterates over denom rates in the store.
func (Keeper) IterateFeederDelegations ¶
func (k Keeper) IterateFeederDelegations(ctx sdk.Context, handler func(delegator sdk.ValAddress, delegate sdk.AccAddress) (stop bool))
IterateFeederDelegations iterates over the feed delegates and performs a callback function.
func (Keeper) IterateMissCounters ¶
func (k Keeper) IterateMissCounters(ctx sdk.Context, handler func(operator sdk.ValAddress, missCounter uint64) (stop bool))
IterateMissCounters iterates over the miss counters and performs a callback function.
func (Keeper) IterateTargets ¶
IterateTargets iterates rate over targets in the store.
func (Keeper) IterateVoteTargets ¶
IterateVoteTargets iterates rate over vote targets in the store.
func (Keeper) MinValidPerWindow ¶
MinValidPerWindow returns oracle slashing threshold.
func (Keeper) MissCounter ¶
func (k Keeper) MissCounter(c context.Context, req *types.QueryMissCounterRequest) (*types.QueryMissCounterResponse, error)
func (Keeper) OrganizeBallotByDenom ¶
func (k Keeper) OrganizeBallotByDenom(ctx sdk.Context, validatorClaimMap map[string]types.Claim) (votes map[string]types.ExchangeRateBallot)
OrganizeBallotByDenom collects all oracle votes for the period, categorized by the votes' denom parameter.
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) RewardBallotWinners ¶
func (k Keeper) RewardBallotWinners( ctx sdk.Context, votePeriod int64, rewardDistributionWindow int64, voteTargets map[string]struct{}, ballotWinners map[string]types.Claim, )
RewardBallotWinners gives out portion of seigniorage reward to the oracle voters that voted faithfully, at the end of every VotePeriod.
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 seigniorage reward comes in and then is distributed.
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 vote to the store.
func (Keeper) SetExchangeRate ¶
SetExchangeRate sets the consensus exchange rate of denom denominated in uUSD to the store.
func (Keeper) SetExchangeRateWithEvent ¶
SetExchangeRateWithEvent sets the consensus exchange rate of denom denominated in uUSD 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 that the validator operator delegated oracle vote rights to.
func (Keeper) SetMissCounter ¶
SetMissCounter updates the # of vote periods missed in this oracle slash window.
func (*Keeper) SetStakingKeeper ¶
func (k *Keeper) SetStakingKeeper(sk types.StakingKeeper)
func (Keeper) SetVoteTarget ¶
SetVoteTarget sets vote target for the denom.
func (Keeper) SlashAndResetMissCounters ¶
SlashAndResetMissCounters slashes any operator who over criteria and clears all operators' miss counter to zero.
func (Keeper) SlashFraction ¶
SlashFraction returns oracle voting penalty rate.
func (Keeper) SlashWindow ¶
SlashWindow returns # of vote period for oracle slashing.
func (Keeper) StakingKeeper ¶
func (k Keeper) StakingKeeper() types.StakingKeeper
func (Keeper) Targets ¶
func (k Keeper) Targets(c context.Context, req *types.QueryTargetsRequest) (*types.QueryTargetsResponse, error)
func (Keeper) ValidateFeeder ¶
func (k Keeper) ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, validatorAddr sdk.ValAddress) error
ValidateFeeder return the given feeder is allowed to feed the message or not.
func (Keeper) VotePeriod ¶
VotePeriod returns the number of blocks during which voting takes place.
func (Keeper) VoteTargets ¶
func (k Keeper) VoteTargets(c context.Context, req *types.QueryVoteTargetsRequest) (*types.QueryVoteTargetsResponse, error)
type TestInput ¶
type TestInput struct { Ctx sdk.Context Cdc *codec.LegacyAmino AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper OracleKeeper Keeper StakingKeeper stakingkeeper.Keeper DistrKeeper distrkeeper.Keeper }
TestInput nolint