app

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 148 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountAddressPrefix = "lum"
	CoinBondDenom        = "ulum"
	CoinPurpose          = 44
	CoinType             = 880
)
View Source
const (
	ICAControllerCustomStoreKey = "lum-icacontroller"
)

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.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
		bank.AppModuleBasic{},
		capability.AppModuleBasic{},
		staking.AppModuleBasic{},
		mint.AppModuleBasic{},
		distr.AppModuleBasic{},
		gov.NewAppModuleBasic(
			[]govclient.ProposalHandler{
				paramsclient.ProposalHandler,
				upgradeclient.LegacyProposalHandler,
				upgradeclient.LegacyCancelProposalHandler,
				ibcclientclient.UpdateClientProposalHandler,
				ibcclientclient.UpgradeProposalHandler,
				dfractclient.UpdateParamsProposalHandler,
				millionsclient.RegisterPoolProposalHandler,
				millionsclient.ClosePoolProposalHandler,
				millionsclient.UpdatePoolProposalHandler,
				millionsclient.UpdateParamsProposalHandler,
			},
		),
		params.AppModuleBasic{},
		crisis.AppModuleBasic{},
		slashing.AppModuleBasic{},
		ibc.AppModuleBasic{},
		ica.AppModuleBasic{},
		feegrantmodule.AppModuleBasic{},
		upgrade.AppModuleBasic{},
		evidence.AppModuleBasic{},
		transfer.AppModuleBasic{},
		consensus.AppModuleBasic{},
		authzmodule.AppModuleBasic{},
		vesting.AppModuleBasic{},
		tendermintlightclient.AppModuleBasic{},
		icacallbacks.AppModuleBasic{},
		icqueries.AppModuleBasic{},
		beam.AppModuleBasic{},
		airdrop.AppModuleBasic{},
		dfract.AppModuleBasic{},
		millions.AppModuleBasic{},
		epochs.AppModuleBasic{},
	)
)
View Source
var (
	AccountPubKeyPrefix    = AccountAddressPrefix + "pub"
	ValidatorAddressPrefix = AccountAddressPrefix + "valoper"
	ValidatorPubKeyPrefix  = AccountAddressPrefix + "valoperpub"
	ConsNodeAddressPrefix  = AccountAddressPrefix + "valcons"
	ConsNodePubKeyPrefix   = AccountAddressPrefix + "valconspub"
)
View Source
var (
	LumChainID     = "LUM-NETWORK"
	TestIcaVersion = string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{
		Version:                icatypes.Version,
		ControllerConnectionId: ibctesting.FirstConnectionID,
		HostConnectionId:       ibctesting.FirstConnectionID,
		Encoding:               icatypes.EncodingProtobuf,
		TxType:                 icatypes.TxTypeSDKMultiMsg,
	}))
)
View Source
var DefaultSupplyWeight int64 = 100000001000000

Functions

func CopyConnectionAndClientToPath added in v1.4.0

func CopyConnectionAndClientToPath(path *ibctesting.Path, pathToCopy *ibctesting.Path) *ibctesting.Path

CopyConnectionAndClientToPath In ibctesting, there's no easy way to create a new channel on an existing connection To get around this, this helper function will copy the client/connection info from an existing channel We use this when creating ICA channels, because we want to reuse the same connections/clients from the transfer channel

func MakeEncodingConfig

func MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig creates an EncodingConfig for testing

func NewIcaPath added in v1.4.0

func NewIcaPath(chainA *ibctesting.TestChain, chainB *ibctesting.TestChain) *ibctesting.Path

NewIcaPath Creates an ICA channel between two chains

func NewTransferPath added in v1.4.0

func NewTransferPath(chainA *ibctesting.TestChain, chainB *ibctesting.TestChain) *ibctesting.Path

NewTransferPath Creates a transfer channel between two chains

func RegisterSwaggerAPI added in v1.1.0

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

RegisterSwaggerAPI registers swagger route with API Server

func SetConfig

func SetConfig()

func SetupForIBCTesting added in v1.4.0

func SetupForIBCTesting() (ibctesting.TestingApp, map[string]json.RawMessage)

