app

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 144 Imported by: 0

Documentation

Overview

Package app provides the assets information for server module.

Index

Constants

View Source
const (
	// AppName specifies the global application name.
	AppName = "Shentu"
)

Variables

View Source
var DefaultConsensusParams = &abci.ConsensusParams{
	Block: &abci.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 SimApp testing.

Functions

func AddTestAddrs

func AddTestAddrs(app *ShentuApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress

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

func AddTestAddrsFromPubKeys

func AddTestAddrsFromPubKeys(app *ShentuApp, ctx sdk.Context, pubKeys []cryptotypes.PubKey, accAmt math.Int)

AddTestAddrsFromPubKeys adds the addresses into the SimApp providing only the public keys.

func AddTestAddrsIncremental added in v2.10.0

func AddTestAddrsIncremental(app *ShentuApp, ctx sdk.Context, accNum int, accAmt math.Int) []sdk.AccAddress

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

func BeginBlockForks

func BeginBlockForks(ctx sdk.Context, app *ShentuApp)

BeginBlockForks is intended to be ran in

func CreateTestPubKeys

func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey

CreateTestPubKeys returns a total of numPubKeys public keys in ascending order.

func DefaultConfig

func DefaultConfig() network.Config

DefaultConfig returns a default configuration suitable for nearly all testing requirements.

func MakeCodecs

func MakeCodecs() (codec.Codec, *codec.LegacyAmino)

MakeCodecs constructs the *std.Marshaler and *codec.LegacyAmino instances used by app. It is useful for tests and clients who do not want to construct the full app

func MakeEncodingConfig

func MakeEncodingConfig() params.EncodingConfig

MakeEncodingConfig creates an EncodingConfig for testing

func NewAppConstructor

func NewAppConstructor(encodingCfg params.EncodingConfig) network.AppConstructor

func NewPubKeyFromHex

func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey)

NewPubKeyFromHex returns a PubKey from a hex string.

func RegisterSwaggerAPI

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

RegisterSwaggerAPI registers swagger route with API Server

func TestAddr added in v2.10.0

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

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 added in v2.10.0

type GenerateAccountStrategy func(int) []sdk.AccAddress

type GenesisState

type GenesisState map[string]json.RawMessage

GenesisState of the blockchain is represented here as a map of raw json messages key'd by an 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 GenesisStateWithSingleValidator added in v2.10.0

func GenesisStateWithSingleValidator(t *testing.T, app *ShentuApp) GenesisState

GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts that also act as delegators.

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState

NewDefaultGenesisState generates the default state for the application.

type SetupOptions added in v2.10.0

type SetupOptions struct {
	Logger             log.Logger
	DB                 *dbm.MemDB
	InvCheckPeriod     uint
	HomePath           string
	SkipUpgradeHeights map[int64]bool
	EncConfig          params.EncodingConfig
	AppOpts            types.AppOptions
}

SetupOptions defines arguments that are passed into `Simapp` constructor.

type ShentuApp

type ShentuApp struct {
	*baseapp.BaseApp

	AccountKeeper    sdkauthkeeper.AccountKeeper
	AuthzKeeper      authzkeeper.Keeper
	BankKeeper       bankkeeper.Keeper
	CrisisKeeper     crisiskeeper.Keeper
	StakingKeeper    stakingkeeper.Keeper
	SlashingKeeper   slashingkeeper.Keeper
	MintKeeper       mintkeeper.Keeper
	DistrKeeper      distrkeeper.Keeper
	FeegrantKeeper   feegrantkeeper.Keeper
	ParamsKeeper     paramskeeper.Keeper
	UpgradeKeeper    upgradekeeper.Keeper
	GovKeeper        govkeeper.Keeper
	CertKeeper       certkeeper.Keeper
	AuthKeeper       authkeeper.Keeper
	EvidenceKeeper   evidencekeeper.Keeper
	IBCKeeper        *ibckeeper.Keeper
	ICAHostKeeper    icahostkeeper.Keeper
	TransferKeeper   ibctransferkeeper.Keeper
	CapabilityKeeper *capabilitykeeper.Keeper
	CVMKeeper        cvmkeeper.Keeper
	OracleKeeper     oraclekeeper.Keeper
	ShieldKeeper     shieldkeeper.Keeper
	BountyKeeper     bountykeeper.Keeper
	GroupKeeper      groupkeeper.Keeper

	// make scoped keepers public for test purposes
	ScopedIBCKeeper      capabilitykeeper.ScopedKeeper
	ScopedTransferKeeper capabilitykeeper.ScopedKeeper
	ScopedICAHostKeeper  capabilitykeeper.ScopedKeeper
	// contains filtered or unexported fields
}

ShentuApp is the main Shentu Chain application type.

func NewShentuApp

func NewShentuApp(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)) *ShentuApp

NewShentuApp returns a reference to an initialized ShentuApp.

func NewSimappWithCustomOptions added in v2.10.0

func NewSimappWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptions) *ShentuApp

NewSimappWithCustomOptions initializes a new SimApp with custom options.

func Setup

func Setup(t *testing.T, isCheckTx bool) *ShentuApp

func SetupWithGenesisValSet added in v2.10.0

func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *ShentuApp

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 (*ShentuApp) BeginBlocker

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

BeginBlocker processes application updates at the beginning of each block.

func (*ShentuApp) Codec

func (app *ShentuApp) Codec() codec.Codec

Codec returns app.legacyAmino.

func (*ShentuApp) EndBlocker

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

EndBlocker processes application updates at the end of each block.

func (*ShentuApp) ExportAppStateAndValidators

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

ExportAppStateAndValidators exports the application state for a genesis file.

func (*ShentuApp) GetKey

func (app *ShentuApp) 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 (*ShentuApp) GetMemKey

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

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*ShentuApp) GetSubspace

func (app *ShentuApp) 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 (*ShentuApp) GetTKey

func (app *ShentuApp) 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 (*ShentuApp) GetTxConfig

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

GetTxConfig is used solely for testing purposes.

func (*ShentuApp) InitChainer

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

InitChainer defines application update at chain initialization

func (*ShentuApp) InterfaceRegistry

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

InterfaceRegistry returns the app's InterfaceRegistry

func (*ShentuApp) LegacyAmino

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

LegacyAmino returns SimApp'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 (*ShentuApp) LoadHeight

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

LoadHeight loads a particular height

func (*ShentuApp) ModuleAccountAddrs

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

ModuleAccountAddrs returns all the app's module account addresses.

func (*ShentuApp) ModuleManager

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

ModuleManager implements the SimulationApp interface

func (*ShentuApp) Name

func (app *ShentuApp) Name() string

Name returns the name of the App

func (*ShentuApp) RegisterAPIRoutes

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

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

func (*ShentuApp) RegisterTendermintService

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

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*ShentuApp) RegisterTxService

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

RegisterTxService implements the Application.RegisterTxService method.

func (*ShentuApp) RegisterUpgradeHandlers

func (app *ShentuApp) RegisterUpgradeHandlers()

RegisterUpgradeHandlers registers necessary upgrade handlers

func (*ShentuApp) SimulationManager

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

SimulationManager returns app.sm.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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