types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NativeToken defines the default coin denomination used in brczero 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 brczero.
	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
	BIP44HDPathbrczero = "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 = system.Chain + "/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 = "brczero"
)

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

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.

func SetChainId

func SetChainId(chainid string) error

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"`
	StateRoot              ethcmn.Hash `json:"state_root" yaml:"state_root"` // merkle root of the storage trie
}

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

func (EthAccount) AminoSize

func (acc EthAccount) AminoSize(cdc *amino.Codec) int

func (EthAccount) Balance

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

Balance returns the balance of an account.

func (EthAccount) Copy

func (acc EthAccount) Copy() sdk.Account

func (EthAccount) DeepCopy

func (acc EthAccount) DeepCopy() sdk.Account

func (EthAccount) EthAddress

func (acc EthAccount) EthAddress() ethcmn.Address

EthAddress returns the account address ethereum format.

func (EthAccount) GetCodeHash

func (acc EthAccount) GetCodeHash() []byte

func (EthAccount) GetStateRoot

func (acc EthAccount) GetStateRoot() ethcmn.Hash

func (EthAccount) IsContract

func (acc EthAccount) IsContract() bool

IsContract returns if the account contains contract code.

func (EthAccount) MarshalAminoTo

func (acc EthAccount) MarshalAminoTo(cdc *amino.Codec, buf *bytes.Buffer) error

func (EthAccount) MarshalJSON

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

MarshalJSON returns the JSON representation of an EthAccount.

func (EthAccount) MarshalToAmino

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) SetStateRoot

func (acc *EthAccount) SetStateRoot(hash ethcmn.Hash)

func (EthAccount) String

func (acc EthAccount) String() string

String implements the fmt.Stringer interface

func (*EthAccount) UnmarshalFromAmino

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

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

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

Jump to

Keyboard shortcuts

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