keeper

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Addrs = createTestAddrs(500)
)

Functions

func Abs

func Abs(x sdk.Int) sdk.Int

Returns integer abs

func MakeTestCodec

func MakeTestCodec() *codec.Codec

create a codec used only for testing

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier creates a new querier for coin clients.

func TestAddr

func TestAddr(addr string, bech string) sdk.AccAddress

for incode address generation

Types

type Keeper

type Keeper struct {
	AccountKeeper auth.AccountKeeper
	BankKeeper    bank.Keeper
	SupplyKeeper  supply.Keeper
	Config        *config.Config
	// contains filtered or unexported fields
}

Keeper of the coin store

func CreateTestInput

func CreateTestInput(t *testing.T, isCheckTx bool) (sdk.Context, Keeper, auth.AccountKeeper)

Hogpodge of all sorts of input required for testing. `initPower` is converted to an amount of tokens. If `initPower` is 0, no addrs get created.

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramspace types.ParamSubspace, accountKeeper auth.AccountKeeper, coinKeeper bank.Keeper, supplyKeeper supply.Keeper, config *config.Config) Keeper

NewKeeper creates a coin keeper

func (*Keeper) ClearCoinCache

func (k *Keeper) ClearCoinCache()

func (Keeper) GetAllCoins

func (k Keeper) GetAllCoins(ctx sdk.Context) []types.Coin

func (Keeper) GetBaseCoin

func (k Keeper) GetBaseCoin(ctx sdk.Context) string

func (Keeper) GetCoin

func (k Keeper) GetCoin(ctx sdk.Context, symbol string) (types.Coin, error)

GetCoin returns types.Coin instance if exists in KVStore

func (Keeper) GetCoinCache

func (k Keeper) GetCoinCache(symbol string) bool

func (Keeper) GetCoinsIterator

func (k Keeper) GetCoinsIterator(ctx sdk.Context) sdk.Iterator

GetCoinsIterator gets an iterator over all Coins in which the keys are the symbols and the values are the coins

func (Keeper) GetCommission

func (k Keeper) GetCommission(ctx sdk.Context, commissionInBaseCoin sdk.Int) (sdk.Int, string, error)

func (Keeper) IsCheckRedeemed

func (k Keeper) IsCheckRedeemed(ctx sdk.Context, check *types.Check) bool

func (Keeper) IsCoinBase

func (k Keeper) IsCoinBase(symbol string) bool

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (*Keeper) SetCachedCoin

func (k *Keeper) SetCachedCoin(ctx sdk.Context, coin string)

func (Keeper) SetCheckRedeemed

func (k Keeper) SetCheckRedeemed(ctx sdk.Context, check *types.Check)

func (Keeper) SetCoin

func (k Keeper) SetCoin(ctx sdk.Context, coin types.Coin)

func (Keeper) UpdateBalance

func (k Keeper) UpdateBalance(ctx sdk.Context, coinSymbol string, amount sdk.Int, address sdk.AccAddress) error

Updating balances

func (Keeper) UpdateCoin

func (k Keeper) UpdateCoin(ctx sdk.Context, coin types.Coin, reserve sdk.Int, volume sdk.Int)

Jump to

Keyboard shortcuts

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