types

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// NativeToken defines the default coin denomination used in OKExChain 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 OKExChain.
	NativeToken string = sdk.DefaultBondDenom

	// BaseDenomUnit defines the base denomination unit for Photons.
	// 1 photon = 1x10^{BaseDenomUnit} aphoton
	BaseDenomUnit = 18
)
View Source
const (
	// EthBech32Prefix defines the Bech32 prefix used for EthAccounts
	EthBech32Prefix = "ex"

	// 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        = 996
	BIP44HDPathOKExChain = "m/44'/996'/0'/0/0"
)
View Source
const (
	// DefaultGasPrice is default gas price for evm transactions
	DefaultGasPrice = 1
	// DefaultRPCGasLimit is default gas limit for RPC call operations
	DefaultRPCGasLimit = 30000000
)
View Source
const (
	// EthAccountName is the amino encoding name for EthAccount
	EthAccountName = "okexchain/EthAccount"
)
View Source
const (

	// ProtocolVersion is the latest supported version of the eth protocol.
	ProtocolVersion = eth65
)

Constants to match up protocol versions and messages

View Source
const (
	// RootCodespace is the codespace for all errors defined in this package
	RootCodespace = "okexchain"
)

Variables

View Source
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")

	// ErrVMExecution returns an error resulting from an error in EVM execution.
	ErrVMExecution = sdkerrors.Register(RootCodespace, 4, "error while executing evm transaction")

	ErrInvalidMsgType = sdkerrors.Register(RootCodespace, 5, "invalid message type")
)
View Source
var (
	// BIP44HDPath is the BIP44 HD path used on Ethereum.
	BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
)

Functions

func IsValidChainID

func IsValidChainID(chainID string) bool

IsValidChainID returns false if the given chain identifier is incorrectly formatted.

func IsValidateChainIdWithGenesisHeight added in v1.0.0

func IsValidateChainIdWithGenesisHeight(chainID string) error

func NewPhotonCoin

func NewPhotonCoin(amount sdk.Int) sdk.Coin

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

func NewPhotonCoinInt64(amount int64) sdk.Coin

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

func NewPhotonDecCoin(amount sdk.Int) sdk.SysCoin

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

func ParseChainID(chainID string) (*big.Int, error)

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

func ProtoAccount() exported.Account

ProtoAccount defines the prototype function for BaseAccount used for an AccountKeeper.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the account interfaces and concrete types on the provided Amino codec.

func SetBech32Prefixes

func SetBech32Prefixes(config *sdk.Config)

SetBech32Prefixes sets the global prefixes to be used when serializing addresses and public keys to Bech32 strings.

func SetBip44CoinType

func SetBip44CoinType(config *sdk.Config)

SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets.

Types

type Code

type Code []byte

Code is account Code type alias

func (Code) String

func (c Code) String() string

type EthAccount

type EthAccount struct {
	*authtypes.BaseAccount `json:"base_account" yaml:"base_account"`
	CodeHash               []byte `json:"code_hash" yaml:"code_hash"`
}

EthAccount implements the auth.Account interface and embeds an auth.BaseAccount type. It is compatible with the auth.AccountKeeper.

func (EthAccount) Balance

func (acc EthAccount) Balance(denom string) sdk.Dec

Balance returns the balance of an account.

func (EthAccount) Copy added in v1.0.0

func (acc EthAccount) Copy() interface{}

func (EthAccount) EthAddress

func (acc EthAccount) EthAddress() ethcmn.Address

EthAddress returns the account address ethereum format.

func (EthAccount) MarshalJSON

func (acc EthAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of an EthAccount.

func (EthAccount) MarshalToAmino added in v0.19.16

func (acc EthAccount) MarshalToAmino(cdc *amino.Codec) ([]byte, error)

func (EthAccount) MarshalYAML

func (acc EthAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of an account.

func (*EthAccount) SetBalance

func (acc *EthAccount) SetBalance(denom string, amt sdk.Dec)

SetBalance sets an account's balance of the given coin denomination.

CONTRACT: assumes the denomination is valid.

func (EthAccount) String

func (acc EthAccount) String() string

String implements the fmt.Stringer interface

func (*EthAccount) UnmarshalFromAmino added in v1.1.6

func (acc *EthAccount) UnmarshalFromAmino(cdc *amino.Codec, data []byte) error

func (*EthAccount) UnmarshalJSON

func (acc *EthAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into an EthAccount.

type NodeMode added in v0.19.14

type NodeMode string
const (
	// node mode values
	RpcNode       NodeMode = "rpc"
	ValidatorNode NodeMode = "validator"
	ArchiveNode   NodeMode = "archive"

	// node mode flag
	FlagNodeMode = "node-mode"
)

Jump to

Keyboard shortcuts

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