Documentation
¶
Overview ¶
Package types provides compatibility shims for the cosmos/evm migration. This file will be progressively removed as each usage is migrated to the correct cosmos/evm package.
Copyright Tharsis Labs Ltd.(Evmos) SPDX-License-Identifier:ENCL-1.0(https://github.com/evmos/evmos/blob/main/LICENSE)
Index ¶
- Constants
- Variables
- func ChainIDFromGenesisFile(homePath string) string
- func ConvertAddressCosmos2Evm(cosmosAddress string) (string, error)
- func ConvertAddressEvm2Cosmos(evmAddress string) (string, error)
- func GetUptickAddressFromBech32(address string) (sdk.AccAddress, error)
- func IsSupportedKey(pubkey cryptotypes.PubKey) bool
- func IsValidChainID(chainID string) bool
- func ParseEIP155ChainID(chainID string) (uint64, error)
- func ResolveEVMChainID(appOpts servertypes.AppOptions, cosmosChainID string) uint64
- func ValidateAddress(addr string) error
- type EthAccount
- type GenesisState
Constants ¶
const ( // MainnetEVMChainID is the EIP-155 chain ID for uptick_117-1. MainnetEVMChainID uint64 = 117 // TestnetEVMChainID is the EIP-155 chain ID for uptick_1170-3. TestnetEVMChainID uint64 = 1170 )
const AttoPhoton = "auptick"
AttoPhoton is the base denomination for Uptick.
const BIP44HDPath = "m/44'/60'/0'/0/0"
BIP44HDPath is the default HD path for EVM keys.
const BaseDenomUnit = 18
BaseDenomUnit is the number of decimal places in the base denom (18 for EVM chains).
const Bip44CoinType = 60
Bip44CoinType is the BIP-44 coin type for EVM chains.
const RootCodespace = "uptick"
RootCodespace is the codespace for all errors defined in this package
Variables ¶
var (
ErrKeyTypeNotSupported = sdkerrors.Register(RootCodespace, codeKeyTypeNotSupported, "key type 'secp256k1' not supported")
)
errors
var PowerReduction = math.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))
PowerReduction is the power reduction for EVM chains (10^18).
var ProtoAccount = authtypes.ProtoBaseAccount
ProtoAccount is the default proto account type. In cosmos/evm, standard BaseAccount is used instead of EthAccount.
Functions ¶
func ChainIDFromGenesisFile ¶ added in v0.4.0
ChainIDFromGenesisFile reads the Cosmos chain-id from $home/config/genesis.json.
func ConvertAddressCosmos2Evm ¶ added in v0.2.16
func ConvertAddressEvm2Cosmos ¶ added in v0.2.16
func GetUptickAddressFromBech32 ¶
func GetUptickAddressFromBech32(address string) (sdk.AccAddress, error)
GetUptickAddressFromBech32 returns the sdk.Account address of given address, while also changing bech32 human readable prefix (HRP) to the value set on the global sdk.Config (eg: `uptick`). The function fails if the provided bech32 address is invalid.
func IsSupportedKey ¶
func IsSupportedKey(pubkey cryptotypes.PubKey) bool
IsSupportedKey returns true if the pubkey type is supported by the chain (i.e eth_secp256k1, amino multisig, ed25519). NOTE: Nested multisigs are not supported.
func IsValidChainID ¶ added in v0.4.0
IsValidChainID reports whether chainID is a Cosmos EIP-155 id of the form {name}_{eip155}-{revision}, e.g. uptick_117-1.
func ParseEIP155ChainID ¶ added in v0.4.0
ParseEIP155ChainID extracts the EIP-155 id from a Cosmos chain-id of the form {name}_{eip155}-{revision}, e.g. uptick_117-1 → 117.
func ResolveEVMChainID ¶ added in v0.4.0
func ResolveEVMChainID(appOpts servertypes.AppOptions, cosmosChainID string) uint64
ResolveEVMChainID derives the EIP-155 chain id from the Cosmos chain-id ({name}_{eip155}-{revision}). app.toml / --evm.evm-chain-id is only used when no parseable Cosmos chain-id is available. The cosmos/evm default 262144 is treated as unset so NewRootCmd's temporary app does not lock start.
func ValidateAddress ¶ added in v0.4.0
ValidateAddress validates that the given string is a valid hex (Ethereum) address.
Types ¶
type EthAccount ¶ added in v0.4.0
type EthAccount struct {
*authtypes.BaseAccount
CodeHash string
}
EthAccount wraps BaseAccount with a CodeHash for EVM compatibility. In cosmos/evm, EthAccount is no longer used — standard BaseAccount is used instead. This type is provided as a temporary shim during migration.
type GenesisState ¶ added in v0.3.0
type GenesisState map[string]json.RawMessage
GenesisState 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.