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 sdk.Int) []sdk.AccAddress
- 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 sdk.Int) (x, y sdk.Int)
- func GetRandRange(r *rand.Rand, min, max int) sdk.Int
- func GetRandomOrders(denomX, denomY string, x, y sdk.Int, r *rand.Rand, sizeXToY, sizeYToX int) (xToY, yToX []*types.MsgSwapWithinBatch)
- func GetRandomSizeOrders(denomX, denomY string, x, y sdk.Int, r *rand.Rand, sizeXToY, sizeYToX int32) (xToY, yToX []*types.MsgSwapWithinBatch)
- func GetSwapMsg(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, offerCoins []sdk.Coin, ...) []*types.MsgSwapWithinBatch
- func MakeTestEncodingConfig() params.EncodingConfig
- func RegisterSwaggerAPI(rtr *mux.Router)
- 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 sdk.Int, ...) uint64
- func TestDepositPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, x, y sdk.Int, ...)
- func TestWithdrawPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, poolCoinAmt sdk.Int, ...)
- type EmptyAppOptions
- type GenerateAccountStrategy
- type GenesisState
- type LiquidityApp
- func CreateTestInput() (*LiquidityApp, sdk.Context)
- func NewLiquidityApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, ...) *LiquidityApp
- func NewSimappWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *LiquidityApp
- func Setup(isCheckTx bool) *LiquidityApp
- func SetupWithGenesisValSet(valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, ...) *LiquidityApp
- func (app *LiquidityApp) AppCodec() codec.Codec
- func (app *LiquidityApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *LiquidityApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *LiquidityApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []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
- func (app *LiquidityApp) InterfaceRegistry() types.InterfaceRegistry
- func (app *LiquidityApp) LegacyAmino() *codec.LegacyAmino
- func (app *LiquidityApp) LoadHeight(height int64) error
- func (app *LiquidityApp) ModuleAccountAddrs() map[string]bool
- func (app *LiquidityApp) Name() string
- func (app *LiquidityApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *LiquidityApp) RegisterTendermintService(clientCtx client.Context)
- func (app *LiquidityApp) RegisterTxService(clientCtx client.Context)
- func (app *LiquidityApp) SimulationManager() *module.SimulationManager
- 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.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( []govclient.ProposalHandler{ paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler, }, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, authzmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, liquidity.AppModuleBasic{}, ) )
var DefaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: 200000, MaxGas: 2000000, }, Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, }, Validator: &tmproto.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 sdk.Int) []sdk.AccAddress
AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order
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
func GetRandomOrders ¶
func GetRandomSizeOrders ¶
func GetSwapMsg ¶
func GetSwapMsg(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, offerCoins []sdk.Coin, orderPrices []sdk.Dec, addrs []sdk.AccAddress, poolID uint64) []*types.MsgSwapWithinBatch
func MakeTestEncodingConfig ¶
func MakeTestEncodingConfig() params.EncodingConfig
MakeEncodingConfig creates an EncodingConfig for testing
func RegisterSwaggerAPI ¶
RegisterSwaggerAPI registers swagger route with API Server
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 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(cdc codec.JSONCodec) GenesisState
NewDefaultGenesisState generates the default state for the application.
type LiquidityApp ¶
type LiquidityApp struct { *baseapp.BaseApp // keepers AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper CapabilityKeeper *capabilitykeeper.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 LiquidityKeeper liquiditykeeper.Keeper // 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() (*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, skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, encodingConfig liquidityparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *LiquidityApp
NewLiquidityApp returns a reference to an initialized LiquidityApp.
func NewSimappWithCustomOptions ¶
func NewSimappWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *LiquidityApp
NewSimappWithCustomOptions initializes a new SimApp with custom options.
func Setup ¶
func Setup(isCheckTx bool) *LiquidityApp
Setup initializes a new LiquidityApp. A Nop logger is set in LiquidityApp.
func SetupWithGenesisValSet ¶
func SetupWithGenesisValSet(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, req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlocker application updates every begin block
func (*LiquidityApp) EndBlocker ¶
func (app *LiquidityApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlocker application updates every end block
func (*LiquidityApp) ExportAppStateAndValidators ¶
func (app *LiquidityApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []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
InitChainer application update at chain initialization
func (*LiquidityApp) InterfaceRegistry ¶
func (app *LiquidityApp) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns LiquidityApp'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) ModuleAccountAddrs ¶
func (app *LiquidityApp) ModuleAccountAddrs() map[string]bool
ModuleAccountAddrs returns all the app's module account addresses.
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) 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
type SetupOptions ¶
type SetupOptions struct { Logger log.Logger DB *dbm.MemDB InvCheckPeriod uint HomePath string SkipUpgradeHeights map[int64]bool EncConfig params.EncodingConfig AppOpts sdkserver.AppOptions }
SetupOptions defines arguments that are passed into `Simapp` constructor.