Skip to content

Instantly share code, notes, and snippets.

@Pongch
Created October 15, 2019 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pongch/d18d8b664b818a0acea381ef99b958e1 to your computer and use it in GitHub Desktop.
Save Pongch/d18d8b664b818a0acea381ef99b958e1 to your computer and use it in GitHub Desktop.
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package Erc20Vault
import (
"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"
)
// Erc20VaultABI is the input ABI used to generate the binding from.
const Erc20VaultABI = "[{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"depositVerifiers\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"}],\"name\":\"setDepositVerifier\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getEffectiveDepositVerifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"operator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"newDepositVerifierMaturityTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contractPlasmaFramework\",\"name\":\"_framework\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"addresspayable\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Erc20Withdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"depositor\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blknum\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DepositCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"nextDepositVerifier\",\"type\":\"address\"}],\"name\":\"SetDepositVerifierCalled\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"depositTx\",\"type\":\"bytes\"}],\"name\":\"deposit\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"
// Erc20Vault is an auto generated Go binding around an Ethereum contract.
type Erc20Vault struct {
Erc20VaultCaller // Read-only binding to the contract
Erc20VaultTransactor // Write-only binding to the contract
Erc20VaultFilterer // Log filterer for contract events
}
// Erc20VaultCaller is an auto generated read-only Go binding around an Ethereum contract.
type Erc20VaultCaller struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// Erc20VaultTransactor is an auto generated write-only Go binding around an Ethereum contract.
type Erc20VaultTransactor struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// Erc20VaultFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
type Erc20VaultFilterer struct {
contract *bind.BoundContract // Generic contract wrapper for the low level calls
}
// Erc20VaultSession is an auto generated Go binding around an Ethereum contract,
// with pre-set call and transact options.
type Erc20VaultSession struct {
Contract *Erc20Vault // 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
}
// Erc20VaultCallerSession is an auto generated read-only Go binding around an Ethereum contract,
// with pre-set call options.
type Erc20VaultCallerSession struct {
Contract *Erc20VaultCaller // Generic contract caller binding to set the session for
CallOpts bind.CallOpts // Call options to use throughout this session
}
// Erc20VaultTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
// with pre-set transact options.
type Erc20VaultTransactorSession struct {
Contract *Erc20VaultTransactor // Generic contract transactor binding to set the session for
TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}
// Erc20VaultRaw is an auto generated low-level Go binding around an Ethereum contract.
type Erc20VaultRaw struct {
Contract *Erc20Vault // Generic contract binding to access the raw methods on
}
// Erc20VaultCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
type Erc20VaultCallerRaw struct {
Contract *Erc20VaultCaller // Generic read-only contract binding to access the raw methods on
}
// Erc20VaultTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
type Erc20VaultTransactorRaw struct {
Contract *Erc20VaultTransactor // Generic write-only contract binding to access the raw methods on
}
// NewErc20Vault creates a new instance of Erc20Vault, bound to a specific deployed contract.
func NewErc20Vault(address common.Address, backend bind.ContractBackend) (*Erc20Vault, error) {
contract, err := bindErc20Vault(address, backend, backend, backend)
if err != nil {
return nil, err
}
return &Erc20Vault{Erc20VaultCaller: Erc20VaultCaller{contract: contract}, Erc20VaultTransactor: Erc20VaultTransactor{contract: contract}, Erc20VaultFilterer: Erc20VaultFilterer{contract: contract}}, nil
}
// NewErc20VaultCaller creates a new read-only instance of Erc20Vault, bound to a specific deployed contract.
func NewErc20VaultCaller(address common.Address, caller bind.ContractCaller) (*Erc20VaultCaller, error) {
contract, err := bindErc20Vault(address, caller, nil, nil)
if err != nil {
return nil, err
}
return &Erc20VaultCaller{contract: contract}, nil
}
// NewErc20VaultTransactor creates a new write-only instance of Erc20Vault, bound to a specific deployed contract.
func NewErc20VaultTransactor(address common.Address, transactor bind.ContractTransactor) (*Erc20VaultTransactor, error) {
contract, err := bindErc20Vault(address, nil, transactor, nil)
if err != nil {
return nil, err
}
return &Erc20VaultTransactor{contract: contract}, nil
}
// NewErc20VaultFilterer creates a new log filterer instance of Erc20Vault, bound to a specific deployed contract.
func NewErc20VaultFilterer(address common.Address, filterer bind.ContractFilterer) (*Erc20VaultFilterer, error) {
contract, err := bindErc20Vault(address, nil, nil, filterer)
if err != nil {
return nil, err
}
return &Erc20VaultFilterer{contract: contract}, nil
}
// bindErc20Vault binds a generic wrapper to an already deployed contract.
func bindErc20Vault(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(Erc20VaultABI))
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 (_Erc20Vault *Erc20VaultRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
return _Erc20Vault.Contract.Erc20VaultCaller.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 (_Erc20Vault *Erc20VaultRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Erc20Vault.Contract.Erc20VaultTransactor.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Erc20Vault *Erc20VaultRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Erc20Vault.Contract.Erc20VaultTransactor.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 (_Erc20Vault *Erc20VaultCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {
return _Erc20Vault.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 (_Erc20Vault *Erc20VaultTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
return _Erc20Vault.Contract.contract.Transfer(opts)
}
// Transact invokes the (paid) contract method with params as input values.
func (_Erc20Vault *Erc20VaultTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
return _Erc20Vault.Contract.contract.Transact(opts, method, params...)
}
// DepositVerifiers is a free data retrieval call binding the contract method 0x02e9b07b.
//
// Solidity: function depositVerifiers( uint256) constant returns(address)
func (_Erc20Vault *Erc20VaultCaller) DepositVerifiers(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {
var (
ret0 = new(common.Address)
)
out := ret0
err := _Erc20Vault.contract.Call(opts, out, "depositVerifiers", arg0)
return *ret0, err
}
// DepositVerifiers is a free data retrieval call binding the contract method 0x02e9b07b.
//
// Solidity: function depositVerifiers( uint256) constant returns(address)
func (_Erc20Vault *Erc20VaultSession) DepositVerifiers(arg0 *big.Int) (common.Address, error) {
return _Erc20Vault.Contract.DepositVerifiers(&_Erc20Vault.CallOpts, arg0)
}
// DepositVerifiers is a free data retrieval call binding the contract method 0x02e9b07b.
//
// Solidity: function depositVerifiers( uint256) constant returns(address)
func (_Erc20Vault *Erc20VaultCallerSession) DepositVerifiers(arg0 *big.Int) (common.Address, error) {
return _Erc20Vault.Contract.DepositVerifiers(&_Erc20Vault.CallOpts, arg0)
}
// GetEffectiveDepositVerifier is a free data retrieval call binding the contract method 0x52518b7f.
//
// Solidity: function getEffectiveDepositVerifier() constant returns(address)
func (_Erc20Vault *Erc20VaultCaller) GetEffectiveDepositVerifier(opts *bind.CallOpts) (common.Address, error) {
var (
ret0 = new(common.Address)
)
out := ret0
err := _Erc20Vault.contract.Call(opts, out, "getEffectiveDepositVerifier")
return *ret0, err
}
// GetEffectiveDepositVerifier is a free data retrieval call binding the contract method 0x52518b7f.
//
// Solidity: function getEffectiveDepositVerifier() constant returns(address)
func (_Erc20Vault *Erc20VaultSession) GetEffectiveDepositVerifier() (common.Address, error) {
return _Erc20Vault.Contract.GetEffectiveDepositVerifier(&_Erc20Vault.CallOpts)
}
// GetEffectiveDepositVerifier is a free data retrieval call binding the contract method 0x52518b7f.
//
// Solidity: function getEffectiveDepositVerifier() constant returns(address)
func (_Erc20Vault *Erc20VaultCallerSession) GetEffectiveDepositVerifier() (common.Address, error) {
return _Erc20Vault.Contract.GetEffectiveDepositVerifier(&_Erc20Vault.CallOpts)
}
// NewDepositVerifierMaturityTimestamp is a free data retrieval call binding the contract method 0xa7e5994f.
//
// Solidity: function newDepositVerifierMaturityTimestamp() constant returns(uint256)
func (_Erc20Vault *Erc20VaultCaller) NewDepositVerifierMaturityTimestamp(opts *bind.CallOpts) (*big.Int, error) {
var (
ret0 = new(*big.Int)
)
out := ret0
err := _Erc20Vault.contract.Call(opts, out, "newDepositVerifierMaturityTimestamp")
return *ret0, err
}
// NewDepositVerifierMaturityTimestamp is a free data retrieval call binding the contract method 0xa7e5994f.
//
// Solidity: function newDepositVerifierMaturityTimestamp() constant returns(uint256)
func (_Erc20Vault *Erc20VaultSession) NewDepositVerifierMaturityTimestamp() (*big.Int, error) {
return _Erc20Vault.Contract.NewDepositVerifierMaturityTimestamp(&_Erc20Vault.CallOpts)
}
// NewDepositVerifierMaturityTimestamp is a free data retrieval call binding the contract method 0xa7e5994f.
//
// Solidity: function newDepositVerifierMaturityTimestamp() constant returns(uint256)
func (_Erc20Vault *Erc20VaultCallerSession) NewDepositVerifierMaturityTimestamp() (*big.Int, error) {
return _Erc20Vault.Contract.NewDepositVerifierMaturityTimestamp(&_Erc20Vault.CallOpts)
}
// Operator is a free data retrieval call binding the contract method 0x570ca735.
//
// Solidity: function operator() constant returns(address)
func (_Erc20Vault *Erc20VaultCaller) Operator(opts *bind.CallOpts) (common.Address, error) {
var (
ret0 = new(common.Address)
)
out := ret0
err := _Erc20Vault.contract.Call(opts, out, "operator")
return *ret0, err
}
// Operator is a free data retrieval call binding the contract method 0x570ca735.
//
// Solidity: function operator() constant returns(address)
func (_Erc20Vault *Erc20VaultSession) Operator() (common.Address, error) {
return _Erc20Vault.Contract.Operator(&_Erc20Vault.CallOpts)
}
// Operator is a free data retrieval call binding the contract method 0x570ca735.
//
// Solidity: function operator() constant returns(address)
func (_Erc20Vault *Erc20VaultCallerSession) Operator() (common.Address, error) {
return _Erc20Vault.Contract.Operator(&_Erc20Vault.CallOpts)
}
// Deposit is a paid mutator transaction binding the contract method 0x98b1e06a.
//
// Solidity: function deposit(depositTx bytes) returns()
func (_Erc20Vault *Erc20VaultTransactor) Deposit(opts *bind.TransactOpts, depositTx []byte) (*types.Transaction, error) {
return _Erc20Vault.contract.Transact(opts, "deposit", depositTx)
}
// Deposit is a paid mutator transaction binding the contract method 0x98b1e06a.
//
// Solidity: function deposit(depositTx bytes) returns()
func (_Erc20Vault *Erc20VaultSession) Deposit(depositTx []byte) (*types.Transaction, error) {
return _Erc20Vault.Contract.Deposit(&_Erc20Vault.TransactOpts, depositTx)
}
// Deposit is a paid mutator transaction binding the contract method 0x98b1e06a.
//
// Solidity: function deposit(depositTx bytes) returns()
func (_Erc20Vault *Erc20VaultTransactorSession) Deposit(depositTx []byte) (*types.Transaction, error) {
return _Erc20Vault.Contract.Deposit(&_Erc20Vault.TransactOpts, depositTx)
}
// SetDepositVerifier is a paid mutator transaction binding the contract method 0x2c6ce78b.
//
// Solidity: function setDepositVerifier(_verifier address) returns()
func (_Erc20Vault *Erc20VaultTransactor) SetDepositVerifier(opts *bind.TransactOpts, _verifier common.Address) (*types.Transaction, error) {
return _Erc20Vault.contract.Transact(opts, "setDepositVerifier", _verifier)
}
// SetDepositVerifier is a paid mutator transaction binding the contract method 0x2c6ce78b.
//
// Solidity: function setDepositVerifier(_verifier address) returns()
func (_Erc20Vault *Erc20VaultSession) SetDepositVerifier(_verifier common.Address) (*types.Transaction, error) {
return _Erc20Vault.Contract.SetDepositVerifier(&_Erc20Vault.TransactOpts, _verifier)
}
// SetDepositVerifier is a paid mutator transaction binding the contract method 0x2c6ce78b.
//
// Solidity: function setDepositVerifier(_verifier address) returns()
func (_Erc20Vault *Erc20VaultTransactorSession) SetDepositVerifier(_verifier common.Address) (*types.Transaction, error) {
return _Erc20Vault.Contract.SetDepositVerifier(&_Erc20Vault.TransactOpts, _verifier)
}
// Withdraw is a paid mutator transaction binding the contract method 0xd9caed12.
//
// Solidity: function withdraw(receiver address, token address, amount uint256) returns()
func (_Erc20Vault *Erc20VaultTransactor) Withdraw(opts *bind.TransactOpts, receiver common.Address, token common.Address, amount *big.Int) (*types.Transaction, error) {
return _Erc20Vault.contract.Transact(opts, "withdraw", receiver, token, amount)
}
// Withdraw is a paid mutator transaction binding the contract method 0xd9caed12.
//
// Solidity: function withdraw(receiver address, token address, amount uint256) returns()
func (_Erc20Vault *Erc20VaultSession) Withdraw(receiver common.Address, token common.Address, amount *big.Int) (*types.Transaction, error) {
return _Erc20Vault.Contract.Withdraw(&_Erc20Vault.TransactOpts, receiver, token, amount)
}
// Withdraw is a paid mutator transaction binding the contract method 0xd9caed12.
//
// Solidity: function withdraw(receiver address, token address, amount uint256) returns()
func (_Erc20Vault *Erc20VaultTransactorSession) Withdraw(receiver common.Address, token common.Address, amount *big.Int) (*types.Transaction, error) {
return _Erc20Vault.Contract.Withdraw(&_Erc20Vault.TransactOpts, receiver, token, amount)
}
// Erc20VaultDepositCreatedIterator is returned from FilterDepositCreated and is used to iterate over the raw logs and unpacked data for DepositCreated events raised by the Erc20Vault contract.
type Erc20VaultDepositCreatedIterator struct {
Event *Erc20VaultDepositCreated // 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 *Erc20VaultDepositCreatedIterator) 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(Erc20VaultDepositCreated)
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(Erc20VaultDepositCreated)
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 *Erc20VaultDepositCreatedIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *Erc20VaultDepositCreatedIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// Erc20VaultDepositCreated represents a DepositCreated event raised by the Erc20Vault contract.
type Erc20VaultDepositCreated struct {
Depositor common.Address
Blknum *big.Int
Token common.Address
Amount *big.Int
Raw types.Log // Blockchain specific contextual infos
}
// FilterDepositCreated is a free log retrieval operation binding the contract event 0x18569122d84f30025bb8dffb33563f1bdbfb9637f21552b11b8305686e9cb307.
//
// Solidity: e DepositCreated(depositor indexed address, blknum indexed uint256, token indexed address, amount uint256)
func (_Erc20Vault *Erc20VaultFilterer) FilterDepositCreated(opts *bind.FilterOpts, depositor []common.Address, blknum []*big.Int, token []common.Address) (*Erc20VaultDepositCreatedIterator, error) {
var depositorRule []interface{}
for _, depositorItem := range depositor {
depositorRule = append(depositorRule, depositorItem)
}
var blknumRule []interface{}
for _, blknumItem := range blknum {
blknumRule = append(blknumRule, blknumItem)
}
var tokenRule []interface{}
for _, tokenItem := range token {
tokenRule = append(tokenRule, tokenItem)
}
logs, sub, err := _Erc20Vault.contract.FilterLogs(opts, "DepositCreated", depositorRule, blknumRule, tokenRule)
if err != nil {
return nil, err
}
return &Erc20VaultDepositCreatedIterator{contract: _Erc20Vault.contract, event: "DepositCreated", logs: logs, sub: sub}, nil
}
// WatchDepositCreated is a free log subscription operation binding the contract event 0x18569122d84f30025bb8dffb33563f1bdbfb9637f21552b11b8305686e9cb307.
//
// Solidity: e DepositCreated(depositor indexed address, blknum indexed uint256, token indexed address, amount uint256)
func (_Erc20Vault *Erc20VaultFilterer) WatchDepositCreated(opts *bind.WatchOpts, sink chan<- *Erc20VaultDepositCreated, depositor []common.Address, blknum []*big.Int, token []common.Address) (event.Subscription, error) {
var depositorRule []interface{}
for _, depositorItem := range depositor {
depositorRule = append(depositorRule, depositorItem)
}
var blknumRule []interface{}
for _, blknumItem := range blknum {
blknumRule = append(blknumRule, blknumItem)
}
var tokenRule []interface{}
for _, tokenItem := range token {
tokenRule = append(tokenRule, tokenItem)
}
logs, sub, err := _Erc20Vault.contract.WatchLogs(opts, "DepositCreated", depositorRule, blknumRule, tokenRule)
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(Erc20VaultDepositCreated)
if err := _Erc20Vault.contract.UnpackLog(event, "DepositCreated", 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
}
// Erc20VaultErc20WithdrawnIterator is returned from FilterErc20Withdrawn and is used to iterate over the raw logs and unpacked data for Erc20Withdrawn events raised by the Erc20Vault contract.
type Erc20VaultErc20WithdrawnIterator struct {
Event *Erc20VaultErc20Withdrawn // 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 *Erc20VaultErc20WithdrawnIterator) 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(Erc20VaultErc20Withdrawn)
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(Erc20VaultErc20Withdrawn)
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 *Erc20VaultErc20WithdrawnIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *Erc20VaultErc20WithdrawnIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// Erc20VaultErc20Withdrawn represents a Erc20Withdrawn event raised by the Erc20Vault contract.
type Erc20VaultErc20Withdrawn struct {
Receiver common.Address
Token common.Address
Amount *big.Int
Raw types.Log // Blockchain specific contextual infos
}
// FilterErc20Withdrawn is a free log retrieval operation binding the contract event 0xcd43b20ab5058a2a0a057681c9d3754aa8971fe74dacc8b6e4be0a49dae13101.
//
// Solidity: e Erc20Withdrawn(receiver indexed address, token indexed address, amount uint256)
func (_Erc20Vault *Erc20VaultFilterer) FilterErc20Withdrawn(opts *bind.FilterOpts, receiver []common.Address, token []common.Address) (*Erc20VaultErc20WithdrawnIterator, error) {
var receiverRule []interface{}
for _, receiverItem := range receiver {
receiverRule = append(receiverRule, receiverItem)
}
var tokenRule []interface{}
for _, tokenItem := range token {
tokenRule = append(tokenRule, tokenItem)
}
logs, sub, err := _Erc20Vault.contract.FilterLogs(opts, "Erc20Withdrawn", receiverRule, tokenRule)
if err != nil {
return nil, err
}
return &Erc20VaultErc20WithdrawnIterator{contract: _Erc20Vault.contract, event: "Erc20Withdrawn", logs: logs, sub: sub}, nil
}
// WatchErc20Withdrawn is a free log subscription operation binding the contract event 0xcd43b20ab5058a2a0a057681c9d3754aa8971fe74dacc8b6e4be0a49dae13101.
//
// Solidity: e Erc20Withdrawn(receiver indexed address, token indexed address, amount uint256)
func (_Erc20Vault *Erc20VaultFilterer) WatchErc20Withdrawn(opts *bind.WatchOpts, sink chan<- *Erc20VaultErc20Withdrawn, receiver []common.Address, token []common.Address) (event.Subscription, error) {
var receiverRule []interface{}
for _, receiverItem := range receiver {
receiverRule = append(receiverRule, receiverItem)
}
var tokenRule []interface{}
for _, tokenItem := range token {
tokenRule = append(tokenRule, tokenItem)
}
logs, sub, err := _Erc20Vault.contract.WatchLogs(opts, "Erc20Withdrawn", receiverRule, tokenRule)
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(Erc20VaultErc20Withdrawn)
if err := _Erc20Vault.contract.UnpackLog(event, "Erc20Withdrawn", 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
}
// Erc20VaultSetDepositVerifierCalledIterator is returned from FilterSetDepositVerifierCalled and is used to iterate over the raw logs and unpacked data for SetDepositVerifierCalled events raised by the Erc20Vault contract.
type Erc20VaultSetDepositVerifierCalledIterator struct {
Event *Erc20VaultSetDepositVerifierCalled // 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 *Erc20VaultSetDepositVerifierCalledIterator) 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(Erc20VaultSetDepositVerifierCalled)
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(Erc20VaultSetDepositVerifierCalled)
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 *Erc20VaultSetDepositVerifierCalledIterator) Error() error {
return it.fail
}
// Close terminates the iteration process, releasing any pending underlying
// resources.
func (it *Erc20VaultSetDepositVerifierCalledIterator) Close() error {
it.sub.Unsubscribe()
return nil
}
// Erc20VaultSetDepositVerifierCalled represents a SetDepositVerifierCalled event raised by the Erc20Vault contract.
type Erc20VaultSetDepositVerifierCalled struct {
NextDepositVerifier common.Address
Raw types.Log // Blockchain specific contextual infos
}
// FilterSetDepositVerifierCalled is a free log retrieval operation binding the contract event 0x11e5a7570e0de4b31179f8c9cf5e8a1e6cfd23731ec7a5a06e3006d71dd321fd.
//
// Solidity: e SetDepositVerifierCalled(nextDepositVerifier address)
func (_Erc20Vault *Erc20VaultFilterer) FilterSetDepositVerifierCalled(opts *bind.FilterOpts) (*Erc20VaultSetDepositVerifierCalledIterator, error) {
logs, sub, err := _Erc20Vault.contract.FilterLogs(opts, "SetDepositVerifierCalled")
if err != nil {
return nil, err
}
return &Erc20VaultSetDepositVerifierCalledIterator{contract: _Erc20Vault.contract, event: "SetDepositVerifierCalled", logs: logs, sub: sub}, nil
}
// WatchSetDepositVerifierCalled is a free log subscription operation binding the contract event 0x11e5a7570e0de4b31179f8c9cf5e8a1e6cfd23731ec7a5a06e3006d71dd321fd.
//
// Solidity: e SetDepositVerifierCalled(nextDepositVerifier address)
func (_Erc20Vault *Erc20VaultFilterer) WatchSetDepositVerifierCalled(opts *bind.WatchOpts, sink chan<- *Erc20VaultSetDepositVerifierCalled) (event.Subscription, error) {
logs, sub, err := _Erc20Vault.contract.WatchLogs(opts, "SetDepositVerifierCalled")
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(Erc20VaultSetDepositVerifierCalled)
if err := _Erc20Vault.contract.UnpackLog(event, "SetDepositVerifierCalled", 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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment