types

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

noalias

nolint:deadcode unused noalias

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = "oracle"

	CodeUnknownDenom        codeType = 1
	CodeInvalidExchangeRate codeType = 2
	CodeVoterNotValidator   codeType = 3
	CodeInvalidVote         codeType = 4
	CodeNoVotingPermission  codeType = 5
	CodeInvalidHashLength   codeType = 6
	CodeInvalidPrevote      codeType = 7
	CodeVerificationFailed  codeType = 8
	CodeNotRevealPeriod     codeType = 9
	CodeInvalidSaltLength   codeType = 10
	CodeInvalidMsgFormat    codeType = 11
)

Oracle error codes

View Source
const (
	EventTypeExchangeRateUpdate = "exchange_rate_update"
	EventTypePrevote            = "prevote"
	EventTypeVote               = "vote"
	EventTypeFeedDeleate        = "feed_delegate"

	AttributeKeyDenom        = "denom"
	AttributeKeyVoter        = "voter"
	AttributeKeyExchangeRate = "exchange_rate"
	AttributeKeyOperator     = "operator"
	AttributeKeyFeeder       = "feeder"

	AttributeValueCategory = ModuleName
)

Oracle module event types

View Source
const (
	// ModuleName is the name of the oracle module
	ModuleName = "oracle"

	// StoreKey is the string store representation
	StoreKey = ModuleName

	// RouterKey is the msg router key for the oracle module
	RouterKey = ModuleName

	// QuerierRoute is the query router key for the oracle module
	QuerierRoute = ModuleName
)
View Source
const (
	DefaultVotePeriod               = core.BlocksPerMinute / 2 // 30 seconds
	DefaultSlashWindow              = core.BlocksPerWeek       // window for a week
	DefaultRewardDistributionWindow = core.BlocksPerYear       // window for a year
)

Default parameter values

View Source
const (
	QueryParameters       = "parameters"
	QueryExchangeRate     = "exchangeRate"
	QueryExchangeRates    = "exchangeRates"
	QueryActives          = "actives"
	QueryPrevotes         = "prevotes"
	QueryVotes            = "votes"
	QueryFeederDelegation = "feederDelegation"
	QueryMissCounter      = "missCounter"
)

Defines the prefix of each query path

View Source
const DefaultParamspace = ModuleName

DefaultParamspace defines default space for oracle params

Variables

View Source
var (
	// Keys for store prefixes
	PrevoteKey          = []byte{0x01} // prefix for each key to a prevote
	VoteKey             = []byte{0x02} // prefix for each key to a vote
	ExchangeRateKey     = []byte{0x03} // prefix for each key to a rate
	FeederDelegationKey = []byte{0x04} // prefix for each key to a feeder delegation
	MissCounterKey      = []byte{0x05} // prefix for each key to a miss counter
)

Keys for oracle store Items are stored with the following key: values

- 0x01<denom_Bytes><valAddress_Bytes>: Prevote

- 0x02<denom_Bytes><valAddress_Bytes>: Vote

- 0x03<denom_Bytes>: sdk.Dec

- 0x04<valAddress_Bytes>: accAddress

- 0x05<valAddress_Bytes>: int64

View Source
var (
	ParamStoreKeyVotePeriod               = []byte("voteperiod")
	ParamStoreKeyVoteThreshold            = []byte("votethreshold")
	ParamStoreKeyRewardBand               = []byte("rewardband")
	ParamStoreKeyRewardDistributionWindow = []byte("rewarddistributionwindow")
	ParamStoreKeyWhitelist                = []byte("whitelist")
	ParamStoreKeySlashFraction            = []byte("slashfraction")
	ParamStoreKeySlashWindow              = []byte("slashwindow")
	ParamStoreKeyMinValidPerWindow        = []byte("minvalidperwindow")
)

Parameter keys

View Source
var (
	DefaultVoteThreshold     = sdk.NewDecWithPrec(50, 2)                                             // 50%
	DefaultRewardBand        = sdk.NewDecWithPrec(2, 2)                                              // 1%
	DefaultWhitelist         = DenomList{core.MicroKRWDenom, core.MicroSDRDenom, core.MicroUSDDenom} // ukrw, usdr, uusd
	DefaultSlashFraction     = sdk.NewDecWithPrec(1, 4)                                              // 0.01%
	DefaultMinValidPerWindow = sdk.NewDecWithPrec(5, 2)                                              // 5%
)

