app

package
v4.1.6-rc0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 170 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SimAppChainID = ""
)

SimAppChainID hardcoded chainID for simulation

Variables

View Source
var DefaultConsensusParams = &tmproto.ConsensusParams{
	Block: &tmproto.BlockParams{
		MaxBytes: 200000,
		MaxGas:   2000000,
	},
	Evidence: &tmproto.EvidenceParams{
		MaxAgeNumBlocks: 302400,
		MaxAgeDuration:  504 * time.Hour,
		MaxBytes:        10000,
	},
	Validator: &tmproto.ValidatorParams{
		PubKeyTypes: []string{
			tmtypes.ABCIPubKeyTypeEd25519,
		},
	},
}

DefaultConsensusParams defines the default Tendermint consensus params used in app testing.

View Source
var (
	// DefaultNodeHome default home directories for wasmd
	DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir
)

These constants are derived from the above variables. These are the ones we will want to use in the code, based on any overrides above

View Source
var (
	// 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{},
		alliancemodule.AppModuleBasic{},
		genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
		terracustombank.AppModule{},
		capability.AppModuleBasic{},
		consensus.AppModuleBasic{},
		staking.AppModuleBasic{},
		mint.AppModuleBasic{},
		distr.AppModuleBasic{},
		gov.NewAppModuleBasic([]govclient.ProposalHandler{
			paramsclient.ProposalHandler,
			upgradeclient.LegacyProposalHandler,
			upgradeclient.LegacyCancelProposalHandler,
			ibcclientclient.UpdateClientProposalHandler,
			ibcclientclient.UpgradeProposalHandler,
			alliancemoduleclient.CreateAllianceProposalHandler,
			alliancemoduleclient.UpdateAllianceProposalHandler,
			alliancemoduleclient.DeleteAllianceProposalHandler,
			feeburnmoduleclient.UpdateTxFeeBurnPercentProposalHandler,
		}),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		feegrantmodule.AppModuleBasic{},
		authzmodule.AppModuleBasic{},
		ibc.AppModuleBasic{},
		ibctm.AppModuleBasic{},
		icq.AppModuleBasic{},
		solomachine.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		evidence.AppModuleBasic{},
		transfer.AppModuleBasic{},
		vesting.AppModuleBasic{},
		tokenfactory.AppModuleBasic{},
		wasm.AppModuleBasic{},
		ibchooks.AppModuleBasic{},
		packetforward.AppModuleBasic{},
		ica.AppModuleBasic{},
		ibcfee.AppModuleBasic{},
		feeburnmodule.AppModuleBasic{},
		feeabsmodule.AppModuleBasic{},
	)
)
View Source
var NodeDir = ".migalood"

Functions

func CreateRandomAccounts

func CreateRandomAccounts(numAccts int) []sdk.AccAddress

CreateRandomAccounts is a function return a list of randomly generated AccAddresses

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a copy of the module account permissions

func MakeEncodingConfig

func MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig creates a new EncodingConfig with all modules registered

func NewAnteHandler

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)

func RegisterSwaggerAPI

func RegisterSwaggerAPI(rtr *mux.Router)

RegisterSwaggerAPI registers swagger route with API Server

Types

type EmptyAppOptions

type EmptyAppOptions struct{}

func (EmptyAppOptions) Get

func (EmptyAppOptions) Get(_ string) interface{}

type EmptyBaseAppOptions

type EmptyBaseAppOptions struct{}

func (EmptyBaseAppOptions) Get

func (ao EmptyBaseAppOptions) Get(_ string) interface{}

Get implements AppOptions

type GenesisState

type GenesisState map[string]json.RawMessage

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

type HandlerOptions struct {
	ante.HandlerOptions

	IBCKeeper         *keeper.Keeper
	FeeburnKeeper     *feeburnkeeper.Keeper
	BankKeeper        bankkeeper.Keeper
	WasmConfig        *wasmTypes.WasmConfig
	TXCounterStoreKey storetypes.StoreKey
	FeeabsKeeper      feeabskeeper.Keeper
}

HandlerOptions extend the SDK's AnteHandler options by requiring the IBC channel keeper.

type KeeperTestHelper

type KeeperTestHelper struct {
	suite.Suite

	App           *MigalooApp
	Ctx           sdk.Context // ctx is deliver ctx
	CheckCtx      sdk.Context
	QueryHelper   *baseapp.QueryServiceTestHelper
	TestAccs      []sdk.AccAddress
	StakingHelper *stakinghelper.Helper
}

func (*KeeperTestHelper) AllocateRewardsToValidator

func (s *KeeperTestHelper) AllocateRewardsToValidator(valAddr sdk.ValAddress, rewardAmt math.Int)

AllocateRewardsToValidator allocates reward tokens to a distribution module then allocates rewards to the validator address.

func (*KeeperTestHelper) BeginNewBlock

