Documentation
¶
Index ¶
- Variables
- func AddRandomTestAddr(app *LiquidityApp, ctx sdk.Context, initCoins sdk.Coins) sdk.AccAddress
- func AddTestAddrs(app *LiquidityApp, ctx sdk.Context, accNum int, initCoins sdk.Coins) []sdk.AccAddress
- func AddTestAddrsIncremental(app *LiquidityApp, ctx sdk.Context, accNum int, accAmt mathsdk.Int) []sdk.AccAddress
- func BlockedAddresses() map[string]bool
- func FundAccount(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error
- func GetMaccPerms() map[string][]string
- func GetRandPoolAmt(r *rand.Rand, minInitDepositAmt mathsdk.Int) (x, y mathsdk.Int)
- func GetRandRange(r *rand.Rand, min, max int) mathsdk.Int
- func GetRandomOrders(denomX, denomY string, x, y mathsdk.Int, r *rand.Rand, sizeXToY, sizeYToX int) (xToY, yToX []*types.MsgSwapWithinBatch)
- func GetRandomSizeOrders(denomX, denomY string, x, y mathsdk.Int, r *rand.Rand, ...) (xToY, yToX []*types.MsgSwapWithinBatch)
- func GetSwapMsg(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, offerCoins []sdk.Coin, ...) []*types.MsgSwapWithinBatch
- func MakeEncodingConfig() params.EncodingConfig
- func NewTestNetworkFixture() network.TestFixture
- func SaveAccount(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, initCoins sdk.Coins)
- func SaveAccountWithFee(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, initCoins sdk.Coins, ...)
- func TestAddr(addr string, bech string) (sdk.AccAddress, error)
- func TestCreatePool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, x, y mathsdk.Int, ...) uint64
- func TestDepositPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, x, y mathsdk.Int, ...)
- func TestSwapPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, offerCoins []sdk.Coin, ...) ([]*types.SwapMsgState, types.PoolBatch)
- func TestWithdrawPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, poolCoinAmt mathsdk.Int, ...)
- type EmptyAppOptions
- type GenerateAccountStrategy
- type GenesisState
- type LiquidityApp
- func CreateTestInput(t *testing.T) (*LiquidityApp, sdk.Context)
- func NewLiquidityApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, ...) *LiquidityApp
- func NewLiquidityAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *LiquidityApp
- func Setup(t *testing.T, isCheckTx bool) *LiquidityApp
- func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) *LiquidityApp
- func (app *LiquidityApp) AppCodec() codec.Codec
- func (app *LiquidityApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
- func (a *LiquidityApp) Configurator() module.Configurator
- func (a *LiquidityApp) DefaultGenesis() map[string]json.RawMessage
- func (app *LiquidityApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error)
- func (app *LiquidityApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)
- func (app *LiquidityApp) GetKey(storeKey string) *storetypes.KVStoreKey
- func (app *LiquidityApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
- func (app *LiquidityApp) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *LiquidityApp) GetTKey(storeKey string) *storetypes.TransientStoreKey
- func (app *LiquidityApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
- func (app *LiquidityApp) InterfaceRegistry() types.InterfaceRegistry
- func (app *LiquidityApp) LegacyAmino() *codec.LegacyAmino
- func (app *LiquidityApp) LoadHeight(height int64) error
- func (app *LiquidityApp) Name() string
- func (app *LiquidityApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *LiquidityApp) RegisterNodeService(clientCtx client.Context, config config.Config)
- func (app *LiquidityApp) RegisterTendermintService(clientCtx client.Context)
- func (app *LiquidityApp) RegisterTxService(clientCtx client.Context)
- func (app *LiquidityApp) SimulationManager() *module.SimulationManager
- func (app *LiquidityApp) TxConfig() client.TxConfig
- type SetupOptions
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string // ModuleBasics defines the module BasicManager is in charge of setting up basic, // non-dependant module elements, such as codec registration // and genesis verification. ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( []govclient.ProposalHandler{ paramsclient.ProposalHandler, }, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, authzmodule.AppModuleBasic{}, groupmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, nftmodule.AppModuleBasic{}, consensus.AppModuleBasic{}, liquidity.AppModuleBasic{}, ) )
var DefaultConsensusParams = tmtypes.ConsensusParams{ Block: tmtypes.BlockParams{ MaxBytes: 200000, MaxGas: 2000000, }, Evidence: tmtypes.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, }, Validator: tmtypes.ValidatorParams{ PubKeyTypes: []string{ tmtypes.ABCIPubKeyTypeEd25519, }, }, }
DefaultConsensusParams defines the default Tendermint consensus params used in LiquidityApp testing.
Functions ¶
func AddRandomTestAddr ¶
func AddRandomTestAddr(app *LiquidityApp, ctx sdk.Context, initCoins sdk.Coins) sdk.AccAddress
AddRandomTestAddr creates new account with random address.
func AddTestAddrs ¶
func AddTestAddrs(app *LiquidityApp, ctx sdk.Context, accNum int, initCoins sdk.Coins) []sdk.AccAddress
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func AddTestAddrsIncremental ¶
func AddTestAddrsIncremental(app *LiquidityApp, ctx sdk.Context, accNum int, accAmt mathsdk.Int) []sdk.AccAddress
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
func BlockedAddresses ¶
BlockedAddresses returns all the app's blocked account addresses.
func FundAccount ¶
func FundAccount(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error
permission of minting, create a "faucet" account. (@fdymylja)
func GetMaccPerms ¶
GetMaccPerms returns a copy of the module account permissions
NOTE: This is solely to be used for testing purposes.
func GetRandPoolAmt ¶
func GetRandomOrders ¶
func GetRandomSizeOrders ¶
func GetSwapMsg ¶
func GetSwapMsg(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, offerCoins []sdk.Coin, orderPrices []mathsdk.LegacyDec, addrs []sdk.AccAddress, poolID uint64) []*types.MsgSwapWithinBatch
func MakeEncodingConfig ¶
func MakeEncodingConfig() params.EncodingConfig
MakeEncodingConfig creates an EncodingConfig for testing
func NewTestNetworkFixture ¶
func NewTestNetworkFixture() network.TestFixture
NewTestNetworkFixture returns a new simapp AppConstructor for network simulation tests
func SaveAccount ¶
func SaveAccount(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, initCoins sdk.Coins)
SaveAccount saves the provided account into the simapp with balance based on initCoins.
func SaveAccountWithFee ¶
func SaveAccountWithFee(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, initCoins sdk.Coins, offerCoin sdk.Coin)
func TestCreatePool ¶
func TestDepositPool ¶
func TestSwapPool ¶
func TestWithdrawPool ¶
Types ¶
type EmptyAppOptions ¶
type EmptyAppOptions struct{}
EmptyAppOptions is a stub implementing AppOptions
func (EmptyAppOptions) Get ¶
func (ao EmptyAppOptions) Get(o string) interface{}
Get implements AppOptions
type GenerateAccountStrategy ¶
type GenerateAccountStrategy func(int) []sdk.AccAddress
type GenesisState ¶
type GenesisState map[string]json.RawMessage
The genesis state of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.
func NewDefaultGenesisState ¶
func NewDefaultGenesisState() GenesisState
NewDefaultGenesisState generates the default state for the application.
type LiquidityApp ¶
type LiquidityApp struct { *baseapp.BaseApp // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper StakingKeeper *stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper GovKeeper govkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper AuthzKeeper authzkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper LiquidityKeeper liquiditykeeper.Keeper // the module manager ModuleManager *module.Manager // contains filtered or unexported fields }
LiquidityApp extends an ABCI application, but with most of its parameters exported. They are exported for convenience in creating helper functions, as object capabilities aren't needed for testing.
func CreateTestInput ¶
func CreateTestInput(t *testing.T) (*LiquidityApp, sdk.Context)
CreateTestInput returns a simapp with custom LiquidityKeeper to avoid messing with the hooks.
func NewLiquidityApp ¶
func NewLiquidityApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *LiquidityApp
NewSimApp returns a reference to an initialized SimApp.
func NewLiquidityAppWithCustomOptions ¶
func NewLiquidityAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *LiquidityApp
NewSimappWithCustomOptions initializes a new SimApp with custom options.
func Setup ¶
func Setup(t *testing.T, isCheckTx bool) *LiquidityApp
Setup initializes a new SimApp. A Nop logger is set in SimApp.
func SetupWithGenesisValSet ¶
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *LiquidityApp
SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts that also act as delegators. For simplicity, each validator is bonded with a delegation of one consensus engine unit in the default token of the simapp from first genesis account. A Nop logger is set in SimApp.
func (*LiquidityApp) AppCodec ¶
func (app *LiquidityApp) AppCodec() codec.Codec
AppCodec returns LiquidityApp's app codec.
NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.
func (*LiquidityApp) BeginBlocker ¶
func (app *LiquidityApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
BeginBlocker application updates every begin block
func (*LiquidityApp) Configurator ¶
func (a *LiquidityApp) Configurator() module.Configurator
func (*LiquidityApp) DefaultGenesis ¶
func (a *LiquidityApp) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis returns a default genesis from the registered AppModuleBasic's.
func (*LiquidityApp) EndBlocker ¶
EndBlocker application updates every end block
func (*LiquidityApp) ExportAppStateAndValidators ¶
func (app *LiquidityApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, ) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*LiquidityApp) GetKey ¶
func (app *LiquidityApp) GetKey(storeKey string) *storetypes.KVStoreKey
GetKey returns the KVStoreKey for the provided store key.
NOTE: This is solely to be used for testing purposes.
func (*LiquidityApp) GetMemKey ¶
func (app *LiquidityApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
GetMemKey returns the MemStoreKey for the provided mem key.
NOTE: This is solely used for testing purposes.
func (*LiquidityApp) GetSubspace ¶
func (app *LiquidityApp) GetSubspace(moduleName string) paramstypes.Subspace
GetSubspace returns a param subspace for a given module name.
NOTE: This is solely to be used for testing purposes.
func (*LiquidityApp) GetTKey ¶
func (app *LiquidityApp) GetTKey(storeKey string) *storetypes.TransientStoreKey
GetTKey returns the TransientStoreKey for the provided store key.
NOTE: This is solely to be used for testing purposes.
func (*LiquidityApp) InitChainer ¶
func (app *LiquidityApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
InitChainer application update at chain initialization
func (*LiquidityApp) InterfaceRegistry ¶
func (app *LiquidityApp) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns SimApp's InterfaceRegistry
func (*LiquidityApp) LegacyAmino ¶
func (app *LiquidityApp) LegacyAmino() *codec.LegacyAmino
LegacyAmino returns LiquidityApp's amino codec.
NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.
func (*LiquidityApp) LoadHeight ¶
func (app *LiquidityApp) LoadHeight(height int64) error
LoadHeight loads a particular height
func (*LiquidityApp) RegisterAPIRoutes ¶
func (app *LiquidityApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*LiquidityApp) RegisterNodeService ¶
func (app *LiquidityApp) RegisterNodeService(clientCtx client.Context, config config.Config)
func (*LiquidityApp) RegisterTendermintService ¶
func (app *LiquidityApp) RegisterTendermintService(clientCtx client.Context)
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*LiquidityApp) RegisterTxService ¶
func (app *LiquidityApp) RegisterTxService(clientCtx client.Context)
RegisterTxService implements the Application.RegisterTxService method.
func (*LiquidityApp) SimulationManager ¶
func (app *LiquidityApp) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface
func (*LiquidityApp) TxConfig ¶
func (app *LiquidityApp) TxConfig() client.TxConfig
TxConfig returns LiquidityApp's TxConfig
type SetupOptions ¶
type SetupOptions struct { LoadLatest bool Logger log.Logger DB *dbm.MemDB AppOpts servertypes.AppOptions }
SetupOptions defines arguments that are passed into `Simapp` constructor.