Default parameter values

View Source
var ModuleCdc = codec.New()

ModuleCdc module codec

Functions

func ErrInvalidExchangeRate

func ErrInvalidExchangeRate(codespace sdk.CodespaceType, rate sdk.Dec) sdk.Error

ErrInvalidExchangeRate called when the rate submitted is not valid

func ErrInvalidHashLength

func ErrInvalidHashLength(codespace sdk.CodespaceType, hashLength int) sdk.Error

ErrInvalidHashLength called when the given hash has invalid length

func ErrInvalidSaltLength

func ErrInvalidSaltLength(codespace sdk.CodespaceType, saltLength int) sdk.Error

ErrInvalidSaltLength called when the salt length is not in 1~4

func ErrNoPrevote

func ErrNoPrevote(codespace sdk.CodespaceType, voter sdk.ValAddress, denom string) sdk.Error

ErrNoPrevote called when no prevote exists

func ErrNoVote

func ErrNoVote(codespace sdk.CodespaceType, voter sdk.ValAddress, denom string) sdk.Error

ErrNoVote called when no vote exists

func ErrNoVotingPermission

func ErrNoVotingPermission(codespace sdk.CodespaceType, feeder sdk.AccAddress, operator sdk.ValAddress) sdk.Error

ErrNoVotingPermission called when the feeder has no permission to submit a vote for the given operator

func ErrNotRevealPeriod

func ErrNotRevealPeriod(codespace sdk.CodespaceType) sdk.Error

ErrNotRevealPeriod called when the feeder submit rate reveal vote in wrong period.

func ErrUnknownDenomination

func ErrUnknownDenomination(codespace sdk.CodespaceType, denom string) sdk.Error

ErrUnknownDenomination called when the denom is not known

func ErrVerificationFailed

func ErrVerificationFailed(codespace sdk.CodespaceType, hash []byte, retrivedHash []byte) sdk.Error

ErrVerificationFailed called when the given prevote has different hash from the retrieved one

func GetExchangeRateKey

func GetExchangeRateKey(denom string) []byte

GetExchangeRateKey - stored by *denom*

func GetExchangeRatePrevoteKey

func GetExchangeRatePrevoteKey(denom string, v sdk.ValAddress) []byte

GetExchangeRatePrevoteKey - stored by *Validator* address and denom

func GetFeederDelegationKey

func GetFeederDelegationKey(v sdk.ValAddress) []byte

GetFeederDelegationKey - stored by *Validator* address

func GetMissCounterKey

func GetMissCounterKey(v sdk.ValAddress) []byte

GetMissCounterKey - stored by *Validator* address

func GetVoteKey

func GetVoteKey(denom string, v sdk.ValAddress) []byte

GetVoteKey - stored by *Validator* address and denom

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec codec

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the oracle genesis parameters

func VoteHash

func VoteHash(salt string, rate sdk.Dec, denom string, voter sdk.ValAddress) ([]byte, error)

VoteHash computes hash value of ExchangeRateVote

Types

type Claim

type Claim struct {
	Weight    int64          `json:"weight"`
	Recipient sdk.ValAddress `json:"recipient"`
}

Claim is an interface that directs its rewards to an attached bank account.

func NewClaim

func NewClaim(weight int64, recipient sdk.ValAddress) Claim

NewClaim generates a Claim instance.

type DenomList

type DenomList []string

DenomList is array of denom

func (DenomList) String

func (dl DenomList) String() string

String implements fmt.Stringer interface

type DistributionKeeper

type DistributionKeeper interface {
	AllocateTokensToValidator(ctx sdk.Context, val stakingexported.ValidatorI, tokens sdk.DecCoins)
}

DistributionKeeper is expected keeper for distribution module

type DummyStakingKeeper

type DummyStakingKeeper struct {
	// contains filtered or unexported fields
}

DummyStakingKeeper dummy staking keeper to test ballot

func GenerateRandomTestCase

func GenerateRandomTestCase() (rates []float64, valValAddrs []sdk.ValAddress, stakingKeeper DummyStakingKeeper)

GenerateRandomTestCase nolint

func NewDummyStakingKeeper

func NewDummyStakingKeeper(validators []MockValidator) DummyStakingKeeper

NewDummyStakingKeeper returns new DummyStakingKeeper instance

func (DummyStakingKeeper) IterateValidators

