app

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 98 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
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(
			paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler,
		),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		feegrantmodule.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		evidence.AppModuleBasic{},
		authzmodule.AppModuleBasic{},
		vesting.AppModuleBasic{},
		liquidity.AppModuleBasic{},
	)
)
View Source
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 added in v1.2.0

func AddRandomTestAddr(app *LiquidityApp, ctx sdk.Context, initCoins sdk.Coins) sdk.AccAddress

AddRandomTestAddr creates new account with random address.

func AddTestAddrs added in v1.2.0

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 added in v1.2.0

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 added in v1.3.0

func FundAccount(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error

permission of minting, create a "faucet" account. (@fdymylja)

func GetMaccPerms added in v1.2.0

func GetMaccPerms() map[string][]string

GetMaccPerms returns a copy of the module account permissions

func GetRandPoolAmt added in v1.2.0

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

func GetRandRange added in v1.2.0

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

func GetRandomOrders added in v1.2.0

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

func GetRandomSizeOrders added in v1.2.0

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

func GetSwapMsg added in v1.2.0

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 added in v1.2.0

func MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig creates an EncodingConfig for testing

func RegisterSwaggerAPI added in v1.2.0

func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router)

RegisterSwaggerAPI registers swagger route with API Server

func SaveAccount added in v1.2.0

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 added in v1.2.0

func SaveAccountWithFee(app *LiquidityApp, ctx sdk.Context, addr sdk.AccAddress, initCoins sdk.Coins, offerCoin sdk.Coin)

func TestAddr added in v1.2.0

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

func TestCreatePool added in v1.2.0

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

func TestDepositPool added in v1.2.0

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

func TestSwapPool added in v1.2.0

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 added in v1.2.0

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

Types

type EmptyAppOptions added in v1.2.0

type EmptyAppOptions struct{}

EmptyAppOptions is a stub implementing AppOptions

func (EmptyAppOptions) Get added in v1.2.0

func (ao EmptyAppOptions) Get(o string) interface{}

Get implements AppOptions

type GenerateAccountStrategy added in v1.2.0

type GenerateAccountStrategy func(int) []sdk.AccAddress

type GenesisState added in v1.2.0

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 added in v1.2.0

func NewDefaultGenesisState() GenesisState

NewDefaultGenesisState generates the default state for the application.

type LiquidityApp added in v1.2.0

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 added in v1.2.0

func CreateTestInput() (*LiquidityApp, sdk.Context)

CreateTestInput returns a simapp with custom LiquidityKeeper to avoid messing with the hooks.

func NewLiquidityApp added in v1.2.0

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 Setup added in v1.2.0

func Setup(isCheckTx bool) *LiquidityApp

Setup initializes a new LiquidityApp. A Nop logger is set in LiquidityApp.

func (*LiquidityApp) AppCodec added in v1.2.0

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 added in v1.2.0

BeginBlocker application updates every begin block

func (*LiquidityApp) EndBlocker added in v1.2.0

func (app *LiquidityApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

EndBlocker application updates every end block

func (*LiquidityApp) ExportAppStateAndValidators added in v1.2.0

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 added in v1.2.0

func (app *LiquidityApp) GetKey(storeKey string) *sdk.KVStoreKey

GetKey returns the KVStoreKey for the provided store key.

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

func (*LiquidityApp) GetMemKey added in v1.2.0

func (app *LiquidityApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*LiquidityApp) GetSubspace added in v1.2.0

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 added in v1.2.0

func (app *LiquidityApp) GetTKey(storeKey string) *sdk.TransientStoreKey

GetTKey returns the TransientStoreKey for the provided store key.

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

func (*LiquidityApp) InitChainer added in v1.2.0

func (app *LiquidityApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain

InitChainer application update at chain initialization

func (*LiquidityApp) InterfaceRegistry added in v1.2.0

func (app *LiquidityApp) InterfaceRegistry() types.InterfaceRegistry

InterfaceRegistry returns LiquidityApp's InterfaceRegistry

func (*LiquidityApp) LegacyAmino added in v1.2.0

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 added in v1.2.0

func (app *LiquidityApp) LoadHeight(height int64) error

LoadHeight loads a particular height

func (*LiquidityApp) ModuleAccountAddrs added in v1.2.0

func (app *LiquidityApp) ModuleAccountAddrs() map[string]bool

ModuleAccountAddrs returns all the app's module account addresses.

func (*LiquidityApp) Name added in v1.2.0

func (app *LiquidityApp) Name() string

Name returns the name of the App

func (*LiquidityApp) RegisterAPIRoutes added in v1.2.0

func (app *LiquidityApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)

RegisterAPIRoutes registers all application module routes with the provided API server.

func (*LiquidityApp) RegisterTendermintService added in v1.2.0

func (app *LiquidityApp) RegisterTendermintService(clientCtx client.Context)

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*LiquidityApp) RegisterTxService added in v1.2.0

func (app *LiquidityApp) RegisterTxService(clientCtx client.Context)

RegisterTxService implements the Application.RegisterTxService method.

func (*LiquidityApp) SimulationManager added in v1.2.0

func (app *LiquidityApp) SimulationManager() *module.SimulationManager

SimulationManager implements the SimulationApp interface

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