Documentation ¶
Index ¶
- Variables
- func FundAccount(input TestInput, addr sdk.AccAddress, amounts sdk.Coins) error
- func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig
- func MakeTestCodec(t *testing.T) codec.Codec
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) types.QueryServer
- type Keeper
- func (k Keeper) ApplySwapToPool(ctx sdk.Context, offerCoin sdk.Coin, askCoin sdk.DecCoin) error
- func (k Keeper) BasePool(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) ComputeInternalSwap(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, error)
- func (k Keeper) ComputeSwap(ctx sdk.Context, offerCoin sdk.Coin, askDenom string) (retDecCoin sdk.DecCoin, spread sdk.Dec, err error)
- func (k Keeper) GetMarketAccount(ctx sdk.Context) authtypes.ModuleAccountI
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetTerraPoolDelta(ctx sdk.Context) sdk.Dec
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MinStabilitySpread(ctx sdk.Context) (res sdk.Dec)
- func (k Keeper) PoolRecoveryPeriod(ctx sdk.Context) (res uint64)
- func (k Keeper) ReplenishPools(ctx sdk.Context)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetTerraPoolDelta(ctx sdk.Context, delta sdk.Dec)
- type TestInput
Constants ¶
This section is empty.
Variables ¶
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, sdk.DefaultPowerReduction) InitCoins = sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens)) )
Test Account
var ModuleBasics = module.NewBasicManager( customauth.AppModuleBasic{}, custombank.AppModuleBasic{}, customstaking.AppModuleBasic{}, customdistr.AppModuleBasic{}, customparams.AppModuleBasic{}, oracle.AppModuleBasic{}, )
Functions ¶
func FundAccount ¶
FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!
func MakeEncodingConfig ¶
func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig
MakeEncodingConfig
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the market MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(keeper Keeper) types.QueryServer
NewQuerier returns an implementation of the market QueryServer interface for the provided Keeper.
Types ¶
type Keeper ¶
type Keeper struct { AccountKeeper types.AccountKeeper BankKeeper types.BankKeeper OracleKeeper types.OracleKeeper // contains filtered or unexported fields }
Keeper of the market store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramstore paramstypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, oracleKeeper types.OracleKeeper, ) Keeper
NewKeeper constructs a new keeper for oracle
func (Keeper) ApplySwapToPool ¶
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 ¶
BasePool is liquidity pool(usdr unit) which will be made available per PoolRecoveryPeriod
func (Keeper) ComputeInternalSwap ¶
func (k Keeper) ComputeInternalSwap(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, 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 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) GetMarketAccount ¶
func (k Keeper) GetMarketAccount(ctx sdk.Context) authtypes.ModuleAccountI
GetMarketAccount returns market ModuleAccount
func (Keeper) GetTerraPoolDelta ¶
GetTerraPoolDelta returns the gap between the TerraPool and the TerraBasePool
func (Keeper) MinStabilitySpread ¶
MinStabilitySpread is the minimum spread applied to swaps to / from Luna. Intended to prevent swing trades exploiting oracle period delays
func (Keeper) PoolRecoveryPeriod ¶
PoolRecoveryPeriod is the period required to recover Terra&Luna Pools to the MintBasePool & BurnBasePool
func (Keeper) ReplenishPools ¶
ReplenishPools replenishes each pool(Terra,Luna) to BasePool
type TestInput ¶
type TestInput struct { Ctx sdk.Context Cdc *codec.LegacyAmino AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper OracleKeeper types.OracleKeeper MarketKeeper Keeper }