SetupForIBCTesting Configure the testing application and cast it as an IBC testing application

Types

type App

type App struct {
	*baseapp.BaseApp

	AppKeepers
	// contains filtered or unexported fields
}

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

func New(
	appName string,
	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,
	baseAppOptions ...func(*baseapp.BaseApp),
) *App

New returns a reference to an initialized App.

func SetupForTesting added in v1.2.0

func SetupForTesting(isCheckTx bool) *App

func (*App) AppCodec

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

AppCodec returns Gaia's app codec.

func (*App) BeginBlocker

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

BeginBlocker application updates every begin block

func (*App) BlockedModuleAccountAddrs added in v1.3.1

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

BlockedModuleAccountAddrs returns all the app's blocked module account addresses

func (*App) EndBlocker

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

EndBlocker application updates every end block

func (*App) ExportAppStateAndValidators

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

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

func (*App) GetBaseApp added in v1.4.0

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

GetBaseApp returns the base app of the application

func (*App) GetIBCKeeper added in v1.4.0

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

GetIBCKeeper implements the TestingApp interface.

func (*App) GetKey

func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey

GetKey returns the KVStoreKey for the provided store key.

func (*App) GetMemKey

func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey

GetMemKey returns the MemStoreKey for the provided mem key.

func (*App) GetScopedIBCKeeper added in v1.4.0

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

GetScopedIBCKeeper implements the TestingApp interface.

func (*App) GetStakingKeeper added in v1.4.0

func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper

GetStakingKeeper implements the TestingApp interface.

func (*App) GetSubspace

func (app *App) GetSubspace(moduleName string) paramstypes.Subspace

GetSubspace returns a param subspace for a given module name.

func (*App) GetTKey

func (app *App) GetTKey(storeKey string) *storetypes.TransientStoreKey

GetTKey returns the TransientStoreKey for the provided store key.

func (*App) GetTransferKeeper added in v1.4.0

func (app *App) GetTransferKeeper() *ibctransferkeeper.Keeper

GetTransferKeeper implements the TestingApp interface.

func (*App) GetTxConfig added in v1.4.0

func (app *App) GetTxConfig() client.TxConfig

GetTxConfig implements the TestingApp interface.

func (*App) InitChainer

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

InitChainer application update at chain initialization

func (*App) InitNormalKeepers added in v1.2.0

func (app *App) InitNormalKeepers()

InitNormalKeepers Initialize the normal keepers

func (*App) InitParamsKeeper added in v1.2.0

func (app *App) InitParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper

InitParamsKeeper init params keeper and its subspaces

func (*App) InitSpecialKeepers added in v1.2.0

func (app *App) InitSpecialKeepers(
	skipUpgradeHeights map[int64]bool,
	homePath string,
	invCheckPeriod uint,
)

InitSpecialKeepers Init the "special" keepers in the order of definition

func (*App) InterfaceRegistry

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

InterfaceRegistry returns Gaia's InterfaceRegistry

func (*App) LegacyAmino

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

LegacyAmino returns SimApp's amino codec.

func (*App) LoadHeight

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

LoadHeight loads a particular height

func (*App) ModuleAccountAddrs

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

ModuleAccountAddrs returns all the app's module account addresses.

func (*App) Name

func (app *App) Name() string

Name returns the name of the App

func (*App) RegisterAPIRoutes

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

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

func (*App) RegisterNodeService added in v1.5.0

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

RegisterNodeService registers the node gRPC Query service.

func (*App) RegisterTendermintService

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

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*App) RegisterTxService

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

RegisterTxService implements the Application.RegisterTxService method.

func (*App) SetupHooks added in v1.2.0

func (app *App) SetupHooks()

func (*App) SimulationManager

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

type AppKeepers added in v1.2.0

