mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Wrap all errors with tracerr
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
"github.com/hermeznetwork/tracerr"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -36,12 +37,12 @@ var HEZBin = "0x608060405234801561001057600080fd5b506040516111153803806111158339
|
||||
func DeployHEZ(auth *bind.TransactOpts, backend bind.ContractBackend, initialHolder common.Address) (common.Address, *types.Transaction, *HEZ, error) {
|
||||
parsed, err := abi.JSON(strings.NewReader(HEZABI))
|
||||
if err != nil {
|
||||
return common.Address{}, nil, nil, err
|
||||
return common.Address{}, nil, nil, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(HEZBin), backend, initialHolder)
|
||||
if err != nil {
|
||||
return common.Address{}, nil, nil, err
|
||||
return common.Address{}, nil, nil, tracerr.Wrap(err)
|
||||
}
|
||||
return address, tx, &HEZ{HEZCaller: HEZCaller{contract: contract}, HEZTransactor: HEZTransactor{contract: contract}, HEZFilterer: HEZFilterer{contract: contract}}, nil
|
||||
}
|
||||
@@ -109,7 +110,7 @@ type HEZTransactorRaw struct {
|
||||
func NewHEZ(address common.Address, backend bind.ContractBackend) (*HEZ, error) {
|
||||
contract, err := bindHEZ(address, backend, backend, backend)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return &HEZ{HEZCaller: HEZCaller{contract: contract}, HEZTransactor: HEZTransactor{contract: contract}, HEZFilterer: HEZFilterer{contract: contract}}, nil
|
||||
}
|
||||
@@ -118,7 +119,7 @@ func NewHEZ(address common.Address, backend bind.ContractBackend) (*HEZ, error)
|
||||
func NewHEZCaller(address common.Address, caller bind.ContractCaller) (*HEZCaller, error) {
|
||||
contract, err := bindHEZ(address, caller, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return &HEZCaller{contract: contract}, nil
|
||||
}
|
||||
@@ -127,7 +128,7 @@ func NewHEZCaller(address common.Address, caller bind.ContractCaller) (*HEZCalle
|
||||
func NewHEZTransactor(address common.Address, transactor bind.ContractTransactor) (*HEZTransactor, error) {
|
||||
contract, err := bindHEZ(address, nil, transactor, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return &HEZTransactor{contract: contract}, nil
|
||||
}
|
||||
@@ -136,7 +137,7 @@ func NewHEZTransactor(address common.Address, transactor bind.ContractTransactor
|
||||
func NewHEZFilterer(address common.Address, filterer bind.ContractFilterer) (*HEZFilterer, error) {
|
||||
contract, err := bindHEZ(address, nil, nil, filterer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return &HEZFilterer{contract: contract}, nil
|
||||
}
|
||||
@@ -145,7 +146,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) {
|
||||
parsed, err := abi.JSON(strings.NewReader(HEZABI))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil
|
||||
}
|
||||
@@ -197,7 +198,7 @@ func (_HEZ *HEZCaller) EIP712DOMAINHASH(opts *bind.CallOpts) ([32]byte, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "EIP712DOMAIN_HASH")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// EIP712DOMAINHASH is a free data retrieval call binding the contract method 0xc473af33.
|
||||
@@ -223,7 +224,7 @@ func (_HEZ *HEZCaller) NAMEHASH(opts *bind.CallOpts) ([32]byte, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "NAME_HASH")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// NAMEHASH is a free data retrieval call binding the contract method 0x04622c2e.
|
||||
@@ -249,7 +250,7 @@ func (_HEZ *HEZCaller) PERMITTYPEHASH(opts *bind.CallOpts) ([32]byte, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "PERMIT_TYPEHASH")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// PERMITTYPEHASH is a free data retrieval call binding the contract method 0x30adf81f.
|
||||
@@ -275,7 +276,7 @@ func (_HEZ *HEZCaller) TRANSFERWITHAUTHORIZATIONTYPEHASH(opts *bind.CallOpts) ([
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "TRANSFER_WITH_AUTHORIZATION_TYPEHASH")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// TRANSFERWITHAUTHORIZATIONTYPEHASH is a free data retrieval call binding the contract method 0xa0cc6a68.
|
||||
@@ -301,7 +302,7 @@ func (_HEZ *HEZCaller) VERSIONHASH(opts *bind.CallOpts) ([32]byte, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "VERSION_HASH")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// VERSIONHASH is a free data retrieval call binding the contract method 0x9e4e7318.
|
||||
@@ -327,7 +328,7 @@ func (_HEZ *HEZCaller) Allowance(opts *bind.CallOpts, arg0 common.Address, arg1
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "allowance", arg0, arg1)
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.
|
||||
@@ -353,7 +354,7 @@ func (_HEZ *HEZCaller) AuthorizationState(opts *bind.CallOpts, arg0 common.Addre
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "authorizationState", arg0, arg1)
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// AuthorizationState is a free data retrieval call binding the contract method 0xe94a0102.
|
||||
@@ -379,7 +380,7 @@ func (_HEZ *HEZCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "balanceOf", arg0)
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// BalanceOf is a free data retrieval call binding the contract method 0x70a08231.
|
||||
@@ -405,7 +406,7 @@ func (_HEZ *HEZCaller) Decimals(opts *bind.CallOpts) (uint8, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "decimals")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// Decimals is a free data retrieval call binding the contract method 0x313ce567.
|
||||
@@ -431,7 +432,7 @@ func (_HEZ *HEZCaller) GetChainId(opts *bind.CallOpts) (*big.Int, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "getChainId")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// GetChainId is a free data retrieval call binding the contract method 0x3408e470.
|
||||
@@ -457,7 +458,7 @@ func (_HEZ *HEZCaller) InitialBalance(opts *bind.CallOpts) (*big.Int, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "initialBalance")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// InitialBalance is a free data retrieval call binding the contract method 0x18369a2a.
|
||||
@@ -483,7 +484,7 @@ func (_HEZ *HEZCaller) Name(opts *bind.CallOpts) (string, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "name")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// Name is a free data retrieval call binding the contract method 0x06fdde03.
|
||||
@@ -509,7 +510,7 @@ func (_HEZ *HEZCaller) Nonces(opts *bind.CallOpts, arg0 common.Address) (*big.In
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "nonces", arg0)
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// Nonces is a free data retrieval call binding the contract method 0x7ecebe00.
|
||||
@@ -535,7 +536,7 @@ func (_HEZ *HEZCaller) Symbol(opts *bind.CallOpts) (string, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "symbol")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// Symbol is a free data retrieval call binding the contract method 0x95d89b41.
|
||||
@@ -561,7 +562,7 @@ func (_HEZ *HEZCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) {
|
||||
)
|
||||
out := ret0
|
||||
err := _HEZ.contract.Call(opts, out, "totalSupply")
|
||||
return *ret0, err
|
||||
return *ret0, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd.
|
||||
@@ -795,7 +796,7 @@ func (_HEZ *HEZFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Ad
|
||||
|
||||
logs, sub, err := _HEZ.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return &HEZApprovalIterator{contract: _HEZ.contract, event: "Approval", logs: logs, sub: sub}, nil
|
||||
}
|
||||
@@ -816,7 +817,7 @@ func (_HEZ *HEZFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *HEZApp
|
||||
|
||||
logs, sub, err := _HEZ.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
@@ -826,19 +827,19 @@ func (_HEZ *HEZFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *HEZApp
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(HEZApproval)
|
||||
if err := _HEZ.contract.UnpackLog(event, "Approval", log); err != nil {
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
@@ -852,7 +853,7 @@ func (_HEZ *HEZFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *HEZApp
|
||||
func (_HEZ *HEZFilterer) ParseApproval(log types.Log) (*HEZApproval, error) {
|
||||
event := new(HEZApproval)
|
||||
if err := _HEZ.contract.UnpackLog(event, "Approval", log); err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return event, nil
|
||||
}
|
||||
@@ -947,7 +948,7 @@ func (_HEZ *HEZFilterer) FilterAuthorizationUsed(opts *bind.FilterOpts, authoriz
|
||||
|
||||
logs, sub, err := _HEZ.contract.FilterLogs(opts, "AuthorizationUsed", authorizerRule, nonceRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return &HEZAuthorizationUsedIterator{contract: _HEZ.contract, event: "AuthorizationUsed", logs: logs, sub: sub}, nil
|
||||
}
|
||||
@@ -968,7 +969,7 @@ func (_HEZ *HEZFilterer) WatchAuthorizationUsed(opts *bind.WatchOpts, sink chan<
|
||||
|
||||
logs, sub, err := _HEZ.contract.WatchLogs(opts, "AuthorizationUsed", authorizerRule, nonceRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
@@ -978,19 +979,19 @@ func (_HEZ *HEZFilterer) WatchAuthorizationUsed(opts *bind.WatchOpts, sink chan<
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(HEZAuthorizationUsed)
|
||||
if err := _HEZ.contract.UnpackLog(event, "AuthorizationUsed", log); err != nil {
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
@@ -1004,7 +1005,7 @@ func (_HEZ *HEZFilterer) WatchAuthorizationUsed(opts *bind.WatchOpts, sink chan<
|
||||
func (_HEZ *HEZFilterer) ParseAuthorizationUsed(log types.Log) (*HEZAuthorizationUsed, error) {
|
||||
event := new(HEZAuthorizationUsed)
|
||||
if err := _HEZ.contract.UnpackLog(event, "AuthorizationUsed", log); err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return event, nil
|
||||
}
|
||||
@@ -1100,7 +1101,7 @@ func (_HEZ *HEZFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Add
|
||||
|
||||
logs, sub, err := _HEZ.contract.FilterLogs(opts, "Transfer", fromRule, toRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return &HEZTransferIterator{contract: _HEZ.contract, event: "Transfer", logs: logs, sub: sub}, nil
|
||||
}
|
||||
@@ -1121,7 +1122,7 @@ func (_HEZ *HEZFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *HEZTra
|
||||
|
||||
logs, sub, err := _HEZ.contract.WatchLogs(opts, "Transfer", fromRule, toRule)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
defer sub.Unsubscribe()
|
||||
@@ -1131,19 +1132,19 @@ func (_HEZ *HEZFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *HEZTra
|
||||
// New log arrived, parse the event and forward to the user
|
||||
event := new(HEZTransfer)
|
||||
if err := _HEZ.contract.UnpackLog(event, "Transfer", log); err != nil {
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
}
|
||||
event.Raw = log
|
||||
|
||||
select {
|
||||
case sink <- event:
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
case err := <-sub.Err():
|
||||
return err
|
||||
return tracerr.Wrap(err)
|
||||
case <-quit:
|
||||
return nil
|
||||
}
|
||||
@@ -1157,7 +1158,7 @@ func (_HEZ *HEZFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *HEZTra
|
||||
func (_HEZ *HEZFilterer) ParseTransfer(log types.Log) (*HEZTransfer, error) {
|
||||
event := new(HEZTransfer)
|
||||
if err := _HEZ.contract.UnpackLog(event, "Transfer", log); err != nil {
|
||||
return nil, err
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
return event, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user