erc20

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxUint256 *big.Int

MaxUint256 is the big.Int representation of 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.

View Source
var NilTransactOptsError = fmt.Errorf("param transactOpts (*bind.TransactOpts) cannot be nil")

Functions

func TokenAllowance

func TokenAllowance(ctx context.Context, token common.Address, chainId chainid.ChainID, owner, spender common.Address) (*big.Int, error)

func TokenBalanceOf

func TokenBalanceOf(ctx context.Context, token common.Address, chainId chainid.ChainID, owner common.Address) (*big.Int, error)

func TokenName

func TokenName(ctx context.Context, token common.Address, chainId chainid.ChainID) (string, error)

func TokenSymbol

func TokenSymbol(ctx context.Context, token common.Address, chainId chainid.ChainID) (string, error)

Types

type ERC20

type ERC20 struct {
	// contains filtered or unexported fields
}

func MustInit

func MustInit(instance *ERC20, err error) *ERC20

func NewERC20

func NewERC20(address common.Address, chainId chainid.ChainID) (*ERC20, error)

func NewERC20Context

func NewERC20Context(ctx context.Context, address common.Address, chainId chainid.ChainID) (*ERC20, error)

func NewERC20WithRPC

func NewERC20WithRPC(address common.Address, chainId chainid.ChainID, rpc bind.ContractBackend) (*ERC20, error)

func (ERC20) Address

func (e ERC20) Address() common.Address

func (ERC20) Allowance

func (e ERC20) Allowance(ctx context.Context, owner, spender common.Address) (*big.Int, error)

func (*ERC20) Approve

func (e *ERC20) Approve(
	ctx context.Context, opts *bind.TransactOpts,
	spender common.Address,
	amount *big.Int,
) (txn *types.Transaction, err error)

Approve wraps IERC20.Approve(), allowing `spender` to transfer `amount` of this ERC20 token from the `From` address found in `opts`. If `amount` is nil or zero, then it is set to the maximum possible amount (MaxUint256) which is essentially an "infinite" approval.

func (ERC20) BalanceOf

func (e ERC20) BalanceOf(ctx context.Context, owner common.Address) (*big.Int, error)

func (ERC20) ChainID

func (e ERC20) ChainID() chainid.ChainID

func (ERC20) Decimals

func (e ERC20) Decimals(ctx context.Context) (uint8, error)

func (ERC20) Name

func (e ERC20) Name(ctx context.Context) (string, error)

func (ERC20) Symbol

func (e ERC20) Symbol(ctx context.Context) (string, error)

func (ERC20) TotalSupply

func (e ERC20) TotalSupply(ctx context.Context) (*big.Int, error)

func (*ERC20) Transfer

func (e *ERC20) Transfer(
	ctx context.Context, opts *bind.TransactOpts,
	to common.Address,
	amount *big.Int,
) (txn *types.Transaction, err error)

func (*ERC20) TransferFrom

func (e *ERC20) TransferFrom(
	ctx context.Context, opts *bind.TransactOpts,
	from, to common.Address,
	amount *big.Int,
) (txn *types.Transaction, err error)

Jump to

Keyboard shortcuts

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