type AppKeepers struct {
	// Special Keepers
	ParamsKeeper          *paramskeeper.Keeper
	CapabilityKeeper      *capabilitykeeper.Keeper
	CrisisKeeper          *crisiskeeper.Keeper
	UpgradeKeeper         *upgradekeeper.Keeper
	ConsensusParamsKeeper *consensusparamkeeper.Keeper

	// make scoped keepers public for test purposes
	ScopedIBCKeeper           capabilitykeeper.ScopedKeeper
	ScopedICAHostKeeper       capabilitykeeper.ScopedKeeper
	ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper
	ScopedTransferKeeper      capabilitykeeper.ScopedKeeper

	// Normal Keepers
	AccountKeeper       *authkeeper.AccountKeeper
	BankKeeper          *bankkeeper.BaseKeeper
	AuthzKeeper         *authzkeeper.Keeper
	StakingKeeper       *stakingkeeper.Keeper
	DistrKeeper         *distrkeeper.Keeper
	SlashingKeeper      *slashingkeeper.Keeper
	IBCKeeper           *ibckeeper.Keeper
	ICAHostKeeper       *icahostkeeper.Keeper
	ICAControllerKeeper *icacontrollerkeeper.Keeper
	TransferKeeper      *ibctransferkeeper.Keeper
	EvidenceKeeper      *evidencekeeper.Keeper
	MintKeeper          *mintkeeper.Keeper
	GovKeeper           *govkeeper.Keeper
	FeeGrantKeeper      *feegrantkeeper.Keeper

	// Custom Keepers
	ICACallbacksKeeper *icacallbackskeeper.Keeper
	ICQueriesKeeper    *icquerieskeeper.Keeper
	AirdropKeeper      *airdropkeeper.Keeper
	BeamKeeper         *beamkeeper.Keeper
	DFractKeeper       *dfractkeeper.Keeper
	MillionsKeeper     *millionskeeper.Keeper
	EpochsKeeper       *epochskeeper.Keeper
}

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

func GenesisStateWithValSet(app *App, genesisState GenesisState, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) GenesisState

func NewDefaultGenesisState

func NewDefaultGenesisState() GenesisState

NewDefaultGenesisState generates the default state for the application.

type LumApp

type LumApp interface {
	// Name The assigned name of the app.
	Name() string

	// LegacyAmino The application types codec.
	// NOTE: This should be sealed before being returned.
	LegacyAmino() *codec.LegacyAmino

	// BeginBlocker Application updates every begin block.
	BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

	// EndBlocker Application updates every end block.
	EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

	// InitChainer Application update at chain (i.e app) initialization.
	InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain

	// LoadHeight Loads the app at a given height.
	LoadHeight(height int64) error

	// ExportAppStateAndValidators Exports the state of the application for a genesis file.
	ExportAppStateAndValidators(
		forZeroHeight bool, jailAllowedAddrs []string,
	) (types.ExportedApp, error)

	// ModuleAccountAddrs All the registered module account addreses.
	ModuleAccountAddrs() map[string]bool
}

LumApp implements the common methods for a Cosmos SDK-based application specific blockchain.

type TestPackage added in v1.4.0

type TestPackage struct {
	suite.Suite
	App     *App
	HostApp *simapp.SimApp

	IbcEnabled   bool
	Coordinator  *ibctesting.Coordinator
	LumChain     *ibctesting.TestChain
	HostChain    *ibctesting.TestChain
	TransferPath *ibctesting.Path

	QueryHelper  *baseapp.QueryServiceTestHelper
	TestAccs     []sdk.AccAddress
	ICAAddresses map[string]string
	Ctx          sdk.Context
}

func (*TestPackage) CreateICAChannel added in v1.4.0

func (p *TestPackage) CreateICAChannel(owner string) string

CreateICAChannel Creates an ICA channel through ibctesting, also creates a transfer channel if it hasn't been done yet

func (*TestPackage) CreateTransferChannel added in v1.4.0

func (p *TestPackage) CreateTransferChannel(hostChainID string)

CreateTransferChannel Creates clients, connections, and a transfer channel between Lum and a host chain

func (*TestPackage) RegisterInterchainAccount added in v1.4.0

func (p *TestPackage) RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string)

RegisterInterchainAccount Register's a new ICA account on the next channel available, this function assumes a connection already exists

func (*TestPackage) Setup added in v1.4.0

func (p *TestPackage) Setup()

func (*TestPackage) SetupIBC added in v1.4.0

func (p *TestPackage) SetupIBC(hostChainID string)

SetupIBC Initialize the IBC configuration for test environment

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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