diff --git a/Makefile b/Makefile index bcba034a..3e527129 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ core_default := "DelegationManager IRewardsCoordinator ISlasher StrategyManager core_location := "./lib/eigenlayer-middleware/lib/eigenlayer-contracts" core_bindings_location := "../../../../bindings" -middleware_default := "RegistryCoordinator IndexRegistry OperatorStateRetriever StakeRegistry BLSApkRegistry IBLSSignatureChecker ServiceManagerBase IERC20" +middleware_default := "RegistryCoordinator IndexRegistry OperatorStateRetriever StakeRegistry BLSApkRegistry IBLSSignatureChecker ServiceManagerBase IERC20 ERC20" middleware_location := "./lib/eigenlayer-middleware" middleware_bindings_location := "../../bindings" diff --git a/chainio/clients/elcontracts/reader.go b/chainio/clients/elcontracts/reader.go index b4632bf3..f25448e8 100644 --- a/chainio/clients/elcontracts/reader.go +++ b/chainio/clients/elcontracts/reader.go @@ -12,8 +12,8 @@ import ( "github.com/Layr-Labs/eigensdk-go/chainio/clients/eth" delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager" + erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ERC20" avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAVSDirectory" - erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20" rewardscoordinator "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IRewardsCoordinator" slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher" strategy "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IStrategy" @@ -176,7 +176,7 @@ func (r *ChainReader) GetStrategyAndUnderlyingToken( func (r *ChainReader) GetStrategyAndUnderlyingERC20Token( ctx context.Context, strategyAddr gethcommon.Address, -) (*strategy.ContractIStrategy, erc20.ContractIERC20Methods, gethcommon.Address, error) { +) (*strategy.ContractIStrategy, erc20.ContractERC20Methods, gethcommon.Address, error) { contractStrategy, err := strategy.NewContractIStrategy(strategyAddr, r.ethClient) if err != nil { return nil, nil, common.Address{}, utils.WrapError("Failed to fetch strategy contract", err) @@ -185,7 +185,7 @@ func (r *ChainReader) GetStrategyAndUnderlyingERC20Token( if err != nil { return nil, nil, common.Address{}, utils.WrapError("Failed to fetch token contract", err) } - contractUnderlyingToken, err := erc20.NewContractIERC20(underlyingTokenAddr, r.ethClient) + contractUnderlyingToken, err := erc20.NewContractERC20(underlyingTokenAddr, r.ethClient) if err != nil { return nil, nil, common.Address{}, utils.WrapError("Failed to fetch token contract", err) } diff --git a/chainio/clients/elcontracts/reader_test.go b/chainio/clients/elcontracts/reader_test.go index 7eb3428a..50c2bb55 100644 --- a/chainio/clients/elcontracts/reader_test.go +++ b/chainio/clients/elcontracts/reader_test.go @@ -5,7 +5,7 @@ import ( "math/big" "testing" - erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20" + erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ERC20" "github.com/Layr-Labs/eigensdk-go/testutils" "github.com/Layr-Labs/eigensdk-go/testutils/testclients" "github.com/Layr-Labs/eigensdk-go/types" @@ -46,7 +46,7 @@ func TestChainReader(t *testing.T) { assert.NotNil(t, strategy) assert.NotEqual(t, common.Address{}, underlyingTokenAddr) - erc20Token, err := erc20.NewContractIERC20(underlyingTokenAddr, clients.EthHttpClient) + erc20Token, err := erc20.NewContractERC20(underlyingTokenAddr, clients.EthHttpClient) assert.NoError(t, err) tokenName, err := erc20Token.Name(&bind.CallOpts{}) diff --git a/chainio/clients/elcontracts/writer.go b/chainio/clients/elcontracts/writer.go index 882c7482..7272ec83 100644 --- a/chainio/clients/elcontracts/writer.go +++ b/chainio/clients/elcontracts/writer.go @@ -12,8 +12,8 @@ import ( "github.com/Layr-Labs/eigensdk-go/chainio/clients/eth" "github.com/Layr-Labs/eigensdk-go/chainio/txmgr" delegationmanager "github.com/Layr-Labs/eigensdk-go/contracts/bindings/DelegationManager" + erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ERC20" avsdirectory "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IAVSDirectory" - erc20 "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IERC20" rewardscoordinator "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IRewardsCoordinator" slasher "github.com/Layr-Labs/eigensdk-go/contracts/bindings/ISlasher" strategy "github.com/Layr-Labs/eigensdk-go/contracts/bindings/IStrategy" @@ -27,7 +27,7 @@ import ( type Reader interface { GetStrategyAndUnderlyingERC20Token( ctx context.Context, strategyAddr gethcommon.Address, - ) (*strategy.ContractIStrategy, erc20.ContractIERC20Methods, gethcommon.Address, error) + ) (*strategy.ContractIStrategy, erc20.ContractERC20Methods, gethcommon.Address, error) } type ChainWriter struct { diff --git a/contracts/bindings/ERC20/binding.go b/contracts/bindings/ERC20/binding.go new file mode 100644 index 00000000..06478492 --- /dev/null +++ b/contracts/bindings/ERC20/binding.go @@ -0,0 +1,860 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package contractERC20 + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ContractERC20MetaData contains all meta data concerning the ContractERC20 contract. +var ContractERC20MetaData = &bind.MetaData{ + ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"name_\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"symbol_\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decreaseAllowance\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"subtractedValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"increaseAllowance\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"addedValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"totalSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transfer\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false}]", + Bin: "0x60806040523480156200001157600080fd5b5060405162000b1938038062000b198339810160408190526200003491620001db565b81516200004990600390602085019062000068565b5080516200005f90600490602084019062000068565b50505062000282565b828054620000769062000245565b90600052602060002090601f0160209004810192826200009a5760008555620000e5565b82601f10620000b557805160ff1916838001178555620000e5565b82800160010185558215620000e5579182015b82811115620000e5578251825591602001919060010190620000c8565b50620000f3929150620000f7565b5090565b5b80821115620000f35760008155600101620000f8565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200013657600080fd5b81516001600160401b03808211156200015357620001536200010e565b604051601f8301601f19908116603f011681019082821181831017156200017e576200017e6200010e565b816040528381526020925086838588010111156200019b57600080fd5b600091505b83821015620001bf5785820183015181830184015290820190620001a0565b83821115620001d15760008385830101525b9695505050505050565b60008060408385031215620001ef57600080fd5b82516001600160401b03808211156200020757600080fd5b620002158683870162000124565b935060208501519150808211156200022c57600080fd5b506200023b8582860162000124565b9150509250929050565b600181811c908216806200025a57607f821691505b602082108114156200027c57634e487b7160e01b600052602260045260246000fd5b50919050565b61088780620002926000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101a0565b6040516100c391906106c4565b60405180910390f35b6100df6100da366004610735565b610232565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461075f565b61024a565b604051601281526020016100c3565b6100df610131366004610735565b61026e565b6100f361014436600461079b565b6001600160a01b031660009081526020819052604090205490565b6100b6610290565b6100df610175366004610735565b61029f565b6100df610188366004610735565b61031f565b6100f361019b3660046107bd565b61032d565b6060600380546101af906107f0565b80601f01602080910402602001604051908101604052809291908181526020018280546101db906107f0565b80156102285780601f106101fd57610100808354040283529160200191610228565b820191906000526020600020905b81548152906001019060200180831161020b57829003601f168201915b5050505050905090565b600033610240818585610358565b5060019392505050565b60003361025885828561047c565b6102638585856104f6565b506001949350505050565b600033610240818585610281838361032d565b61028b919061082b565b610358565b6060600480546101af906107f0565b600033816102ad828661032d565b9050838110156103125760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6102638286868403610358565b6000336102408185856104f6565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0383166103ba5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610309565b6001600160a01b03821661041b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610309565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610488848461032d565b905060001981146104f057818110156104e35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610309565b6104f08484848403610358565b50505050565b6001600160a01b03831661055a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610309565b6001600160a01b0382166105bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610309565b6001600160a01b038316600090815260208190526040902054818110156106345760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610309565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061066b90849061082b565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106b791815260200190565b60405180910390a36104f0565b600060208083528351808285015260005b818110156106f1578581018301518582016040015282016106d5565b81811115610703576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461073057600080fd5b919050565b6000806040838503121561074857600080fd5b61075183610719565b946020939093013593505050565b60008060006060848603121561077457600080fd5b61077d84610719565b925061078b60208501610719565b9150604084013590509250925092565b6000602082840312156107ad57600080fd5b6107b682610719565b9392505050565b600080604083850312156107d057600080fd5b6107d983610719565b91506107e760208401610719565b90509250929050565b600181811c9082168061080457607f821691505b6020821081141561082557634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561084c57634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220eee75a319b4b066c913ab39d77d9b8ed2494bb94cc6eadb9da0497831b6e224064736f6c634300080c0033", +} + +// ContractERC20ABI is the input ABI used to generate the binding from. +// Deprecated: Use ContractERC20MetaData.ABI instead. +var ContractERC20ABI = ContractERC20MetaData.ABI + +// ContractERC20Bin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use ContractERC20MetaData.Bin instead. +var ContractERC20Bin = ContractERC20MetaData.Bin + +// DeployContractERC20 deploys a new Ethereum contract, binding an instance of ContractERC20 to it. +func DeployContractERC20(auth *bind.TransactOpts, backend bind.ContractBackend, name_ string, symbol_ string) (common.Address, *types.Transaction, *ContractERC20, error) { + parsed, err := ContractERC20MetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ContractERC20Bin), backend, name_, symbol_) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ContractERC20{ContractERC20Caller: ContractERC20Caller{contract: contract}, ContractERC20Transactor: ContractERC20Transactor{contract: contract}, ContractERC20Filterer: ContractERC20Filterer{contract: contract}}, nil +} + +// ContractERC20Methods is an auto generated interface around an Ethereum contract. +type ContractERC20Methods interface { + ContractERC20Calls + ContractERC20Transacts + ContractERC20Filters +} + +// ContractERC20Calls is an auto generated interface that defines the call methods available for an Ethereum contract. +type ContractERC20Calls interface { + Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) + + BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) + + Decimals(opts *bind.CallOpts) (uint8, error) + + Name(opts *bind.CallOpts) (string, error) + + Symbol(opts *bind.CallOpts) (string, error) + + TotalSupply(opts *bind.CallOpts) (*big.Int, error) +} + +// ContractERC20Transacts is an auto generated interface that defines the transact methods available for an Ethereum contract. +type ContractERC20Transacts interface { + Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) + + DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) + + IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *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) +} + +// ContractERC20Filterer is an auto generated interface that defines the log filtering methods available for an Ethereum contract. +type ContractERC20Filters interface { + FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ContractERC20ApprovalIterator, error) + WatchApproval(opts *bind.WatchOpts, sink chan<- *ContractERC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error) + ParseApproval(log types.Log) (*ContractERC20Approval, error) + + FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ContractERC20TransferIterator, error) + WatchTransfer(opts *bind.WatchOpts, sink chan<- *ContractERC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error) + ParseTransfer(log types.Log) (*ContractERC20Transfer, error) +} + +// ContractERC20 is an auto generated Go binding around an Ethereum contract. +type ContractERC20 struct { + ContractERC20Caller // Read-only binding to the contract + ContractERC20Transactor // Write-only binding to the contract + ContractERC20Filterer // Log filterer for contract events +} + +// ContractERC20 implements the ContractERC20Methods interface. +var _ ContractERC20Methods = (*ContractERC20)(nil) + +// ContractERC20Caller is an auto generated read-only Go binding around an Ethereum contract. +type ContractERC20Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractERC20Caller implements the ContractERC20Calls interface. +var _ ContractERC20Calls = (*ContractERC20Caller)(nil) + +// ContractERC20Transactor is an auto generated write-only Go binding around an Ethereum contract. +type ContractERC20Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractERC20Transactor implements the ContractERC20Transacts interface. +var _ ContractERC20Transacts = (*ContractERC20Transactor)(nil) + +// ContractERC20Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ContractERC20Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ContractERC20Filterer implements the ContractERC20Filters interface. +var _ ContractERC20Filters = (*ContractERC20Filterer)(nil) + +// ContractERC20Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ContractERC20Session struct { + Contract *ContractERC20 // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractERC20CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ContractERC20CallerSession struct { + Contract *ContractERC20Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ContractERC20TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ContractERC20TransactorSession struct { + Contract *ContractERC20Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ContractERC20Raw is an auto generated low-level Go binding around an Ethereum contract. +type ContractERC20Raw struct { + Contract *ContractERC20 // Generic contract binding to access the raw methods on +} + +// ContractERC20CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ContractERC20CallerRaw struct { + Contract *ContractERC20Caller // Generic read-only contract binding to access the raw methods on +} + +// ContractERC20TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ContractERC20TransactorRaw struct { + Contract *ContractERC20Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewContractERC20 creates a new instance of ContractERC20, bound to a specific deployed contract. +func NewContractERC20(address common.Address, backend bind.ContractBackend) (*ContractERC20, error) { + contract, err := bindContractERC20(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ContractERC20{ContractERC20Caller: ContractERC20Caller{contract: contract}, ContractERC20Transactor: ContractERC20Transactor{contract: contract}, ContractERC20Filterer: ContractERC20Filterer{contract: contract}}, nil +} + +// NewContractERC20Caller creates a new read-only instance of ContractERC20, bound to a specific deployed contract. +func NewContractERC20Caller(address common.Address, caller bind.ContractCaller) (*ContractERC20Caller, error) { + contract, err := bindContractERC20(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ContractERC20Caller{contract: contract}, nil +} + +// NewContractERC20Transactor creates a new write-only instance of ContractERC20, bound to a specific deployed contract. +func NewContractERC20Transactor(address common.Address, transactor bind.ContractTransactor) (*ContractERC20Transactor, error) { + contract, err := bindContractERC20(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ContractERC20Transactor{contract: contract}, nil +} + +// NewContractERC20Filterer creates a new log filterer instance of ContractERC20, bound to a specific deployed contract. +func NewContractERC20Filterer(address common.Address, filterer bind.ContractFilterer) (*ContractERC20Filterer, error) { + contract, err := bindContractERC20(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ContractERC20Filterer{contract: contract}, nil +} + +// bindContractERC20 binds a generic wrapper to an already deployed contract. +func bindContractERC20(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ContractERC20MetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ContractERC20 *ContractERC20Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ContractERC20.Contract.ContractERC20Caller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ContractERC20 *ContractERC20Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ContractERC20.Contract.ContractERC20Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ContractERC20 *ContractERC20Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ContractERC20.Contract.ContractERC20Transactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ContractERC20 *ContractERC20CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ContractERC20.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ContractERC20 *ContractERC20TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ContractERC20.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ContractERC20 *ContractERC20TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ContractERC20.Contract.contract.Transact(opts, method, params...) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ContractERC20 *ContractERC20Caller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { + var out []interface{} + err := _ContractERC20.contract.Call(opts, &out, "allowance", owner, spender) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ContractERC20 *ContractERC20Session) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ContractERC20.Contract.Allowance(&_ContractERC20.CallOpts, owner, spender) +} + +// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. +// +// Solidity: function allowance(address owner, address spender) view returns(uint256) +func (_ContractERC20 *ContractERC20CallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ContractERC20.Contract.Allowance(&_ContractERC20.CallOpts, owner, spender) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ContractERC20 *ContractERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { + var out []interface{} + err := _ContractERC20.contract.Call(opts, &out, "balanceOf", account) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ContractERC20 *ContractERC20Session) BalanceOf(account common.Address) (*big.Int, error) { + return _ContractERC20.Contract.BalanceOf(&_ContractERC20.CallOpts, account) +} + +// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. +// +// Solidity: function balanceOf(address account) view returns(uint256) +func (_ContractERC20 *ContractERC20CallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _ContractERC20.Contract.BalanceOf(&_ContractERC20.CallOpts, account) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ContractERC20 *ContractERC20Caller) Decimals(opts *bind.CallOpts) (uint8, error) { + var out []interface{} + err := _ContractERC20.contract.Call(opts, &out, "decimals") + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ContractERC20 *ContractERC20Session) Decimals() (uint8, error) { + return _ContractERC20.Contract.Decimals(&_ContractERC20.CallOpts) +} + +// Decimals is a free data retrieval call binding the contract method 0x313ce567. +// +// Solidity: function decimals() view returns(uint8) +func (_ContractERC20 *ContractERC20CallerSession) Decimals() (uint8, error) { + return _ContractERC20.Contract.Decimals(&_ContractERC20.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ContractERC20 *ContractERC20Caller) Name(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ContractERC20.contract.Call(opts, &out, "name") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ContractERC20 *ContractERC20Session) Name() (string, error) { + return _ContractERC20.Contract.Name(&_ContractERC20.CallOpts) +} + +// Name is a free data retrieval call binding the contract method 0x06fdde03. +// +// Solidity: function name() view returns(string) +func (_ContractERC20 *ContractERC20CallerSession) Name() (string, error) { + return _ContractERC20.Contract.Name(&_ContractERC20.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ContractERC20 *ContractERC20Caller) Symbol(opts *bind.CallOpts) (string, error) { + var out []interface{} + err := _ContractERC20.contract.Call(opts, &out, "symbol") + + if err != nil { + return *new(string), err + } + + out0 := *abi.ConvertType(out[0], new(string)).(*string) + + return out0, err + +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ContractERC20 *ContractERC20Session) Symbol() (string, error) { + return _ContractERC20.Contract.Symbol(&_ContractERC20.CallOpts) +} + +// Symbol is a free data retrieval call binding the contract method 0x95d89b41. +// +// Solidity: function symbol() view returns(string) +func (_ContractERC20 *ContractERC20CallerSession) Symbol() (string, error) { + return _ContractERC20.Contract.Symbol(&_ContractERC20.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ContractERC20 *ContractERC20Caller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _ContractERC20.contract.Call(opts, &out, "totalSupply") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ContractERC20 *ContractERC20Session) TotalSupply() (*big.Int, error) { + return _ContractERC20.Contract.TotalSupply(&_ContractERC20.CallOpts) +} + +// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. +// +// Solidity: function totalSupply() view returns(uint256) +func (_ContractERC20 *ContractERC20CallerSession) TotalSupply() (*big.Int, error) { + return _ContractERC20.Contract.TotalSupply(&_ContractERC20.CallOpts) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.contract.Transact(opts, "approve", spender, amount) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20Session) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.Approve(&_ContractERC20.TransactOpts, spender, amount) +} + +// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. +// +// Solidity: function approve(address spender, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20TransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.Approve(&_ContractERC20.TransactOpts, spender, amount) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ContractERC20 *ContractERC20Transactor) DecreaseAllowance(opts *bind.TransactOpts, spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ContractERC20.contract.Transact(opts, "decreaseAllowance", spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ContractERC20 *ContractERC20Session) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.DecreaseAllowance(&_ContractERC20.TransactOpts, spender, subtractedValue) +} + +// DecreaseAllowance is a paid mutator transaction binding the contract method 0xa457c2d7. +// +// Solidity: function decreaseAllowance(address spender, uint256 subtractedValue) returns(bool) +func (_ContractERC20 *ContractERC20TransactorSession) DecreaseAllowance(spender common.Address, subtractedValue *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.DecreaseAllowance(&_ContractERC20.TransactOpts, spender, subtractedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ContractERC20 *ContractERC20Transactor) IncreaseAllowance(opts *bind.TransactOpts, spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ContractERC20.contract.Transact(opts, "increaseAllowance", spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ContractERC20 *ContractERC20Session) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.IncreaseAllowance(&_ContractERC20.TransactOpts, spender, addedValue) +} + +// IncreaseAllowance is a paid mutator transaction binding the contract method 0x39509351. +// +// Solidity: function increaseAllowance(address spender, uint256 addedValue) returns(bool) +func (_ContractERC20 *ContractERC20TransactorSession) IncreaseAllowance(spender common.Address, addedValue *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.IncreaseAllowance(&_ContractERC20.TransactOpts, spender, addedValue) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20Transactor) Transfer(opts *bind.TransactOpts, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.contract.Transact(opts, "transfer", to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20Session) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.Transfer(&_ContractERC20.TransactOpts, to, amount) +} + +// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. +// +// Solidity: function transfer(address to, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20TransactorSession) Transfer(to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.Transfer(&_ContractERC20.TransactOpts, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20Transactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.contract.Transact(opts, "transferFrom", from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20Session) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.TransferFrom(&_ContractERC20.TransactOpts, from, to, amount) +} + +// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. +// +// Solidity: function transferFrom(address from, address to, uint256 amount) returns(bool) +func (_ContractERC20 *ContractERC20TransactorSession) TransferFrom(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error) { + return _ContractERC20.Contract.TransferFrom(&_ContractERC20.TransactOpts, from, to, amount) +} + +// ContractERC20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ContractERC20 contract. +type ContractERC20ApprovalIterator struct { + Event *ContractERC20Approval // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractERC20ApprovalIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractERC20Approval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractERC20Approval) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractERC20ApprovalIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractERC20ApprovalIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractERC20Approval represents a Approval event raised by the ContractERC20 contract. +type ContractERC20Approval struct { + Owner common.Address + Spender common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ContractERC20 *ContractERC20Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ContractERC20ApprovalIterator, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ContractERC20.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return &ContractERC20ApprovalIterator{contract: _ContractERC20.contract, event: "Approval", logs: logs, sub: sub}, nil +} + +// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ContractERC20 *ContractERC20Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ContractERC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error) { + + var ownerRule []interface{} + for _, ownerItem := range owner { + ownerRule = append(ownerRule, ownerItem) + } + var spenderRule []interface{} + for _, spenderItem := range spender { + spenderRule = append(spenderRule, spenderItem) + } + + logs, sub, err := _ContractERC20.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractERC20Approval) + if err := _ContractERC20.contract.UnpackLog(event, "Approval", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. +// +// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) +func (_ContractERC20 *ContractERC20Filterer) ParseApproval(log types.Log) (*ContractERC20Approval, error) { + event := new(ContractERC20Approval) + if err := _ContractERC20.contract.UnpackLog(event, "Approval", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// ContractERC20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ContractERC20 contract. +type ContractERC20TransferIterator struct { + Event *ContractERC20Transfer // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ContractERC20TransferIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ContractERC20Transfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ContractERC20Transfer) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ContractERC20TransferIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ContractERC20TransferIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ContractERC20Transfer represents a Transfer event raised by the ContractERC20 contract. +type ContractERC20Transfer struct { + From common.Address + To common.Address + Value *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ContractERC20 *ContractERC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ContractERC20TransferIterator, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ContractERC20.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return &ContractERC20TransferIterator{contract: _ContractERC20.contract, event: "Transfer", logs: logs, sub: sub}, nil +} + +// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ContractERC20 *ContractERC20Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ContractERC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error) { + + var fromRule []interface{} + for _, fromItem := range from { + fromRule = append(fromRule, fromItem) + } + var toRule []interface{} + for _, toItem := range to { + toRule = append(toRule, toItem) + } + + logs, sub, err := _ContractERC20.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ContractERC20Transfer) + if err := _ContractERC20.contract.UnpackLog(event, "Transfer", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. +// +// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) +func (_ContractERC20 *ContractERC20Filterer) ParseTransfer(log types.Log) (*ContractERC20Transfer, error) { + event := new(ContractERC20Transfer) + if err := _ContractERC20.contract.UnpackLog(event, "Transfer", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +}