diff --git a/.mockery.yaml b/.mockery.yaml new file mode 100644 index 0000000..17e5b76 --- /dev/null +++ b/.mockery.yaml @@ -0,0 +1,36 @@ +with-expecter: true +dir: "mocks" +filename: "{{.InterfaceName | lower }}.generated.go" +mockname: "{{.InterfaceName}}" +outpkg: "mocks" +packages: + github.com/0xPolygon/beethoven/etherman: + config: + interfaces: + IEthereumClient: + config: + mockname: EthereumClientMock + filename: etherman_client.generated.go + github.com/0xPolygon/beethoven/types: + config: + interfaces: + IDB: + config: + mockname: DBMock + filename: db.generated.go + IEtherman: + config: + mockname: EthermanMock + filename: etherman.generated.go + IEthTxManager: + config: + mockname: EthTxManagerMock + filename: eth_tx_manager.generated.go + IZkEVMClient: + config: + mockname: ZkEVMClientMock + filename: zk_evm_client.generated.go + IZkEVMClientClientCreator: + config: + mockname: ZkEVMClientClientCreatorMock + filename: zk_evm_client_creator.generated.go diff --git a/client/client.go b/client/client.go index 780f030..481bf58 100644 --- a/client/client.go +++ b/client/client.go @@ -8,11 +8,10 @@ import ( "time" "github.com/0xPolygon/beethoven/rpc/types" + "github.com/0xPolygon/beethoven/tx" "github.com/0xPolygonHermez/zkevm-node/ethtxmanager" "github.com/0xPolygonHermez/zkevm-node/jsonrpc/client" "github.com/ethereum/go-ethereum/common" - - "github.com/0xPolygon/beethoven/tx" ) // ClientFactoryInterface interface for the client factory diff --git a/etherman/interfaces.go b/etherman/interfaces.go index c926d90..91a05d5 100644 --- a/etherman/interfaces.go +++ b/etherman/interfaces.go @@ -5,7 +5,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" ) -//go:generate mockery --name IEthereumClient --structname EthereumClientMock --output ../mocks --case=underscore --filename etherman_client.generated.go type IEthereumClient interface { ethereum.ChainReader ethereum.ChainStateReader diff --git a/mocks/db.generated.go b/mocks/db.generated.go index e950eb1..73aab79 100644 --- a/mocks/db.generated.go +++ b/mocks/db.generated.go @@ -14,6 +14,14 @@ type DBMock struct { mock.Mock } +type DBMock_Expecter struct { + mock *mock.Mock +} + +func (_m *DBMock) EXPECT() *DBMock_Expecter { + return &DBMock_Expecter{mock: &_m.Mock} +} + // BeginStateTransaction provides a mock function with given fields: ctx func (_m *DBMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) { ret := _m.Called(ctx) @@ -44,6 +52,34 @@ func (_m *DBMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) { return r0, r1 } +// DBMock_BeginStateTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BeginStateTransaction' +type DBMock_BeginStateTransaction_Call struct { + *mock.Call +} + +// BeginStateTransaction is a helper method to define mock.On call +// - ctx context.Context +func (_e *DBMock_Expecter) BeginStateTransaction(ctx interface{}) *DBMock_BeginStateTransaction_Call { + return &DBMock_BeginStateTransaction_Call{Call: _e.mock.On("BeginStateTransaction", ctx)} +} + +func (_c *DBMock_BeginStateTransaction_Call) Run(run func(ctx context.Context)) *DBMock_BeginStateTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *DBMock_BeginStateTransaction_Call) Return(_a0 pgx.Tx, _a1 error) *DBMock_BeginStateTransaction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *DBMock_BeginStateTransaction_Call) RunAndReturn(run func(context.Context) (pgx.Tx, error)) *DBMock_BeginStateTransaction_Call { + _c.Call.Return(run) + return _c +} + // NewDBMock creates a new instance of DBMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewDBMock(t interface { diff --git a/mocks/eth_tx_manager.generated.go b/mocks/eth_tx_manager.generated.go index d83c45e..cadd77d 100644 --- a/mocks/eth_tx_manager.generated.go +++ b/mocks/eth_tx_manager.generated.go @@ -20,6 +20,14 @@ type EthTxManagerMock struct { mock.Mock } +type EthTxManagerMock_Expecter struct { + mock *mock.Mock +} + +func (_m *EthTxManagerMock) EXPECT() *EthTxManagerMock_Expecter { + return &EthTxManagerMock_Expecter{mock: &_m.Mock} +} + // Add provides a mock function with given fields: ctx, owner, id, from, to, value, data, gasOffset, dbTx func (_m *EthTxManagerMock) Add(ctx context.Context, owner string, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error { ret := _m.Called(ctx, owner, id, from, to, value, data, gasOffset, dbTx) @@ -38,11 +46,78 @@ func (_m *EthTxManagerMock) Add(ctx context.Context, owner string, id string, fr return r0 } +// EthTxManagerMock_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add' +type EthTxManagerMock_Add_Call struct { + *mock.Call +} + +// Add is a helper method to define mock.On call +// - ctx context.Context +// - owner string +// - id string +// - from common.Address +// - to *common.Address +// - value *big.Int +// - data []byte +// - gasOffset uint64 +// - dbTx pgx.Tx +func (_e *EthTxManagerMock_Expecter) Add(ctx interface{}, owner interface{}, id interface{}, from interface{}, to interface{}, value interface{}, data interface{}, gasOffset interface{}, dbTx interface{}) *EthTxManagerMock_Add_Call { + return &EthTxManagerMock_Add_Call{Call: _e.mock.On("Add", ctx, owner, id, from, to, value, data, gasOffset, dbTx)} +} + +func (_c *EthTxManagerMock_Add_Call) Run(run func(ctx context.Context, owner string, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx)) *EthTxManagerMock_Add_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(common.Address), args[4].(*common.Address), args[5].(*big.Int), args[6].([]byte), args[7].(uint64), args[8].(pgx.Tx)) + }) + return _c +} + +func (_c *EthTxManagerMock_Add_Call) Return(_a0 error) *EthTxManagerMock_Add_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EthTxManagerMock_Add_Call) RunAndReturn(run func(context.Context, string, string, common.Address, *common.Address, *big.Int, []byte, uint64, pgx.Tx) error) *EthTxManagerMock_Add_Call { + _c.Call.Return(run) + return _c +} + // ProcessPendingMonitoredTxs provides a mock function with given fields: ctx, owner, failedResultHandler, dbTx func (_m *EthTxManagerMock) ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx) { _m.Called(ctx, owner, failedResultHandler, dbTx) } +// EthTxManagerMock_ProcessPendingMonitoredTxs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessPendingMonitoredTxs' +type EthTxManagerMock_ProcessPendingMonitoredTxs_Call struct { + *mock.Call +} + +// ProcessPendingMonitoredTxs is a helper method to define mock.On call +// - ctx context.Context +// - owner string +// - failedResultHandler ethtxmanager.ResultHandler +// - dbTx pgx.Tx +func (_e *EthTxManagerMock_Expecter) ProcessPendingMonitoredTxs(ctx interface{}, owner interface{}, failedResultHandler interface{}, dbTx interface{}) *EthTxManagerMock_ProcessPendingMonitoredTxs_Call { + return &EthTxManagerMock_ProcessPendingMonitoredTxs_Call{Call: _e.mock.On("ProcessPendingMonitoredTxs", ctx, owner, failedResultHandler, dbTx)} +} + +func (_c *EthTxManagerMock_ProcessPendingMonitoredTxs_Call) Run(run func(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx)) *EthTxManagerMock_ProcessPendingMonitoredTxs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(ethtxmanager.ResultHandler), args[3].(pgx.Tx)) + }) + return _c +} + +func (_c *EthTxManagerMock_ProcessPendingMonitoredTxs_Call) Return() *EthTxManagerMock_ProcessPendingMonitoredTxs_Call { + _c.Call.Return() + return _c +} + +func (_c *EthTxManagerMock_ProcessPendingMonitoredTxs_Call) RunAndReturn(run func(context.Context, string, ethtxmanager.ResultHandler, pgx.Tx)) *EthTxManagerMock_ProcessPendingMonitoredTxs_Call { + _c.Call.Return(run) + return _c +} + // Result provides a mock function with given fields: ctx, owner, id, dbTx func (_m *EthTxManagerMock) Result(ctx context.Context, owner string, id string, dbTx pgx.Tx) (ethtxmanager.MonitoredTxResult, error) { ret := _m.Called(ctx, owner, id, dbTx) @@ -71,6 +146,37 @@ func (_m *EthTxManagerMock) Result(ctx context.Context, owner string, id string, return r0, r1 } +// EthTxManagerMock_Result_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Result' +type EthTxManagerMock_Result_Call struct { + *mock.Call +} + +// Result is a helper method to define mock.On call +// - ctx context.Context +// - owner string +// - id string +// - dbTx pgx.Tx +func (_e *EthTxManagerMock_Expecter) Result(ctx interface{}, owner interface{}, id interface{}, dbTx interface{}) *EthTxManagerMock_Result_Call { + return &EthTxManagerMock_Result_Call{Call: _e.mock.On("Result", ctx, owner, id, dbTx)} +} + +func (_c *EthTxManagerMock_Result_Call) Run(run func(ctx context.Context, owner string, id string, dbTx pgx.Tx)) *EthTxManagerMock_Result_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(pgx.Tx)) + }) + return _c +} + +func (_c *EthTxManagerMock_Result_Call) Return(_a0 ethtxmanager.MonitoredTxResult, _a1 error) *EthTxManagerMock_Result_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthTxManagerMock_Result_Call) RunAndReturn(run func(context.Context, string, string, pgx.Tx) (ethtxmanager.MonitoredTxResult, error)) *EthTxManagerMock_Result_Call { + _c.Call.Return(run) + return _c +} + // ResultsByStatus provides a mock function with given fields: ctx, owner, statuses, dbTx func (_m *EthTxManagerMock) ResultsByStatus(ctx context.Context, owner string, statuses []ethtxmanager.MonitoredTxStatus, dbTx pgx.Tx) ([]ethtxmanager.MonitoredTxResult, error) { ret := _m.Called(ctx, owner, statuses, dbTx) @@ -101,6 +207,37 @@ func (_m *EthTxManagerMock) ResultsByStatus(ctx context.Context, owner string, s return r0, r1 } +// EthTxManagerMock_ResultsByStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResultsByStatus' +type EthTxManagerMock_ResultsByStatus_Call struct { + *mock.Call +} + +// ResultsByStatus is a helper method to define mock.On call +// - ctx context.Context +// - owner string +// - statuses []ethtxmanager.MonitoredTxStatus +// - dbTx pgx.Tx +func (_e *EthTxManagerMock_Expecter) ResultsByStatus(ctx interface{}, owner interface{}, statuses interface{}, dbTx interface{}) *EthTxManagerMock_ResultsByStatus_Call { + return &EthTxManagerMock_ResultsByStatus_Call{Call: _e.mock.On("ResultsByStatus", ctx, owner, statuses, dbTx)} +} + +func (_c *EthTxManagerMock_ResultsByStatus_Call) Run(run func(ctx context.Context, owner string, statuses []ethtxmanager.MonitoredTxStatus, dbTx pgx.Tx)) *EthTxManagerMock_ResultsByStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].([]ethtxmanager.MonitoredTxStatus), args[3].(pgx.Tx)) + }) + return _c +} + +func (_c *EthTxManagerMock_ResultsByStatus_Call) Return(_a0 []ethtxmanager.MonitoredTxResult, _a1 error) *EthTxManagerMock_ResultsByStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthTxManagerMock_ResultsByStatus_Call) RunAndReturn(run func(context.Context, string, []ethtxmanager.MonitoredTxStatus, pgx.Tx) ([]ethtxmanager.MonitoredTxResult, error)) *EthTxManagerMock_ResultsByStatus_Call { + _c.Call.Return(run) + return _c +} + // NewEthTxManagerMock creates a new instance of EthTxManagerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewEthTxManagerMock(t interface { diff --git a/mocks/etherman.generated.go b/mocks/etherman.generated.go index ab0af5a..d732bd2 100644 --- a/mocks/etherman.generated.go +++ b/mocks/etherman.generated.go @@ -20,6 +20,14 @@ type EthermanMock struct { mock.Mock } +type EthermanMock_Expecter struct { + mock *mock.Mock +} + +func (_m *EthermanMock) EXPECT() *EthermanMock_Expecter { + return &EthermanMock_Expecter{mock: &_m.Mock} +} + // BuildTrustedVerifyBatchesTxData provides a mock function with given fields: lastVerifiedBatch, newVerifiedBatch, proof, rollupId func (_m *EthermanMock) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch uint64, newVerifiedBatch uint64, proof tx.ZKP, rollupId uint32) ([]byte, error) { ret := _m.Called(lastVerifiedBatch, newVerifiedBatch, proof, rollupId) @@ -50,6 +58,37 @@ func (_m *EthermanMock) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch uint64 return r0, r1 } +// EthermanMock_BuildTrustedVerifyBatchesTxData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BuildTrustedVerifyBatchesTxData' +type EthermanMock_BuildTrustedVerifyBatchesTxData_Call struct { + *mock.Call +} + +// BuildTrustedVerifyBatchesTxData is a helper method to define mock.On call +// - lastVerifiedBatch uint64 +// - newVerifiedBatch uint64 +// - proof tx.ZKP +// - rollupId uint32 +func (_e *EthermanMock_Expecter) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch interface{}, newVerifiedBatch interface{}, proof interface{}, rollupId interface{}) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + return &EthermanMock_BuildTrustedVerifyBatchesTxData_Call{Call: _e.mock.On("BuildTrustedVerifyBatchesTxData", lastVerifiedBatch, newVerifiedBatch, proof, rollupId)} +} + +func (_c *EthermanMock_BuildTrustedVerifyBatchesTxData_Call) Run(run func(lastVerifiedBatch uint64, newVerifiedBatch uint64, proof tx.ZKP, rollupId uint32)) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(uint64), args[2].(tx.ZKP), args[3].(uint32)) + }) + return _c +} + +func (_c *EthermanMock_BuildTrustedVerifyBatchesTxData_Call) Return(data []byte, err error) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + _c.Call.Return(data, err) + return _c +} + +func (_c *EthermanMock_BuildTrustedVerifyBatchesTxData_Call) RunAndReturn(run func(uint64, uint64, tx.ZKP, uint32) ([]byte, error)) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + _c.Call.Return(run) + return _c +} + // CallContract provides a mock function with given fields: ctx, call, blockNumber func (_m *EthermanMock) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) { ret := _m.Called(ctx, call, blockNumber) @@ -80,6 +119,36 @@ func (_m *EthermanMock) CallContract(ctx context.Context, call ethereum.CallMsg, return r0, r1 } +// EthermanMock_CallContract_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CallContract' +type EthermanMock_CallContract_Call struct { + *mock.Call +} + +// CallContract is a helper method to define mock.On call +// - ctx context.Context +// - call ethereum.CallMsg +// - blockNumber *big.Int +func (_e *EthermanMock_Expecter) CallContract(ctx interface{}, call interface{}, blockNumber interface{}) *EthermanMock_CallContract_Call { + return &EthermanMock_CallContract_Call{Call: _e.mock.On("CallContract", ctx, call, blockNumber)} +} + +func (_c *EthermanMock_CallContract_Call) Run(run func(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int)) *EthermanMock_CallContract_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ethereum.CallMsg), args[2].(*big.Int)) + }) + return _c +} + +func (_c *EthermanMock_CallContract_Call) Return(_a0 []byte, _a1 error) *EthermanMock_CallContract_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthermanMock_CallContract_Call) RunAndReturn(run func(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error)) *EthermanMock_CallContract_Call { + _c.Call.Return(run) + return _c +} + // GetSequencerAddr provides a mock function with given fields: rollupId func (_m *EthermanMock) GetSequencerAddr(rollupId uint32) (common.Address, error) { ret := _m.Called(rollupId) @@ -110,6 +179,34 @@ func (_m *EthermanMock) GetSequencerAddr(rollupId uint32) (common.Address, error return r0, r1 } +// EthermanMock_GetSequencerAddr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSequencerAddr' +type EthermanMock_GetSequencerAddr_Call struct { + *mock.Call +} + +// GetSequencerAddr is a helper method to define mock.On call +// - rollupId uint32 +func (_e *EthermanMock_Expecter) GetSequencerAddr(rollupId interface{}) *EthermanMock_GetSequencerAddr_Call { + return &EthermanMock_GetSequencerAddr_Call{Call: _e.mock.On("GetSequencerAddr", rollupId)} +} + +func (_c *EthermanMock_GetSequencerAddr_Call) Run(run func(rollupId uint32)) *EthermanMock_GetSequencerAddr_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint32)) + }) + return _c +} + +func (_c *EthermanMock_GetSequencerAddr_Call) Return(_a0 common.Address, _a1 error) *EthermanMock_GetSequencerAddr_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthermanMock_GetSequencerAddr_Call) RunAndReturn(run func(uint32) (common.Address, error)) *EthermanMock_GetSequencerAddr_Call { + _c.Call.Return(run) + return _c +} + // NewEthermanMock creates a new instance of EthermanMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewEthermanMock(t interface { diff --git a/mocks/etherman_client.generated.go b/mocks/etherman_client.generated.go index 3dfb2e6..a1848a1 100644 --- a/mocks/etherman_client.generated.go +++ b/mocks/etherman_client.generated.go @@ -20,6 +20,14 @@ type EthereumClientMock struct { mock.Mock } +type EthereumClientMock_Expecter struct { + mock *mock.Mock +} + +func (_m *EthereumClientMock) EXPECT() *EthereumClientMock_Expecter { + return &EthereumClientMock_Expecter{mock: &_m.Mock} +} + // BalanceAt provides a mock function with given fields: ctx, account, blockNumber func (_m *EthereumClientMock) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) { ret := _m.Called(ctx, account, blockNumber) @@ -50,6 +58,36 @@ func (_m *EthereumClientMock) BalanceAt(ctx context.Context, account common.Addr return r0, r1 } +// EthereumClientMock_BalanceAt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BalanceAt' +type EthereumClientMock_BalanceAt_Call struct { + *mock.Call +} + +// BalanceAt is a helper method to define mock.On call +// - ctx context.Context +// - account common.Address +// - blockNumber *big.Int +func (_e *EthereumClientMock_Expecter) BalanceAt(ctx interface{}, account interface{}, blockNumber interface{}) *EthereumClientMock_BalanceAt_Call { + return &EthereumClientMock_BalanceAt_Call{Call: _e.mock.On("BalanceAt", ctx, account, blockNumber)} +} + +func (_c *EthereumClientMock_BalanceAt_Call) Run(run func(ctx context.Context, account common.Address, blockNumber *big.Int)) *EthereumClientMock_BalanceAt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Address), args[2].(*big.Int)) + }) + return _c +} + +func (_c *EthereumClientMock_BalanceAt_Call) Return(_a0 *big.Int, _a1 error) *EthereumClientMock_BalanceAt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_BalanceAt_Call) RunAndReturn(run func(context.Context, common.Address, *big.Int) (*big.Int, error)) *EthereumClientMock_BalanceAt_Call { + _c.Call.Return(run) + return _c +} + // BlockByHash provides a mock function with given fields: ctx, hash func (_m *EthereumClientMock) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) { ret := _m.Called(ctx, hash) @@ -80,6 +118,35 @@ func (_m *EthereumClientMock) BlockByHash(ctx context.Context, hash common.Hash) return r0, r1 } +// EthereumClientMock_BlockByHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockByHash' +type EthereumClientMock_BlockByHash_Call struct { + *mock.Call +} + +// BlockByHash is a helper method to define mock.On call +// - ctx context.Context +// - hash common.Hash +func (_e *EthereumClientMock_Expecter) BlockByHash(ctx interface{}, hash interface{}) *EthereumClientMock_BlockByHash_Call { + return &EthereumClientMock_BlockByHash_Call{Call: _e.mock.On("BlockByHash", ctx, hash)} +} + +func (_c *EthereumClientMock_BlockByHash_Call) Run(run func(ctx context.Context, hash common.Hash)) *EthereumClientMock_BlockByHash_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *EthereumClientMock_BlockByHash_Call) Return(_a0 *types.Block, _a1 error) *EthereumClientMock_BlockByHash_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_BlockByHash_Call) RunAndReturn(run func(context.Context, common.Hash) (*types.Block, error)) *EthereumClientMock_BlockByHash_Call { + _c.Call.Return(run) + return _c +} + // BlockByNumber provides a mock function with given fields: ctx, number func (_m *EthereumClientMock) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error) { ret := _m.Called(ctx, number) @@ -110,6 +177,35 @@ func (_m *EthereumClientMock) BlockByNumber(ctx context.Context, number *big.Int return r0, r1 } +// EthereumClientMock_BlockByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BlockByNumber' +type EthereumClientMock_BlockByNumber_Call struct { + *mock.Call +} + +// BlockByNumber is a helper method to define mock.On call +// - ctx context.Context +// - number *big.Int +func (_e *EthereumClientMock_Expecter) BlockByNumber(ctx interface{}, number interface{}) *EthereumClientMock_BlockByNumber_Call { + return &EthereumClientMock_BlockByNumber_Call{Call: _e.mock.On("BlockByNumber", ctx, number)} +} + +func (_c *EthereumClientMock_BlockByNumber_Call) Run(run func(ctx context.Context, number *big.Int)) *EthereumClientMock_BlockByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*big.Int)) + }) + return _c +} + +func (_c *EthereumClientMock_BlockByNumber_Call) Return(_a0 *types.Block, _a1 error) *EthereumClientMock_BlockByNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_BlockByNumber_Call) RunAndReturn(run func(context.Context, *big.Int) (*types.Block, error)) *EthereumClientMock_BlockByNumber_Call { + _c.Call.Return(run) + return _c +} + // CallContract provides a mock function with given fields: ctx, call, blockNumber func (_m *EthereumClientMock) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) { ret := _m.Called(ctx, call, blockNumber) @@ -140,6 +236,36 @@ func (_m *EthereumClientMock) CallContract(ctx context.Context, call ethereum.Ca return r0, r1 } +// EthereumClientMock_CallContract_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CallContract' +type EthereumClientMock_CallContract_Call struct { + *mock.Call +} + +// CallContract is a helper method to define mock.On call +// - ctx context.Context +// - call ethereum.CallMsg +// - blockNumber *big.Int +func (_e *EthereumClientMock_Expecter) CallContract(ctx interface{}, call interface{}, blockNumber interface{}) *EthereumClientMock_CallContract_Call { + return &EthereumClientMock_CallContract_Call{Call: _e.mock.On("CallContract", ctx, call, blockNumber)} +} + +func (_c *EthereumClientMock_CallContract_Call) Run(run func(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int)) *EthereumClientMock_CallContract_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ethereum.CallMsg), args[2].(*big.Int)) + }) + return _c +} + +func (_c *EthereumClientMock_CallContract_Call) Return(_a0 []byte, _a1 error) *EthereumClientMock_CallContract_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_CallContract_Call) RunAndReturn(run func(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error)) *EthereumClientMock_CallContract_Call { + _c.Call.Return(run) + return _c +} + // CodeAt provides a mock function with given fields: ctx, account, blockNumber func (_m *EthereumClientMock) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error) { ret := _m.Called(ctx, account, blockNumber) @@ -170,6 +296,36 @@ func (_m *EthereumClientMock) CodeAt(ctx context.Context, account common.Address return r0, r1 } +// EthereumClientMock_CodeAt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CodeAt' +type EthereumClientMock_CodeAt_Call struct { + *mock.Call +} + +// CodeAt is a helper method to define mock.On call +// - ctx context.Context +// - account common.Address +// - blockNumber *big.Int +func (_e *EthereumClientMock_Expecter) CodeAt(ctx interface{}, account interface{}, blockNumber interface{}) *EthereumClientMock_CodeAt_Call { + return &EthereumClientMock_CodeAt_Call{Call: _e.mock.On("CodeAt", ctx, account, blockNumber)} +} + +func (_c *EthereumClientMock_CodeAt_Call) Run(run func(ctx context.Context, account common.Address, blockNumber *big.Int)) *EthereumClientMock_CodeAt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Address), args[2].(*big.Int)) + }) + return _c +} + +func (_c *EthereumClientMock_CodeAt_Call) Return(_a0 []byte, _a1 error) *EthereumClientMock_CodeAt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_CodeAt_Call) RunAndReturn(run func(context.Context, common.Address, *big.Int) ([]byte, error)) *EthereumClientMock_CodeAt_Call { + _c.Call.Return(run) + return _c +} + // EstimateGas provides a mock function with given fields: ctx, call func (_m *EthereumClientMock) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) { ret := _m.Called(ctx, call) @@ -198,6 +354,35 @@ func (_m *EthereumClientMock) EstimateGas(ctx context.Context, call ethereum.Cal return r0, r1 } +// EthereumClientMock_EstimateGas_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EstimateGas' +type EthereumClientMock_EstimateGas_Call struct { + *mock.Call +} + +// EstimateGas is a helper method to define mock.On call +// - ctx context.Context +// - call ethereum.CallMsg +func (_e *EthereumClientMock_Expecter) EstimateGas(ctx interface{}, call interface{}) *EthereumClientMock_EstimateGas_Call { + return &EthereumClientMock_EstimateGas_Call{Call: _e.mock.On("EstimateGas", ctx, call)} +} + +func (_c *EthereumClientMock_EstimateGas_Call) Run(run func(ctx context.Context, call ethereum.CallMsg)) *EthereumClientMock_EstimateGas_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ethereum.CallMsg)) + }) + return _c +} + +func (_c *EthereumClientMock_EstimateGas_Call) Return(_a0 uint64, _a1 error) *EthereumClientMock_EstimateGas_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_EstimateGas_Call) RunAndReturn(run func(context.Context, ethereum.CallMsg) (uint64, error)) *EthereumClientMock_EstimateGas_Call { + _c.Call.Return(run) + return _c +} + // FilterLogs provides a mock function with given fields: ctx, q func (_m *EthereumClientMock) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) { ret := _m.Called(ctx, q) @@ -228,6 +413,35 @@ func (_m *EthereumClientMock) FilterLogs(ctx context.Context, q ethereum.FilterQ return r0, r1 } +// EthereumClientMock_FilterLogs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterLogs' +type EthereumClientMock_FilterLogs_Call struct { + *mock.Call +} + +// FilterLogs is a helper method to define mock.On call +// - ctx context.Context +// - q ethereum.FilterQuery +func (_e *EthereumClientMock_Expecter) FilterLogs(ctx interface{}, q interface{}) *EthereumClientMock_FilterLogs_Call { + return &EthereumClientMock_FilterLogs_Call{Call: _e.mock.On("FilterLogs", ctx, q)} +} + +func (_c *EthereumClientMock_FilterLogs_Call) Run(run func(ctx context.Context, q ethereum.FilterQuery)) *EthereumClientMock_FilterLogs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ethereum.FilterQuery)) + }) + return _c +} + +func (_c *EthereumClientMock_FilterLogs_Call) Return(_a0 []types.Log, _a1 error) *EthereumClientMock_FilterLogs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_FilterLogs_Call) RunAndReturn(run func(context.Context, ethereum.FilterQuery) ([]types.Log, error)) *EthereumClientMock_FilterLogs_Call { + _c.Call.Return(run) + return _c +} + // HeaderByHash provides a mock function with given fields: ctx, hash func (_m *EthereumClientMock) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) { ret := _m.Called(ctx, hash) @@ -258,6 +472,35 @@ func (_m *EthereumClientMock) HeaderByHash(ctx context.Context, hash common.Hash return r0, r1 } +// EthereumClientMock_HeaderByHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeaderByHash' +type EthereumClientMock_HeaderByHash_Call struct { + *mock.Call +} + +// HeaderByHash is a helper method to define mock.On call +// - ctx context.Context +// - hash common.Hash +func (_e *EthereumClientMock_Expecter) HeaderByHash(ctx interface{}, hash interface{}) *EthereumClientMock_HeaderByHash_Call { + return &EthereumClientMock_HeaderByHash_Call{Call: _e.mock.On("HeaderByHash", ctx, hash)} +} + +func (_c *EthereumClientMock_HeaderByHash_Call) Run(run func(ctx context.Context, hash common.Hash)) *EthereumClientMock_HeaderByHash_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *EthereumClientMock_HeaderByHash_Call) Return(_a0 *types.Header, _a1 error) *EthereumClientMock_HeaderByHash_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_HeaderByHash_Call) RunAndReturn(run func(context.Context, common.Hash) (*types.Header, error)) *EthereumClientMock_HeaderByHash_Call { + _c.Call.Return(run) + return _c +} + // HeaderByNumber provides a mock function with given fields: ctx, number func (_m *EthereumClientMock) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) { ret := _m.Called(ctx, number) @@ -288,6 +531,35 @@ func (_m *EthereumClientMock) HeaderByNumber(ctx context.Context, number *big.In return r0, r1 } +// EthereumClientMock_HeaderByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeaderByNumber' +type EthereumClientMock_HeaderByNumber_Call struct { + *mock.Call +} + +// HeaderByNumber is a helper method to define mock.On call +// - ctx context.Context +// - number *big.Int +func (_e *EthereumClientMock_Expecter) HeaderByNumber(ctx interface{}, number interface{}) *EthereumClientMock_HeaderByNumber_Call { + return &EthereumClientMock_HeaderByNumber_Call{Call: _e.mock.On("HeaderByNumber", ctx, number)} +} + +func (_c *EthereumClientMock_HeaderByNumber_Call) Run(run func(ctx context.Context, number *big.Int)) *EthereumClientMock_HeaderByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*big.Int)) + }) + return _c +} + +func (_c *EthereumClientMock_HeaderByNumber_Call) Return(_a0 *types.Header, _a1 error) *EthereumClientMock_HeaderByNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_HeaderByNumber_Call) RunAndReturn(run func(context.Context, *big.Int) (*types.Header, error)) *EthereumClientMock_HeaderByNumber_Call { + _c.Call.Return(run) + return _c +} + // NonceAt provides a mock function with given fields: ctx, account, blockNumber func (_m *EthereumClientMock) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) { ret := _m.Called(ctx, account, blockNumber) @@ -316,6 +588,36 @@ func (_m *EthereumClientMock) NonceAt(ctx context.Context, account common.Addres return r0, r1 } +// EthereumClientMock_NonceAt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NonceAt' +type EthereumClientMock_NonceAt_Call struct { + *mock.Call +} + +// NonceAt is a helper method to define mock.On call +// - ctx context.Context +// - account common.Address +// - blockNumber *big.Int +func (_e *EthereumClientMock_Expecter) NonceAt(ctx interface{}, account interface{}, blockNumber interface{}) *EthereumClientMock_NonceAt_Call { + return &EthereumClientMock_NonceAt_Call{Call: _e.mock.On("NonceAt", ctx, account, blockNumber)} +} + +func (_c *EthereumClientMock_NonceAt_Call) Run(run func(ctx context.Context, account common.Address, blockNumber *big.Int)) *EthereumClientMock_NonceAt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Address), args[2].(*big.Int)) + }) + return _c +} + +func (_c *EthereumClientMock_NonceAt_Call) Return(_a0 uint64, _a1 error) *EthereumClientMock_NonceAt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_NonceAt_Call) RunAndReturn(run func(context.Context, common.Address, *big.Int) (uint64, error)) *EthereumClientMock_NonceAt_Call { + _c.Call.Return(run) + return _c +} + // PendingCodeAt provides a mock function with given fields: ctx, account func (_m *EthereumClientMock) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error) { ret := _m.Called(ctx, account) @@ -346,6 +648,35 @@ func (_m *EthereumClientMock) PendingCodeAt(ctx context.Context, account common. return r0, r1 } +// EthereumClientMock_PendingCodeAt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PendingCodeAt' +type EthereumClientMock_PendingCodeAt_Call struct { + *mock.Call +} + +// PendingCodeAt is a helper method to define mock.On call +// - ctx context.Context +// - account common.Address +func (_e *EthereumClientMock_Expecter) PendingCodeAt(ctx interface{}, account interface{}) *EthereumClientMock_PendingCodeAt_Call { + return &EthereumClientMock_PendingCodeAt_Call{Call: _e.mock.On("PendingCodeAt", ctx, account)} +} + +func (_c *EthereumClientMock_PendingCodeAt_Call) Run(run func(ctx context.Context, account common.Address)) *EthereumClientMock_PendingCodeAt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Address)) + }) + return _c +} + +func (_c *EthereumClientMock_PendingCodeAt_Call) Return(_a0 []byte, _a1 error) *EthereumClientMock_PendingCodeAt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_PendingCodeAt_Call) RunAndReturn(run func(context.Context, common.Address) ([]byte, error)) *EthereumClientMock_PendingCodeAt_Call { + _c.Call.Return(run) + return _c +} + // PendingNonceAt provides a mock function with given fields: ctx, account func (_m *EthereumClientMock) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) { ret := _m.Called(ctx, account) @@ -374,6 +705,35 @@ func (_m *EthereumClientMock) PendingNonceAt(ctx context.Context, account common return r0, r1 } +// EthereumClientMock_PendingNonceAt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PendingNonceAt' +type EthereumClientMock_PendingNonceAt_Call struct { + *mock.Call +} + +// PendingNonceAt is a helper method to define mock.On call +// - ctx context.Context +// - account common.Address +func (_e *EthereumClientMock_Expecter) PendingNonceAt(ctx interface{}, account interface{}) *EthereumClientMock_PendingNonceAt_Call { + return &EthereumClientMock_PendingNonceAt_Call{Call: _e.mock.On("PendingNonceAt", ctx, account)} +} + +func (_c *EthereumClientMock_PendingNonceAt_Call) Run(run func(ctx context.Context, account common.Address)) *EthereumClientMock_PendingNonceAt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Address)) + }) + return _c +} + +func (_c *EthereumClientMock_PendingNonceAt_Call) Return(_a0 uint64, _a1 error) *EthereumClientMock_PendingNonceAt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_PendingNonceAt_Call) RunAndReturn(run func(context.Context, common.Address) (uint64, error)) *EthereumClientMock_PendingNonceAt_Call { + _c.Call.Return(run) + return _c +} + // SendTransaction provides a mock function with given fields: ctx, tx func (_m *EthereumClientMock) SendTransaction(ctx context.Context, tx *types.Transaction) error { ret := _m.Called(ctx, tx) @@ -392,6 +752,35 @@ func (_m *EthereumClientMock) SendTransaction(ctx context.Context, tx *types.Tra return r0 } +// EthereumClientMock_SendTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendTransaction' +type EthereumClientMock_SendTransaction_Call struct { + *mock.Call +} + +// SendTransaction is a helper method to define mock.On call +// - ctx context.Context +// - tx *types.Transaction +func (_e *EthereumClientMock_Expecter) SendTransaction(ctx interface{}, tx interface{}) *EthereumClientMock_SendTransaction_Call { + return &EthereumClientMock_SendTransaction_Call{Call: _e.mock.On("SendTransaction", ctx, tx)} +} + +func (_c *EthereumClientMock_SendTransaction_Call) Run(run func(ctx context.Context, tx *types.Transaction)) *EthereumClientMock_SendTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*types.Transaction)) + }) + return _c +} + +func (_c *EthereumClientMock_SendTransaction_Call) Return(_a0 error) *EthereumClientMock_SendTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EthereumClientMock_SendTransaction_Call) RunAndReturn(run func(context.Context, *types.Transaction) error) *EthereumClientMock_SendTransaction_Call { + _c.Call.Return(run) + return _c +} + // StorageAt provides a mock function with given fields: ctx, account, key, blockNumber func (_m *EthereumClientMock) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error) { ret := _m.Called(ctx, account, key, blockNumber) @@ -422,6 +811,37 @@ func (_m *EthereumClientMock) StorageAt(ctx context.Context, account common.Addr return r0, r1 } +// EthereumClientMock_StorageAt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StorageAt' +type EthereumClientMock_StorageAt_Call struct { + *mock.Call +} + +// StorageAt is a helper method to define mock.On call +// - ctx context.Context +// - account common.Address +// - key common.Hash +// - blockNumber *big.Int +func (_e *EthereumClientMock_Expecter) StorageAt(ctx interface{}, account interface{}, key interface{}, blockNumber interface{}) *EthereumClientMock_StorageAt_Call { + return &EthereumClientMock_StorageAt_Call{Call: _e.mock.On("StorageAt", ctx, account, key, blockNumber)} +} + +func (_c *EthereumClientMock_StorageAt_Call) Run(run func(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int)) *EthereumClientMock_StorageAt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Address), args[2].(common.Hash), args[3].(*big.Int)) + }) + return _c +} + +func (_c *EthereumClientMock_StorageAt_Call) Return(_a0 []byte, _a1 error) *EthereumClientMock_StorageAt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_StorageAt_Call) RunAndReturn(run func(context.Context, common.Address, common.Hash, *big.Int) ([]byte, error)) *EthereumClientMock_StorageAt_Call { + _c.Call.Return(run) + return _c +} + // SubscribeFilterLogs provides a mock function with given fields: ctx, q, ch func (_m *EthereumClientMock) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) { ret := _m.Called(ctx, q, ch) @@ -452,6 +872,36 @@ func (_m *EthereumClientMock) SubscribeFilterLogs(ctx context.Context, q ethereu return r0, r1 } +// EthereumClientMock_SubscribeFilterLogs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscribeFilterLogs' +type EthereumClientMock_SubscribeFilterLogs_Call struct { + *mock.Call +} + +// SubscribeFilterLogs is a helper method to define mock.On call +// - ctx context.Context +// - q ethereum.FilterQuery +// - ch chan<- types.Log +func (_e *EthereumClientMock_Expecter) SubscribeFilterLogs(ctx interface{}, q interface{}, ch interface{}) *EthereumClientMock_SubscribeFilterLogs_Call { + return &EthereumClientMock_SubscribeFilterLogs_Call{Call: _e.mock.On("SubscribeFilterLogs", ctx, q, ch)} +} + +func (_c *EthereumClientMock_SubscribeFilterLogs_Call) Run(run func(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log)) *EthereumClientMock_SubscribeFilterLogs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ethereum.FilterQuery), args[2].(chan<- types.Log)) + }) + return _c +} + +func (_c *EthereumClientMock_SubscribeFilterLogs_Call) Return(_a0 ethereum.Subscription, _a1 error) *EthereumClientMock_SubscribeFilterLogs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_SubscribeFilterLogs_Call) RunAndReturn(run func(context.Context, ethereum.FilterQuery, chan<- types.Log) (ethereum.Subscription, error)) *EthereumClientMock_SubscribeFilterLogs_Call { + _c.Call.Return(run) + return _c +} + // SubscribeNewHead provides a mock function with given fields: ctx, ch func (_m *EthereumClientMock) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error) { ret := _m.Called(ctx, ch) @@ -482,6 +932,35 @@ func (_m *EthereumClientMock) SubscribeNewHead(ctx context.Context, ch chan<- *t return r0, r1 } +// EthereumClientMock_SubscribeNewHead_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscribeNewHead' +type EthereumClientMock_SubscribeNewHead_Call struct { + *mock.Call +} + +// SubscribeNewHead is a helper method to define mock.On call +// - ctx context.Context +// - ch chan<- *types.Header +func (_e *EthereumClientMock_Expecter) SubscribeNewHead(ctx interface{}, ch interface{}) *EthereumClientMock_SubscribeNewHead_Call { + return &EthereumClientMock_SubscribeNewHead_Call{Call: _e.mock.On("SubscribeNewHead", ctx, ch)} +} + +func (_c *EthereumClientMock_SubscribeNewHead_Call) Run(run func(ctx context.Context, ch chan<- *types.Header)) *EthereumClientMock_SubscribeNewHead_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(chan<- *types.Header)) + }) + return _c +} + +func (_c *EthereumClientMock_SubscribeNewHead_Call) Return(_a0 ethereum.Subscription, _a1 error) *EthereumClientMock_SubscribeNewHead_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_SubscribeNewHead_Call) RunAndReturn(run func(context.Context, chan<- *types.Header) (ethereum.Subscription, error)) *EthereumClientMock_SubscribeNewHead_Call { + _c.Call.Return(run) + return _c +} + // SuggestGasPrice provides a mock function with given fields: ctx func (_m *EthereumClientMock) SuggestGasPrice(ctx context.Context) (*big.Int, error) { ret := _m.Called(ctx) @@ -512,6 +991,34 @@ func (_m *EthereumClientMock) SuggestGasPrice(ctx context.Context) (*big.Int, er return r0, r1 } +// EthereumClientMock_SuggestGasPrice_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SuggestGasPrice' +type EthereumClientMock_SuggestGasPrice_Call struct { + *mock.Call +} + +// SuggestGasPrice is a helper method to define mock.On call +// - ctx context.Context +func (_e *EthereumClientMock_Expecter) SuggestGasPrice(ctx interface{}) *EthereumClientMock_SuggestGasPrice_Call { + return &EthereumClientMock_SuggestGasPrice_Call{Call: _e.mock.On("SuggestGasPrice", ctx)} +} + +func (_c *EthereumClientMock_SuggestGasPrice_Call) Run(run func(ctx context.Context)) *EthereumClientMock_SuggestGasPrice_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EthereumClientMock_SuggestGasPrice_Call) Return(_a0 *big.Int, _a1 error) *EthereumClientMock_SuggestGasPrice_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_SuggestGasPrice_Call) RunAndReturn(run func(context.Context) (*big.Int, error)) *EthereumClientMock_SuggestGasPrice_Call { + _c.Call.Return(run) + return _c +} + // SuggestGasTipCap provides a mock function with given fields: ctx func (_m *EthereumClientMock) SuggestGasTipCap(ctx context.Context) (*big.Int, error) { ret := _m.Called(ctx) @@ -542,6 +1049,34 @@ func (_m *EthereumClientMock) SuggestGasTipCap(ctx context.Context) (*big.Int, e return r0, r1 } +// EthereumClientMock_SuggestGasTipCap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SuggestGasTipCap' +type EthereumClientMock_SuggestGasTipCap_Call struct { + *mock.Call +} + +// SuggestGasTipCap is a helper method to define mock.On call +// - ctx context.Context +func (_e *EthereumClientMock_Expecter) SuggestGasTipCap(ctx interface{}) *EthereumClientMock_SuggestGasTipCap_Call { + return &EthereumClientMock_SuggestGasTipCap_Call{Call: _e.mock.On("SuggestGasTipCap", ctx)} +} + +func (_c *EthereumClientMock_SuggestGasTipCap_Call) Run(run func(ctx context.Context)) *EthereumClientMock_SuggestGasTipCap_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EthereumClientMock_SuggestGasTipCap_Call) Return(_a0 *big.Int, _a1 error) *EthereumClientMock_SuggestGasTipCap_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_SuggestGasTipCap_Call) RunAndReturn(run func(context.Context) (*big.Int, error)) *EthereumClientMock_SuggestGasTipCap_Call { + _c.Call.Return(run) + return _c +} + // TransactionByHash provides a mock function with given fields: ctx, txHash func (_m *EthereumClientMock) TransactionByHash(ctx context.Context, txHash common.Hash) (*types.Transaction, bool, error) { ret := _m.Called(ctx, txHash) @@ -579,6 +1114,35 @@ func (_m *EthereumClientMock) TransactionByHash(ctx context.Context, txHash comm return r0, r1, r2 } +// EthereumClientMock_TransactionByHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransactionByHash' +type EthereumClientMock_TransactionByHash_Call struct { + *mock.Call +} + +// TransactionByHash is a helper method to define mock.On call +// - ctx context.Context +// - txHash common.Hash +func (_e *EthereumClientMock_Expecter) TransactionByHash(ctx interface{}, txHash interface{}) *EthereumClientMock_TransactionByHash_Call { + return &EthereumClientMock_TransactionByHash_Call{Call: _e.mock.On("TransactionByHash", ctx, txHash)} +} + +func (_c *EthereumClientMock_TransactionByHash_Call) Run(run func(ctx context.Context, txHash common.Hash)) *EthereumClientMock_TransactionByHash_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *EthereumClientMock_TransactionByHash_Call) Return(tx *types.Transaction, isPending bool, err error) *EthereumClientMock_TransactionByHash_Call { + _c.Call.Return(tx, isPending, err) + return _c +} + +func (_c *EthereumClientMock_TransactionByHash_Call) RunAndReturn(run func(context.Context, common.Hash) (*types.Transaction, bool, error)) *EthereumClientMock_TransactionByHash_Call { + _c.Call.Return(run) + return _c +} + // TransactionCount provides a mock function with given fields: ctx, blockHash func (_m *EthereumClientMock) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error) { ret := _m.Called(ctx, blockHash) @@ -607,6 +1171,35 @@ func (_m *EthereumClientMock) TransactionCount(ctx context.Context, blockHash co return r0, r1 } +// EthereumClientMock_TransactionCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransactionCount' +type EthereumClientMock_TransactionCount_Call struct { + *mock.Call +} + +// TransactionCount is a helper method to define mock.On call +// - ctx context.Context +// - blockHash common.Hash +func (_e *EthereumClientMock_Expecter) TransactionCount(ctx interface{}, blockHash interface{}) *EthereumClientMock_TransactionCount_Call { + return &EthereumClientMock_TransactionCount_Call{Call: _e.mock.On("TransactionCount", ctx, blockHash)} +} + +func (_c *EthereumClientMock_TransactionCount_Call) Run(run func(ctx context.Context, blockHash common.Hash)) *EthereumClientMock_TransactionCount_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *EthereumClientMock_TransactionCount_Call) Return(_a0 uint, _a1 error) *EthereumClientMock_TransactionCount_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_TransactionCount_Call) RunAndReturn(run func(context.Context, common.Hash) (uint, error)) *EthereumClientMock_TransactionCount_Call { + _c.Call.Return(run) + return _c +} + // TransactionInBlock provides a mock function with given fields: ctx, blockHash, index func (_m *EthereumClientMock) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error) { ret := _m.Called(ctx, blockHash, index) @@ -637,6 +1230,36 @@ func (_m *EthereumClientMock) TransactionInBlock(ctx context.Context, blockHash return r0, r1 } +// EthereumClientMock_TransactionInBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransactionInBlock' +type EthereumClientMock_TransactionInBlock_Call struct { + *mock.Call +} + +// TransactionInBlock is a helper method to define mock.On call +// - ctx context.Context +// - blockHash common.Hash +// - index uint +func (_e *EthereumClientMock_Expecter) TransactionInBlock(ctx interface{}, blockHash interface{}, index interface{}) *EthereumClientMock_TransactionInBlock_Call { + return &EthereumClientMock_TransactionInBlock_Call{Call: _e.mock.On("TransactionInBlock", ctx, blockHash, index)} +} + +func (_c *EthereumClientMock_TransactionInBlock_Call) Run(run func(ctx context.Context, blockHash common.Hash, index uint)) *EthereumClientMock_TransactionInBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash), args[2].(uint)) + }) + return _c +} + +func (_c *EthereumClientMock_TransactionInBlock_Call) Return(_a0 *types.Transaction, _a1 error) *EthereumClientMock_TransactionInBlock_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_TransactionInBlock_Call) RunAndReturn(run func(context.Context, common.Hash, uint) (*types.Transaction, error)) *EthereumClientMock_TransactionInBlock_Call { + _c.Call.Return(run) + return _c +} + // TransactionReceipt provides a mock function with given fields: ctx, txHash func (_m *EthereumClientMock) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { ret := _m.Called(ctx, txHash) @@ -667,6 +1290,35 @@ func (_m *EthereumClientMock) TransactionReceipt(ctx context.Context, txHash com return r0, r1 } +// EthereumClientMock_TransactionReceipt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransactionReceipt' +type EthereumClientMock_TransactionReceipt_Call struct { + *mock.Call +} + +// TransactionReceipt is a helper method to define mock.On call +// - ctx context.Context +// - txHash common.Hash +func (_e *EthereumClientMock_Expecter) TransactionReceipt(ctx interface{}, txHash interface{}) *EthereumClientMock_TransactionReceipt_Call { + return &EthereumClientMock_TransactionReceipt_Call{Call: _e.mock.On("TransactionReceipt", ctx, txHash)} +} + +func (_c *EthereumClientMock_TransactionReceipt_Call) Run(run func(ctx context.Context, txHash common.Hash)) *EthereumClientMock_TransactionReceipt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *EthereumClientMock_TransactionReceipt_Call) Return(_a0 *types.Receipt, _a1 error) *EthereumClientMock_TransactionReceipt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthereumClientMock_TransactionReceipt_Call) RunAndReturn(run func(context.Context, common.Hash) (*types.Receipt, error)) *EthereumClientMock_TransactionReceipt_Call { + _c.Call.Return(run) + return _c +} + // NewEthereumClientMock creates a new instance of EthereumClientMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewEthereumClientMock(t interface { diff --git a/mocks/zk_evm_client.generated.go b/mocks/zk_evm_client.generated.go index 4cac43e..1aabc30 100644 --- a/mocks/zk_evm_client.generated.go +++ b/mocks/zk_evm_client.generated.go @@ -16,6 +16,14 @@ type ZkEVMClientMock struct { mock.Mock } +type ZkEVMClientMock_Expecter struct { + mock *mock.Mock +} + +func (_m *ZkEVMClientMock) EXPECT() *ZkEVMClientMock_Expecter { + return &ZkEVMClientMock_Expecter{mock: &_m.Mock} +} + // BatchByNumber provides a mock function with given fields: ctx, number func (_m *ZkEVMClientMock) BatchByNumber(ctx context.Context, number *big.Int) (*types.Batch, error) { ret := _m.Called(ctx, number) @@ -46,6 +54,35 @@ func (_m *ZkEVMClientMock) BatchByNumber(ctx context.Context, number *big.Int) ( return r0, r1 } +// ZkEVMClientMock_BatchByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchByNumber' +type ZkEVMClientMock_BatchByNumber_Call struct { + *mock.Call +} + +// BatchByNumber is a helper method to define mock.On call +// - ctx context.Context +// - number *big.Int +func (_e *ZkEVMClientMock_Expecter) BatchByNumber(ctx interface{}, number interface{}) *ZkEVMClientMock_BatchByNumber_Call { + return &ZkEVMClientMock_BatchByNumber_Call{Call: _e.mock.On("BatchByNumber", ctx, number)} +} + +func (_c *ZkEVMClientMock_BatchByNumber_Call) Run(run func(ctx context.Context, number *big.Int)) *ZkEVMClientMock_BatchByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*big.Int)) + }) + return _c +} + +func (_c *ZkEVMClientMock_BatchByNumber_Call) Return(_a0 *types.Batch, _a1 error) *ZkEVMClientMock_BatchByNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ZkEVMClientMock_BatchByNumber_Call) RunAndReturn(run func(context.Context, *big.Int) (*types.Batch, error)) *ZkEVMClientMock_BatchByNumber_Call { + _c.Call.Return(run) + return _c +} + // NewZkEVMClientMock creates a new instance of ZkEVMClientMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewZkEVMClientMock(t interface { diff --git a/mocks/zk_evm_client_creator.generated.go b/mocks/zk_evm_client_creator.generated.go index dfa6dc8..506624c 100644 --- a/mocks/zk_evm_client_creator.generated.go +++ b/mocks/zk_evm_client_creator.generated.go @@ -12,6 +12,14 @@ type ZkEVMClientClientCreatorMock struct { mock.Mock } +type ZkEVMClientClientCreatorMock_Expecter struct { + mock *mock.Mock +} + +func (_m *ZkEVMClientClientCreatorMock) EXPECT() *ZkEVMClientClientCreatorMock_Expecter { + return &ZkEVMClientClientCreatorMock_Expecter{mock: &_m.Mock} +} + // NewClient provides a mock function with given fields: rpc func (_m *ZkEVMClientClientCreatorMock) NewClient(rpc string) types.IZkEVMClient { ret := _m.Called(rpc) @@ -32,6 +40,34 @@ func (_m *ZkEVMClientClientCreatorMock) NewClient(rpc string) types.IZkEVMClient return r0 } +// ZkEVMClientClientCreatorMock_NewClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewClient' +type ZkEVMClientClientCreatorMock_NewClient_Call struct { + *mock.Call +} + +// NewClient is a helper method to define mock.On call +// - rpc string +func (_e *ZkEVMClientClientCreatorMock_Expecter) NewClient(rpc interface{}) *ZkEVMClientClientCreatorMock_NewClient_Call { + return &ZkEVMClientClientCreatorMock_NewClient_Call{Call: _e.mock.On("NewClient", rpc)} +} + +func (_c *ZkEVMClientClientCreatorMock_NewClient_Call) Run(run func(rpc string)) *ZkEVMClientClientCreatorMock_NewClient_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ZkEVMClientClientCreatorMock_NewClient_Call) Return(_a0 types.IZkEVMClient) *ZkEVMClientClientCreatorMock_NewClient_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ZkEVMClientClientCreatorMock_NewClient_Call) RunAndReturn(run func(string) types.IZkEVMClient) *ZkEVMClientClientCreatorMock_NewClient_Call { + _c.Call.Return(run) + return _c +} + // NewZkEVMClientClientCreatorMock creates a new instance of ZkEVMClientClientCreatorMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewZkEVMClientClientCreatorMock(t interface { diff --git a/types/interfaces.go b/types/interfaces.go index 1d4e003..ab7c363 100644 --- a/types/interfaces.go +++ b/types/interfaces.go @@ -12,19 +12,16 @@ import ( "github.com/jackc/pgx/v4" ) -//go:generate mockery --name IDB --structname DBMock --output ../mocks --case=underscore --filename db.generated.go type IDB interface { BeginStateTransaction(ctx context.Context) (pgx.Tx, error) } -//go:generate mockery --name IEtherman --structname EthermanMock --output ../mocks --case=underscore --filename etherman.generated.go type IEtherman interface { GetSequencerAddr(rollupId uint32) (common.Address, error) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, proof tx.ZKP, rollupId uint32) (data []byte, err error) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) } -//go:generate mockery --name IEthTxManager --structname EthTxManagerMock --output ../mocks --case=underscore --filename eth_tx_manager.generated.go type IEthTxManager interface { Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error Result(ctx context.Context, owner, id string, dbTx pgx.Tx) (ethtxmanager.MonitoredTxResult, error) @@ -32,12 +29,10 @@ type IEthTxManager interface { ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx) } -//go:generate mockery --name IZkEVMClient --structname ZkEVMClientMock --output ../mocks --case=underscore --filename zk_evm_client.generated.go type IZkEVMClient interface { BatchByNumber(ctx context.Context, number *big.Int) (*types.Batch, error) } -//go:generate mockery --name IZkEVMClientClientCreator --structname ZkEVMClientClientCreatorMock --output ../mocks --case=underscore --filename zk_evm_client_creator.generated.go type IZkEVMClientClientCreator interface { NewClient(rpc string) IZkEVMClient }