app

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 117 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func BlockedAddresses

func BlockedAddresses() map[string]bool

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

func GetMaccPerms() map[string][]string

GetMaccPerms returns a copy of the module account permissions

NOTE: This is solely to be used for testing purposes.

func GetRandPoolAmt

func GetRandPoolAmt(r *rand.Rand, minInitDepositAmt sdk.Int) (x, y sdk.Int)

func GetRandRange

func GetRandRange(r *rand.Rand, min, max int) sdk.Int

func GetRandomOrders

func GetRandomOrders(denomX, denomY string, x, y sdk.Int, r *rand.Rand, sizeXToY, sizeYToX int) (xToY, yToX []*types.MsgSwapWithinBatch)

func GetRandomSizeOrders

func GetRandomSizeOrders(denomX, denomY string, x, y sdk.Int, r *rand.Rand, sizeXToY, sizeYToX int32) (xToY, yToX []*types.MsgSwapWithinBatch)

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 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 TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

func TestCreatePool

func TestCreatePool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, x, y sdk.Int, denomX, denomY string, addr sdk.AccAddress) uint64

func TestDepositPool

func TestDepositPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, x, y sdk.Int, addrs []sdk.AccAddress, poolID uint64, withEndblock bool)

func TestSwapPool

func TestSwapPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, offerCoins []sdk.Coin, orderPrices []sdk.Dec,
	addrs []sdk.AccAddress, poolID uint64, withEndblock bool) ([]*types.SwapMsgState, types.PoolBatch)

func TestWithdrawPool

func TestWithdrawPool(t *testing.T, simapp *LiquidityApp, ctx sdk.Context, poolCoinAmt sdk.Int, addrs []sdk.AccAddress, poolID uint64, withEndblock bool)

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
	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
	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

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

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, 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

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) Name

func (app *LiquidityApp) Name() string

Name returns the name of the App

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)

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.

Directories

Path Synopsis
Package params defines the simulation parameters in the simapp.
Package params defines the simulation parameters in the simapp.

Jump to

Keyboard shortcuts

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