Documentation ¶
Index ¶
- func NewMsgServer(k Keeper) types.MsgServer
- func NewQueryServer(k Keeper) types.QueryServer
- type Keeper
- func (k Keeper) CreateCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllCurrencyPairs(ctx sdk.Context) []types.CurrencyPair
- func (k Keeper) GetCurrencyPairFromID(ctx sdk.Context, id uint64) (types.CurrencyPair, bool)
- func (k Keeper) GetIDForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) (uint64, bool)
- func (k Keeper) GetNonceForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) (uint64, error)
- func (k Keeper) GetPriceForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) (types.QuotePrice, error)
- func (k Keeper) GetPriceWithNonceForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) (types.QuotePriceWithNonce, error)
- func (k Keeper) HasCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) bool
- func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)
- func (k Keeper) IterateCurrencyPairs(ctx sdk.Context, cb func(cp types.CurrencyPair, cps types.CurrencyPairState)) error
- func (k Keeper) NextCurrencyPairID(ctx sdk.Context) (uint64, error)
- func (k Keeper) RemoveCurrencyPair(ctx sdk.Context, cp types.CurrencyPair)
- func (k Keeper) SetPriceForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair, qp types.QuotePrice) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServer ¶
NewMsgServer returns the default implementation of the x/oracle message service
func NewQueryServer ¶
func NewQueryServer(k Keeper) types.QueryServer
NewQueryServer returns an implementation of the x/oracle QueryServer
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper is the base keeper for the x/oracle module
func NewKeeper ¶
func NewKeeper( ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.AccAddress, ) Keeper
NewKeeper constructs a new keeper from a store-key + authority account address
func (Keeper) CreateCurrencyPair ¶
CreateCurrencyPair creates a CurrencyPair in state, and sets its ID to the next available ID. If the CurrencyPair already exists, return an error. the nonce for the CurrencyPair is set to 0.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis, retrieve all CurrencyPairs + QuotePrices set for the module, and return them as a genesis state. This module panics on any errors encountered in execution.
func (Keeper) GetAllCurrencyPairs ¶
func (k Keeper) GetAllCurrencyPairs(ctx sdk.Context) []types.CurrencyPair
GetAllCurrencyPairs returns all CurrencyPairs that have currently been stored to state.
func (Keeper) GetCurrencyPairFromID ¶
GetCurrencyPairFromID returns the CurrencyPair for a given ID. If the ID does not exist, return an error and an empty CurrencyPair. Otherwise, return the currency pair and no error.
func (Keeper) GetIDForCurrencyPair ¶
GetIDForCurrencyPair returns the ID for a given CurrencyPair. If the CurrencyPair does not exist, return 0, false, if it does, return true and the ID.
func (Keeper) GetNonceForCurrencyPair ¶
GetNonceForCurrency Pair returns the nonce for a given CurrencyPair. If one has not been stored, return an error.
func (Keeper) GetPriceForCurrencyPair ¶
func (k Keeper) GetPriceForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) (types.QuotePrice, error)
GetPriceForCurrencyPair retrieves the QuotePrice for a given CurrencyPair. if a QuotePrice does not exist for the given CurrencyPair, this function errors and returns an empty QuotePrice
func (Keeper) GetPriceWithNonceForCurrencyPair ¶
func (k Keeper) GetPriceWithNonceForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair) (types.QuotePriceWithNonce, error)
GetPriceWithNonceForCurrencyPair returns a QuotePriceWithNonce for a given CurrencyPair. The nonce for the QuotePrice represents the number of times that a given QuotePrice has been updated. Notice: prefer GetPriceWithNonceForCurrencyPair over GetPriceForCurrencyPair.
func (Keeper) HasCurrencyPair ¶
HasCurrencyPair returns true if a given CurrencyPair is stored in state, false otherwise.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)
InitGenesis initializes the set of CurrencyPairs + their genesis prices (if any) for the x/oracle module. this function panics on any errors, i.e if the genesis state is invalid, or any state-modifications fail.
func (Keeper) IterateCurrencyPairs ¶
func (k Keeper) IterateCurrencyPairs(ctx sdk.Context, cb func(cp types.CurrencyPair, cps types.CurrencyPairState)) error
IterateCurrencyPairs iterates over all CurrencyPairs in the store, and executes a callback for each CurrencyPair.
func (Keeper) NextCurrencyPairID ¶
NextCurrencyPairID returns the next ID to be assigned to a currency-pair
func (Keeper) RemoveCurrencyPair ¶
func (k Keeper) RemoveCurrencyPair(ctx sdk.Context, cp types.CurrencyPair)
RemoveCurrencyPair removes a given CurrencyPair from state, i.e removes its nonce + QuotePrice from the module's store.
func (Keeper) SetPriceForCurrencyPair ¶
func (k Keeper) SetPriceForCurrencyPair(ctx sdk.Context, cp types.CurrencyPair, qp types.QuotePrice) error
SetPriceForCurrencyPair sets the given QuotePrice for a given CurrencyPair, and updates the CurrencyPair's nonce. Note, no validation is performed on either the CurrencyPair or the QuotePrice (it is expected the caller performs this validation). If the CurrencyPair does not exist, create the currency-pair and set its nonce to 0.