Skip to content

Commit

Permalink
add custody setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Jul 31, 2024
1 parent 026a9b7 commit 53337e6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions cmd/zetae2e/config/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error {
}

if c := conf.Contracts.EVM.ERC20CustodyNew; c != "" {
r.ERC20CustodyNewAddr, err = c.AsEVMAddress()
r.ERC20CustodyV2Addr, err = c.AsEVMAddress()
if err != nil {
return fmt.Errorf("invalid ERC20CustodyNewAddr: %w", err)
return fmt.Errorf("invalid ERC20CustodyV2Addr: %w", err)
}
r.ERC20CustodyNew, err = erc20custodyv2.NewERC20Custody(r.ERC20CustodyNewAddr, r.EVMClient)
r.ERC20CustodyV2, err = erc20custodyv2.NewERC20Custody(r.ERC20CustodyV2Addr, r.EVMClient)
if err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions e2e/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ type E2ERunner struct {
mutex sync.Mutex

// evm v2
GatewayEVMAddr ethcommon.Address
GatewayEVM *gatewayevm.GatewayEVM
ERC20CustodyNewAddr ethcommon.Address
ERC20CustodyNew *erc20custodyv2.ERC20Custody
GatewayEVMAddr ethcommon.Address
GatewayEVM *gatewayevm.GatewayEVM
ERC20CustodyV2Addr ethcommon.Address
ERC20CustodyV2 *erc20custodyv2.ERC20Custody

// zevm v2
GatewayZEVMAddr ethcommon.Address
Expand Down Expand Up @@ -298,8 +298,8 @@ func (r *E2ERunner) CopyAddressesFrom(other *E2ERunner) (err error) {
if err != nil {
return err
}
r.ERC20CustodyNewAddr = other.ERC20CustodyNewAddr
r.ERC20CustodyNew, err = erc20custodyv2.NewERC20Custody(r.ERC20CustodyNewAddr, r.EVMClient)
r.ERC20CustodyV2Addr = other.ERC20CustodyV2Addr
r.ERC20CustodyV2, err = erc20custodyv2.NewERC20Custody(r.ERC20CustodyV2Addr, r.EVMClient)
if err != nil {
return err
}
Expand Down Expand Up @@ -360,7 +360,7 @@ func (r *E2ERunner) PrintContractAddresses() {

r.Logger.Print(" --- 📜EVM v2 contracts ---")
r.Logger.Print("GatewayEVM: %s", r.GatewayEVMAddr.Hex())
r.Logger.Print("ERC20CustodyNew:%s", r.ERC20CustodyNewAddr.Hex())
r.Logger.Print("ERC20CustodyV2:%s", r.ERC20CustodyV2Addr.Hex())
}

// Errorf logs an error message. Mimics the behavior of testing.T.Errorf
Expand Down
14 changes: 10 additions & 4 deletions e2e/runner/v2_setup_evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,22 @@ func (r *E2ERunner) SetupEVMV2() {
)
require.NoError(r, err)

r.ERC20CustodyNewAddr = erc20CustodyNewAddr
r.ERC20CustodyNew = erc20CustodyNew
r.ERC20CustodyV2Addr = erc20CustodyNewAddr
r.ERC20CustodyV2 = erc20CustodyNew
r.Logger.Info(
"ERC20CustodyNew contract address: %s, tx hash: %s",
"ERC20CustodyV2 contract address: %s, tx hash: %s",
erc20CustodyNewAddr.Hex(),
txCustody.Hash().Hex(),
)

ensureTxReceipt(txCustody, "ERC20CustodyV2 deployment failed")

// set custody contract in gateway
txSetCustody, err := r.GatewayEVM.SetCustody(r.EVMAuth, erc20CustodyNewAddr)
require.NoError(r, err)

// check contract deployment receipt
ensureTxReceipt(txDonation, "EVM donation tx failed")
ensureTxReceipt(txCustody, "ERC20CustodyNew deployment failed")
ensureTxReceipt(txProxy, "Gateway proxy deployment failed")
ensureTxReceipt(txSetCustody, "Set custody in Gateway failed")
}

0 comments on commit 53337e6

Please sign in to comment.