func (DummyStakingKeeper) IterateValidators(sdk.Context, func(index int64, validator exported.ValidatorI) (stop bool))

IterateValidators nolint

func (DummyStakingKeeper) Jail

Jail nolint

func (DummyStakingKeeper) Slash

Slash nolint

func (DummyStakingKeeper) TotalBondedTokens

func (DummyStakingKeeper) TotalBondedTokens(_ sdk.Context) sdk.Int

TotalBondedTokens nolint

func (DummyStakingKeeper) Validator

func (sk DummyStakingKeeper) Validator(ctx sdk.Context, address sdk.ValAddress) exported.ValidatorI

Validator nolint

func (DummyStakingKeeper) Validators

func (sk DummyStakingKeeper) Validators() []MockValidator

Validators nolint

type ExchangeRateBallot

type ExchangeRateBallot []VoteForTally

ExchangeRateBallot is a convinience wrapper around a ExchangeRateVote slice

func (ExchangeRateBallot) Len

func (pb ExchangeRateBallot) Len() int

Len implements sort.Interface

func (ExchangeRateBallot) Less

func (pb ExchangeRateBallot) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (ExchangeRateBallot) Power

func (pb ExchangeRateBallot) Power() int64

Power returns the total amount of voting power in the ballot

func (ExchangeRateBallot) StandardDeviation

func (pb ExchangeRateBallot) StandardDeviation() (standardDeviation sdk.Dec)

StandardDeviation returns the standard deviation by the power of the ExchangeRateVote.

func (ExchangeRateBallot) Swap

func (pb ExchangeRateBallot) Swap(i, j int)

Swap implements sort.Interface.

func (ExchangeRateBallot) WeightedMedian

func (pb ExchangeRateBallot) WeightedMedian() sdk.Dec

WeightedMedian returns the median weighted by the power of the ExchangeRateVote.

type ExchangeRatePrevote

type ExchangeRatePrevote struct {
	Hash        string         `json:"hash"`  // Vote hex hash to protect centralize data source problem
	Denom       string         `json:"denom"` // Ticker name of target fiat currency
	Voter       sdk.ValAddress `json:"voter"` // Voter val address
	SubmitBlock int64          `json:"submit_block"`
}

ExchangeRatePrevote - struct to store a validator's prevote on the rate of Luna in the denom asset

func NewExchangeRatePrevote

func NewExchangeRatePrevote(hash string, denom string, voter sdk.ValAddress, submitBlock int64) ExchangeRatePrevote

NewExchangeRatePrevote returns ExchangeRatePrevote object

func (ExchangeRatePrevote) String

func (pp ExchangeRatePrevote) String() string

String implements fmt.Stringer interface

type ExchangeRatePrevotes

type ExchangeRatePrevotes []ExchangeRatePrevote

ExchangeRatePrevotes is a collection of PreicePrevote

func (ExchangeRatePrevotes) String

func (v ExchangeRatePrevotes) String() (out string)

String implements fmt.Stringer interface

type ExchangeRateVote

type ExchangeRateVote struct {
	ExchangeRate sdk.Dec        `json:"exchange_rate"` // ExchangeRate of Luna in target fiat currency
	Denom        string         `json:"denom"`         // Ticker name of target fiat currency
	Voter        sdk.ValAddress `json:"voter"`         // voter val address of validator
}

ExchangeRateVote - struct to store a validator's vote on the rate of Luna in the denom asset

func NewExchangeRateVote

func NewExchangeRateVote(rate sdk.Dec, denom string, voter sdk.ValAddress) ExchangeRateVote

NewExchangeRateVote creates a ExchangeRateVote instance

func (ExchangeRateVote) String

func (pv ExchangeRateVote) String() string

String implements fmt.Stringer interface

type ExchangeRateVotes

type ExchangeRateVotes []ExchangeRateVote

ExchangeRateVotes is a collection of ExchangeRateVote

func (ExchangeRateVotes) String

func (v ExchangeRateVotes) String() (out string)

String implements fmt.Stringer interface

type GenesisState

type GenesisState struct {
	Params               Params                    `json:"params" yaml:"params"`
	FeederDelegations    map[string]sdk.AccAddress `json:"feeder_delegations" yaml:"feeder_delegations"`
	ExchangeRates        map[string]sdk.Dec        `json:"exchange_rates" yaml:"exchange_rates"`
	ExchangeRatePrevotes []ExchangeRatePrevote     `json:"exchange_rate_prevotes" yaml:"exchange_rate_prevotes"`
	ExchangeRateVotes    []ExchangeRateVote        `json:"exchange_rate_votes" yaml:"exchange_rate_votes"`
	MissCounters         map[string]int64          `json:"miss_counters" yaml:"miss_counters"`
}

