Documentation ¶
Index ¶
- Constants
- Variables
- func BlockGasLimit(ctx sdk.Context) uint64
- func GenerateRandomChainID() string
- func IsEmptyHash(hash string) bool
- func IsValidChainID(chainID string) bool
- func IsZeroAddress(address string) bool
- func NewPhotonCoin(amount sdk.Int) sdk.Coin
- func NewPhotonCoinInt64(amount int64) sdk.Coin
- func NewPhotonDecCoin(amount sdk.Int) sdk.DecCoin
- func ParseChainID(chainID string) (*big.Int, error)
- func ProtoAccount() authtypes.AccountI
- func RegisterInterfaces(registry codectypes.InterfaceRegistry)
- func SetBech32Prefixes(config *sdk.Config)
- func SetBip44CoinType(config *sdk.Config)
- func ValidateAddress(address string) error
- type Code
- type EthAccount
- func (*EthAccount) Descriptor() ([]byte, []int)
- func (acc EthAccount) EthAddress() common.Address
- func (acc EthAccount) GetCodeHash() common.Hash
- func (m *EthAccount) Marshal() (dAtA []byte, err error)
- func (m *EthAccount) MarshalTo(dAtA []byte) (int, error)
- func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*EthAccount) ProtoMessage()
- func (m *EthAccount) Reset()
- func (m *EthAccount) Size() (n int)
- func (m *EthAccount) Unmarshal(dAtA []byte) error
- func (m *EthAccount) XXX_DiscardUnknown()
- func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *EthAccount) XXX_Merge(src proto.Message)
- func (m *EthAccount) XXX_Size() int
- func (m *EthAccount) XXX_Unmarshal(b []byte) error
Constants ¶
const ( // AttoPhoton defines the default coin denomination used in Ethermint in: // // - Staking parameters: denomination used as stake in the dPoS chain // - Mint parameters: denomination minted due to fee distribution rewards // - Governance parameters: denomination used for spam prevention in proposal deposits // - Crisis parameters: constant fee denomination used for spam prevention to check broken invariant // - EVM parameters: denomination used for running EVM state transitions in Ethermint. AttoPhoton string = "aphoton" // BaseDenomUnit defines the base denomination unit for Photons. // 1 photon = 1x10^{BaseDenomUnit} aphoton BaseDenomUnit = 18 )
const ( // EthBech32Prefix defines the Bech32 prefix used for EthAccounts EthBech32Prefix = "eth" // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address Bech32PrefixAccAddr = EthBech32Prefix // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key Bech32PrefixAccPub = EthBech32Prefix + sdk.PrefixPublic // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address Bech32PrefixValAddr = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key Bech32PrefixValPub = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixOperator + sdk.PrefixPublic // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address Bech32PrefixConsAddr = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key Bech32PrefixConsPub = EthBech32Prefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic // Bip44CoinType satisfies EIP84. See https://github.com/ethereum/EIPs/issues/84 for more info. Bip44CoinType = 60 )
const ( // DefaultGasPrice is default gas price for evm transactions DefaultGasPrice = 20 // DefaultRPCGasLimit is default gas limit for RPC call operations DefaultRPCGasLimit = 10000000 )
const (
// ProtocolVersion is the latest supported version of the eth protocol.
ProtocolVersion = eth65
)
Constants to match up protocol versions and messages
const (
// RootCodespace is the codespace for all errors defined in this package
RootCodespace = "ethermint"
)
Variables ¶
var ( ErrInvalidLengthAccount = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowAccount = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupAccount = fmt.Errorf("proto: unexpected end of group") )
var ( // BIP44HDPath is the BIP44 HD path used on Ethereum. BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String() // PowerReduction defines the default power reduction value for staking PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)) )
var ( // ErrInvalidValue returns an error resulting from an invalid value. ErrInvalidValue = sdkerrors.Register(RootCodespace, 2, "invalid value") // ErrInvalidChainID returns an error resulting from an invalid chain ID. ErrInvalidChainID = sdkerrors.Register(RootCodespace, 3, "invalid chain ID") // ErrMarshalBigInt returns an error resulting from marshaling a big.Int to a string. ErrMarshalBigInt = sdkerrors.Register(RootCodespace, 5, "cannot marshal big.Int to string") // ErrUnmarshalBigInt returns an error resulting from unmarshaling a big.Int from a string. ErrUnmarshalBigInt = sdkerrors.Register(RootCodespace, 6, "cannot unmarshal big.Int from string") )
Functions ¶
func BlockGasLimit ¶
BlockGasLimit returns the max gas (limit) defined in the block gas meter. If the meter is not set, it returns the max gas from the application consensus params. NOTE: see https://github.com/cosmos/cosmos-sdk/issues/9514 for full reference
func GenerateRandomChainID ¶
func GenerateRandomChainID() string
GenerateRandomChainID returns a random chain-id in the valid format.
func IsEmptyHash ¶
IsEmptyHash returns true if the hash corresponds to an empty ethereum hex hash.
func IsValidChainID ¶
IsValidChainID returns false if the given chain identifier is incorrectly formatted.
func IsZeroAddress ¶
IsZeroAddress returns true if the address corresponds to an empty ethereum hex address.
func NewPhotonCoin ¶
NewPhotonCoin is a utility function that returns an "aphoton" coin with the given sdk.Int amount. The function will panic if the provided amount is negative.
func NewPhotonCoinInt64 ¶
NewPhotonCoinInt64 is a utility function that returns an "aphoton" coin with the given int64 amount. The function will panic if the provided amount is negative.
func NewPhotonDecCoin ¶
NewPhotonDecCoin is a utility function that returns an "aphoton" decimal coin with the given sdk.Int amount. The function will panic if the provided amount is negative.
func ParseChainID ¶
ParseChainID parses a string chain identifier's epoch to an Ethereum-compatible chain-id in *big.Int format. The function returns an error if the chain-id has an invalid format
func ProtoAccount ¶
ProtoAccount defines the prototype function for BaseAccount used for an AccountKeeper.
func RegisterInterfaces ¶
func RegisterInterfaces(registry codectypes.InterfaceRegistry)
RegisterInterfaces registers the tendermint concrete client-related implementations and interfaces.
func SetBech32Prefixes ¶
SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings.
func SetBip44CoinType ¶
SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets.
func ValidateAddress ¶
ValidateAddress returns an error if the provided string is either not a hex formatted string address
Types ¶
type EthAccount ¶
type EthAccount struct { *types.BaseAccount `` /* 136-byte string literal not displayed */ CodeHash string `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty" yaml:"code_hash"` }
EthAccount implements the authtypes.AccountI interface and embeds an authtypes.BaseAccount type. It is compatible with the auth AccountKeeper.
func (*EthAccount) Descriptor ¶
func (*EthAccount) Descriptor() ([]byte, []int)
func (EthAccount) EthAddress ¶
func (acc EthAccount) EthAddress() common.Address
EthAddress returns the account address ethereum format.
func (EthAccount) GetCodeHash ¶
func (acc EthAccount) GetCodeHash() common.Hash
GetCodeHash returns the account code hash in byte format
func (*EthAccount) Marshal ¶
func (m *EthAccount) Marshal() (dAtA []byte, err error)
func (*EthAccount) MarshalToSizedBuffer ¶
func (m *EthAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*EthAccount) ProtoMessage ¶
func (*EthAccount) ProtoMessage()
func (*EthAccount) Reset ¶
func (m *EthAccount) Reset()
func (*EthAccount) Size ¶
func (m *EthAccount) Size() (n int)
func (*EthAccount) Unmarshal ¶
func (m *EthAccount) Unmarshal(dAtA []byte) error
func (*EthAccount) XXX_DiscardUnknown ¶
func (m *EthAccount) XXX_DiscardUnknown()
func (*EthAccount) XXX_Marshal ¶
func (m *EthAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*EthAccount) XXX_Merge ¶
func (m *EthAccount) XXX_Merge(src proto.Message)
func (*EthAccount) XXX_Size ¶
func (m *EthAccount) XXX_Size() int
func (*EthAccount) XXX_Unmarshal ¶
func (m *EthAccount) XXX_Unmarshal(b []byte) error