Documentation
¶
Overview ¶
Copyright Tharsis Labs Ltd.(Evmos) SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)
Index ¶
- Constants
- Variables
- func BlockedAddresses() map[string]bool
- func EvmosAppOptions(chainID string) error
- func GetMaccPerms() map[string][]string
- func NewAvailableStaticPrecompiles(stakingKeeper stakingkeeper.Keeper, ...) map[common.Address]vm.PrecompiledContract
- func NewEVMGenesisState() *evmtypes.GenesisState
- func NewErc20GenesisState() *erc20types.GenesisState
- func NewMintGenesisState() *minttypes.GenesisState
- func NoOpEvmosOptions(_ string) error
- func SetupTestingApp(chainID string) func() (ibctesting.TestingApp, map[string]json.RawMessage)
- type EvmosOptionsFn
- type ExampleChain
- func (app *ExampleChain) AppCodec() codec.Codec
- func (app *ExampleChain) AutoCliOpts() autocli.AppOptions
- func (app *ExampleChain) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
- func (a *ExampleChain) Configurator() module.Configurator
- func (a *ExampleChain) DefaultGenesis() map[string]json.RawMessage
- func (app *ExampleChain) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error)
- func (app *ExampleChain) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)
- func (app *ExampleChain) FinalizeBlock(req *abci.RequestFinalizeBlock) (res *abci.ResponseFinalizeBlock, err error)
- func (app *ExampleChain) GetBaseApp() *baseapp.BaseApp
- func (app *ExampleChain) GetIBCKeeper() *ibckeeper.Keeper
- func (app *ExampleChain) GetKey(storeKey string) *storetypes.KVStoreKey
- func (app *ExampleChain) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
- func (app *ExampleChain) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
- func (app *ExampleChain) GetStakingKeeper() ibctestingtypes.StakingKeeper
- func (app *ExampleChain) GetStakingKeeperSDK() stakingkeeper.Keeper
- func (app *ExampleChain) GetSubspace(moduleName string) paramstypes.Subspace
- func (app *ExampleChain) GetTKey(storeKey string) *storetypes.TransientStoreKey
- func (app *ExampleChain) GetTxConfig() client.TxConfig
- func (app *ExampleChain) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
- func (app *ExampleChain) InterfaceRegistry() types.InterfaceRegistry
- func (app *ExampleChain) LegacyAmino() *codec.LegacyAmino
- func (app *ExampleChain) LoadHeight(height int64) error
- func (app *ExampleChain) Name() string
- func (app *ExampleChain) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error)
- func (app *ExampleChain) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
- func (app *ExampleChain) RegisterNodeService(clientCtx client.Context, cfg config.Config)
- func (app *ExampleChain) RegisterTendermintService(clientCtx client.Context)
- func (app *ExampleChain) RegisterTxService(clientCtx client.Context)
- func (app ExampleChain) RegisterUpgradeHandlers()
- func (app *ExampleChain) SimulationManager() *module.SimulationManager
- func (app *ExampleChain) TxConfig() client.TxConfig
- type GenesisState
- type SetupOptions
Constants ¶
const ( // ExampleChainDenom is the denomination of the evmOS example chain's base coin. ExampleChainDenom = "aevmos" // ExampleDisplayDenom is the display denomination of the evmOS example chain's base coin. ExampleDisplayDenom = "evmos" // EighteenDecimalsChainID is the chain ID for the 18 decimals chain. EighteenDecimalsChainID = "os_9001" // SixDecimalsChainID is the chain ID for the 6 decimals chain. SixDecimalsChainID = "ossix_9002" )
const WEVMOSContractMainnet = "0xD4949664cD82660AaE99bEdc034a0deA8A0bd517"
WEVMOSContractMainnet is the WEVMOS contract address for mainnet
Variables ¶
var ChainsCoinInfo = map[string]evmtypes.EvmCoinInfo{ EighteenDecimalsChainID: { Denom: ExampleChainDenom, DisplayDenom: ExampleDisplayDenom, Decimals: evmtypes.EighteenDecimals, }, }
ChainsCoinInfo is a map of the chain id and its corresponding EvmCoinInfo that allows initializing the app with different coin info based on the chain id
var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string )
var ExampleTokenPairs = []erc20types.TokenPair{ { Erc20Address: WEVMOSContractMainnet, Denom: ExampleChainDenom, Enabled: true, ContractOwner: erc20types.OWNER_MODULE, }, }
ExampleTokenPairs creates a slice of token pairs, that contains a pair for the native denom of the example chain implementation.
Functions ¶
func BlockedAddresses ¶
BlockedAddresses returns all the app's blocked account addresses.
Note, this includes:
- module accounts
- Ethereum's native precompiled smart contracts
- evmOS' available static precompiled contracts
func EvmosAppOptions ¶
EvmosAppOptions allows to setup the global configuration for the Evmos chain.
func GetMaccPerms ¶
GetMaccPerms returns a copy of the module account permissions
func NewAvailableStaticPrecompiles ¶
func NewAvailableStaticPrecompiles( stakingKeeper stakingkeeper.Keeper, distributionKeeper distributionkeeper.Keeper, bankKeeper bankkeeper.Keeper, erc20Keeper erc20Keeper.Keeper, authzKeeper authzkeeper.Keeper, transferKeeper transferkeeper.Keeper, channelKeeper channelkeeper.Keeper, evmKeeper *evmkeeper.Keeper, govKeeper govkeeper.Keeper, slashingKeeper slashingkeeper.Keeper, evidenceKeeper evidencekeeper.Keeper, ) map[common.Address]vm.PrecompiledContract
NewAvailableStaticPrecompiles returns the list of all available static precompiled contracts from evmOS.
NOTE: this should only be used during initialization of the Keeper.
func NewEVMGenesisState ¶
func NewEVMGenesisState() *evmtypes.GenesisState
NewEVMGenesisState returns the default genesis state for the EVM module.
NOTE: for the example chain implementation we need to set the default EVM denomination and enable ALL precompiles.
func NewErc20GenesisState ¶
func NewErc20GenesisState() *erc20types.GenesisState
NewErc20GenesisState returns the default genesis state for the ERC20 module.
NOTE: for the example chain implementation we are also adding a default token pair, which is the base denomination of the chain (i.e. the WEVMOS contract).
func NewMintGenesisState ¶
func NewMintGenesisState() *minttypes.GenesisState
NewMintGenesisState returns the default genesis state for the mint module.
NOTE: for the example chain implementation we are also adding a default minter.
func NoOpEvmosOptions ¶
NoOpEvmosOptions is a no-op function that can be used when the app does not need any specific configuration.
func SetupTestingApp ¶
func SetupTestingApp(chainID string) func() (ibctesting.TestingApp, map[string]json.RawMessage)
SetupTestingApp initializes the IBC-go testing application need to keep this design to comply with the ibctesting SetupTestingApp func and be able to set the chainID for the tests properly
Types ¶
type EvmosOptionsFn ¶
EvmosOptionsFn defines a function type for setting app options specifically for the Evmos app. The function should receive the chainID and return an error if any.
type ExampleChain ¶
type ExampleChain 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 UpgradeKeeper *upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper AuthzKeeper authzkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper // IBC keepers IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly TransferKeeper transferkeeper.Keeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper // evmOS keepers FeeMarketKeeper feemarketkeeper.Keeper EVMKeeper *evmkeeper.Keeper Erc20Keeper erc20keeper.Keeper // the module manager ModuleManager *module.Manager BasicModuleManager module.BasicManager // contains filtered or unexported fields }
ExampleChain 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 NewExampleApp ¶
func NewExampleApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, evmosAppOptions EvmosOptionsFn, baseAppOptions ...func(*baseapp.BaseApp), ) *ExampleChain
NewExampleApp returns a reference to an initialized ExampleChain.
func Setup ¶
func Setup(t *testing.T, chainID string) *ExampleChain
Setup initializes a new ExampleChain. A Nop logger is set in ExampleChain.
func SetupWithGenesisValSet ¶
func SetupWithGenesisValSet(t *testing.T, chainID string, valSet *cmttypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *ExampleChain
SetupWithGenesisValSet initializes a new ExampleChain 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 ExampleChain.
func (*ExampleChain) AppCodec ¶
func (app *ExampleChain) AppCodec() codec.Codec
AppCodec returns ExampleChain'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 (*ExampleChain) AutoCliOpts ¶
func (app *ExampleChain) AutoCliOpts() autocli.AppOptions
AutoCliOpts returns the autocli options for the app.
func (*ExampleChain) BeginBlocker ¶
func (app *ExampleChain) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
BeginBlocker application updates every begin block
func (*ExampleChain) Configurator ¶
func (a *ExampleChain) Configurator() module.Configurator
func (*ExampleChain) DefaultGenesis ¶
func (a *ExampleChain) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis returns a default genesis from the registered AppModuleBasic's.
TODO: change all receivers to osApp
func (*ExampleChain) EndBlocker ¶
EndBlocker application updates every end block
func (*ExampleChain) ExportAppStateAndValidators ¶
func (app *ExampleChain) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string) (servertypes.ExportedApp, error)
ExportAppStateAndValidators exports the state of the application for a genesis file.
func (*ExampleChain) FinalizeBlock ¶
func (app *ExampleChain) FinalizeBlock(req *abci.RequestFinalizeBlock) (res *abci.ResponseFinalizeBlock, err error)
func (*ExampleChain) GetBaseApp ¶
func (app *ExampleChain) GetBaseApp() *baseapp.BaseApp
GetBaseApp implements the TestingApp interface.
func (*ExampleChain) GetIBCKeeper ¶
func (app *ExampleChain) GetIBCKeeper() *ibckeeper.Keeper
GetIBCKeeper implements the TestingApp interface.
func (*ExampleChain) GetKey ¶
func (app *ExampleChain) 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 (*ExampleChain) GetMemKey ¶
func (app *ExampleChain) GetMemKey(storeKey string) *storetypes.MemoryStoreKey
GetMemKey returns the MemStoreKey for the provided mem key.
NOTE: This is solely used for testing purposes.
func (*ExampleChain) GetScopedIBCKeeper ¶
func (app *ExampleChain) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper
GetScopedIBCKeeper implements the TestingApp interface.
func (*ExampleChain) GetStakingKeeper ¶
func (app *ExampleChain) GetStakingKeeper() ibctestingtypes.StakingKeeper
GetStakingKeeper implements the TestingApp interface.
func (*ExampleChain) GetStakingKeeperSDK ¶
func (app *ExampleChain) GetStakingKeeperSDK() stakingkeeper.Keeper
GetStakingKeeperSDK implements the TestingApp interface.
func (*ExampleChain) GetSubspace ¶
func (app *ExampleChain) 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 (*ExampleChain) GetTKey ¶
func (app *ExampleChain) 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 (*ExampleChain) GetTxConfig ¶
func (app *ExampleChain) GetTxConfig() client.TxConfig
GetTxConfig implements the TestingApp interface.
func (*ExampleChain) InitChainer ¶
func (app *ExampleChain) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error)
InitChainer application update at chain initialization
func (*ExampleChain) InterfaceRegistry ¶
func (app *ExampleChain) InterfaceRegistry() types.InterfaceRegistry
InterfaceRegistry returns ExampleChain's InterfaceRegistry
func (*ExampleChain) LegacyAmino ¶
func (app *ExampleChain) LegacyAmino() *codec.LegacyAmino
LegacyAmino returns ExampleChain'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 (*ExampleChain) LoadHeight ¶
func (app *ExampleChain) LoadHeight(height int64) error
LoadHeight loads a particular height
func (*ExampleChain) PreBlocker ¶
func (app *ExampleChain) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error)
func (*ExampleChain) RegisterAPIRoutes ¶
func (app *ExampleChain) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)
RegisterAPIRoutes registers all application module routes with the provided API server.
func (*ExampleChain) RegisterNodeService ¶
func (app *ExampleChain) RegisterNodeService(clientCtx client.Context, cfg config.Config)
func (*ExampleChain) RegisterTendermintService ¶
func (app *ExampleChain) RegisterTendermintService(clientCtx client.Context)
RegisterTendermintService implements the Application.RegisterTendermintService method.
func (*ExampleChain) RegisterTxService ¶
func (app *ExampleChain) RegisterTxService(clientCtx client.Context)
RegisterTxService implements the Application.RegisterTxService method.
func (ExampleChain) RegisterUpgradeHandlers ¶
func (app ExampleChain) RegisterUpgradeHandlers()
func (*ExampleChain) SimulationManager ¶
func (app *ExampleChain) SimulationManager() *module.SimulationManager
SimulationManager implements the SimulationApp interface
func (*ExampleChain) TxConfig ¶
func (app *ExampleChain) TxConfig() client.TxConfig
TxConfig returns ExampleChain's TxConfig
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.
type SetupOptions ¶
type SetupOptions struct { Logger log.Logger DB *dbm.MemDB AppOpts servertypes.AppOptions }
SetupOptions defines arguments that are passed into `Simapp` constructor.