keeper

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServer

func NewMsgServer(k *Keeper) types.MsgServer

NewMsgServer returns the default implementation of the x/marketmap message service.

func NewQueryServer

func NewQueryServer(k *Keeper) types.QueryServer

NewQueryServer returns an implementation of the x/marketmap QueryServer.

Types

type Keeper

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

Keeper is the module's keeper implementation.

func NewKeeper

func NewKeeper(ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.AccAddress, opts ...Option) *Keeper

NewKeeper initializes the keeper and its backing stores.

func (*Keeper) CreateMarket

func (k *Keeper) CreateMarket(ctx sdk.Context, market types.Market) error

CreateMarket initializes a new Market. The Ticker.String corresponds to a market, and must be unique.

func (*Keeper) DeleteMarket

func (k *Keeper) DeleteMarket(ctx sdk.Context, tickerStr string) (bool, error)

DeleteMarket removes a Market. If the market does not exist, this is a no-op and nil is returned. If the market exists, all DeleteMarketValidationHooks are called on the market before deletion. Additionally, returns true if the market was deleted.

func (*Keeper) DisableMarket

func (k *Keeper) DisableMarket(ctx sdk.Context, tickerStr string) error

DisableMarket sets the Enabled field of a Market Ticker to false.

func (*Keeper) EnableMarket

func (k *Keeper) EnableMarket(ctx sdk.Context, tickerStr string) error

EnableMarket sets the Enabled field of a Market Ticker to true.

func (*Keeper) ExportGenesis

func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis retrieves the genesis from state.

func (*Keeper) GetAllMarkets

func (k *Keeper) GetAllMarkets(ctx sdk.Context) (map[string]types.Market, error)

GetAllMarkets returns the set of Market objects currently stored in state as a map[TickerString] -> Markets.

func (*Keeper) GetAllMarketsList

func (k *Keeper) GetAllMarketsList(ctx sdk.Context) ([]types.Market, error)

GetAllMarketsList returns the set of Market objects currently stored in state as a list.

func (*Keeper) GetLastUpdated

func (k *Keeper) GetLastUpdated(ctx sdk.Context) (uint64, error)

GetLastUpdated gets the last block-height the market map was updated.

func (*Keeper) GetMarket

func (k *Keeper) GetMarket(ctx sdk.Context, tickerStr string) (types.Market, error)

GetMarket returns a market from the store by its currency pair string ID.

func (*Keeper) GetParams

func (k *Keeper) GetParams(ctx sdk.Context) (types.Params, error)

GetParams returns the x/marketmap module's parameters.

func (*Keeper) HasMarket

func (k *Keeper) HasMarket(ctx sdk.Context, tickerStr string) (bool, error)

HasMarket checks if a market exists in the store.

func (*Keeper) Hooks

func (k *Keeper) Hooks() types.MarketMapHooks

Hooks gets the hooks for x/marketmap keeper.

func (*Keeper) InitGenesis

func (k *Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState)

InitGenesis initializes the genesis state. Panics if there is an error. Any modules that integrate with x/marketmap must set their InitGenesis to occur before the x/marketmap module's InitGenesis. This is so that logic any consuming modules may want to implement in AfterMarketGenesis will be run properly.

func (*Keeper) InitializeForGenesis

func (k *Keeper) InitializeForGenesis(_ sdk.Context)

InitializeForGenesis is a no-op.

func (*Keeper) IsMarketValid

func (k *Keeper) IsMarketValid(ctx sdk.Context, market types.Market) error

IsMarketValid checks if a market is valid by statefully checking if each of the currency pairs specified by its provider configs are valid and in state.

func (*Keeper) SetDeleteMarketValidationHooks

func (k *Keeper) SetDeleteMarketValidationHooks(hooks types.MarketValidationHooks)

SetDeleteMarketValidationHooks sets the MarketValidationHooks for deletion in the keeper.

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(mmh types.MarketMapHooks)

SetHooks sets the x/marketmap hooks. In contrast to other receivers, this method must take a pointer due to nature of the hooks interface and SDK start up sequence.

func (*Keeper) SetLastUpdated

func (k *Keeper) SetLastUpdated(ctx sdk.Context, height uint64) error

SetLastUpdated sets the lastUpdated field to the current block height.

func (*Keeper) SetParams

func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) error

SetParams sets the x/marketmap module's parameters.

func (*Keeper) UpdateMarket

func (k *Keeper) UpdateMarket(ctx sdk.Context, market types.Market) error

UpdateMarket updates a Market. The Ticker.String corresponds to a market, and exist unique.

func (*Keeper) ValidateState

func (k *Keeper) ValidateState(ctx sdk.Context, updates []types.Market) error

ValidateState is called after keeper modifications have been made to the market map to verify that the aggregate of all updates has led to a valid state.

type Option

type Option func(*Keeper)

Option is a type that modifies a keeper during instantiation. These can be passed variadically into NewKeeper to specify keeper behavior.

func WithDeleteValidationHooks

func WithDeleteValidationHooks(hooks []types.MarketValidationHook) Option

WithDeleteValidationHooks sets the keeper deleteMarketValidationHooks to the given hooks.

func WithHooks

func WithHooks(hooks types.MarketMapHooks) Option

WithHooks sets the keeper hooks to the given hooks.

Jump to

Keyboard shortcuts

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