Documentation ¶
Index ¶
- Variables
- func CreateRandomAccounts(numAccts int) []sdk.AccAddress
- func GenerateTestAddrs() (string, string)
- func TestMessageAuthzSerialization(t *testing.T, msg sdk.Msg)
- type KeeperTestHelper
- func (s *KeeperTestHelper) AllocateRewardsToValidator(valAddr sdk.ValAddress, rewardAmt sdk.Int)
- func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected string, numEventsExpected int)
- func (s *KeeperTestHelper) BeginNewBlock(executeNextEpoch bool)
- func (s *KeeperTestHelper) BeginNewBlockWithProposer(executeNextEpoch bool, proposer sdk.ValAddress)
- func (s *KeeperTestHelper) BuildTx(txBuilder client.TxBuilder, msgs []sdk.Msg, sigV2 signing.SignatureV2, ...) authsigning.Tx
- func (s *KeeperTestHelper) CalcAmoutOfTokenToGetTargetPrice(ctx sdk.Context, pool gammtypes.CFMMPoolI, targetSpotPrice sdk.Dec, ...) (amountTrade sdk.Dec)
- func (s *KeeperTestHelper) Commit()
- func (s *KeeperTestHelper) CreateTestContext() sdk.Context
- func (s *KeeperTestHelper) CreateTestContextWithMultiStore() (sdk.Context, sdk.CommitMultiStore)
- func (s *KeeperTestHelper) EndBlock()
- func (s *KeeperTestHelper) ExtractAttributes(event sdk.Event) map[string]string
- func (s *KeeperTestHelper) FindEvent(events []sdk.Event, name string) sdk.Event
- func (s *KeeperTestHelper) FundAcc(acc sdk.AccAddress, amounts sdk.Coins)
- func (s *KeeperTestHelper) FundModuleAcc(moduleName string, amounts sdk.Coins)
- func (s *KeeperTestHelper) LockTokens(addr sdk.AccAddress, coins sdk.Coins, duration time.Duration) (lockID uint64)
- func (s *KeeperTestHelper) MintCoins(coins sdk.Coins)
- func (s *KeeperTestHelper) ModifySpotPrice(poolID uint64, targetSpotPrice sdk.Dec, baseDenom string)
- func (s *KeeperTestHelper) PrepareBalancerPool() uint64
- func (s *KeeperTestHelper) PrepareBalancerPoolWithCoins(coins ...sdk.Coin) uint64
- func (s *KeeperTestHelper) PrepareBalancerPoolWithCoinsAndWeights(coins sdk.Coins, weights []int64) uint64
- func (s *KeeperTestHelper) PrepareBalancerPoolWithPoolParams(poolParams balancer.PoolParams) uint64
- func (s *KeeperTestHelper) PrepareBasicStableswapPool() uint64
- func (s *KeeperTestHelper) PrepareConcentratedPool() types.ConcentratedPoolExtension
- func (s *KeeperTestHelper) PrepareCustomBalancerPool(assets []balancer.PoolAsset, params balancer.PoolParams) uint64
- func (s *KeeperTestHelper) PrepareCustomBalancerPoolFromCoins(coins sdk.Coins, params balancer.PoolParams) uint64
- func (s *KeeperTestHelper) PrepareCustomConcentratedPool(owner sdk.AccAddress, denom0, denom1 string, tickSpacing uint64, ...) types.ConcentratedPoolExtension
- func (s *KeeperTestHelper) PrepareImbalancedStableswapPool() uint64
- func (s *KeeperTestHelper) PrepareMultipleBalancerPools(poolsToCreate uint16) []uint64
- func (s *KeeperTestHelper) PrepareMultipleConcentratedPools(poolsToCreate uint16) []uint64
- func (s *KeeperTestHelper) RunBasicExit(poolId uint64)
- func (s *KeeperTestHelper) RunBasicJoin(poolId uint64)
- func (s *KeeperTestHelper) RunBasicSwap(poolId uint64)
- func (s *KeeperTestHelper) RunMsg(msg sdk.Msg) (*sdk.Result, error)
- func (s *KeeperTestHelper) SetEpochStartTime()
- func (s *KeeperTestHelper) Setup()
- func (s *KeeperTestHelper) SetupGammPoolsWithBondDenomMultiplier(multipliers []sdk.Dec) []gammtypes.CFMMPoolI
- func (s *KeeperTestHelper) SetupMultipleValidators(numValidator int) []string
- func (s *KeeperTestHelper) SetupTestForInitGenesis()
- func (s *KeeperTestHelper) SetupValidator(bondStatus stakingtypes.BondStatus) sdk.ValAddress
- func (s *KeeperTestHelper) StateNotAltered()
- func (s *KeeperTestHelper) SuperfluidDelegateToDefaultVal(sender sdk.AccAddress, poolId uint64, lockId uint64) error
- func (s *KeeperTestHelper) SwapAndSetSpotPrice(poolId uint64, fromAsset sdk.Coin, toAsset sdk.Coin) sdk.Dec
Constants ¶
This section is empty.
Variables ¶
var ( ETH = "eth" USDC = "usdc" DefaultTickSpacing = uint64(1) DefaultExponentAtPriceOne = sdk.NewInt(-4) )
var ( SecondaryDenom = "uion" SecondaryAmount = sdk.NewInt(100000000) )
var DefaultAcctFunds sdk.Coins = sdk.NewCoins( sdk.NewCoin("umer", sdk.NewInt(10000000000)), sdk.NewCoin("foo", sdk.NewInt(10000000000)), sdk.NewCoin("bar", sdk.NewInt(10000000000)), sdk.NewCoin("baz", sdk.NewInt(10000000000)), )
var DefaultPoolAssets = []balancer.PoolAsset{ { Weight: sdk.NewInt(100), Token: sdk.NewCoin("foo", sdk.NewInt(5000000)), }, { Weight: sdk.NewInt(200), Token: sdk.NewCoin("bar", sdk.NewInt(5000000)), }, { Weight: sdk.NewInt(300), Token: sdk.NewCoin("baz", sdk.NewInt(5000000)), }, { Weight: sdk.NewInt(400), Token: sdk.NewCoin("umer", sdk.NewInt(5000000)), }, }
Functions ¶
func CreateRandomAccounts ¶
func CreateRandomAccounts(numAccts int) []sdk.AccAddress
CreateRandomAccounts is a function return a list of randomly generated AccAddresses
func GenerateTestAddrs ¶
Types ¶
type KeeperTestHelper ¶
type KeeperTestHelper struct { suite.Suite App *app.MerlinApp Ctx sdk.Context QueryHelper *baseapp.QueryServiceTestHelper TestAccs []sdk.AccAddress }
func (*KeeperTestHelper) AllocateRewardsToValidator ¶
func (s *KeeperTestHelper) AllocateRewardsToValidator(valAddr sdk.ValAddress, rewardAmt sdk.Int)
AllocateRewardsToValidator allocates reward tokens to a distribution module then allocates rewards to the validator address.
func (*KeeperTestHelper) AssertEventEmitted ¶
func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected string, numEventsExpected int)
AssertEventEmitted asserts that ctx's event manager has emitted the given number of events of the given type.
func (*KeeperTestHelper) BeginNewBlock ¶
func (s *KeeperTestHelper) BeginNewBlock(executeNextEpoch bool)
BeginNewBlock starts a new block.
func (*KeeperTestHelper) BeginNewBlockWithProposer ¶
func (s *KeeperTestHelper) BeginNewBlockWithProposer(executeNextEpoch bool, proposer sdk.ValAddress)
BeginNewBlockWithProposer begins a new block with a proposer.
func (*KeeperTestHelper) BuildTx ¶
func (s *KeeperTestHelper) BuildTx( txBuilder client.TxBuilder, msgs []sdk.Msg, sigV2 signing.SignatureV2, memo string, txFee sdk.Coins, gasLimit uint64, ) authsigning.Tx
BuildTx builds a transaction.
func (*KeeperTestHelper) CalcAmoutOfTokenToGetTargetPrice ¶
func (*KeeperTestHelper) Commit ¶
func (s *KeeperTestHelper) Commit()
CreateTestContext creates a test context.
func (*KeeperTestHelper) CreateTestContext ¶
func (s *KeeperTestHelper) CreateTestContext() sdk.Context
CreateTestContext creates a test context.
func (*KeeperTestHelper) CreateTestContextWithMultiStore ¶
func (s *KeeperTestHelper) CreateTestContextWithMultiStore() (sdk.Context, sdk.CommitMultiStore)
CreateTestContextWithMultiStore creates a test context and returns it together with multi store.
func (*KeeperTestHelper) EndBlock ¶
func (s *KeeperTestHelper) EndBlock()
EndBlock ends the block, and runs commit
func (*KeeperTestHelper) ExtractAttributes ¶
func (s *KeeperTestHelper) ExtractAttributes(event sdk.Event) map[string]string
func (*KeeperTestHelper) FundAcc ¶
func (s *KeeperTestHelper) FundAcc(acc sdk.AccAddress, amounts sdk.Coins)
FundAcc funds target address with specified amount.
func (*KeeperTestHelper) FundModuleAcc ¶
func (s *KeeperTestHelper) FundModuleAcc(moduleName string, amounts sdk.Coins)
FundModuleAcc funds target modules with specified amount.
func (*KeeperTestHelper) LockTokens ¶
func (s *KeeperTestHelper) LockTokens(addr sdk.AccAddress, coins sdk.Coins, duration time.Duration) (lockID uint64)
LockTokens funds an account, locks tokens and returns a lockID.
func (*KeeperTestHelper) MintCoins ¶
func (s *KeeperTestHelper) MintCoins(coins sdk.Coins)
func (*KeeperTestHelper) ModifySpotPrice ¶
func (s *KeeperTestHelper) ModifySpotPrice(poolID uint64, targetSpotPrice sdk.Dec, baseDenom string)
Modify spotprice of a pool to target spotprice
func (*KeeperTestHelper) PrepareBalancerPool ¶
func (s *KeeperTestHelper) PrepareBalancerPool() uint64
PrepareBalancerPool returns a Balancer pool's pool-ID with pool params set in PrepareBalancerPoolWithPoolParams.
func (*KeeperTestHelper) PrepareBalancerPoolWithCoins ¶
func (s *KeeperTestHelper) PrepareBalancerPoolWithCoins(coins ...sdk.Coin) uint64
PrepareBalancerPoolWithCoins returns a balancer pool consisted of given coins with equal weight.
func (*KeeperTestHelper) PrepareBalancerPoolWithCoinsAndWeights ¶
func (s *KeeperTestHelper) PrepareBalancerPoolWithCoinsAndWeights(coins sdk.Coins, weights []int64) uint64
PrepareBalancerPoolWithCoins returns a balancer pool PrepareBalancerPoolWithCoinsAndWeights returns a balancer pool consisted of given coins with the specified weights.
func (*KeeperTestHelper) PrepareBalancerPoolWithPoolParams ¶
func (s *KeeperTestHelper) PrepareBalancerPoolWithPoolParams(poolParams balancer.PoolParams) uint64
PrepareBalancerPoolWithPoolParams sets up a Balancer pool with poolParams. Uses default pool assets.
func (*KeeperTestHelper) PrepareBasicStableswapPool ¶
func (s *KeeperTestHelper) PrepareBasicStableswapPool() uint64
func (*KeeperTestHelper) PrepareConcentratedPool ¶
func (s *KeeperTestHelper) PrepareConcentratedPool() types.ConcentratedPoolExtension
PrepareConcentratedPool sets up an eth usdc concentrated liquidity pool with pool ID 1, tick spacing of 1, no liquidity and zero swap fee.
func (*KeeperTestHelper) PrepareCustomBalancerPool ¶
func (s *KeeperTestHelper) PrepareCustomBalancerPool(assets []balancer.PoolAsset, params balancer.PoolParams) uint64
PrepareCustomBalancerPool sets up a Balancer pool with an array of assets and given parameters
func (*KeeperTestHelper) PrepareCustomBalancerPoolFromCoins ¶
func (s *KeeperTestHelper) PrepareCustomBalancerPoolFromCoins(coins sdk.Coins, params balancer.PoolParams) uint64
PrepareCustomBalancerPoolFromCoins sets up a Balancer pool with an array of coins and given parameters The coins are converted to pool assets where each asset has a weight of 1.
func (*KeeperTestHelper) PrepareCustomConcentratedPool ¶
func (s *KeeperTestHelper) PrepareCustomConcentratedPool(owner sdk.AccAddress, denom0, denom1 string, tickSpacing uint64, exponentAtPriceOne sdk.Int, swapFee sdk.Dec) types.ConcentratedPoolExtension
PrepareCustomConcentratedPool sets up a concentrated liquidity pool with the custom parameters.
func (*KeeperTestHelper) PrepareImbalancedStableswapPool ¶
func (s *KeeperTestHelper) PrepareImbalancedStableswapPool() uint64
func (*KeeperTestHelper) PrepareMultipleBalancerPools ¶
func (s *KeeperTestHelper) PrepareMultipleBalancerPools(poolsToCreate uint16) []uint64
PrepareMultipleBalancerPools returns X Balancer pool's with X being provided by the user.
func (*KeeperTestHelper) PrepareMultipleConcentratedPools ¶
func (s *KeeperTestHelper) PrepareMultipleConcentratedPools(poolsToCreate uint16) []uint64
PrepareMultipleConcentratedPools returns X cl pool's with X being provided by the user.
func (*KeeperTestHelper) RunBasicExit ¶
func (s *KeeperTestHelper) RunBasicExit(poolId uint64)
func (*KeeperTestHelper) RunBasicJoin ¶
func (s *KeeperTestHelper) RunBasicJoin(poolId uint64)
func (*KeeperTestHelper) RunBasicSwap ¶
func (s *KeeperTestHelper) RunBasicSwap(poolId uint64)
func (*KeeperTestHelper) SetEpochStartTime ¶
func (s *KeeperTestHelper) SetEpochStartTime()
func (*KeeperTestHelper) Setup ¶
func (s *KeeperTestHelper) Setup()
Setup sets up basic environment for suite (App, Ctx, and test accounts)
func (*KeeperTestHelper) SetupGammPoolsWithBondDenomMultiplier ¶
func (s *KeeperTestHelper) SetupGammPoolsWithBondDenomMultiplier(multipliers []sdk.Dec) []gammtypes.CFMMPoolI
SetupGammPoolsWithBondDenomMultiplier uses given multipliers to set initial pool supply of bond denom.
func (*KeeperTestHelper) SetupMultipleValidators ¶
func (s *KeeperTestHelper) SetupMultipleValidators(numValidator int) []string
SetupMultipleValidators setups "numValidator" validators and returns their address in string
func (*KeeperTestHelper) SetupTestForInitGenesis ¶
func (s *KeeperTestHelper) SetupTestForInitGenesis()
func (*KeeperTestHelper) SetupValidator ¶
func (s *KeeperTestHelper) SetupValidator(bondStatus stakingtypes.BondStatus) sdk.ValAddress
SetupValidator sets up a validator and returns the ValAddress.
func (*KeeperTestHelper) StateNotAltered ¶
func (s *KeeperTestHelper) StateNotAltered()
StateNotAltered validates that app state is not altered. Fails if it is.
func (*KeeperTestHelper) SuperfluidDelegateToDefaultVal ¶
func (s *KeeperTestHelper) SuperfluidDelegateToDefaultVal(sender sdk.AccAddress, poolId uint64, lockId uint64) error
func (*KeeperTestHelper) SwapAndSetSpotPrice ¶
func (s *KeeperTestHelper) SwapAndSetSpotPrice(poolId uint64, fromAsset sdk.Coin, toAsset sdk.Coin) sdk.Dec
SwapAndSetSpotPrice runs a swap to set Spot price of a pool using arbitrary values returns spot price after the arbitrary swap.