Skip to content

Commit

Permalink
- fixes after merge
Browse files Browse the repository at this point in the history
- code cleanup
  • Loading branch information
iulianpascalau committed Dec 22, 2023
1 parent c448f57 commit d793ff8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 55 deletions.
1 change: 0 additions & 1 deletion bridges/ethMultiversX/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type MultiversXClient interface {
type EthereumClient interface {
GetBatch(ctx context.Context, nonce uint64) (*clients.TransferBatch, error)
WasExecuted(ctx context.Context, batchID uint64) (bool, error)
GenerateMessageHash(batch *clients.TransferBatch) (common.Hash, error)
IsDepositSCCall(deposit *clients.DepositTransfer) bool
GenerateMessageHash(batch *batchProcessor.ArgListsBatch, batchId uint64) (common.Hash, error)

Expand Down
28 changes: 11 additions & 17 deletions clients/ethereum/wrappers/ethereumChainWrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ import (

// ArgsEthereumChainWrapper is the DTO used to construct a ethereumChainWrapper instance
type ArgsEthereumChainWrapper struct {
StatusHandler core.StatusHandler
MultiSigContract multiSigContract
SCExecProxyContract scExecProxyContract
SafeContract safeContract
BlockchainClient blockchainClient
StatusHandler core.StatusHandler
MultiSigContract multiSigContract
SafeContract safeContract
BlockchainClient blockchainClient
}

type ethereumChainWrapper struct {
core.StatusHandler
multiSigContract multiSigContract
scExecProxyContract scExecProxyContract
safeContract safeContract
blockchainClient blockchainClient
multiSigContract multiSigContract
safeContract safeContract
blockchainClient blockchainClient
}

// NewEthereumChainWrapper creates a new instance of type ethereumChainWrapper
Expand All @@ -39,11 +37,10 @@ func NewEthereumChainWrapper(args ArgsEthereumChainWrapper) (*ethereumChainWrapp
}

return &ethereumChainWrapper{
StatusHandler: args.StatusHandler,
multiSigContract: args.MultiSigContract,
scExecProxyContract: args.SCExecProxyContract,
safeContract: args.SafeContract,
blockchainClient: args.BlockchainClient,
StatusHandler: args.StatusHandler,
multiSigContract: args.MultiSigContract,
safeContract: args.SafeContract,
blockchainClient: args.BlockchainClient,
}, nil
}

Expand All @@ -54,9 +51,6 @@ func checkArgs(args ArgsEthereumChainWrapper) error {
if check.IfNilReflect(args.MultiSigContract) {
return errNilMultiSigContract
}
if check.IfNilReflect(args.SCExecProxyContract) {
return errNilSCExecProxyContract
}
if check.IfNilReflect(args.SafeContract) {
return errNilSafeContract
}
Expand Down
9 changes: 4 additions & 5 deletions clients/ethereum/wrappers/ethereumChainWrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ func createMockArgsEthereumChainWrapper() (ArgsEthereumChainWrapper, *testsCommo
statusHandler := testsCommon.NewStatusHandlerMock("mock")

return ArgsEthereumChainWrapper{
MultiSigContract: &bridgeTests.MultiSigContractStub{},
SafeContract: &bridgeTests.SafeContractStub{},
BlockchainClient: &interactors.BlockchainClientStub{},
SCExecProxyContract: &bridgeTests.SCExecProxyContractStub{},
StatusHandler: statusHandler,
MultiSigContract: &bridgeTests.MultiSigContractStub{},
SafeContract: &bridgeTests.SafeContractStub{},
BlockchainClient: &interactors.BlockchainClientStub{},
StatusHandler: statusHandler,
}, statusHandler
}

Expand Down
13 changes: 3 additions & 10 deletions cmd/bridge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,6 @@ func startRelay(ctx *cli.Context, version string) error {
return err
}

scExecProxyAddr := ethCommon.HexToAddress(cfg.Eth.SCExecProxyAddress)
scExecProxy, err := contract.NewSCExecProxy(scExecProxyAddr, ethClient)
if err != nil {
return err
}

safeEthAddress := ethCommon.HexToAddress(cfg.Eth.SafeContractAddress)
safeInstance, err := contract.NewContract(safeEthAddress, ethClient)
if err != nil {
Expand Down Expand Up @@ -221,11 +215,10 @@ func startRelay(ctx *cli.Context, version string) error {
}

argsClientWrapper := wrappers.ArgsEthereumChainWrapper{
StatusHandler: ethClientStatusHandler,
MultiSigContract: multiSigInstance,
StatusHandler: ethClientStatusHandler,
MultiSigContract: multiSigInstance,
SafeContract: safeInstance,
BlockchainClient: ethClient,
SCExecProxyContract: scExecProxy,
BlockchainClient: ethClient,
}

clientWrapper, err := wrappers.NewEthereumChainWrapper(argsClientWrapper)
Expand Down
22 changes: 0 additions & 22 deletions testsCommon/bridge/scExecProxyContractStub.go

This file was deleted.

0 comments on commit d793ff8

Please sign in to comment.