GenesisState - all oracle state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - default GenesisState used by columbus-2

func NewGenesisState

func NewGenesisState(
	params Params, exchangeRatePrevotes []ExchangeRatePrevote,
	exchangeRateVotes []ExchangeRateVote, rates map[string]sdk.Dec,
	feederDelegations map[string]sdk.AccAddress, missCounters map[string]int64,
) GenesisState

NewGenesisState creates a new GenesisState object

func (GenesisState) Equal

func (data GenesisState) Equal(data2 GenesisState) bool

Equal checks whether 2 GenesisState structs are equivalent.

func (GenesisState) IsEmpty

func (data GenesisState) IsEmpty() bool

IsEmpty returns if a GenesisState is empty or has data in it

type MockValidator

type MockValidator struct {
	// contains filtered or unexported fields
}

func NewMockValidator

func NewMockValidator(valAddr sdk.ValAddress, power int64) MockValidator

func (MockValidator) GetBondedTokens

func (v MockValidator) GetBondedTokens() sdk.Int

func (MockValidator) GetCommission

func (v MockValidator) GetCommission() sdk.Dec

func (MockValidator) GetConsAddr

func (MockValidator) GetConsAddr() sdk.ConsAddress

func (MockValidator) GetConsPubKey

func (MockValidator) GetConsPubKey() crypto.PubKey

func (MockValidator) GetConsensusPower

func (v MockValidator) GetConsensusPower() int64

func (MockValidator) GetDelegatorShares

func (v MockValidator) GetDelegatorShares() sdk.Dec

func (MockValidator) GetMinSelfDelegation

func (v MockValidator) GetMinSelfDelegation() sdk.Int

func (MockValidator) GetMoniker

func (MockValidator) GetMoniker() string

func (MockValidator) GetOperator

func (v MockValidator) GetOperator() sdk.ValAddress

func (MockValidator) GetStatus

func (MockValidator) GetStatus() sdk.BondStatus

func (MockValidator) GetTokens

func (v MockValidator) GetTokens() sdk.Int

func (MockValidator) IsBonded

func (MockValidator) IsBonded() bool

func (MockValidator) IsJailed

func (MockValidator) IsJailed() bool

func (MockValidator) IsUnbonded

func (MockValidator) IsUnbonded() bool

func (MockValidator) IsUnbonding

func (MockValidator) IsUnbonding() bool

func (MockValidator) SetPower

func (v MockValidator) SetPower(power int64)

func (MockValidator) SharesFromTokens

func (v MockValidator) SharesFromTokens(amt sdk.Int) (sdk.Dec, sdk.Error)

func (MockValidator) SharesFromTokensTruncated

func (v MockValidator) SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, sdk.Error)

func (MockValidator) TokensFromShares

func (v MockValidator) TokensFromShares(sdk.Dec) sdk.Dec

func (MockValidator) TokensFromSharesRoundUp

func (v MockValidator) TokensFromSharesRoundUp(sdk.Dec) sdk.Dec

func (MockValidator) TokensFromSharesTruncated

func (v MockValidator) TokensFromSharesTruncated(sdk.Dec) sdk.Dec

type MsgDelegateFeedConsent

type MsgDelegateFeedConsent struct {
	Operator sdk.ValAddress `json:"operator" yaml:"operator"`
	Delegate sdk.AccAddress `json:"delegate" yaml:"delegate"`
}

MsgDelegateFeedConsent - struct for delegating oracle voting rights to another address.

func NewMsgDelegateFeedConsent

func NewMsgDelegateFeedConsent(operatorAddress sdk.ValAddress, feederAddress sdk.AccAddress) MsgDelegateFeedConsent

NewMsgDelegateFeedConsent creates a MsgDelegateFeedConsent instance

func (MsgDelegateFeedConsent) GetSignBytes

func (msg MsgDelegateFeedConsent) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (MsgDelegateFeedConsent) GetSigners

func (msg MsgDelegateFeedConsent) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (MsgDelegateFeedConsent) Route

func (msg MsgDelegateFeedConsent) Route() string