func (s *KeeperTestHelper) BeginNewBlock()

BeginNewBlock starts a new block.

func (*KeeperTestHelper) BeginNewBlockWithProposer

func (s *KeeperTestHelper) BeginNewBlockWithProposer(proposer sdk.ValAddress)

BeginNewBlockWithProposer begins a new block with a proposer.

func (*KeeperTestHelper) BuildTx

func (s *KeeperTestHelper) BuildTx(
	txBuilder client.TxBuilder,
	msgs []sdk.Msg,
	sigV2 signing.SignatureV2,
	memo string, txFee sdk.Coins,
	gasLimit uint64,
) authsigning.Tx

BuildTx builds a transaction.

func (*KeeperTestHelper) Commit

func (s *KeeperTestHelper) Commit()

CreateTestContext creates a test context.

func (*KeeperTestHelper) ConfirmUpgradeSucceeded

func (s *KeeperTestHelper) ConfirmUpgradeSucceeded(upgradeName string, upgradeHeight int64)

func (*KeeperTestHelper) Ed25519PubAddr

func (*KeeperTestHelper) EndBlock

func (s *KeeperTestHelper) EndBlock()

EndBlock ends the block.

func (*KeeperTestHelper) FundAcc

func (s *KeeperTestHelper) FundAcc(acc sdk.AccAddress, amounts sdk.Coins)

FundAcc funds target address with specified amount.

func (*KeeperTestHelper) FundModuleAcc

func (s *KeeperTestHelper) FundModuleAcc(moduleName string, amounts sdk.Coins)

FundModuleAcc funds target modules with specified amount.

func (*KeeperTestHelper) MintCoins

func (s *KeeperTestHelper) MintCoins(coins sdk.Coins)

func (*KeeperTestHelper) RandomAccountAddresses

func (s *KeeperTestHelper) RandomAccountAddresses(n int) []sdk.AccAddress

func (*KeeperTestHelper) Setup

func (s *KeeperTestHelper) Setup(_ *testing.T)

func (*KeeperTestHelper) SetupValidator

func (s *KeeperTestHelper) SetupValidator(bondStatus stakingtypes.BondStatus) sdk.ValAddress

SetupValidator sets up a validator and returns the ValAddress.

type MigalooApp

type MigalooApp struct {
	*baseapp.BaseApp

	// keepers
	AccountKeeper       authkeeper.AccountKeeper
	AllianceKeeper      alliancemodulekeeper.Keeper
	BankKeeper          custombankkeeper.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
	EvidenceKeeper      evidencekeeper.Keeper
	IBCKeeper           *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
	IBCFeeKeeper        ibcfeekeeper.Keeper
	ICAControllerKeeper icacontrollerkeeper.Keeper
	ICAHostKeeper       icahostkeeper.Keeper
	ICQKeeper           icqkeeper.Keeper
	TransferKeeper      ibctransferkeeper.Keeper
	TokenFactoryKeeper  tokenfactorykeeper.Keeper
	FeeGrantKeeper      feegrantkeeper.Keeper
	AuthzKeeper         authzkeeper.Keeper
	WasmKeeper          wasmkeeper.Keeper
	PacketForwardKeeper *packetforwardkeeper.Keeper

	ContractKeeper        *wasmkeeper.PermissionedKeeper
	ConsensusParamsKeeper consensusparamkeeper.Keeper
	FeeBurnKeeper         feeburnmodulekeeper.Keeper

	FeeabsKeeper feeabskeeper.Keeper

	// IBC hooks
	IBCHooksKeeper *ibchookskeeper.Keeper
	TransferStack  *ibcporttypes.IBCModule

	ScopedIBCKeeper           capabilitykeeper.ScopedKeeper
	ScopedICAHostKeeper       capabilitykeeper.ScopedKeeper
	ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
	ScopedICQKeeper           capabilitykeeper.ScopedKeeper
	ScopedTransferKeeper      capabilitykeeper.ScopedKeeper
	ScopedIBCFeeKeeper        capabilitykeeper.ScopedKeeper
	ScopedWasmKeeper          capabilitykeeper.ScopedKeeper
	ScopedFeeabsKeeper        capabilitykeeper.ScopedKeeper

	// Middleware wrapper
	Ics20WasmHooks   *ibchooks.WasmHooks
	HooksICS4Wrapper ibchooks.ICS4Middleware
	// contains filtered or unexported fields
}

MigalooApp extended ABCI application

func NewMigalooApp

func NewMigalooApp(
	logger log.Logger,
	db dbm.DB,
	traceStore io.Writer,
	loadLatest bool,
	skipUpgradeHeights map[int64]bool,
	homePath string,
	invCheckPeriod uint,
	encodingConfig appparams.EncodingConfig,
	appOpts servertypes.AppOptions,
	wasmOpts []wasmkeeper.Option,
	baseAppOptions ...func(*baseapp.BaseApp),
) *MigalooApp

