types

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 16 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 (
	// EthereumContractAddressLen is the length of contract address strings
	EthereumContractAddressLen = 42

	// EthereumAddressPrefix is the address prefix address
	EthereumAddressPrefix = "0x"
)
View Source
const (
	FIP20TransferToChainPrefix = "chain/"
	FIP20TransferToIBCPrefix   = "ibc/"
)
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 (
	// BIP44HDPath is the default BIP44 HD path used on Ethereum.
	BIP44HDPath = ethaccounts.DefaultBaseDerivationPath.String()
)
View Source
var (
	// BypassMinFeeMsgTypesKey defines the configuration key for the
	// BypassMinFeeMsgTypes value.
	// nolint: gosec
	BypassMinFeeMsgTypesKey = "bypass-min-fee.msg-types"
)
View Source
var ChainID = "fxcore"
View Source
var (
	EthereumAddressRegular = regexp.MustCompile("^0x[0-9a-fA-F]{40}$")
)

Functions

func Byte32ToString

func Byte32ToString(bytes [32]byte) string

func ChainId

func ChainId() string

func EIP155ChainID

func EIP155ChainID() *big.Int

func GetCrossChainMetadata

func GetCrossChainMetadata(name, symbol string, decimals uint32, denom string) banktypes.Metadata

func GetFXMetaData

func GetFXMetaData(denom string) banktypes.Metadata

func GetMetadata

func GetMetadata() []banktypes.Metadata

func IBCRouteBlock

func IBCRouteBlock() int64

func IsEmptyHash

func IsEmptyHash(hash string) bool

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

func IsZeroEthereumAddress

func IsZeroEthereumAddress(address string) bool

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

func NetworkMainnet

func NetworkMainnet() string

func NewInfiniteGasMeterWithLimit

func NewInfiniteGasMeterWithLimit(limit sdk.Gas) sdk.GasMeter

NewInfiniteGasMeterWithLimit returns a reference to a new infiniteGasMeter.

func SafeInt64

func SafeInt64(value uint64) (int64, error)

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

func SetChainId

func SetChainId(id string)

func SetTestingManyToOneBlock added in v2.2.0

func SetTestingManyToOneBlock(fn func() int64)

func StringToByte32

func StringToByte32(str string) [32]byte

func SupportDenomManyToOneBlock added in v2.2.0

func SupportDenomManyToOneBlock() int64

func SupportDenomManyToOneMsgTypes added in v2.2.0

func SupportDenomManyToOneMsgTypes() []string

SupportDenomManyToOneMsgTypes return msg types use method return to prevent accidental modification

func TestnetChainId

func TestnetChainId() string

func ValidateEthereumAddress

func ValidateEthereumAddress(address string) error

ValidateEthereumAddress validates the ethereum address strings

Types

type Contract

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

func GetERC1967Proxy

func GetERC1967Proxy() Contract

func GetERC20

func GetERC20() Contract

func GetInitContracts

func GetInitContracts() []Contract

func GetWFX

func GetWFX() 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 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