Documentation ¶
Index ¶
- Constants
- Variables
- func EndBlocker(ctx sdk.Context, k Keeper) (prices map[string]sdk.Dec, rewardees map[string]sdk.Int, resTags sdk.Tags)
- func ErrInvalidPrice(codespace sdk.CodespaceType, price sdk.Dec) sdk.Error
- func ErrNotValidator(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error
- func ErrUnknownDenomination(codespace sdk.CodespaceType, denom string) sdk.Error
- func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
- func KeyDropCounter(denom string) []byte
- func KeyPrice(denom string) []byte
- func KeyVote(denom string, voter sdk.AccAddress) []byte
- func NewHandler(k Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type Keeper
- type Params
- type PriceBallot
- type PriceFeedMsg
- type PriceVote
- type QueryVoteParams
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = "oracle" CodeNotValidator sdk.CodeType = 1 CodeUnknownDenom sdk.CodeType = 2 CodeInvalidPrice sdk.CodeType = 3 )
Oracle errors reserve 1101-1199
const ( // Precision of Oracle vote OracleDecPrec = 2 // RouterKey is they name of the oracle module RouterKey = "oracle" )
const ( QueryPrice = "price" QueryVotes = "votes" QueryActive = "active" QueryParams = "params" )
query endpoints supported by the governance Querier
const (
// default paramspace for params keeper
DefaultParamspace = "oracle"
)
const StoreKey = "oracle"
StoreKey is string representation of the store key for oracle
Variables ¶
var ( PrefixVote = []byte("vote") PrefixPrice = []byte("price") PrefixDropCounter = []byte("drop") KeyDelimiter = []byte(":") ParamStoreKeyParams = []byte("params") )
nolint
Functions ¶
func EndBlocker ¶
func EndBlocker(ctx sdk.Context, k Keeper) (prices map[string]sdk.Dec, rewardees map[string]sdk.Int, resTags sdk.Tags)
EndBlocker is called at the end of every block
func ErrInvalidPrice ¶ added in v0.0.5
ErrInvalidPrice called when the price submitted is not valid
func ErrNotValidator ¶
func ErrNotValidator(codespace sdk.CodespaceType, address sdk.AccAddress) sdk.Error
ErrNotValidator called when the signer of a Msg is not a validator
func ErrUnknownDenomination ¶ added in v0.0.4
func ErrUnknownDenomination(codespace sdk.CodespaceType, denom string) sdk.Error
ErrUnknownDenomination called when the signer of a Msg is not a validator
func InitGenesis ¶ added in v0.0.4
func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)
new oracle genesis
func KeyDropCounter ¶ added in v0.0.5
KeyDropCounter is in format of PrefixDropCounter||denom
func KeyVote ¶ added in v0.0.5
func KeyVote(denom string, voter sdk.AccAddress) []byte
KeyVote Key is in format of PrefixVote||denom||voter.AccAddress
func NewHandler ¶
NewHandler returns a handler for "oracle" type messages.
func NewQuerier ¶ added in v0.0.5
NewQuerier is the module level router for state queries
func ParamKeyTable ¶ added in v0.0.5
ParamKeyTable for oracle module
func RegisterCodec ¶ added in v0.0.5
Register concrete types on codec codec
func ValidateGenesis ¶ added in v0.0.4
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the provided oracle genesis state to ensure the expected invariants holds. (i.e. params in correct bounds, no duplicate validators)
Types ¶
type GenesisState ¶ added in v0.0.4
type GenesisState struct {
Params Params `json:"params"` // oracle params
}
GenesisState - all oracle state that must be provided at genesis
func DefaultGenesisState ¶ added in v0.0.4
func DefaultGenesisState() GenesisState
get raw genesis raw message for testing
func ExportGenesis ¶ added in v0.0.4
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
ExportGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, and validator/delegator distribution info's
func NewGenesisState ¶ added in v0.0.4
func NewGenesisState(params Params) GenesisState
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the oracle store
func NewKeeper ¶
func NewKeeper(key sdk.StoreKey, cdc *codec.Codec, valset sdk.ValidatorSet, paramspace params.Subspace) Keeper
NewKeeper constructs a new keeper
type Params ¶ added in v0.0.4
type Params struct { VotePeriod sdk.Int `json:"vote_period"` // voting period; tallys and reward claim period VoteThreshold sdk.Dec `json:"vote_threshold"` // minimum stake power threshold to clear vote DropThreshold sdk.Int `json:"drop_threshold"` // tolerated drops before blacklist }
Params oracle parameters
func DefaultParams ¶ added in v0.0.4
func DefaultParams() Params
DefaultParams creates default oracle module parameters
type PriceBallot ¶ added in v0.0.5
type PriceBallot []PriceVote
func (PriceBallot) Len ¶ added in v0.0.5
func (pb PriceBallot) Len() int
Len implements sort.Interface
func (PriceBallot) Less ¶ added in v0.0.5
func (pb PriceBallot) Less(i, j int) bool
Less reports whether the element with index i should sort before the element with index j.
func (PriceBallot) String ¶ added in v0.0.5
func (pb PriceBallot) String() (out string)
String implements fmt.Stringer interface
func (PriceBallot) Swap ¶ added in v0.0.5
func (pb PriceBallot) Swap(i, j int)
type PriceFeedMsg ¶
type PriceFeedMsg struct { Denom string Price sdk.Dec // in Luna Feeder sdk.AccAddress }
PriceFeedMsg - struct for voting on payloads. Note that the Price is denominated in Luna. All validators must vote on Terra prices.
func NewPriceFeedMsg ¶
func NewPriceFeedMsg(denom string, price sdk.Dec, feederAddress sdk.AccAddress) PriceFeedMsg
NewPriceFeedMsg creates a PriceFeedMsg instance
func (PriceFeedMsg) GetSignBytes ¶
func (msg PriceFeedMsg) GetSignBytes() []byte
GetSignBytes implements sdk.Msg
func (PriceFeedMsg) GetSigners ¶
func (msg PriceFeedMsg) GetSigners() []sdk.AccAddress
GetSigners implements sdk.Msg
func (PriceFeedMsg) ValidateBasic ¶
func (msg PriceFeedMsg) ValidateBasic() sdk.Error
ValidateBasic Implements sdk.Msg
type PriceVote ¶
type PriceVote struct { Price sdk.Dec `json:"price"` // Price of Luna in target fiat currency Denom string `json:"denom"` // Ticker name of target fiat currency Power sdk.Int `json:"power"` // Total bonded tokens of validator Voter sdk.AccAddress `json:"voter"` // account address of validator }
PriceVote - struct to store a validator's vote on the price
func NewPriceVote ¶
NewPriceVote creates a PriceVote instance
type QueryVoteParams ¶ added in v0.0.5
type QueryVoteParams struct { Voter sdk.AccAddress Denom string }
Params for query 'custom/oracle/votes'
func NewQueryVoteParams ¶ added in v0.0.5
func NewQueryVoteParams(voter sdk.AccAddress, denom string) QueryVoteParams
creates a new instance of QueryVoteParams