keeper

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

nolint:deadcode unused noalias

Index

Constants

This section is empty.

Variables

View Source
var (
	PubKeys = []crypto.PubKey{
		secp256k1.GenPrivKey().PubKey(),
		secp256k1.GenPrivKey().PubKey(),
		secp256k1.GenPrivKey().PubKey(),
	}

	Addrs = []sdk.AccAddress{
		sdk.AccAddress(PubKeys[0].Address()),
		sdk.AccAddress(PubKeys[1].Address()),
		sdk.AccAddress(PubKeys[2].Address()),
	}

	ValAddrs = []sdk.ValAddress{
		sdk.ValAddress(PubKeys[0].Address()),
		sdk.ValAddress(PubKeys[1].Address()),
		sdk.ValAddress(PubKeys[2].Address()),
	}

	InitTokens = sdk.TokensFromConsensusPower(200)
	InitCoins  = sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens))
)

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for market module

Types

type Keeper

type Keeper struct {
	SupplyKeeper types.SupplyKeeper
	// contains filtered or unexported fields
}

Keeper of the oracle store

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey,
	paramspace params.Subspace, oracleKeeper types.OracleKeeper,
	supplyKeeper types.SupplyKeeper, codespace sdk.CodespaceType) Keeper

NewKeeper constructs a new keeper for oracle

func (Keeper) ApplySwapToPool

func (k Keeper) ApplySwapToPool(ctx sdk.Context, offerCoin sdk.Coin, askCoin sdk.DecCoin) sdk.Error

ApplySwapToPool updates each pool with offerCoin and askCoin taken from swap operation, OfferPool = OfferPool + offerAmt (Fills the swap pool with offerAmt) AskPool = AskPool - askAmt (Uses askAmt from the swap pool)

func (Keeper) BasePool

func (k Keeper) BasePool(ctx sdk.Context) (res sdk.Dec)

BasePool is Terra liquidity pool(usdr unit) which will be made available per PoolRecoveryPeriod

func (Keeper) Codespace

func (k Keeper) Codespace() sdk.CodespaceType

Codespace returns a codespace of keeper

func (Keeper) ComputeInternalSwap

func (k Keeper) ComputeInternalSwap(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, sdk.Error)

ComputeInternalSwap returns the amount of asked DecCoin should be returned for a given offerCoin at the effective exchange rate registered with the oracle. Different from ComputeSwap, ComputeInternalSwap does not charge a spread as its use is system internal.

func (Keeper) ComputeSwap

func (k Keeper) ComputeSwap(ctx sdk.Context, offerCoin sdk.Coin, askDenom string) (retDecCoin sdk.DecCoin, spread sdk.Dec, err sdk.Error)

ComputeSwap returns the amount of asked coins should be returned for a given offerCoin at the effective exchange rate registered with the oracle. Returns an Error if the swap is recursive, or the coins to be traded are unknown by the oracle, or the amount to trade is too small.

func (Keeper) GetParams

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

GetParams returns the total set of market parameters.

func (Keeper) GetTerraPoolDelta

func (k Keeper) GetTerraPoolDelta(ctx sdk.Context) (delta sdk.Dec)

GetTerraPoolDelta returns the gap between the TerraPool and the BasePool

func (Keeper) IlliquidTobinTaxList

func (k Keeper) IlliquidTobinTaxList(ctx sdk.Context) (res types.TobinTaxList)

IlliquidTobinTaxList is the exceptions that have to pay a higher tobin tax due to illiquidity TobinTax will be used for the denoms which are not in the list

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MinSpread

func (k Keeper) MinSpread(ctx sdk.Context) (res sdk.Dec)

MinSpread is the minimum swap fee(spread)

func (Keeper) PoolRecoveryPeriod

func (k Keeper) PoolRecoveryPeriod(ctx sdk.Context) (res int64)

PoolRecoveryPeriod is the period required to recover Terra&Luna Pools to the BasePool

func (Keeper) ReplenishPools

func (k Keeper) ReplenishPools(ctx sdk.Context)

ReplenishPools replenishes each pool(Terra,Luna) to BasePool

func (Keeper) SetParams

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

SetParams sets the total set of market parameters.

func (Keeper) SetTerraPoolDelta

func (k Keeper) SetTerraPoolDelta(ctx sdk.Context, delta sdk.Dec)

SetTerraPoolDelta updates TerraPoolDelta which is gap between the TerraPool and the BasePool

func (Keeper) TobinTax

func (k Keeper) TobinTax(ctx sdk.Context) (res sdk.Dec)

TobinTax is a tax rate on all spot conversions of one Terra into another Terra

type TestInput

type TestInput struct {
	Ctx          sdk.Context
	Cdc          *codec.Codec
	OracleKeeper oracle.Keeper
	SupplyKeeper supply.Keeper
	MarketKeeper Keeper
}

TestInput nolint

func CreateTestInput

func CreateTestInput(t *testing.T) TestInput

CreateTestInput nolint

Jump to

Keyboard shortcuts

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