types

package
v1.2.0-dhobyghaut Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name          = "fxcore"
	AddressPrefix = "fx"

	DefaultDenom = "FX"
	// BaseDenomUnit defines the base denomination unit for Photons.
	// 1 FX = 1x10^{BaseDenomUnit} fx
	BaseDenomUnit = 18

	// DefaultGasPrice is default gas price for evm transactions 500Gwei
	DefaultGasPrice = 500000000000
)
View Source
const (
	EmptyEvmAddress   = "0x0000000000000000000000000000000000000000"
	FIP20LogicAddress = "0x0000000000000000000000000000000000001001"
	WFXLogicAddress   = "0x0000000000000000000000000000000000001002"
)
View Source
const (
	FIP20TransferToChainPrefix = "chain/"
	FIP20TransferToIBCPrefix   = "ibc/"
)
View Source
const ExternalContractAddressLen = 42

ExternalContractAddressLen is the length of contract address strings

View Source
const (
	FIP20EventTransferCrossChain = "TransferCrossChain"
)
View Source
const (

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

Constants to match up protocol versions and messages

Variables

View Source
var (
	ErrInvalidLengthAccount        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAccount          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAccount = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthWeb3        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWeb3          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWeb3 = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// BIP44HDPath is the default BIP44 HD path used on Ethereum.
	BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
)
View Source
var ChainID = "fxcore"
View Source
var (
	ExternalAddressRegular = regexp.MustCompile("^0x[0-9a-fA-F]{40}$")
)

Functions

func BlockGasLimit

func BlockGasLimit(ctx sdk.Context) uint64

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 Byte32ToString

func Byte32ToString(bytes [32]byte) string

func ChangeNetworkForTest

func ChangeNetworkForTest(newNetwork string)

ChangeNetworkForTest change network for test

func CrossChainSupportBscBlock

func CrossChainSupportBscBlock() int64

func CrossChainSupportPolygonAndTronBlock

func CrossChainSupportPolygonAndTronBlock() int64

func EIP155ChainID

func EIP155ChainID() *big.Int

func EvmV0ClearKVStores

func EvmV0ClearKVStores() []string

func EvmV0SupportBlock

func EvmV0SupportBlock() int64

func EvmV1SupportBlock

func EvmV1SupportBlock() int64

func GetFxBankMetaData

func GetFxBankMetaData(denom string) banktypes.Metadata

func GetMetadata

func GetMetadata() []banktypes.Metadata

func GravityPruneValsetAndAttestationBlock

func GravityPruneValsetAndAttestationBlock() int64

func GravityValsetSlashBlock

func GravityValsetSlashBlock() int64

func IsEmptyHash

func IsEmptyHash(hash string) bool

IsEmptyHash returns true if the hash corresponds to an empty ethereum hex hash.

func IsRequestBatchBaseFee

func IsRequestBatchBaseFee(height int64) bool

func IsZeroAddress

func IsZeroAddress(address string) bool

IsZeroAddress returns true if the address corresponds to an empty ethereum hex address.

func Network

func Network() string

func NetworkDevnet

func NetworkDevnet() string

func NetworkMainnet

func NetworkMainnet() string

func NetworkTestnet

func NetworkTestnet() string

func NewInfiniteGasMeterWithLimit

func NewInfiniteGasMeterWithLimit(limit sdk.Gas) sdk.GasMeter

NewInfiniteGasMeterWithLimit returns a reference to a new infiniteGasMeter.

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the tendermint concrete client-related implementations and interfaces.

func RequestBatchBaseFeeBlock

func RequestBatchBaseFeeBlock() int64

func SafeInt64

func SafeInt64(value uint64) (int64, error)

SafeInt64 checks for overflows while casting a uint64 to int64 value.

func StringToByte32

func StringToByte32(str string) [32]byte

func ValidateAddress

func ValidateAddress(address string) error

ValidateAddress validates the ethereum address strings

func ValidateAddressIgnoreChecksum

func ValidateAddressIgnoreChecksum(address string) error

func ValidateNonZeroAddress

func ValidateNonZeroAddress(address string) error

ValidateNonZeroAddress returns an error if the provided string is not a hex formatted string address or is equal to zero

Types

type Contract

type Contract struct {
	Address common.Address
	ABI     abi.ABI
	Bin     []byte
	Code    []byte
	Version string
}

func GetERC1967Proxy

func GetERC1967Proxy(height int64) Contract

func GetERC20

func GetERC20(height int64) Contract

func GetInitContracts

func GetInitContracts() []Contract

func GetUpgradeContracts

func GetUpgradeContracts(height int64) []Contract

func GetWFX

func GetWFX(height int64) Contract

type ErrorGasOverflow

type ErrorGasOverflow struct {
	Descriptor string
}

ErrorGasOverflow defines an error thrown when an action results gas consumption unsigned integer overflow.

type ErrorNegativeGasConsumed

type ErrorNegativeGasConsumed struct {
	Descriptor string
}

ErrorNegativeGasConsumed defines an error thrown when the amount of gas refunded results in a negative gas consumed amount. Copied from cosmos-sdk

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

func (m *EthAccount) Marshal() (dAtA []byte, err error)

func (*EthAccount) MarshalTo

func (m *EthAccount) MarshalTo(dAtA []byte) (int, 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

type ExtensionOptionsWeb3Tx

type ExtensionOptionsWeb3Tx struct {
	// typed data chain id used only in EIP712 Domain and should match
	// Ethereum network ID in a Web3 provider (e.g. Metamask).
	TypedDataChainID uint64 `protobuf:"varint,1,opt,name=typed_data_chain_id,json=typedDataChainId,proto3" json:"typedDataChainID,omitempty"`
	// fee payer is an account address for the fee payer. It will be validated
	// during EIP712 signature checking.
	FeePayer string `protobuf:"bytes,2,opt,name=fee_payer,json=feePayer,proto3" json:"feePayer,omitempty"`
	// fee payer sig is a signature data from the fee paying account,
	// allows to perform fee delegation when using EIP712 Domain.
	FeePayerSig []byte `protobuf:"bytes,3,opt,name=fee_payer_sig,json=feePayerSig,proto3" json:"feePayerSig,omitempty"`
}

func (*ExtensionOptionsWeb3Tx) Descriptor

func (*ExtensionOptionsWeb3Tx) Descriptor() ([]byte, []int)

func (*ExtensionOptionsWeb3Tx) Marshal

func (m *ExtensionOptionsWeb3Tx) Marshal() (dAtA []byte, err error)

func (*ExtensionOptionsWeb3Tx) MarshalTo

func (m *ExtensionOptionsWeb3Tx) MarshalTo(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) MarshalToSizedBuffer

func (m *ExtensionOptionsWeb3Tx) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ExtensionOptionsWeb3Tx) ProtoMessage

func (*ExtensionOptionsWeb3Tx) ProtoMessage()

func (*ExtensionOptionsWeb3Tx) Reset

func (m *ExtensionOptionsWeb3Tx) Reset()

func (*ExtensionOptionsWeb3Tx) Size

func (m *ExtensionOptionsWeb3Tx) Size() (n int)

func (*ExtensionOptionsWeb3Tx) String

func (m *ExtensionOptionsWeb3Tx) String() string

func (*ExtensionOptionsWeb3Tx) Unmarshal

func (m *ExtensionOptionsWeb3Tx) Unmarshal(dAtA []byte) error

func (*ExtensionOptionsWeb3Tx) XXX_DiscardUnknown

func (m *ExtensionOptionsWeb3Tx) XXX_DiscardUnknown()

func (*ExtensionOptionsWeb3Tx) XXX_Marshal

func (m *ExtensionOptionsWeb3Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ExtensionOptionsWeb3Tx) XXX_Merge

func (m *ExtensionOptionsWeb3Tx) XXX_Merge(src proto.Message)

func (*ExtensionOptionsWeb3Tx) XXX_Size

func (m *ExtensionOptionsWeb3Tx) XXX_Size() int

func (*ExtensionOptionsWeb3Tx) XXX_Unmarshal

func (m *ExtensionOptionsWeb3Tx) XXX_Unmarshal(b []byte) error

type ExtensionOptionsWeb3TxI

type ExtensionOptionsWeb3TxI interface{}

type Fip20TargetType

type Fip20TargetType int
const (
	FIP20TargetUnknown Fip20TargetType = iota
	FIP20TargetChain
	FIP20TargetIBC
)

func (Fip20TargetType) String

func (tt Fip20TargetType) String() string

type HDPathIterator

type HDPathIterator func() ethaccounts.DerivationPath

func NewHDPathIterator

func NewHDPathIterator(basePath string, ledgerIter bool) (HDPathIterator, error)

NewHDPathIterator receives a base path as a string and a boolean for the desired iterator type and returns a function that iterates over the base HD path, returning the string.

type TargetIBC

type TargetIBC struct {
	Prefix        string
	SourcePort    string
	SourceChannel string
}

func ParseHexTargetIBC

func ParseHexTargetIBC(hexTargetIbc string) (TargetIBC, bool)

func ParseTargetIBC

func ParseTargetIBC(targetIbc string) (TargetIBC, bool)

type TransferCrossChainEvent

type TransferCrossChainEvent struct {
	From      common.Address
	Recipient string
	Amount    *big.Int
	Fee       *big.Int
	Target    [32]byte
}

func ParseTransferCrossChainEvent

func ParseTransferCrossChainEvent(fip20ABI abi.ABI, log *ethtypes.Log) (*TransferCrossChainEvent, bool, error)

func (*TransferCrossChainEvent) GetAmount

func (event *TransferCrossChainEvent) GetAmount(denom string) sdk.Coin

func (*TransferCrossChainEvent) GetFee

func (event *TransferCrossChainEvent) GetFee(denom string) sdk.Coin

func (*TransferCrossChainEvent) GetFrom

func (event *TransferCrossChainEvent) GetFrom() sdk.AccAddress

func (*TransferCrossChainEvent) GetTarget

func (event *TransferCrossChainEvent) GetTarget() (Fip20TargetType, string)

func (*TransferCrossChainEvent) TotalAmount

func (event *TransferCrossChainEvent) TotalAmount(denom string) sdk.Coins

Jump to

Keyboard shortcuts

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