keeper

package
v0.0.0-...-6577280 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the pricefeed MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries

func NewQueryServerImpl

func NewQueryServerImpl(k Keeper) types.QueryServer

NewQueryServerImpl creates a new server for handling gRPC queries.

Types

type Keeper

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

Keeper struct for pricefeed module

func NewKeeper

func NewKeeper(
	cdc codec.Codec, key storetypes.StoreKey, paramstore paramtypes.Subspace,
) Keeper

NewKeeper returns a new keeper for the pricefeed module.

func (Keeper) CalculateMedianPrice

func (k Keeper) CalculateMedianPrice(prices []types.CurrentPrice) sdk.Dec

CalculateMedianPrice calculates the median prices for the input prices.

func (Keeper) GetAuthorizedAddresses

func (k Keeper) GetAuthorizedAddresses(ctx sdk.Context) []sdk.AccAddress

GetAuthorizedAddresses returns a list of addresses that have special authorization within this module, eg the oracles of all markets.

func (Keeper) GetCurrentPrice

func (k Keeper) GetCurrentPrice(ctx sdk.Context, marketID string) (types.CurrentPrice, error)

GetCurrentPrice fetches the current median price of all oracles for a specific market

func (Keeper) GetCurrentPrices

func (k Keeper) GetCurrentPrices(ctx sdk.Context) types.CurrentPrices

GetCurrentPrices returns all current price objects from the store

func (Keeper) GetMarket

func (k Keeper) GetMarket(ctx sdk.Context, marketID string) (types.Market, bool)

GetMarket returns the market if it is in the pricefeed system

func (Keeper) GetMarkets

func (k Keeper) GetMarkets(ctx sdk.Context) types.Markets

GetMarkets returns the markets from params

func (Keeper) GetOracle

func (k Keeper) GetOracle(ctx sdk.Context, marketID string, address sdk.AccAddress) (sdk.AccAddress, error)

GetOracle returns the oracle from the store or an error if not found

func (Keeper) GetOracles

func (k Keeper) GetOracles(ctx sdk.Context, marketID string) ([]sdk.AccAddress, error)

GetOracles returns the oracles in the pricefeed store

func (Keeper) GetParams

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

GetParams returns the params from the store

func (Keeper) GetRawPrices

func (k Keeper) GetRawPrices(ctx sdk.Context, marketId string) types.PostedPrices

GetRawPrices fetches the set of all prices posted by oracles for an asset

func (Keeper) IterateCurrentPrices

func (k Keeper) IterateCurrentPrices(ctx sdk.Context, cb func(cp types.CurrentPrice) (stop bool))

IterateCurrentPrices iterates over all current price objects in the store and performs a callback function

func (Keeper) IterateRawPricesByMarket

func (k Keeper) IterateRawPricesByMarket(ctx sdk.Context, marketId string, cb func(record types.PostedPrice) (stop bool))

IterateRawPrices iterates over all raw prices in the store and performs a callback function

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) SetCurrentPrices

func (k Keeper) SetCurrentPrices(ctx sdk.Context, marketID string) error

SetCurrentPrices updates the price of an asset to the median of all valid oracle inputs

func (Keeper) SetParams

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

SetParams sets params on the store

func (Keeper) SetPrice

func (k Keeper) SetPrice(
	ctx sdk.Context,
	oracle sdk.AccAddress,
	marketID string,
	price sdk.Dec,
	expiry time.Time,
) (types.PostedPrice, error)

SetPrice updates the posted price for a specific oracle

Jump to

Keyboard shortcuts

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