app

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 134 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountAddressPrefix = "sif"
)

Variables

View Source
var (
	AccountPubKeyPrefix    = AccountAddressPrefix + "pub"
	ValidatorAddressPrefix = AccountAddressPrefix + "valoper"
	ValidatorPubKeyPrefix  = AccountAddressPrefix + "valoperpub"
	ConsNodeAddressPrefix  = AccountAddressPrefix + "valcons"
	ConsNodePubKeyPrefix   = AccountAddressPrefix + "valconspub"
)
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 AddCoinsToAccount added in v0.10.1

func AddCoinsToAccount(moduleName string, bankKeeper keeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, initCoins sdk.Coins) error

AddCoinsToAccount initializes an account with balance based on initCoins.

func AddTestAddrs

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

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

func ConvertAddrsToValAddrs

func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress

ConvertAddrsToValAddrs converts the provided addresses to ValAddress.

func CreateRandomAccounts

func CreateRandomAccounts(accNum int) []sdk.AccAddress

CreateRandomAccounts is a strategy used by addTestAddrs() in order to generated addresses in random order.

func CreateTestPubKeys

func CreateTestPubKeys(numPubKeys int) []cryptotypes.PubKey

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

func ExportAppState

func ExportAppState(name string, app *SifchainApp, ctx sdk.Context)

ExportAppState exports the validator set and application state into two different files

func GetMaccPerms

func GetMaccPerms() map[string][]string

func MakeTestEncodingConfig

func MakeTestEncodingConfig() simappparams.EncodingConfig

MakeTestEncodingConfig creates an EncodingConfig for testing. This function should be used only internally (in the SDK). App user should'nt create new codecs - use the app.AppCodec instead. [DEPRECATED]

func NewPubKeyFromHex

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

NewPubKeyFromHex returns a PubKey from a hex string.

func RegisterSwaggerAPI

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

RegisterSwaggerAPI registers swagger route with API Server

func SetConfig

func SetConfig(seal bool)

func SetupHandlers

func SetupHandlers(app *SifchainApp)

func TestAddr

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

type GenerateAccountStrategy func(int) []sdk.AccAddress

type GenesisState

type GenesisState map[string]json.RawMessage

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.Codec) GenesisState

type SifchainApp

type SifchainApp struct {
	*baseapp.BaseApp

	AccountKeeper    authkeeper.AccountKeeper
	BankKeeper       bankkeeper.Keeper
	CapabilityKeeper *capabilitykeeper.Keeper
	ParamsKeeper     paramskeeper.Keeper
	UpgradeKeeper    upgradekeeper.Keeper
	GovKeeper        govkeeper.Keeper
	CrisisKeeper     crisiskeeper.Keeper
	StakingKeeper    stakingkeeper.Keeper
	SlashingKeeper   slashingkeeper.Keeper
	MintKeeper       mintkeeper.Keeper
	DistrKeeper      distrkeeper.Keeper
	EvidenceKeeper   evidencekeeper.Keeper
	IBCKeeper        *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
	TransferKeeper   ibctransferkeeper.Keeper
	PortKeeper       ibcmock.PortKeeper
	FeegrantKeeper   feegrantkeeper.Keeper
	AuthzKeeper      authzkeeper.Keeper

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

	ClpKeeper           clpkeeper.Keeper
	MarginKeeper        marginkeeper.Keeper
	OracleKeeper        oraclekeeper.Keeper
	EthbridgeKeeper     ethbridgekeeper.Keeper
	DispensationKeeper  dispkeeper.Keeper
	TokenRegistryKeeper tokenregistrytypes.Keeper
	AdminKeeper         adminkeeper.Keeper
	EpochsKeeper        epochskeeper.Keeper
	// contains filtered or unexported fields
}

func NewSifApp

func NewSifApp(
	logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
	homePath string, invCheckPeriod uint, encodingConfig simappparams.EncodingConfig,
	appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp),
) *SifchainApp

func NewSifAppWithBlacklist added in v0.13.4

func NewSifAppWithBlacklist(
	logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
	homePath string, invCheckPeriod uint, encodingConfig simappparams.EncodingConfig,
	appOpts servertypes.AppOptions, blackListedAddresses []sdk.AccAddress, baseAppOptions ...func(*baseapp.BaseApp),
) *SifchainApp

func Setup

func Setup(isCheckTx bool) *SifchainApp

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

func SetupFromGenesis added in v0.13.0

func SetupFromGenesis(isCheckTx bool, genesisTransformer func(*SifchainApp, GenesisState) GenesisState) *SifchainApp

func SetupWithBlacklist added in v0.13.4

func SetupWithBlacklist(isCheckTx bool, blacklist []sdk.AccAddress) *SifchainApp

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

func (*SifchainApp) AppCodec

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

AppCodec returns SimApp'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 (*SifchainApp) BeginBlocker

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

func (*SifchainApp) EndBlocker

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

func (*SifchainApp) ExportAppStateAndValidators

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

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

func (*SifchainApp) GetKey

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

func (*SifchainApp) GetMemKey

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

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*SifchainApp) GetSubspace

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

func (app *SifchainApp) 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 (*SifchainApp) InitChainer

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

func (*SifchainApp) LegacyAmino

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

func (*SifchainApp) LoadHeight

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

LoadHeight loads a particular height

func (*SifchainApp) ModuleAccountAddrs

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

ModuleAccountAddrs returns all the app's module account addresses.

func (*SifchainApp) RegisterAPIRoutes

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

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

func (*SifchainApp) RegisterTendermintService

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

RegisterTendermintService implements the Application.RegisterTendermintService method.

func (*SifchainApp) RegisterTxService

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

RegisterTxService implements the Application.RegisterTxService method.

func (*SifchainApp) SimulationManager

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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