types

package
v0.0.0-...-69704c5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NativeToken defines the default coin denomination used in Fanx 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 Fanx.
	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
	BIP44HDPathFanx = "m/44'/996'/0'/0/0"
)
View Source
const (
	CongestionHigherGpMode = 0
	NormalGpMode           = 1
	MinimalGpMode          = 2

	NoGasUsedCap = -1
)
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 = "okfanx/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 = "okfanx"
)

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 BigIntArray

type BigIntArray []*big.Int

func (BigIntArray) Len

func (s BigIntArray) Len() int

func (BigIntArray) Less

func (s BigIntArray) Less(i, j int) bool

func (BigIntArray) Swap

func (s BigIntArray) Swap(i, j int)

type BlockGPResults

type BlockGPResults struct {
	// contains filtered or unexported fields
}

BlockGPResults is a circular queue of SingleBlockGPs

func NewBlockGPResults

func NewBlockGPResults(checkBlocksNum int) *BlockGPResults

func (BlockGPResults) Cap

func (rs BlockGPResults) Cap() int

func (*BlockGPResults) ExecuteSamplingBy

func (rs *BlockGPResults) ExecuteSamplingBy(lastPrice *big.Int, adoptHigherGp bool) []*big.Int

func (BlockGPResults) Front

func (rs BlockGPResults) Front() int

func (BlockGPResults) IsEmpty

func (rs BlockGPResults) IsEmpty() bool

func (BlockGPResults) IsFull

func (rs BlockGPResults) IsFull() bool

func (*BlockGPResults) Pop

func (rs *BlockGPResults) Pop() (*SingleBlockGPs, error)

func (*BlockGPResults) Push

func (rs *BlockGPResults) Push(gp *SingleBlockGPs) error

func (BlockGPResults) Rear

func (rs BlockGPResults) Rear() int

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

func (acc EthAccount) EthAddress() ethcmn.Address

EthAddress returns the account address ethereum format.

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

type SingleBlockGPs

type SingleBlockGPs struct {
	// contains filtered or unexported fields
}

SingleBlockGPs holds the gas price of all transactions in a block and will sample the lower few gas prices according to sampleNumber.

func NewSingleBlockGPs

func NewSingleBlockGPs() *SingleBlockGPs

func (*SingleBlockGPs) AddSampledGP

func (bgp *SingleBlockGPs) AddSampledGP(gp *big.Int)

func (*SingleBlockGPs) Clear

func (bgp *SingleBlockGPs) Clear()

func (*SingleBlockGPs) Copy

func (bgp *SingleBlockGPs) Copy() *SingleBlockGPs

func (SingleBlockGPs) GetAll

func (bgp SingleBlockGPs) GetAll() []*big.Int

func (SingleBlockGPs) GetGasUsed

func (bgp SingleBlockGPs) GetGasUsed() uint64

func (SingleBlockGPs) GetSampled

func (bgp SingleBlockGPs) GetSampled() []*big.Int

func (*SingleBlockGPs) SampleGP

func (bgp *SingleBlockGPs) SampleGP(adoptHigherGp bool)

func (*SingleBlockGPs) Update

func (bgp *SingleBlockGPs) Update(gp *big.Int, gas uint64)

Jump to

Keyboard shortcuts

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