Route implements sdk.Msg

func (MsgDelegateFeedConsent) String

func (msg MsgDelegateFeedConsent) String() string

String implements fmt.Stringer interface

func (MsgDelegateFeedConsent) Type

func (msg MsgDelegateFeedConsent) Type() string

Type implements sdk.Msg

func (MsgDelegateFeedConsent) ValidateBasic

func (msg MsgDelegateFeedConsent) ValidateBasic() sdk.Error

ValidateBasic implements sdk.Msg

type MsgExchangeRatePrevote

type MsgExchangeRatePrevote struct {
	Hash      string         `json:"hash" yaml:"hash"` // hex string
	Denom     string         `json:"denom" yaml:"denom"`
	Feeder    sdk.AccAddress `json:"feeder" yaml:"feeder"`
	Validator sdk.ValAddress `json:"validator" yaml:"validator"`
}

MsgExchangeRatePrevote - struct for prevoting on the ExchangeRateVote. The purpose of prevote is to hide vote exchange rate with hash which is formatted as hex string in SHA256("salt:exchange_rate:denom:voter")

func NewMsgExchangeRatePrevote

func NewMsgExchangeRatePrevote(VoteHash string, denom string, feederAddress sdk.AccAddress, valAddress sdk.ValAddress) MsgExchangeRatePrevote

NewMsgExchangeRatePrevote creates a MsgExchangeRatePrevote instance

func (MsgExchangeRatePrevote) GetSignBytes

func (msg MsgExchangeRatePrevote) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (MsgExchangeRatePrevote) GetSigners

func (msg MsgExchangeRatePrevote) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (MsgExchangeRatePrevote) Route

func (msg MsgExchangeRatePrevote) Route() string

Route implements sdk.Msg

func (MsgExchangeRatePrevote) String

func (msg MsgExchangeRatePrevote) String() string

String implements fmt.Stringer interface

func (MsgExchangeRatePrevote) Type

func (msg MsgExchangeRatePrevote) Type() string

Type implements sdk.Msg

func (MsgExchangeRatePrevote) ValidateBasic

func (msg MsgExchangeRatePrevote) ValidateBasic() sdk.Error

ValidateBasic Implements sdk.Msg

type MsgExchangeRateVote

type MsgExchangeRateVote struct {
	ExchangeRate sdk.Dec        `json:"exchange_rate" yaml:"exchange_rate"` // the effective rate of Luna in {Denom}
	Salt         string         `json:"salt" yaml:"salt"`
	Denom        string         `json:"denom" yaml:"denom"`
	Feeder       sdk.AccAddress `json:"feeder" yaml:"feeder"`
	Validator    sdk.ValAddress `json:"validator" yaml:"validator"`
}

MsgExchangeRateVote - struct for voting on the exchange rate of Luna denominated in various Terra assets. For example, if the validator believes that the effective exchange rate of Luna in USD is 10.39, that's what the exchange rate field would be, and if 1213.34 for KRW, same.

func NewMsgExchangeRateVote

func NewMsgExchangeRateVote(rate sdk.Dec, salt string, denom string, feederAddress sdk.AccAddress, valAddress sdk.ValAddress) MsgExchangeRateVote

NewMsgExchangeRateVote creates a MsgExchangeRateVote instance

func (MsgExchangeRateVote) GetSignBytes

func (msg MsgExchangeRateVote) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (MsgExchangeRateVote) GetSigners

func (msg MsgExchangeRateVote) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg

func (MsgExchangeRateVote) Route

func (msg MsgExchangeRateVote) Route() string

Route implements sdk.Msg

func (MsgExchangeRateVote) String

func (msg MsgExchangeRateVote) String() string

String implements fmt.Stringer interface

func (MsgExchangeRateVote) Type

func (msg MsgExchangeRateVote) Type() string

Type implements sdk.Msg

func (MsgExchangeRateVote) ValidateBasic

func (msg MsgExchangeRateVote) ValidateBasic() sdk.Error

ValidateBasic implements sdk.Msg

type Params

