helpers

package
v1.1.29 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPath added in v1.1.27

func BuildPath(addresses []common.Address, fees []int) ([]byte, error)

func GetAuthData

func GetAuthData(privateKey *ecdsa.PrivateKey, chainId *big.Int, client *ethclient.Client) (*bind.TransactOpts, error)

func GetBaseTokenAddressesByChainId

func GetBaseTokenAddressesByChainId(chainId *big.Int, rdb *redis.Client) (result []common.Address, mainToken *common.Address, usdToken *common.Address, err error)

func GetBuyCoefficient

func GetBuyCoefficient(amount *big.Int, total *big.Int) *big.Float

func GetCurrentGasPrice

func GetCurrentGasPrice(client *ethclient.Client) (*big.Int, error)

func GetCurrentNonce

func GetCurrentNonce(client *ethclient.Client, account common.Address) (uint64, error)

func GetKeysWithPrefix

func GetKeysWithPrefix(rdb *redis.Client, prefix string) ([]string, error)

获取所有 redis 键

func GetPrice added in v1.0.2

func GetPrice(defiAddress common.Address, tokenAddress common.Address, baseAddress common.Address, ec *ethclient.Client) (*big.Float, *big.Int, error)

price 除以基本币的小数位后的价格 price1 没除以小数位价格

func InArray

func InArray(needle interface{}, haystack interface{}) (exists bool, index int)

InArray will search element inside array with any type. Will return boolean and index for matched element. True and index more than 0 if element is exist. needle is element to search, haystack is slice of value to be search.

func IsHoneypotToken added in v1.0.2

func IsHoneypotToken(token common.Address, chainId *big.Int, rdb *redis.Client) bool

func MultiplyIntFloat

func MultiplyIntFloat(x *big.Int, y *big.Float) *big.Int

func ParsePath added in v1.1.4

func ParsePath(path []byte) ([]common.Address, []int, error)

func PercentageDifference

func PercentageDifference(x *big.Int, y *big.Int) (*big.Int, *big.Float)

计算两个值的差值和差值占x的系数 返回差值和系数

Types

This section is empty.

Jump to

Keyboard shortcuts

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