keeper

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestPrice = types.Price{
	AssetName: "test",
	Value:     sdk.NewDec(10),
	Expiry:    sdk.NewInt(5000),
}

Test variables

Functions

func NewHandler added in v1.3.2

func NewHandler(keeper Keeper, govKeeper government.Keeper) sdk.Handler

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

Types

type Keeper

type Keeper struct {
	StoreKey sdk.StoreKey
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey) Keeper

func SetupTestInput

func SetupTestInput() (*codec.Codec, sdk.Context, government.Keeper, Keeper)

This function create an environment to test modules

func (Keeper) AddAsset

func (keeper Keeper) AddAsset(ctx sdk.Context, assetName string)

AddAsset add a new priced asset to the assets list

func (Keeper) AddOracle

func (keeper Keeper) AddOracle(ctx sdk.Context, oracle sdk.AccAddress)

AddOracle adds an Oracle to the store

func (Keeper) AddRawPrice added in v1.3.2

func (keeper Keeper) AddRawPrice(ctx sdk.Context, oracle sdk.AccAddress, price types.Price) sdk.Error

AddRawPrice sets the raw price for a given token after checking the validity of the signer. If the signer hasn't the rights to set the price, then function returns error.

func (Keeper) ComputeAndUpdateCurrentPrices added in v1.3.0

func (keeper Keeper) ComputeAndUpdateCurrentPrices(ctx sdk.Context) error

func (Keeper) GetAssets

func (keeper Keeper) GetAssets(ctx sdk.Context) (assets ctypes.Strings)

GetAssets retrieves all the assets

func (Keeper) GetCurrentPrice

func (keeper Keeper) GetCurrentPrice(ctx sdk.Context, asset string) (currentPrice types.Price, found bool)

GetCurrentPrice retrieves the current price for the given asset

func (Keeper) GetCurrentPrices

func (keeper Keeper) GetCurrentPrices(ctx sdk.Context) types.Prices

GetCurrentPrices retrieves all the current prices

func (Keeper) GetOracles

func (keeper Keeper) GetOracles(ctx sdk.Context) (oracles ctypes.Addresses)

GetOracles returns the list of all the currently present oracles

func (Keeper) GetRawPrices

func (keeper Keeper) GetRawPrices(ctx sdk.Context) types.RawPrices

GetRawPrices returns the list of the whole raw prices currently stored

func (Keeper) GetRawPricesForAsset added in v1.3.2

func (keeper Keeper) GetRawPricesForAsset(ctx sdk.Context, assetName string) types.RawPrices

GetRawPricesForAsset retrieves all the raw prices of the given asset

func (Keeper) IsOracle

func (keeper Keeper) IsOracle(ctx sdk.Context, address sdk.Address) bool

IsOracle returns true iif the given address is a valid oracle

func (Keeper) SetCurrentPrice added in v1.3.0

func (keeper Keeper) SetCurrentPrice(ctx sdk.Context, currentPrice types.Price)

SetCurrentPrice allows to set the current price of a specific asset. WARNING: This method should be used for testing purposes only

Jump to

Keyboard shortcuts

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