utils

package
v0.0.0-...-57124fa Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const EthUnit = 1000000000000000000
View Source
const GweiUnit = 1000000000

var Client *ethclient.Client

View Source
const WeiUnit6 = 1000000
View Source
const WeiUnit8 = 100000000

Variables

View Source
var DefaultCallOpts = &bind.CallOpts{}

Functions

func ApproveErc20

func ApproveErc20(fromPrivateKey string, spender string, contractAddr string, amount float64, gas uint64, Client *ethclient.Client) string

func ApproveErc20AndAwait

func ApproveErc20AndAwait(fromPrivateKey string, spender string, contractAddr string, amount float64, gas uint64, client *ethclient.Client) string

func CalculatePath

func CalculatePath(swapFromToken string, swapToToken string, router string, client *ethclient.Client) ([]common.Address, error)

func Erc20Balance

func Erc20Balance(arg, contract string, Client *ethclient.Client) (string, string)

func Erc20Token

func Erc20Token(contractAddr string, Client *ethclient.Client) *erc20.Erc20

func EstimateClient

func EstimateClient(chain string) *ethclient.Client

func EstimateWsClient

func EstimateWsClient(chain string) *ethclient.Client

func EthBalance

func EthBalance(arg string, Client *ethclient.Client) string

func GenerateOneAccount

func GenerateOneAccount(wallet *hdwallet.Wallet, i int) (string, string, string)

func GenerateOnePrivteKey

func GenerateOnePrivteKey() (string, string)

func GetAmountsOut

func GetAmountsOut(router string, path []common.Address, amountIn *big.Int, client *ethclient.Client) *big.Int

func GetFactoryAddress

func GetFactoryAddress(router string, client *ethclient.Client) common.Address

func GetPoolPair

func GetPoolPair(router string, token0, token1 common.Address, client *ethclient.Client) (*uniswapV2Pair.UniswapV2Pair, *common.Address, error)

func GetUni2router2

func GetUni2router2(router string, client *ethclient.Client) *uniswapv2router02.Uniswapv2router02

func PriceFromSwap

func PriceFromSwap(router string, path []common.Address, amountIn *big.Int, client *ethclient.Client) float64

func SendAllEth

func SendAllEth(fromAddresss string, toAddressS string, hexkey string, gas uint64, client *ethclient.Client) string

func SendErc20

func SendErc20(fromPrivateKey string, toAddressS string, contractAddr string, amount float64, gas uint64, Client *ethclient.Client) string

func SendErc20All

func SendErc20All(fromPrivateKey string, toAddressS string, contractAddr string, gas uint64, client *ethclient.Client) string

func SendErc20Batch

func SendErc20Batch(fromPrivateKey string, toAddressS string, contractAddr string, amount float64, nonce uint64, gas uint64, Client *ethclient.Client) string

func SendEth

func SendEth(fromPrivateKey string, toAddressS string, amount float64, gas uint64, Client *ethclient.Client) string

func SendEthBatch

func SendEthBatch(fromPrivateKey string, toAddressS string, amount float64, gas uint64, nonce uint64, Client *ethclient.Client) string

func Str2Float

func Str2Float(amount string) float64

func Str2Int

func Str2Int(amount string) int64

func ToDecimal

func ToDecimal(ivalue interface{}, decimals int) decimal.Decimal

ToDecimal wei to decimals

func ToWei

func ToWei(iamount interface{}, decimals int) *big.Int

ToWei decimals to wei

func WaitForTxFinish

func WaitForTxFinish(hex common.Hash, client *ethclient.Client) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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