erc20

package
v0.0.0-...-8b20efb Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ERC20Approve

func ERC20Approve(spender common.Address, amount *big.Int) ([]byte, error)

generate approve amount call's approveCall Data

func ERC20Balance

func ERC20Balance(userAddr, tokenAddr common.Address) (*big.Int, error)

func GetAllowance

func GetAllowance(tokenAddr, contractAddr, userAddr common.Address) (*big.Int, error)

func PackERC20Approve

func PackERC20Approve(spender common.Address, amount *big.Int) ([]byte, error)

Types

type CheckAllowanceResult

type CheckAllowanceResult struct {
	AllowanceAmount *big.Int `json:"allowanceAmount"`
	IsSatisfied     bool     `json:"isSatisfied"`
	AllowanceData   []byte   `json:"allowanceData"`
}

func CheckAllowance

func CheckAllowance(fromToken, spender, userAddr common.Address, amount *big.Int, fromIsETH bool) (*CheckAllowanceResult, error)

Cannot use this to check ETH

type ERC20Info

type ERC20Info struct {
	TokenAddr   common.Address
	TokenName   string
	TokenSymbol string
	Decimals    uint8
}

func ERC20TokenInfo

func ERC20TokenInfo(tokenAddr common.Address) (ERC20Info, error)

Jump to

Keyboard shortcuts

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