Browse Source

Update contracts and get verifiersLen from SC

feature/sql-semaphore1
Eduard S 3 years ago
parent
commit
90fe98d15c
11 changed files with 452 additions and 427 deletions
  1. +0
    -2
      common/ethrollup.go
  2. +7
    -7
      eth/.env.example
  3. +1
    -1
      eth/README.md
  4. +1
    -4
      eth/client_test.go
  5. +11
    -6
      eth/contracts/README.md
  6. +135
    -136
      eth/contracts/auction/HermezAuctionProtocol.go
  7. +159
    -129
      eth/contracts/hermez/Hermez.go
  8. +53
    -54
      eth/contracts/tokenHEZ/HEZ.go
  9. +76
    -77
      eth/contracts/withdrawdelayer/WithdrawalDelayer.go
  10. +6
    -2
      eth/rollup.go
  11. +3
    -9
      eth/rollup_test.go

+ 0
- 2
common/ethrollup.go

@ -40,8 +40,6 @@ const (
RollupConstMaxWithdrawalDelay = 2 * 7 * 24 * 60 * 60 RollupConstMaxWithdrawalDelay = 2 * 7 * 24 * 60 * 60
// RollupConstExchangeMultiplier exchange multiplier // RollupConstExchangeMultiplier exchange multiplier
RollupConstExchangeMultiplier = 1e14 RollupConstExchangeMultiplier = 1e14
// LenVerifiers number of Rollup Smart Contract Verifiers
LenVerifiers = 1
) )
var ( var (

+ 7
- 7
eth/.env.example

@ -1,7 +1,7 @@
GENESIS_BLOCK=97
AUCTION="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F"
AUCTION_TEST="0x56D4563E85477AC8Aa6a3b980b831DDb18a826ec"
TOKENHEZ="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3"
HERMEZ="0x6F4e99522F4eB37e0B73D0C0373147893EF12fD5"
WDELAYER="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77"
WDELAYER_TEST="0xdc05EFc3029024068FCc86f05323411f14D69280"
GENESIS_BLOCK=98
AUCTION="0x317113D2593e3efF1FfAE0ba2fF7A61861Df7ae5"
AUCTION_TEST="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3"
TOKENHEZ="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77"
HERMEZ="0x8EEaea23686c319133a7cC110b840d1591d9AeE0"
WDELAYER="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F"
WDELAYER_TEST="0xc8F466fFeF9E9788fb363c2F4fBDdF2cAe477805"

+ 1
- 1
eth/README.md

@ -8,7 +8,7 @@ The first step is to clone the github repository where the contracts are located
While the prepared deployment is not found to master, branch in repository must be changed: While the prepared deployment is not found to master, branch in repository must be changed:
`git checkout feature/newDeploymentScript-eth-1` (tested with commit `071926ea2bce1c673cb1ff2728297191a396d350`)
`git checkout feature/newDeploymentScript-eth-edu` (tested with commit `e6c5b7db8da2de1b9cc55e281c8d1dfa524b06f0`)
Now, install the dependencies: Now, install the dependencies:

+ 1
- 4
eth/client_test.go

@ -3,15 +3,12 @@ package eth
import ( import (
"testing" "testing"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestClientInterface(t *testing.T) { func TestClientInterface(t *testing.T) {
ethClient, err := ethclient.Dial(ethClientDialURL)
require.Nil(t, err)
var c ClientInterface var c ClientInterface
client, _ := NewClient(ethClient, nil, nil, &ClientConfig{})
client := &Client{}
c = client c = client
require.NotNil(t, c) require.NotNil(t, c)
} }

+ 11
- 6
eth/contracts/README.md

@ -10,14 +10,19 @@ abigen --abi=HEZ.abi --bin=HEZ.bin --pkg=HEZ --out=HEZ.go
``` ```
You must compile the contracts to get the `.bin` and `.abi` files. The contracts used are in the repo: https://github.com/hermeznetwork/contracts You must compile the contracts to get the `.bin` and `.abi` files. The contracts used are in the repo: https://github.com/hermeznetwork/contracts
Branch: `feature/newDeploymentScript`
Specifically they have been processed in the commit with hash: `254dc035142c56553d6d4ee9b2ea9d97259357c2`
Branch: `feature/newDeploymentScript-eth-edu`
at the commit with hash: `e6c5b7db8da2de1b9cc55e281c8d1dfa524b06f0`
Alternatively, you can run the `update.sh` script like this:
```
./update.sh CONTRACT_REPO_PATH
```
Versions: Versions:
```
solidity version 0.6.12
```
``` ```
$ abigen --version $ abigen --version
abigen version 1.9.21-stable-0287d548
$ solc --version
solc, the solidity compiler commandline interface
Version: 0.7.1+commit.f4a555be.Linux.g++
abigen version 1.9.25-stable-e7872729
``` ```

+ 135
- 136
eth/contracts/auction/HermezAuctionProtocol.go
File diff suppressed because it is too large
View File


+ 159
- 129
eth/contracts/hermez/Hermez.go
File diff suppressed because it is too large
View File


+ 53
- 54
eth/contracts/tokenHEZ/HEZ.go

@ -13,7 +13,6 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
"github.com/hermeznetwork/tracerr"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -93,7 +92,7 @@ type HEZTransactorRaw struct {
func NewHEZ(address common.Address, backend bind.ContractBackend) (*HEZ, error) { func NewHEZ(address common.Address, backend bind.ContractBackend) (*HEZ, error) {
contract, err := bindHEZ(address, backend, backend, backend) contract, err := bindHEZ(address, backend, backend, backend)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &HEZ{HEZCaller: HEZCaller{contract: contract}, HEZTransactor: HEZTransactor{contract: contract}, HEZFilterer: HEZFilterer{contract: contract}}, nil return &HEZ{HEZCaller: HEZCaller{contract: contract}, HEZTransactor: HEZTransactor{contract: contract}, HEZFilterer: HEZFilterer{contract: contract}}, nil
} }
@ -102,7 +101,7 @@ func NewHEZ(address common.Address, backend bind.ContractBackend) (*HEZ, error)
func NewHEZCaller(address common.Address, caller bind.ContractCaller) (*HEZCaller, error) { func NewHEZCaller(address common.Address, caller bind.ContractCaller) (*HEZCaller, error) {
contract, err := bindHEZ(address, caller, nil, nil) contract, err := bindHEZ(address, caller, nil, nil)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &HEZCaller{contract: contract}, nil return &HEZCaller{contract: contract}, nil
} }
@ -111,7 +110,7 @@ func NewHEZCaller(address common.Address, caller bind.ContractCaller) (*HEZCalle
func NewHEZTransactor(address common.Address, transactor bind.ContractTransactor) (*HEZTransactor, error) { func NewHEZTransactor(address common.Address, transactor bind.ContractTransactor) (*HEZTransactor, error) {
contract, err := bindHEZ(address, nil, transactor, nil) contract, err := bindHEZ(address, nil, transactor, nil)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &HEZTransactor{contract: contract}, nil return &HEZTransactor{contract: contract}, nil
} }
@ -120,7 +119,7 @@ func NewHEZTransactor(address common.Address, transactor bind.ContractTransactor
func NewHEZFilterer(address common.Address, filterer bind.ContractFilterer) (*HEZFilterer, error) { func NewHEZFilterer(address common.Address, filterer bind.ContractFilterer) (*HEZFilterer, error) {
contract, err := bindHEZ(address, nil, nil, filterer) contract, err := bindHEZ(address, nil, nil, filterer)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &HEZFilterer{contract: contract}, nil return &HEZFilterer{contract: contract}, nil
} }
@ -129,7 +128,7 @@ func NewHEZFilterer(address common.Address, filterer bind.ContractFilterer) (*HE
func bindHEZ(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { func bindHEZ(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(HEZABI)) parsed, err := abi.JSON(strings.NewReader(HEZABI))
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
} }
@ -180,12 +179,12 @@ func (_HEZ *HEZCaller) EIP712DOMAINHASH(opts *bind.CallOpts) ([32]byte, error) {
err := _HEZ.contract.Call(opts, &out, "EIP712DOMAIN_HASH") err := _HEZ.contract.Call(opts, &out, "EIP712DOMAIN_HASH")
if err != nil { if err != nil {
return *new([32]byte), tracerr.Wrap(err)
return *new([32]byte), err
} }
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -211,12 +210,12 @@ func (_HEZ *HEZCaller) NAMEHASH(opts *bind.CallOpts) ([32]byte, error) {
err := _HEZ.contract.Call(opts, &out, "NAME_HASH") err := _HEZ.contract.Call(opts, &out, "NAME_HASH")
if err != nil { if err != nil {
return *new([32]byte), tracerr.Wrap(err)
return *new([32]byte), err
} }
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -242,12 +241,12 @@ func (_HEZ *HEZCaller) PERMITTYPEHASH(opts *bind.CallOpts) ([32]byte, error) {
err := _HEZ.contract.Call(opts, &out, "PERMIT_TYPEHASH") err := _HEZ.contract.Call(opts, &out, "PERMIT_TYPEHASH")
if err != nil { if err != nil {
return *new([32]byte), tracerr.Wrap(err)
return *new([32]byte), err
} }
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -273,12 +272,12 @@ func (_HEZ *HEZCaller) TRANSFERWITHAUTHORIZATIONTYPEHASH(opts *bind.CallOpts) ([
err := _HEZ.contract.Call(opts, &out, "TRANSFER_WITH_AUTHORIZATION_TYPEHASH") err := _HEZ.contract.Call(opts, &out, "TRANSFER_WITH_AUTHORIZATION_TYPEHASH")
if err != nil { if err != nil {
return *new([32]byte), tracerr.Wrap(err)
return *new([32]byte), err
} }
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -304,12 +303,12 @@ func (_HEZ *HEZCaller) VERSIONHASH(opts *bind.CallOpts) ([32]byte, error) {
err := _HEZ.contract.Call(opts, &out, "VERSION_HASH") err := _HEZ.contract.Call(opts, &out, "VERSION_HASH")
if err != nil { if err != nil {
return *new([32]byte), tracerr.Wrap(err)
return *new([32]byte), err
} }
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -335,12 +334,12 @@ func (_HEZ *HEZCaller) Allowance(opts *bind.CallOpts, arg0 common.Address, arg1
err := _HEZ.contract.Call(opts, &out, "allowance", arg0, arg1) err := _HEZ.contract.Call(opts, &out, "allowance", arg0, arg1)
if err != nil { if err != nil {
return *new(*big.Int), tracerr.Wrap(err)
return *new(*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -366,12 +365,12 @@ func (_HEZ *HEZCaller) AuthorizationState(opts *bind.CallOpts, arg0 common.Addre
err := _HEZ.contract.Call(opts, &out, "authorizationState", arg0, arg1) err := _HEZ.contract.Call(opts, &out, "authorizationState", arg0, arg1)
if err != nil { if err != nil {
return *new(bool), tracerr.Wrap(err)
return *new(bool), err
} }
out0 := *abi.ConvertType(out[0], new(bool)).(*bool) out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -397,12 +396,12 @@ func (_HEZ *HEZCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big
err := _HEZ.contract.Call(opts, &out, "balanceOf", arg0) err := _HEZ.contract.Call(opts, &out, "balanceOf", arg0)
if err != nil { if err != nil {
return *new(*big.Int), tracerr.Wrap(err)
return *new(*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -428,12 +427,12 @@ func (_HEZ *HEZCaller) Decimals(opts *bind.CallOpts) (uint8, error) {
err := _HEZ.contract.Call(opts, &out, "decimals") err := _HEZ.contract.Call(opts, &out, "decimals")
if err != nil { if err != nil {
return *new(uint8), tracerr.Wrap(err)
return *new(uint8), err
} }
out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -459,12 +458,12 @@ func (_HEZ *HEZCaller) GetChainId(opts *bind.CallOpts) (*big.Int, error) {
err := _HEZ.contract.Call(opts, &out, "getChainId") err := _HEZ.contract.Call(opts, &out, "getChainId")
if err != nil { if err != nil {
return *new(*big.Int), tracerr.Wrap(err)
return *new(*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -490,12 +489,12 @@ func (_HEZ *HEZCaller) InitialBalance(opts *bind.CallOpts) (*big.Int, error) {
err := _HEZ.contract.Call(opts, &out, "initialBalance") err := _HEZ.contract.Call(opts, &out, "initialBalance")
if err != nil { if err != nil {
return *new(*big.Int), tracerr.Wrap(err)
return *new(*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -521,12 +520,12 @@ func (_HEZ *HEZCaller) Name(opts *bind.CallOpts) (string, error) {
err := _HEZ.contract.Call(opts, &out, "name") err := _HEZ.contract.Call(opts, &out, "name")
if err != nil { if err != nil {
return *new(string), tracerr.Wrap(err)
return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -552,12 +551,12 @@ func (_HEZ *HEZCaller) Nonces(opts *bind.CallOpts, arg0 common.Address) (*big.In
err := _HEZ.contract.Call(opts, &out, "nonces", arg0) err := _HEZ.contract.Call(opts, &out, "nonces", arg0)
if err != nil { if err != nil {
return *new(*big.Int), tracerr.Wrap(err)
return *new(*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -583,12 +582,12 @@ func (_HEZ *HEZCaller) Symbol(opts *bind.CallOpts) (string, error) {
err := _HEZ.contract.Call(opts, &out, "symbol") err := _HEZ.contract.Call(opts, &out, "symbol")
if err != nil { if err != nil {
return *new(string), tracerr.Wrap(err)
return *new(string), err
} }
out0 := *abi.ConvertType(out[0], new(string)).(*string) out0 := *abi.ConvertType(out[0], new(string)).(*string)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -614,12 +613,12 @@ func (_HEZ *HEZCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) {
err := _HEZ.contract.Call(opts, &out, "totalSupply") err := _HEZ.contract.Call(opts, &out, "totalSupply")
if err != nil { if err != nil {
return *new(*big.Int), tracerr.Wrap(err)
return *new(*big.Int), err
} }
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -854,7 +853,7 @@ func (_HEZ *HEZFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Ad
logs, sub, err := _HEZ.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) logs, sub, err := _HEZ.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &HEZApprovalIterator{contract: _HEZ.contract, event: "Approval", logs: logs, sub: sub}, nil return &HEZApprovalIterator{contract: _HEZ.contract, event: "Approval", logs: logs, sub: sub}, nil
} }
@ -875,7 +874,7 @@ func (_HEZ *HEZFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *HEZApp
logs, sub, err := _HEZ.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) logs, sub, err := _HEZ.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -885,19 +884,19 @@ func (_HEZ *HEZFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *HEZApp
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(HEZApproval) event := new(HEZApproval)
if err := _HEZ.contract.UnpackLog(event, "Approval", log); err != nil { if err := _HEZ.contract.UnpackLog(event, "Approval", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -911,7 +910,7 @@ func (_HEZ *HEZFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *HEZApp
func (_HEZ *HEZFilterer) ParseApproval(log types.Log) (*HEZApproval, error) { func (_HEZ *HEZFilterer) ParseApproval(log types.Log) (*HEZApproval, error) {
event := new(HEZApproval) event := new(HEZApproval)
if err := _HEZ.contract.UnpackLog(event, "Approval", log); err != nil { if err := _HEZ.contract.UnpackLog(event, "Approval", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1007,7 +1006,7 @@ func (_HEZ *HEZFilterer) FilterAuthorizationUsed(opts *bind.FilterOpts, authoriz
logs, sub, err := _HEZ.contract.FilterLogs(opts, "AuthorizationUsed", authorizerRule, nonceRule) logs, sub, err := _HEZ.contract.FilterLogs(opts, "AuthorizationUsed", authorizerRule, nonceRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &HEZAuthorizationUsedIterator{contract: _HEZ.contract, event: "AuthorizationUsed", logs: logs, sub: sub}, nil return &HEZAuthorizationUsedIterator{contract: _HEZ.contract, event: "AuthorizationUsed", logs: logs, sub: sub}, nil
} }
@ -1028,7 +1027,7 @@ func (_HEZ *HEZFilterer) WatchAuthorizationUsed(opts *bind.WatchOpts, sink chan<
logs, sub, err := _HEZ.contract.WatchLogs(opts, "AuthorizationUsed", authorizerRule, nonceRule) logs, sub, err := _HEZ.contract.WatchLogs(opts, "AuthorizationUsed", authorizerRule, nonceRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1038,19 +1037,19 @@ func (_HEZ *HEZFilterer) WatchAuthorizationUsed(opts *bind.WatchOpts, sink chan<
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(HEZAuthorizationUsed) event := new(HEZAuthorizationUsed)
if err := _HEZ.contract.UnpackLog(event, "AuthorizationUsed", log); err != nil { if err := _HEZ.contract.UnpackLog(event, "AuthorizationUsed", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1064,7 +1063,7 @@ func (_HEZ *HEZFilterer) WatchAuthorizationUsed(opts *bind.WatchOpts, sink chan<
func (_HEZ *HEZFilterer) ParseAuthorizationUsed(log types.Log) (*HEZAuthorizationUsed, error) { func (_HEZ *HEZFilterer) ParseAuthorizationUsed(log types.Log) (*HEZAuthorizationUsed, error) {
event := new(HEZAuthorizationUsed) event := new(HEZAuthorizationUsed)
if err := _HEZ.contract.UnpackLog(event, "AuthorizationUsed", log); err != nil { if err := _HEZ.contract.UnpackLog(event, "AuthorizationUsed", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1161,7 +1160,7 @@ func (_HEZ *HEZFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Add
logs, sub, err := _HEZ.contract.FilterLogs(opts, "Transfer", fromRule, toRule) logs, sub, err := _HEZ.contract.FilterLogs(opts, "Transfer", fromRule, toRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &HEZTransferIterator{contract: _HEZ.contract, event: "Transfer", logs: logs, sub: sub}, nil return &HEZTransferIterator{contract: _HEZ.contract, event: "Transfer", logs: logs, sub: sub}, nil
} }
@ -1182,7 +1181,7 @@ func (_HEZ *HEZFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *HEZTra
logs, sub, err := _HEZ.contract.WatchLogs(opts, "Transfer", fromRule, toRule) logs, sub, err := _HEZ.contract.WatchLogs(opts, "Transfer", fromRule, toRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1192,19 +1191,19 @@ func (_HEZ *HEZFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *HEZTra
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(HEZTransfer) event := new(HEZTransfer)
if err := _HEZ.contract.UnpackLog(event, "Transfer", log); err != nil { if err := _HEZ.contract.UnpackLog(event, "Transfer", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1218,7 +1217,7 @@ func (_HEZ *HEZFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *HEZTra
func (_HEZ *HEZFilterer) ParseTransfer(log types.Log) (*HEZTransfer, error) { func (_HEZ *HEZFilterer) ParseTransfer(log types.Log) (*HEZTransfer, error) {
event := new(HEZTransfer) event := new(HEZTransfer)
if err := _HEZ.contract.UnpackLog(event, "Transfer", log); err != nil { if err := _HEZ.contract.UnpackLog(event, "Transfer", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil

+ 76
- 77
eth/contracts/withdrawdelayer/WithdrawalDelayer.go

@ -13,7 +13,6 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
"github.com/hermeznetwork/tracerr"
) )
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -93,7 +92,7 @@ type WithdrawalDelayerTransactorRaw struct {
func NewWithdrawalDelayer(address common.Address, backend bind.ContractBackend) (*WithdrawalDelayer, error) { func NewWithdrawalDelayer(address common.Address, backend bind.ContractBackend) (*WithdrawalDelayer, error) {
contract, err := bindWithdrawalDelayer(address, backend, backend, backend) contract, err := bindWithdrawalDelayer(address, backend, backend, backend)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayer{WithdrawalDelayerCaller: WithdrawalDelayerCaller{contract: contract}, WithdrawalDelayerTransactor: WithdrawalDelayerTransactor{contract: contract}, WithdrawalDelayerFilterer: WithdrawalDelayerFilterer{contract: contract}}, nil return &WithdrawalDelayer{WithdrawalDelayerCaller: WithdrawalDelayerCaller{contract: contract}, WithdrawalDelayerTransactor: WithdrawalDelayerTransactor{contract: contract}, WithdrawalDelayerFilterer: WithdrawalDelayerFilterer{contract: contract}}, nil
} }
@ -102,7 +101,7 @@ func NewWithdrawalDelayer(address common.Address, backend bind.ContractBackend)
func NewWithdrawalDelayerCaller(address common.Address, caller bind.ContractCaller) (*WithdrawalDelayerCaller, error) { func NewWithdrawalDelayerCaller(address common.Address, caller bind.ContractCaller) (*WithdrawalDelayerCaller, error) {
contract, err := bindWithdrawalDelayer(address, caller, nil, nil) contract, err := bindWithdrawalDelayer(address, caller, nil, nil)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerCaller{contract: contract}, nil return &WithdrawalDelayerCaller{contract: contract}, nil
} }
@ -111,7 +110,7 @@ func NewWithdrawalDelayerCaller(address common.Address, caller bind.ContractCall
func NewWithdrawalDelayerTransactor(address common.Address, transactor bind.ContractTransactor) (*WithdrawalDelayerTransactor, error) { func NewWithdrawalDelayerTransactor(address common.Address, transactor bind.ContractTransactor) (*WithdrawalDelayerTransactor, error) {
contract, err := bindWithdrawalDelayer(address, nil, transactor, nil) contract, err := bindWithdrawalDelayer(address, nil, transactor, nil)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerTransactor{contract: contract}, nil return &WithdrawalDelayerTransactor{contract: contract}, nil
} }
@ -120,7 +119,7 @@ func NewWithdrawalDelayerTransactor(address common.Address, transactor bind.Cont
func NewWithdrawalDelayerFilterer(address common.Address, filterer bind.ContractFilterer) (*WithdrawalDelayerFilterer, error) { func NewWithdrawalDelayerFilterer(address common.Address, filterer bind.ContractFilterer) (*WithdrawalDelayerFilterer, error) {
contract, err := bindWithdrawalDelayer(address, nil, nil, filterer) contract, err := bindWithdrawalDelayer(address, nil, nil, filterer)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerFilterer{contract: contract}, nil return &WithdrawalDelayerFilterer{contract: contract}, nil
} }
@ -129,7 +128,7 @@ func NewWithdrawalDelayerFilterer(address common.Address, filterer bind.Contract
func bindWithdrawalDelayer(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { func bindWithdrawalDelayer(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
parsed, err := abi.JSON(strings.NewReader(WithdrawalDelayerABI)) parsed, err := abi.JSON(strings.NewReader(WithdrawalDelayerABI))
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
} }
@ -180,12 +179,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) MAXEMERGENCYMODETIME(opts *bi
err := _WithdrawalDelayer.contract.Call(opts, &out, "MAX_EMERGENCY_MODE_TIME") err := _WithdrawalDelayer.contract.Call(opts, &out, "MAX_EMERGENCY_MODE_TIME")
if err != nil { if err != nil {
return *new(uint64), tracerr.Wrap(err)
return *new(uint64), err
} }
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -211,12 +210,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) MAXWITHDRAWALDELAY(opts *bind
err := _WithdrawalDelayer.contract.Call(opts, &out, "MAX_WITHDRAWAL_DELAY") err := _WithdrawalDelayer.contract.Call(opts, &out, "MAX_WITHDRAWAL_DELAY")
if err != nil { if err != nil {
return *new(uint64), tracerr.Wrap(err)
return *new(uint64), err
} }
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -242,13 +241,13 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) DepositInfo(opts *bind.CallOp
err := _WithdrawalDelayer.contract.Call(opts, &out, "depositInfo", _owner, _token) err := _WithdrawalDelayer.contract.Call(opts, &out, "depositInfo", _owner, _token)
if err != nil { if err != nil {
return *new(*big.Int), *new(uint64), tracerr.Wrap(err)
return *new(*big.Int), *new(uint64), err
} }
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
out1 := *abi.ConvertType(out[1], new(uint64)).(*uint64) out1 := *abi.ConvertType(out[1], new(uint64)).(*uint64)
return out0, out1, tracerr.Wrap(err)
return out0, out1, err
} }
@ -284,7 +283,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) Deposits(opts *bind.CallOpts,
outstruct.Amount = out[0].(*big.Int) outstruct.Amount = out[0].(*big.Int)
outstruct.DepositTimestamp = out[1].(uint64) outstruct.DepositTimestamp = out[1].(uint64)
return *outstruct, tracerr.Wrap(err)
return *outstruct, err
} }
@ -316,12 +315,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) GetEmergencyCouncil(opts *bin
err := _WithdrawalDelayer.contract.Call(opts, &out, "getEmergencyCouncil") err := _WithdrawalDelayer.contract.Call(opts, &out, "getEmergencyCouncil")
if err != nil { if err != nil {
return *new(common.Address), tracerr.Wrap(err)
return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -347,12 +346,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) GetEmergencyModeStartingTime(
err := _WithdrawalDelayer.contract.Call(opts, &out, "getEmergencyModeStartingTime") err := _WithdrawalDelayer.contract.Call(opts, &out, "getEmergencyModeStartingTime")
if err != nil { if err != nil {
return *new(uint64), tracerr.Wrap(err)
return *new(uint64), err
} }
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -378,12 +377,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) GetHermezGovernanceAddress(op
err := _WithdrawalDelayer.contract.Call(opts, &out, "getHermezGovernanceAddress") err := _WithdrawalDelayer.contract.Call(opts, &out, "getHermezGovernanceAddress")
if err != nil { if err != nil {
return *new(common.Address), tracerr.Wrap(err)
return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -409,12 +408,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) GetWithdrawalDelay(opts *bind
err := _WithdrawalDelayer.contract.Call(opts, &out, "getWithdrawalDelay") err := _WithdrawalDelayer.contract.Call(opts, &out, "getWithdrawalDelay")
if err != nil { if err != nil {
return *new(uint64), tracerr.Wrap(err)
return *new(uint64), err
} }
out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -440,12 +439,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) HermezRollupAddress(opts *bin
err := _WithdrawalDelayer.contract.Call(opts, &out, "hermezRollupAddress") err := _WithdrawalDelayer.contract.Call(opts, &out, "hermezRollupAddress")
if err != nil { if err != nil {
return *new(common.Address), tracerr.Wrap(err)
return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -471,12 +470,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) IsEmergencyMode(opts *bind.Ca
err := _WithdrawalDelayer.contract.Call(opts, &out, "isEmergencyMode") err := _WithdrawalDelayer.contract.Call(opts, &out, "isEmergencyMode")
if err != nil { if err != nil {
return *new(bool), tracerr.Wrap(err)
return *new(bool), err
} }
out0 := *abi.ConvertType(out[0], new(bool)).(*bool) out0 := *abi.ConvertType(out[0], new(bool)).(*bool)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -502,12 +501,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) PendingEmergencyCouncil(opts
err := _WithdrawalDelayer.contract.Call(opts, &out, "pendingEmergencyCouncil") err := _WithdrawalDelayer.contract.Call(opts, &out, "pendingEmergencyCouncil")
if err != nil { if err != nil {
return *new(common.Address), tracerr.Wrap(err)
return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -533,12 +532,12 @@ func (_WithdrawalDelayer *WithdrawalDelayerCaller) PendingGovernance(opts *bind.
err := _WithdrawalDelayer.contract.Call(opts, &out, "pendingGovernance") err := _WithdrawalDelayer.contract.Call(opts, &out, "pendingGovernance")
if err != nil { if err != nil {
return *new(common.Address), tracerr.Wrap(err)
return *new(common.Address), err
} }
out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)
return out0, tracerr.Wrap(err)
return out0, err
} }
@ -858,7 +857,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterDeposit(opts *bind.Fi
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "Deposit", ownerRule, tokenRule) logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "Deposit", ownerRule, tokenRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerDepositIterator{contract: _WithdrawalDelayer.contract, event: "Deposit", logs: logs, sub: sub}, nil return &WithdrawalDelayerDepositIterator{contract: _WithdrawalDelayer.contract, event: "Deposit", logs: logs, sub: sub}, nil
} }
@ -879,7 +878,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchDeposit(opts *bind.Wat
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "Deposit", ownerRule, tokenRule) logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "Deposit", ownerRule, tokenRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -889,19 +888,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchDeposit(opts *bind.Wat
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerDeposit) event := new(WithdrawalDelayerDeposit)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "Deposit", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "Deposit", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -915,7 +914,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchDeposit(opts *bind.Wat
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseDeposit(log types.Log) (*WithdrawalDelayerDeposit, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseDeposit(log types.Log) (*WithdrawalDelayerDeposit, error) {
event := new(WithdrawalDelayerDeposit) event := new(WithdrawalDelayerDeposit)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "Deposit", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "Deposit", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1000,7 +999,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterEmergencyModeEnabled(
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "EmergencyModeEnabled") logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "EmergencyModeEnabled")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerEmergencyModeEnabledIterator{contract: _WithdrawalDelayer.contract, event: "EmergencyModeEnabled", logs: logs, sub: sub}, nil return &WithdrawalDelayerEmergencyModeEnabledIterator{contract: _WithdrawalDelayer.contract, event: "EmergencyModeEnabled", logs: logs, sub: sub}, nil
} }
@ -1012,7 +1011,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchEmergencyModeEnabled(o
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "EmergencyModeEnabled") logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "EmergencyModeEnabled")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1022,19 +1021,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchEmergencyModeEnabled(o
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerEmergencyModeEnabled) event := new(WithdrawalDelayerEmergencyModeEnabled)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "EmergencyModeEnabled", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "EmergencyModeEnabled", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1048,7 +1047,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchEmergencyModeEnabled(o
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseEmergencyModeEnabled(log types.Log) (*WithdrawalDelayerEmergencyModeEnabled, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseEmergencyModeEnabled(log types.Log) (*WithdrawalDelayerEmergencyModeEnabled, error) {
event := new(WithdrawalDelayerEmergencyModeEnabled) event := new(WithdrawalDelayerEmergencyModeEnabled)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "EmergencyModeEnabled", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "EmergencyModeEnabled", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1150,7 +1149,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterEscapeHatchWithdrawal
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "EscapeHatchWithdrawal", whoRule, toRule, tokenRule) logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "EscapeHatchWithdrawal", whoRule, toRule, tokenRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerEscapeHatchWithdrawalIterator{contract: _WithdrawalDelayer.contract, event: "EscapeHatchWithdrawal", logs: logs, sub: sub}, nil return &WithdrawalDelayerEscapeHatchWithdrawalIterator{contract: _WithdrawalDelayer.contract, event: "EscapeHatchWithdrawal", logs: logs, sub: sub}, nil
} }
@ -1175,7 +1174,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchEscapeHatchWithdrawal(
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "EscapeHatchWithdrawal", whoRule, toRule, tokenRule) logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "EscapeHatchWithdrawal", whoRule, toRule, tokenRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1185,19 +1184,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchEscapeHatchWithdrawal(
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerEscapeHatchWithdrawal) event := new(WithdrawalDelayerEscapeHatchWithdrawal)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "EscapeHatchWithdrawal", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "EscapeHatchWithdrawal", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1211,7 +1210,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchEscapeHatchWithdrawal(
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseEscapeHatchWithdrawal(log types.Log) (*WithdrawalDelayerEscapeHatchWithdrawal, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseEscapeHatchWithdrawal(log types.Log) (*WithdrawalDelayerEscapeHatchWithdrawal, error) {
event := new(WithdrawalDelayerEscapeHatchWithdrawal) event := new(WithdrawalDelayerEscapeHatchWithdrawal)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "EscapeHatchWithdrawal", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "EscapeHatchWithdrawal", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1299,7 +1298,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterInitializeWithdrawalD
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "InitializeWithdrawalDelayerEvent") logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "InitializeWithdrawalDelayerEvent")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerInitializeWithdrawalDelayerEventIterator{contract: _WithdrawalDelayer.contract, event: "InitializeWithdrawalDelayerEvent", logs: logs, sub: sub}, nil return &WithdrawalDelayerInitializeWithdrawalDelayerEventIterator{contract: _WithdrawalDelayer.contract, event: "InitializeWithdrawalDelayerEvent", logs: logs, sub: sub}, nil
} }
@ -1311,7 +1310,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchInitializeWithdrawalDe
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "InitializeWithdrawalDelayerEvent") logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "InitializeWithdrawalDelayerEvent")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1321,19 +1320,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchInitializeWithdrawalDe
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerInitializeWithdrawalDelayerEvent) event := new(WithdrawalDelayerInitializeWithdrawalDelayerEvent)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "InitializeWithdrawalDelayerEvent", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "InitializeWithdrawalDelayerEvent", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1347,7 +1346,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchInitializeWithdrawalDe
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseInitializeWithdrawalDelayerEvent(log types.Log) (*WithdrawalDelayerInitializeWithdrawalDelayerEvent, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseInitializeWithdrawalDelayerEvent(log types.Log) (*WithdrawalDelayerInitializeWithdrawalDelayerEvent, error) {
event := new(WithdrawalDelayerInitializeWithdrawalDelayerEvent) event := new(WithdrawalDelayerInitializeWithdrawalDelayerEvent)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "InitializeWithdrawalDelayerEvent", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "InitializeWithdrawalDelayerEvent", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1433,7 +1432,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterNewEmergencyCouncil(o
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "NewEmergencyCouncil") logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "NewEmergencyCouncil")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerNewEmergencyCouncilIterator{contract: _WithdrawalDelayer.contract, event: "NewEmergencyCouncil", logs: logs, sub: sub}, nil return &WithdrawalDelayerNewEmergencyCouncilIterator{contract: _WithdrawalDelayer.contract, event: "NewEmergencyCouncil", logs: logs, sub: sub}, nil
} }
@ -1445,7 +1444,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewEmergencyCouncil(op
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "NewEmergencyCouncil") logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "NewEmergencyCouncil")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1455,19 +1454,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewEmergencyCouncil(op
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerNewEmergencyCouncil) event := new(WithdrawalDelayerNewEmergencyCouncil)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewEmergencyCouncil", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewEmergencyCouncil", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1481,7 +1480,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewEmergencyCouncil(op
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseNewEmergencyCouncil(log types.Log) (*WithdrawalDelayerNewEmergencyCouncil, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseNewEmergencyCouncil(log types.Log) (*WithdrawalDelayerNewEmergencyCouncil, error) {
event := new(WithdrawalDelayerNewEmergencyCouncil) event := new(WithdrawalDelayerNewEmergencyCouncil)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewEmergencyCouncil", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewEmergencyCouncil", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1567,7 +1566,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterNewHermezGovernanceAd
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "NewHermezGovernanceAddress") logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "NewHermezGovernanceAddress")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerNewHermezGovernanceAddressIterator{contract: _WithdrawalDelayer.contract, event: "NewHermezGovernanceAddress", logs: logs, sub: sub}, nil return &WithdrawalDelayerNewHermezGovernanceAddressIterator{contract: _WithdrawalDelayer.contract, event: "NewHermezGovernanceAddress", logs: logs, sub: sub}, nil
} }
@ -1579,7 +1578,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewHermezGovernanceAdd
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "NewHermezGovernanceAddress") logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "NewHermezGovernanceAddress")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1589,19 +1588,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewHermezGovernanceAdd
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerNewHermezGovernanceAddress) event := new(WithdrawalDelayerNewHermezGovernanceAddress)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewHermezGovernanceAddress", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewHermezGovernanceAddress", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1615,7 +1614,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewHermezGovernanceAdd
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseNewHermezGovernanceAddress(log types.Log) (*WithdrawalDelayerNewHermezGovernanceAddress, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseNewHermezGovernanceAddress(log types.Log) (*WithdrawalDelayerNewHermezGovernanceAddress, error) {
event := new(WithdrawalDelayerNewHermezGovernanceAddress) event := new(WithdrawalDelayerNewHermezGovernanceAddress)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewHermezGovernanceAddress", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewHermezGovernanceAddress", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1701,7 +1700,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterNewWithdrawalDelay(op
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "NewWithdrawalDelay") logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "NewWithdrawalDelay")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerNewWithdrawalDelayIterator{contract: _WithdrawalDelayer.contract, event: "NewWithdrawalDelay", logs: logs, sub: sub}, nil return &WithdrawalDelayerNewWithdrawalDelayIterator{contract: _WithdrawalDelayer.contract, event: "NewWithdrawalDelay", logs: logs, sub: sub}, nil
} }
@ -1713,7 +1712,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewWithdrawalDelay(opt
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "NewWithdrawalDelay") logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "NewWithdrawalDelay")
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1723,19 +1722,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewWithdrawalDelay(opt
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerNewWithdrawalDelay) event := new(WithdrawalDelayerNewWithdrawalDelay)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewWithdrawalDelay", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewWithdrawalDelay", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1749,7 +1748,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchNewWithdrawalDelay(opt
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseNewWithdrawalDelay(log types.Log) (*WithdrawalDelayerNewWithdrawalDelay, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseNewWithdrawalDelay(log types.Log) (*WithdrawalDelayerNewWithdrawalDelay, error) {
event := new(WithdrawalDelayerNewWithdrawalDelay) event := new(WithdrawalDelayerNewWithdrawalDelay)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewWithdrawalDelay", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "NewWithdrawalDelay", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil
@ -1846,7 +1845,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) FilterWithdraw(opts *bind.F
logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "Withdraw", tokenRule, ownerRule) logs, sub, err := _WithdrawalDelayer.contract.FilterLogs(opts, "Withdraw", tokenRule, ownerRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return &WithdrawalDelayerWithdrawIterator{contract: _WithdrawalDelayer.contract, event: "Withdraw", logs: logs, sub: sub}, nil return &WithdrawalDelayerWithdrawIterator{contract: _WithdrawalDelayer.contract, event: "Withdraw", logs: logs, sub: sub}, nil
} }
@ -1867,7 +1866,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchWithdraw(opts *bind.Wa
logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "Withdraw", tokenRule, ownerRule) logs, sub, err := _WithdrawalDelayer.contract.WatchLogs(opts, "Withdraw", tokenRule, ownerRule)
if err != nil { if err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
return event.NewSubscription(func(quit <-chan struct{}) error { return event.NewSubscription(func(quit <-chan struct{}) error {
defer sub.Unsubscribe() defer sub.Unsubscribe()
@ -1877,19 +1876,19 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchWithdraw(opts *bind.Wa
// New log arrived, parse the event and forward to the user // New log arrived, parse the event and forward to the user
event := new(WithdrawalDelayerWithdraw) event := new(WithdrawalDelayerWithdraw)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "Withdraw", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "Withdraw", log); err != nil {
return tracerr.Wrap(err)
return err
} }
event.Raw = log event.Raw = log
select { select {
case sink <- event: case sink <- event:
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
case err := <-sub.Err(): case err := <-sub.Err():
return tracerr.Wrap(err)
return err
case <-quit: case <-quit:
return nil return nil
} }
@ -1903,7 +1902,7 @@ func (_WithdrawalDelayer *WithdrawalDelayerFilterer) WatchWithdraw(opts *bind.Wa
func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseWithdraw(log types.Log) (*WithdrawalDelayerWithdraw, error) { func (_WithdrawalDelayer *WithdrawalDelayerFilterer) ParseWithdraw(log types.Log) (*WithdrawalDelayerWithdraw, error) {
event := new(WithdrawalDelayerWithdraw) event := new(WithdrawalDelayerWithdraw)
if err := _WithdrawalDelayer.contract.UnpackLog(event, "Withdraw", log); err != nil { if err := _WithdrawalDelayer.contract.UnpackLog(event, "Withdraw", log); err != nil {
return nil, tracerr.Wrap(err)
return nil, err
} }
event.Raw = log event.Raw = log
return event, nil return event, nil

+ 6
- 2
eth/rollup.go

@ -325,7 +325,7 @@ func NewRollupClient(client *EthereumClient, address ethCommon.Address, tokenHEZ
// RollupForgeBatch is the interface to call the smart contract function // RollupForgeBatch is the interface to call the smart contract function
func (c *RollupClient) RollupForgeBatch(args *RollupForgeBatchArgs, auth *bind.TransactOpts) (tx *types.Transaction, err error) { func (c *RollupClient) RollupForgeBatch(args *RollupForgeBatchArgs, auth *bind.TransactOpts) (tx *types.Transaction, err error) {
if auth == nil { if auth == nil {
auth, err := c.client.NewAuth()
auth, err = c.client.NewAuth()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -662,7 +662,11 @@ func (c *RollupClient) RollupConstants() (rollupConstants *common.RollupConstant
if err != nil { if err != nil {
return tracerr.Wrap(err) return tracerr.Wrap(err)
} }
for i := int64(0); i < int64(common.LenVerifiers); i++ {
rollupVerifiersLength, err := c.hermez.RollupVerifiersLength(c.opts)
if err != nil {
return tracerr.Wrap(err)
}
for i := int64(0); i < rollupVerifiersLength.Int64(); i++ {
var newRollupVerifier common.RollupVerifierStruct var newRollupVerifier common.RollupVerifierStruct
rollupVerifier, err := c.hermez.RollupVerifiers(c.opts, big.NewInt(i)) rollupVerifier, err := c.hermez.RollupVerifiers(c.opts, big.NewInt(i))
if err != nil { if err != nil {

+ 3
- 9
eth/rollup_test.go

@ -169,9 +169,7 @@ func TestRollupForgeBatch(t *testing.T) {
args.ProofC[1] = big.NewInt(0) args.ProofC[1] = big.NewInt(0)
argsForge = args argsForge = args
auth, err := rollupClient.client.NewAuth()
require.NoError(t, err)
_, err = rollupClient.RollupForgeBatch(argsForge, auth)
_, err = rollupClient.RollupForgeBatch(argsForge, nil)
require.NoError(t, err) require.NoError(t, err)
currentBlockNum, err = rollupClient.client.EthLastBlock() currentBlockNum, err = rollupClient.client.EthLastBlock()
@ -820,9 +818,7 @@ func TestRollupL1UserTxERC20PermitForceExit(t *testing.T) {
func TestRollupForgeBatch2(t *testing.T) { func TestRollupForgeBatch2(t *testing.T) {
// Forge Batch 2 // Forge Batch 2
auth, err := rollupClient.client.NewAuth()
require.NoError(t, err)
_, err = rollupClient.RollupForgeBatch(argsForge, auth)
_, err := rollupClient.RollupForgeBatch(argsForge, nil)
require.NoError(t, err) require.NoError(t, err)
currentBlockNum, err := rollupClient.client.EthLastBlock() currentBlockNum, err := rollupClient.client.EthLastBlock()
require.NoError(t, err) require.NoError(t, err)
@ -875,9 +871,7 @@ func TestRollupForgeBatch2(t *testing.T) {
argsForge = args argsForge = args
auth, err = rollupClient.client.NewAuth()
require.NoError(t, err)
_, err = rollupClient.RollupForgeBatch(argsForge, auth)
_, err = rollupClient.RollupForgeBatch(argsForge, nil)
require.NoError(t, err) require.NoError(t, err)
currentBlockNum, err = rollupClient.client.EthLastBlock() currentBlockNum, err = rollupClient.client.EthLastBlock()

Loading…
Cancel
Save