type Params struct {
	VotePeriod               int64     `json:"vote_period" yaml:"vote_period"`                               // the number of blocks during which voting takes place.
	VoteThreshold            sdk.Dec   `json:"vote_threshold" yaml:"vote_threshold"`                         // the minimum percentage of votes that must be received for a ballot to pass.
	RewardBand               sdk.Dec   `json:"reward_band" yaml:"reward_band"`                               // the ratio of allowable exchange rate error that can be rewared.
	RewardDistributionWindow int64     `json:"reward_distribution_window" yaml:"reward_distribution_window"` // the number of blocks during which seigiornage reward comes in and then is distributed.
	Whitelist                DenomList `json:"whitelist" yaml:"whitelist"`                                   // the denom list that can be acitivated,
	SlashFraction            sdk.Dec   `json:"slash_fraction" yaml:"slash_fraction"`                         // the ratio of penalty on bonded tokens
	SlashWindow              int64     `json:"slash_window" yaml:"slash_window"`                             // the number of blocks for slashing tallying
	MinValidPerWindow        sdk.Dec   `json:"min_valid_per_window" yaml:"min_valid_per_window"`             // the ratio of minimum valid oracle votes per slash window to avoid slashing
}

Params oracle parameters

func DefaultParams

func DefaultParams() Params

DefaultParams creates default oracle module parameters

func (*Params) ParamSetPairs

func (params *Params) ParamSetPairs() subspace.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of oracle module's parameters.

func (Params) String

func (params Params) String() string

String implements fmt.Stringer interface

func (Params) Validate

func (params Params) Validate() error

Validate validates a set of params

type QueryExchangeRateParams

type QueryExchangeRateParams struct {
	Denom string
}

QueryExchangeRateParams defines the params for the following queries: - 'custom/oracle/exchange_rate'

func NewQueryExchangeRateParams

func NewQueryExchangeRateParams(denom string) QueryExchangeRateParams

NewQueryExchangeRateParams returns params for exchange_rate query

type QueryFeederDelegationParams

type QueryFeederDelegationParams struct {
	Validator sdk.ValAddress
}

QueryFeederDelegationParams defeins the params for the following queries: - 'custom/oracle/feederDelegation'

func NewQueryFeederDelegationParams

func NewQueryFeederDelegationParams(validator sdk.ValAddress) QueryFeederDelegationParams

NewQueryFeederDelegationParams returns params for feeder delegation query

type QueryMissCounterParams

type QueryMissCounterParams struct {
	Validator sdk.ValAddress
}

QueryMissCounterParams defeins the params for the following queries: - 'custom/oracle/missCounter'

func NewQueryMissCounterParams

func NewQueryMissCounterParams(validator sdk.ValAddress) QueryMissCounterParams

NewQueryMissCounterParams returns params for feeder delegation query

type QueryPrevotesParams

type QueryPrevotesParams struct {
	Voter sdk.ValAddress
	Denom string
}

QueryPrevotesParams defines the params for the following queries: - 'custom/oracle/prevotes'

func NewQueryPrevotesParams

func NewQueryPrevotesParams(voter sdk.ValAddress, denom string) QueryPrevotesParams

NewQueryPrevotesParams returns params for exchange_rate prevotes query

type QueryVotesParams

type QueryVotesParams struct {
	Voter sdk.ValAddress
	Denom string
}

QueryVotesParams defines the params for the following queries: - 'custom/oracle/votes'

func NewQueryVotesParams

func NewQueryVotesParams(voter sdk.ValAddress, denom string) QueryVotesParams

NewQueryVotesParams returns params for exchange_rate votes query

type StakingKeeper

type StakingKeeper interface {
	Validator(ctx sdk.Context, address sdk.ValAddress) stakingexported.ValidatorI // get validator by operator address; nil when validator not found
	TotalBondedTokens(sdk.Context) sdk.Int                                        // total bonded tokens within the validator set
	Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec)                    // slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction
	Jail(sdk.Context, sdk.ConsAddress)                                            // jail a validator
	IterateValidators(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool))
}

StakingKeeper is expected keeper for staking module

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAccount(ctx sdk.Context, moduleName string) supplyexported.ModuleAccountI
	SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI)
	GetSupply(ctx sdk.Context) (supply supplyexported.SupplyI)
	SetSupply(ctx sdk.Context, supply supplyexported.SupplyI)
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) sdk.Error
}

SupplyKeeper is expected keeper for supply module

type VoteForTally

type VoteForTally struct {
	ExchangeRateVote
	Power int64
}

VoteForTally is a convinience wrapper to reduct redundant lookup cost

func NewVoteForTally

func NewVoteForTally(vote ExchangeRateVote, power int64) VoteForTally

NewVoteForTally returns a new VoteForTally instance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL