erc20token

package
v0.75.8 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 11 Imported by: 0

README

Manually compile and create Go-Bindings

  1. Select main Solidity file (e.g. TokenBase.sol)
  2. Check which version of Solidity to use (e.g. 0.8.16)
  3. Generate ABI, compile and generate Go bindings
  4. Store: TokenBase.abi, TokenBase.bin, TokenBase.go only.

Generate ABI and compile

docker run -v "$(pwd)":/sources -w /sources \
    ethereum/solc:0.8.16 \
        --abi \
        --bin \
        --overwrite \
        --optimize --optimize-runs 200 \
         -o . \
        TokenBase.sol

Generate Go Bindings

docker run -v "$(pwd)":/sources -w /sources --pull always \
    ethereum/client-go:alltools-latest \
        abigen \
        --abi=TokenBase.abi \
        --bin=TokenBase.bin \
        --pkg=TokenBase \
        --out=TokenBase.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ERC20Token

type ERC20Token struct {
	ERC20TokenStandard
	ERC20TokenCommon
	ERC20TokenTesting
	Address common.Address
	Version ERC20TokenVersion
	// contains filtered or unexported fields
}

func NewERC20Token

func NewERC20Token(
	ethClient *ethclient.Client,
	hexAddress string,
	version ERC20TokenVersion,
) (*ERC20Token, error)

func (*ERC20Token) GetInfo

func (t *ERC20Token) GetInfo() (result ERC20TokenInfo, err error)

func (*ERC20Token) Mint

func (t *ERC20Token) Mint(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error)

type ERC20TokenCommon

type ERC20TokenCommon interface {
	Name(opts *bind.CallOpts) (string, error)
	Symbol(opts *bind.CallOpts) (string, error)
	Decimals(opts *bind.CallOpts) (uint8, error)
}

type ERC20TokenInfo

type ERC20TokenInfo struct {
	Address         string
	TotalSupply     *big.Float
	Name            string
	Symbol          string
	Decimals        uint8
	BurnEnabled     bool
	FaucetAmount    *big.Float
	FaucetCallLimit *big.Int
}

type ERC20TokenStandard

type ERC20TokenStandard interface {
	BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error)
	TotalSupply(opts *bind.CallOpts) (*big.Int, error)
	Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error)
	Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error)
	TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error)
	Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error)
}

type ERC20TokenTesting

type ERC20TokenTesting interface {
	Faucet(opts *bind.TransactOpts) (*types.Transaction, error)
	Mint(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error)
	IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error)
	SetBurnEnabled(opts *bind.TransactOpts, burnEnabled_ bool) (*types.Transaction, error)
	BurnEnabled(opts *bind.CallOpts) (bool, error)
	SetFaucetAmount(opts *bind.TransactOpts, faucetAmount_ *big.Int) (*types.Transaction, error)
	SetFaucetCallLimit(opts *bind.TransactOpts, faucetCallLimit_ *big.Int) (*types.Transaction, error)
	FaucetCallLimit(opts *bind.CallOpts) (*big.Int, error)
	FaucetAmount(opts *bind.CallOpts) (*big.Int, error)

	GetRoleAdmin(opts *bind.CallOpts, role [32]byte) ([32]byte, error)
	MINTERROLE(opts *bind.CallOpts) ([32]byte, error)
	GrantRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error)
	RenounceRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error)
	RevokeRole(opts *bind.TransactOpts, role [32]byte, account common.Address) (*types.Transaction, error)
	HasRole(opts *bind.CallOpts, role [32]byte, account common.Address) (bool, error)
}

type ERC20TokenVersion

type ERC20TokenVersion string
const (
	ERC20TokenBase    ERC20TokenVersion = "TokenBase"
	ERC20TokenOld     ERC20TokenVersion = "TokenOld" // deprecated - don't ever use, remove if you can
	ERC20TokenOther   ERC20TokenVersion = "TokenOther"
	ERC20TokenMinimal ERC20TokenVersion = "TokenMinimal"
)

func (ERC20TokenVersion) IsValid

func (n ERC20TokenVersion) IsValid() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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