NewMigalooApp returns a reference to an initialized MigalooApp.

func SetupApp

func SetupApp(t *testing.T) *MigalooApp

func SetupWithGenesisValSet

func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, chainID string, opts []wasmkeeper.Option, balances ...banktypes.Balance) *MigalooApp

SetupWithGenesisValSet initializes a new app 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 app from first genesis account. A Nop logger is set in app.

func (*MigalooApp) AppCodec

func (app *MigalooApp) AppCodec() codec.Codec

func (*MigalooApp) BeginBlocker

func (app *MigalooApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

BeginBlocker application updates every begin block

func (*MigalooApp) BlockedModuleAccountAddrs

func (app *MigalooApp) BlockedModuleAccountAddrs() map[string]bool

BlockedModuleAccountAddrs returns all the app's blocked module account addresses.

func (*MigalooApp) Close

func (app *MigalooApp) Close() error

func (*MigalooApp) DefaultGenesis

func (app *MigalooApp) DefaultGenesis() map[string]json.RawMessage

DefaultGenesis returns a default genesis from the registered AppModuleBasic's.

func (*MigalooApp) EndBlocker

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

EndBlocker application updates every end block

func (*MigalooApp) ExportAppStateAndValidators

func (app *MigalooApp) ExportAppStateAndValidators(
	forZeroHeight bool, jailAllowedAddrs, modulesToExport []string,
) (servertypes.ExportedApp, error)

ExportAppStateAndValidators exports the state of the application for a genesis file.

func (*MigalooApp) GetAccountKeeper added in v4.1.5

func (app *MigalooApp) GetAccountKeeper() authkeeper.AccountKeeper

func (*MigalooApp) GetBankKeeper added in v4.1.5

func (app *MigalooApp) GetBankKeeper() bankkeeper.Keeper

func (*MigalooApp) GetBaseApp added in v4.1.5

func (app *MigalooApp) GetBaseApp() *baseapp.BaseApp

func (*MigalooApp) GetIBCKeeper added in v4.1.5

func (app *MigalooApp) GetIBCKeeper() *ibckeeper.Keeper

func (*MigalooApp) GetScopedIBCKeeper added in v4.1.5

func (app *MigalooApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper

func (*MigalooApp) GetStakingKeeper added in v4.1.5

func (app *MigalooApp) GetStakingKeeper() *stakingkeeper.Keeper

func (*MigalooApp) GetSubspace

func (app *MigalooApp) 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 (*MigalooApp) GetWasmKeeper added in v4.1.5

func (app *MigalooApp) GetWasmKeeper() wasmkeeper.Keeper

func (*MigalooApp) InitChainer

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

InitChainer application update at chain initialization

func (*MigalooApp) InterfaceRegistry

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

InterfaceRegistry returns Migaloo InterfaceRegistry

func (*MigalooApp) LegacyAmino

func (app *MigalooApp) LegacyAmino() *codec.LegacyAmino

LegacyAmino returns legacy 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 (*MigalooApp) LoadHeight

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

LoadHeight loads a particular height

func (*MigalooApp) ModuleAccountAddrs

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

ModuleAccountAddrs returns all the app's module account addresses.

func (*MigalooApp) ModuleConfigurator

func (app *MigalooApp) ModuleConfigurator() module.Configurator

ModuleConfigurator returns instance

func (*MigalooApp) ModuleManager

func (app *MigalooApp) ModuleManager() module.Manager

ModuleManager returns instance

func (*MigalooApp) Name

func (app *MigalooApp) Name() string

Name returns the name of the App

func (*MigalooApp) RegisterAPIRoutes

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

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

func (*MigalooApp) RegisterNodeService

func (app *MigalooApp) RegisterNodeService(clientCtx client.Context)

func (*MigalooApp) RegisterTendermintService

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

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*MigalooApp) RegisterTxService

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

RegisterTxService implements the Application.RegisterTxService method.

func (*MigalooApp) SimulationManager

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

SimulationManager implements the SimulationApp interface

func (*MigalooApp) TxConfig added in v4.1.5

func (app *MigalooApp) TxConfig() client.TxConfig

TxConfig returns MigalooApp's TxConfig

type PV

type PV struct {
	PrivKey cryptotypes.PrivKey
}

PV implements PrivValidator without any safety or persistence. Only use it for testing.

func NewPV

func NewPV() PV

func (PV) GetPubKey

func (pv PV) GetPubKey() (crypto.PubKey, error)

GetPubKey implements PrivValidator interface

func (PV) SignProposal

func (pv PV) SignProposal(chainID string, proposal *tmproto.Proposal) error

SignProposal implements PrivValidator interface

func (PV) SignVote

func (pv PV) SignVote(chainID string, vote *tmproto.Vote) error

SignVote implements PrivValidator interface

Directories

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

Jump to

Keyboard shortcuts

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