keeper

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: Apache-2.0 Imports: 14 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 MsgServer interface for the provided Keeper.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,

) Keeper

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, token0 string, token1 string,
) (currPrice types.CurrentPrice, err 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) GetCurrentTWAPPrice

func (k Keeper) GetCurrentTWAPPrice(ctx sdk.Context, token0 string, token1 string) (currPrice types.CurrentTWAP, err error)

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

func (Keeper) GetOracle

func (k Keeper) GetOracle(
	ctx sdk.Context, pairID 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, pairID string) ([]sdk.AccAddress, error)

GetOracles returns the oracles in the pricefeed store

func (Keeper) GetPair

func (k Keeper) GetPair(ctx sdk.Context, pairID string) (types.Pair, bool)

GetPair returns the market if it is in the pricefeed system

func (Keeper) GetPairs

func (k Keeper) GetPairs(ctx sdk.Context) types.Pairs

GetPairs returns the markets from params

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

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) IterateRawPricesByPair

func (k Keeper) IterateRawPricesByPair(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

func (Keeper) Oracles

func (Keeper) Pairs

func (Keeper) Params

func (Keeper) Price

func (Keeper) Prices

func (Keeper) RawPrices

func (Keeper) SetCurrentPrices

func (k Keeper) SetCurrentPrices(ctx sdk.Context, token0 string, token1 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 set the params

func (Keeper) SetPrice

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

SetPrice updates the posted price for a specific oracle

func (Keeper) WhitelistOracles added in v0.1.0

func (k Keeper) WhitelistOracles(ctx sdk.Context, oracles []sdk.AccAddress)

Whitelists given 'oracles' for all of the current pairs.

Jump to

Keyboard shortcuts

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