util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommitmentAddedTopic string = "0x65ba9a9f4b62e3d394afcc0ed4b32089839f4dd83f4cfda7e495e09f2cc5657f"
)

Variables

View Source
var IsAlphanumeric = regexp.MustCompile(`^[0-9a-zA-Z]+$`).MatchString

Functions

func ConvertBigIntFromString

func ConvertBigIntFromString(v0, v1 string) (n0 *big.Int, n1 *big.Int, err error)

func ConvertFloat64ToTokenAmount

func ConvertFloat64ToTokenAmount(amount float64, decimals int) *big.Int

func ConvertHexToDecimalInStringFormat

func ConvertHexToDecimalInStringFormat(hexString string) string

func ConvertTokenAmountToFloat64

func ConvertTokenAmountToFloat64(amt string, tokenDecimal int32) float64

func CreateTransactionOpts

func CreateTransactionOpts(client *ethclient.Client, key *ecdsa.PrivateKey, chainId uint64, caller common.Address) (opts *bind.TransactOpts, err error)

func EncodeAddress

func EncodeAddress(addr common.Address) []byte

func EncodeBigInt

func EncodeBigInt(b *big.Int) []byte

func EncodeBytesString

func EncodeBytesString(v string) []byte

func EncodePacked

func EncodePacked(input ...[]byte) []byte

func EncodeUint256

func EncodeUint256(v string) []byte

func EncodeUint256Array

func EncodeUint256Array(arr []string) []byte

func FindOrderEventTopic

func FindOrderEventTopic(topic string) string

func GenerateIncreaseID

func GenerateIncreaseID() (int64, error)

func GetCommitReceiptTopic

func GetCommitReceiptTopic() string

event CommitReceipt 0x581db44feed8ab7f2b0e591fd633c1326a4ba3ea20a5c346ab38fd1f42208e81

func GetCommitmentAdded

func GetCommitmentAdded() string

event CommitmentAdded

func GetCrossFromTopic

func GetCrossFromTopic() string

event CrossFrom 0x104f0c1d6ebbba9acf834bd5f27d78481d562d83159d076b974d16bca9c66c21

func GetCrossToTopic

func GetCrossToTopic() string

event CrossTo 0xeb354ff2ff6b3d6392f3c14565a5e0c60fc642b456cd2538e94968fbc54467e8

func GetHTTPClient

func GetHTTPClient() *http.Client

func GetPairCreatedTopic

func GetPairCreatedTopic()

func HTTPReq

func HTTPReq(method string, url string, httpClient *http.Client, content []byte, headers map[string]string) (body []byte, err error)

HTTPReq ..

func InitLog

func InitLog(logPath, logLever string)

func IsAnAddress

func IsAnAddress(address string) bool

func IsValidTxHash

func IsValidTxHash(txHash string) bool

func Logger

func Logger() *zap.Logger

func PadLeft

func PadLeft(str, pad string, length int) string

func TxWaitToSync

func TxWaitToSync(ctx context.Context, client *ethclient.Client, tx *types.Transaction) (*types.Receipt, bool, error)

Types

type OrderEvent

type OrderEvent struct {
	SrcAddress  common.Address
	SrcToken    common.Address
	SrcAmount   uint32
	DestChain   uint32
	DestAddress common.Address
	DestToken   common.Address
	Porters     []string
	Proof       string
	DestTxHash  string
}

type PairCreatedEvent

type PairCreatedEvent struct {
	Pair common.Address
	Arg3 *big.Int
}

Jump to

Keyboard shortcuts

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