app

package
Version: v0.4.5 Latest Latest
Warning

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

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

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

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

func GetMaccPerms() map[string][]string

GetMaccPerms returns a copy of the module account permissions

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 RegisterSwaggerAPI

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

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

func Setup(isCheckTx bool) *LiquidityApp

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

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) 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) *sdk.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) *sdk.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) *sdk.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) 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) 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

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