diff --git a/LOCAL_TESTING.md b/LOCAL_TESTING.md index 84087eaef2..ba239ccd6e 100644 --- a/LOCAL_TESTING.md +++ b/LOCAL_TESTING.md @@ -193,8 +193,8 @@ type E2ETestFunc func(*E2ERunner) The test can interact with the different networks using the runned object: ```go type E2ERunner struct { - ZevmClient *ethclient.Client - GoerliClient *ethclient.Client + ZEVMClient *ethclient.Client + EVMClient *ethclient.Client BtcRPCClient *rpcclient.Client CctxClient crosschaintypes.QueryClient @@ -204,8 +204,8 @@ type E2ERunner struct { ObserverClient observertypes.QueryClient ZetaTxServer txserver.ZetaTxServer - GoerliAuth *bind.TransactOpts - ZevmAuth *bind.TransactOpts + EVMAuth *bind.TransactOpts + ZEVMAuth *bind.TransactOpts // ... } diff --git a/cmd/zetae2e/config/clients.go b/cmd/zetae2e/config/clients.go index e85acd2dc3..5415223d26 100644 --- a/cmd/zetae2e/config/clients.go +++ b/cmd/zetae2e/config/clients.go @@ -35,7 +35,7 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey st if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get btc client: %w", err) } - goerliClient, goerliAuth, err := getEVMClient(ctx, conf.RPCs.EVM, evmPrivKey) + evmClient, evmAuth, err := getEVMClient(ctx, conf.RPCs.EVM, evmPrivKey) if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get evm client: %w", err) } @@ -48,8 +48,8 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey st return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get zevm client: %w", err) } return btcRPCClient, - goerliClient, - goerliAuth, + evmClient, + evmAuth, cctxClient, fungibleClient, authClient, @@ -85,7 +85,7 @@ func getBtcClient(rpcConf config.BitcoinRPC) (*rpcclient.Client, error) { return rpcclient.New(connCfg, nil) } -// getEVMClient get goerli client +// getEVMClient get evm client func getEVMClient(ctx context.Context, rpc, privKey string) (*ethclient.Client, *bind.TransactOpts, error) { evmClient, err := ethclient.Dial(rpc) if err != nil { diff --git a/cmd/zetae2e/config/config.go b/cmd/zetae2e/config/config.go index 3ec855c78f..57389f9b04 100644 --- a/cmd/zetae2e/config/config.go +++ b/cmd/zetae2e/config/config.go @@ -24,8 +24,8 @@ func RunnerFromConfig( ) (*runner.E2ERunner, error) { // initialize clients btcRPCClient, - goerliClient, - goerliAuth, + evmClient, + evmAuth, cctxClient, fungibleClient, authClient, @@ -56,7 +56,7 @@ func RunnerFromConfig( evmUserAddr, evmUserPrivKey, zetaUserMnemonic, - goerliClient, + evmClient, zevmClient, cctxClient, zetaTxServer, @@ -64,7 +64,7 @@ func RunnerFromConfig( authClient, bankClient, observerClient, - goerliAuth, + evmAuth, zevmAuth, btcRPCClient, logger, diff --git a/cmd/zetae2e/config/contracts.go b/cmd/zetae2e/config/contracts.go index 28d46e8958..2d456a8989 100644 --- a/cmd/zetae2e/config/contracts.go +++ b/cmd/zetae2e/config/contracts.go @@ -30,7 +30,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ZetaEthAddress: %s", c) } r.ZetaEthAddr = ethcommon.HexToAddress(c) - r.ZetaEth, err = zetaeth.NewZetaEth(r.ZetaEthAddr, r.GoerliClient) + r.ZetaEth, err = zetaeth.NewZetaEth(r.ZetaEthAddr, r.EVMClient) if err != nil { return err } @@ -40,7 +40,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ConnectorEthAddr: %s", c) } r.ConnectorEthAddr = ethcommon.HexToAddress(c) - r.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(r.ConnectorEthAddr, r.GoerliClient) + r.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(r.ConnectorEthAddr, r.EVMClient) if err != nil { return err } @@ -50,7 +50,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid CustodyAddr: %s", c) } r.ERC20CustodyAddr = ethcommon.HexToAddress(c) - r.ERC20Custody, err = erc20custody.NewERC20Custody(r.ERC20CustodyAddr, r.GoerliClient) + r.ERC20Custody, err = erc20custody.NewERC20Custody(r.ERC20CustodyAddr, r.EVMClient) if err != nil { return err } @@ -60,7 +60,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ERC20: %s", c) } r.ERC20Addr = ethcommon.HexToAddress(c) - r.ERC20, err = erc20.NewERC20(r.ERC20Addr, r.GoerliClient) + r.ERC20, err = erc20.NewERC20(r.ERC20Addr, r.EVMClient) if err != nil { return err } @@ -72,7 +72,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid SystemContractAddr: %s", c) } r.SystemContractAddr = ethcommon.HexToAddress(c) - r.SystemContract, err = systemcontract.NewSystemContract(r.SystemContractAddr, r.ZevmClient) + r.SystemContract, err = systemcontract.NewSystemContract(r.SystemContractAddr, r.ZEVMClient) if err != nil { return err } @@ -82,7 +82,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ETHZRC20Addr: %s", c) } r.ETHZRC20Addr = ethcommon.HexToAddress(c) - r.ETHZRC20, err = zrc20.NewZRC20(r.ETHZRC20Addr, r.ZevmClient) + r.ETHZRC20, err = zrc20.NewZRC20(r.ETHZRC20Addr, r.ZEVMClient) if err != nil { return err } @@ -92,7 +92,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ERC20ZRC20Addr: %s", c) } r.ERC20ZRC20Addr = ethcommon.HexToAddress(c) - r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZevmClient) + r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZEVMClient) if err != nil { return err } @@ -102,7 +102,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid BTCZRC20Addr: %s", c) } r.BTCZRC20Addr = ethcommon.HexToAddress(c) - r.BTCZRC20, err = zrc20.NewZRC20(r.BTCZRC20Addr, r.ZevmClient) + r.BTCZRC20, err = zrc20.NewZRC20(r.BTCZRC20Addr, r.ZEVMClient) if err != nil { return err } @@ -112,7 +112,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ERC20ZRC20Addr: %s", c) } r.ERC20ZRC20Addr = ethcommon.HexToAddress(c) - r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZevmClient) + r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZEVMClient) if err != nil { return err } @@ -122,7 +122,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid UniswapFactoryAddr: %s", c) } r.UniswapV2FactoryAddr = ethcommon.HexToAddress(c) - r.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(r.UniswapV2FactoryAddr, r.ZevmClient) + r.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(r.UniswapV2FactoryAddr, r.ZEVMClient) if err != nil { return err } @@ -132,7 +132,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid UniswapRouterAddr: %s", c) } r.UniswapV2RouterAddr = ethcommon.HexToAddress(c) - r.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(r.UniswapV2RouterAddr, r.ZevmClient) + r.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(r.UniswapV2RouterAddr, r.ZEVMClient) if err != nil { return err } @@ -142,7 +142,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ConnectorZEVMAddr: %s", c) } r.ConnectorZEVMAddr = ethcommon.HexToAddress(c) - r.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(r.ConnectorZEVMAddr, r.ZevmClient) + r.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(r.ConnectorZEVMAddr, r.ZEVMClient) if err != nil { return err } @@ -152,7 +152,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid WZetaAddr: %s", c) } r.WZetaAddr = ethcommon.HexToAddress(c) - r.WZeta, err = wzeta.NewWETH9(r.WZetaAddr, r.ZevmClient) + r.WZeta, err = wzeta.NewWETH9(r.WZetaAddr, r.ZEVMClient) if err != nil { return err } @@ -162,7 +162,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ZEVMSwapAppAddr: %s", c) } r.ZEVMSwapAppAddr = ethcommon.HexToAddress(c) - r.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(r.ZEVMSwapAppAddr, r.ZevmClient) + r.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(r.ZEVMSwapAppAddr, r.ZEVMClient) if err != nil { return err } @@ -172,7 +172,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ContextAppAddr: %s", c) } r.ContextAppAddr = ethcommon.HexToAddress(c) - r.ContextApp, err = contextapp.NewContextApp(r.ContextAppAddr, r.ZevmClient) + r.ContextApp, err = contextapp.NewContextApp(r.ContextAppAddr, r.ZEVMClient) if err != nil { return err } diff --git a/cmd/zetae2e/stress.go b/cmd/zetae2e/stress.go index 7af2f5b18b..b85d0e78d7 100644 --- a/cmd/zetae2e/stress.go +++ b/cmd/zetae2e/stress.go @@ -89,12 +89,12 @@ func StressTest(cmd *cobra.Command, _ []string) { } // Initialize clients ---------------------------------------------------------------- - goerliClient, err := ethclient.Dial(conf.RPCs.EVM) + evmClient, err := ethclient.Dial(conf.RPCs.EVM) if err != nil { panic(err) } - bal, err := goerliClient.BalanceAt(context.TODO(), local.DeployerAddress, nil) + bal, err := evmClient.BalanceAt(context.TODO(), local.DeployerAddress, nil) if err != nil { panic(err) } @@ -171,7 +171,7 @@ func StressTest(cmd *cobra.Command, _ []string) { panic(err) } e2eTest.ETHZRC20Addr = ethZRC20Addr - e2eTest.ETHZRC20, err = zrc20.NewZRC20(e2eTest.ETHZRC20Addr, e2eTest.ZevmClient) + e2eTest.ETHZRC20, err = zrc20.NewZRC20(e2eTest.ETHZRC20Addr, e2eTest.ZEVMClient) if err != nil { panic(err) } @@ -190,21 +190,21 @@ func StressTest(cmd *cobra.Command, _ []string) { //Pre-approve ETH withdraw on ZEVM fmt.Printf("approving ETH ZRC20...\n") ethZRC20 := e2eTest.ETHZRC20 - tx, err := ethZRC20.Approve(e2eTest.ZevmAuth, e2eTest.ETHZRC20Addr, big.NewInt(1e18)) + tx, err := ethZRC20.Approve(e2eTest.ZEVMAuth, e2eTest.ETHZRC20Addr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(ctx, e2eTest.ZevmClient, tx, logger, e2eTest.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(ctx, e2eTest.ZEVMClient, tx, logger, e2eTest.ReceiptTimeout) fmt.Printf("eth zrc20 approve receipt: status %d\n", receipt.Status) // Get current nonce on zevm for DeployerAddress - Need to keep track of nonce at client level - blockNum, err := e2eTest.ZevmClient.BlockNumber(context.Background()) + blockNum, err := e2eTest.ZEVMClient.BlockNumber(context.Background()) if err != nil { panic(err) } // #nosec G701 e2eTest - always in range - nonce, err := e2eTest.ZevmClient.NonceAt(context.Background(), local.DeployerAddress, big.NewInt(int64(blockNum))) + nonce, err := e2eTest.ZEVMClient.NonceAt(context.Background(), local.DeployerAddress, big.NewInt(int64(blockNum))) if err != nil { panic(err) } @@ -215,11 +215,11 @@ func StressTest(cmd *cobra.Command, _ []string) { // -------------- TEST BEGINS ------------------ fmt.Println("**** STRESS TEST BEGINS ****") - fmt.Println(" 1. Periodically Withdraw ETH from ZEVM to EVM - goerli") + fmt.Println(" 1. Periodically Withdraw ETH from ZEVM to EVM") fmt.Println(" 2. Display Network metrics to monitor performance [Num Pending outbound tx], [Num Trackers]") e2eTest.WG.Add(2) - go WithdrawCCtx(e2eTest) // Withdraw from ZEVM to EVM - goerli + go WithdrawCCtx(e2eTest) // Withdraw from ZEVM to EVM go EchoNetworkMetrics(e2eTest) // Display Network metrics periodically to monitor performance e2eTest.WG.Wait() @@ -242,7 +242,7 @@ func EchoNetworkMetrics(runner *runner.E2ERunner) { var numTicks = 0 var totalMinedTxns = uint64(0) var previousMinedTxns = uint64(0) - chainID, err := getChainID(runner.GoerliClient) + chainID, err := getChainID(runner.EVMClient) if err != nil { panic(err) @@ -306,8 +306,8 @@ func WithdrawETHZRC20(runner *runner.E2ERunner) { ethZRC20 := runner.ETHZRC20 - runner.ZevmAuth.Nonce = zevmNonce - _, err := ethZRC20.Withdraw(runner.ZevmAuth, local.DeployerAddress.Bytes(), big.NewInt(100)) + runner.ZEVMAuth.Nonce = zevmNonce + _, err := ethZRC20.Withdraw(runner.ZEVMAuth, local.DeployerAddress.Bytes(), big.NewInt(100)) if err != nil { panic(err) } diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index c54db656fd..70bdc6de94 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -117,7 +117,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestMessagePassingName, - "goerli->goerli message passing (sending ZETA only)", + "evm->evm message passing (sending ZETA only)", []runner.ArgDefinition{ runner.ArgDefinition{Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, @@ -153,7 +153,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestMessagePassingRevertFailName, - "goerli->goerli message passing (revert fail)", + "evm->evm message passing (revert fail)", []runner.ArgDefinition{ runner.ArgDefinition{Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, @@ -161,7 +161,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestMessagePassingRevertSuccessName, - "goerli->goerli message passing (revert success)", + "evm->evm message passing (revert success)", []runner.ArgDefinition{ runner.ArgDefinition{Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, diff --git a/e2e/e2etests/test_bitcoin_withdraw.go b/e2e/e2etests/test_bitcoin_withdraw.go index d484aff840..7a82f4382d 100644 --- a/e2e/e2etests/test_bitcoin_withdraw.go +++ b/e2e/e2etests/test_bitcoin_withdraw.go @@ -53,11 +53,11 @@ func TestBitcoinWithdrawRestricted(r *runner.E2ERunner, args []string) { } func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) *btcjson.TxRawResult { - tx, err := r.BTCZRC20.Approve(r.ZevmAuth, r.BTCZRC20Addr, big.NewInt(amount.Int64()*2)) // approve more to cover withdraw fee + tx, err := r.BTCZRC20.Approve(r.ZEVMAuth, r.BTCZRC20Addr, big.NewInt(amount.Int64()*2)) // approve more to cover withdraw fee if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic(fmt.Errorf("approve receipt status is not 1")) } @@ -66,11 +66,11 @@ func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) stop := r.MineBlocks() // withdraw 'amount' of BTC from ZRC20 to BTC address - tx, err = r.BTCZRC20.Withdraw(r.ZevmAuth, []byte(to.EncodeAddress()), amount) + tx, err = r.BTCZRC20.Withdraw(r.ZEVMAuth, []byte(to.EncodeAddress()), amount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic(fmt.Errorf("withdraw receipt status is not 1")) } @@ -145,7 +145,7 @@ func WithdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) { // panic(err) // } // r.Logger.Info("BTCZRC20Addr: %s", BTCZRC20Addr.Hex()) -// BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, r.ZevmClient) +// BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, r.ZEVMClient) // if err != nil { // panic(err) // } @@ -159,11 +159,11 @@ func WithdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) { // // approve the ZRC20 contract to spend 1 BTC from the deployer address // { // // approve more to cover withdraw fee -// tx, err := BTCZRC20.Approve(r.ZevmAuth, BTCZRC20Addr, totalAmount.Mul(totalAmount, big.NewInt(100))) +// tx, err := BTCZRC20.Approve(r.ZEVMAuth, BTCZRC20Addr, totalAmount.Mul(totalAmount, big.NewInt(100))) // if err != nil { // panic(err) // } -// receipt := config.MustWaitForTxReceipt(r.ZevmClient, tx, r.Logger) +// receipt := config.MustWaitForTxReceipt(r.ZEVMClient, tx, r.Logger) // r.Logger.Info("approve receipt: status %d", receipt.Status) // if receipt.Status != 1 { // panic(fmt.Errorf("approve receipt status is not 1")) @@ -185,11 +185,11 @@ func WithdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) { // panic(err) // } // r.Logger.Info("withdraw gas fee: %d", gasFee) -// tx, err := BTCZRC20.Withdraw(r.ZevmAuth, []byte(r.BTCDeployerAddress.EncodeAddress()), amount) +// tx, err := BTCZRC20.Withdraw(r.ZEVMAuth, []byte(r.BTCDeployerAddress.EncodeAddress()), amount) // if err != nil { // panic(err) // } -// receipt := config.MustWaitForTxReceipt(r.ZevmClient, tx, r.Logger) +// receipt := config.MustWaitForTxReceipt(r.ZEVMClient, tx, r.Logger) // r.Logger.Info("withdraw receipt: status %d", receipt.Status) // if receipt.Status != 1 { // panic(fmt.Errorf("withdraw receipt status is not 1")) diff --git a/e2e/e2etests/test_bitcoin_withdraw_invalid.go b/e2e/e2etests/test_bitcoin_withdraw_invalid.go index 3b6953a3d3..4c529bf8ac 100644 --- a/e2e/e2etests/test_bitcoin_withdraw_invalid.go +++ b/e2e/e2etests/test_bitcoin_withdraw_invalid.go @@ -33,11 +33,11 @@ func WithdrawToInvalidAddress(r *runner.E2ERunner, amount *big.Int) { approvalAmount := 1000000000000000000 // approve the ZRC20 contract to spend approvalAmount BTC from the deployer address. // the actual amount transferred is provided as test arg BTC, but we approve more to cover withdraw fee - tx, err := r.BTCZRC20.Approve(r.ZevmAuth, r.BTCZRC20Addr, big.NewInt(int64(approvalAmount))) + tx, err := r.BTCZRC20.Approve(r.ZEVMAuth, r.BTCZRC20Addr, big.NewInt(int64(approvalAmount))) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic(fmt.Errorf("approve receipt status is not 1")) } @@ -46,11 +46,11 @@ func WithdrawToInvalidAddress(r *runner.E2ERunner, amount *big.Int) { stop := r.MineBlocks() // withdraw amount provided as test arg BTC from ZRC20 to BTC legacy address - tx, err = r.BTCZRC20.Withdraw(r.ZevmAuth, []byte("1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3"), amount) + tx, err = r.BTCZRC20.Withdraw(r.ZEVMAuth, []byte("1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3"), amount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic(fmt.Errorf("withdraw receipt status is successful for an invalid BTC address")) } diff --git a/e2e/e2etests/test_context.go b/e2e/e2etests/test_context.go index 6600283dbb..eeb9c62ea9 100644 --- a/e2e/e2etests/test_context.go +++ b/e2e/e2etests/test_context.go @@ -31,12 +31,12 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) { panic(err) } - r.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("EVM tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } - r.Logger.Info("GOERLI tx receipt: %d", receipt.Status) + r.Logger.Info("EVM tx receipt: %d", receipt.Status) r.Logger.Info(" tx hash: %s", receipt.TxHash.String()) r.Logger.Info(" to: %s", signedTx.To().String()) r.Logger.Info(" value: %d", signedTx.Value()) @@ -63,7 +63,7 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) { if bytes.Compare(eventIter.Event.Origin, r.DeployerAddress.Bytes()) != 0 { panic("origin mismatch") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_crosschain_swap.go b/e2e/e2etests/test_crosschain_swap.go index 071309a42a..34aa6e3d23 100644 --- a/e2e/e2etests/test_crosschain_swap.go +++ b/e2e/e2etests/test_crosschain_swap.go @@ -13,51 +13,51 @@ import ( ) func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { - r.ZevmAuth.GasLimit = 10000000 + r.ZEVMAuth.GasLimit = 10000000 // TODO: move into setup and skip it if already initialized // https://github.com/zeta-chain/node-private/issues/88 // it is kept as is for now to be consistent with the old implementation // if the tx fails due to already initialized, it will be ignored - _, err := r.UniswapV2Factory.CreatePair(r.ZevmAuth, r.ERC20ZRC20Addr, r.BTCZRC20Addr) + _, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.BTCZRC20Addr) if err != nil { r.Logger.Print("ℹ️create pair error") } - txERC20ZRC20Approve, err := r.ERC20ZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + txERC20ZRC20Approve, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - txBTCApprove, err := r.BTCZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + txBTCApprove, err := r.BTCZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } // Fund ZEVMSwapApp with gas ZRC20s - txTransferETH, err := r.ETHZRC20.Transfer(r.ZevmAuth, r.ZEVMSwapAppAddr, big.NewInt(1e7)) + txTransferETH, err := r.ETHZRC20.Transfer(r.ZEVMAuth, r.ZEVMSwapAppAddr, big.NewInt(1e7)) if err != nil { panic(err) } - txTransferBTC, err := r.BTCZRC20.Transfer(r.ZevmAuth, r.ZEVMSwapAppAddr, big.NewInt(1e6)) + txTransferBTC, err := r.BTCZRC20.Transfer(r.ZEVMAuth, r.ZEVMSwapAppAddr, big.NewInt(1e6)) if err != nil { panic(err) } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txERC20ZRC20Approve, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txERC20ZRC20Approve, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("ZRC20 ERC20 approve failed") } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txBTCApprove, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txBTCApprove, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("btc approve failed") } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txTransferETH, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txTransferETH, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("ETH ZRC20 transfer failed") } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txTransferBTC, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txTransferBTC, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("BTC ZRC20 transfer failed") } // Add 100 erc20 zrc20 liq and 0.001 BTC txAddLiquidity, err := r.UniswapV2Router.AddLiquidity( - r.ZevmAuth, + r.ZEVMAuth, r.ERC20ZRC20Addr, r.BTCZRC20Addr, big.NewInt(1e8), @@ -71,7 +71,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { panic(fmt.Sprintf("Error liq %s", err.Error())) } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txAddLiquidity, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txAddLiquidity, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("add liq receipt status is not 1") } diff --git a/e2e/e2etests/test_donation.go b/e2e/e2etests/test_donation.go index 028109da28..e10882788b 100644 --- a/e2e/e2etests/test_donation.go +++ b/e2e/e2etests/test_donation.go @@ -26,7 +26,7 @@ func TestDonationEther(r *runner.E2ERunner, args []string) { r.Logger.EVMTransaction(*txDonation, "donation") // check contract deployment receipt - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, txDonation, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, txDonation, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "donation") if receipt.Status != 1 { panic("donation tx failed") diff --git a/e2e/e2etests/test_erc20_multiple_deposits.go b/e2e/e2etests/test_erc20_multiple_deposits.go index f2822228d1..d48b0fe2ac 100644 --- a/e2e/e2etests/test_erc20_multiple_deposits.go +++ b/e2e/e2etests/test_erc20_multiple_deposits.go @@ -50,7 +50,7 @@ func TestMultipleERC20Deposit(r *runner.E2ERunner, args []string) { func MultipleDeposits(r *runner.E2ERunner, amount, count *big.Int) ethcommon.Hash { // deploy depositor - depositorAddr, _, depositor, err := testcontract.DeployDepositor(r.GoerliAuth, r.GoerliClient, r.ERC20CustodyAddr) + depositorAddr, _, depositor, err := testcontract.DeployDepositor(r.EVMAuth, r.EVMClient, r.ERC20CustodyAddr) if err != nil { panic(err) } @@ -58,22 +58,22 @@ func MultipleDeposits(r *runner.E2ERunner, amount, count *big.Int) ethcommon.Has fullAmount := big.NewInt(0).Mul(amount, count) // approve - tx, err := r.ERC20.Approve(r.GoerliAuth, depositorAddr, fullAmount) + tx, err := r.ERC20.Approve(r.EVMAuth, depositorAddr, fullAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } r.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) // deposit - tx, err = depositor.RunDeposits(r.GoerliAuth, r.DeployerAddress.Bytes(), r.ERC20Addr, amount, []byte{}, count) + tx, err = depositor.RunDeposits(r.EVMAuth, r.DeployerAddress.Bytes(), r.ERC20Addr, amount, []byte{}, count) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposits failed") } @@ -87,6 +87,6 @@ func MultipleDeposits(r *runner.E2ERunner, amount, count *big.Int) ethcommon.Has r.Logger.Info("Multiple deposit event: ") r.Logger.Info(" Amount: %d, ", event.Amount) } - r.Logger.Info("gas limit %d", r.ZevmAuth.GasLimit) + r.Logger.Info("gas limit %d", r.ZEVMAuth.GasLimit) return tx.Hash() } diff --git a/e2e/e2etests/test_erc20_multiple_withdraws.go b/e2e/e2etests/test_erc20_multiple_withdraws.go index 3743ec44c2..3991165818 100644 --- a/e2e/e2etests/test_erc20_multiple_withdraws.go +++ b/e2e/e2etests/test_erc20_multiple_withdraws.go @@ -33,28 +33,28 @@ func TestMultipleWithdraws(r *runner.E2ERunner, args []string) { } // deploy withdrawer - withdrawerAddr, _, withdrawer, err := testcontract.DeployWithdrawer(r.ZevmAuth, r.ZevmClient) + withdrawerAddr, _, withdrawer, err := testcontract.DeployWithdrawer(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } // approve - tx, err := r.ERC20ZRC20.Approve(r.ZevmAuth, withdrawerAddr, approvedAmount) + tx, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, withdrawerAddr, approvedAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } r.Logger.Info("ERC20 ZRC20 approve receipt: status %d", receipt.Status) // approve gas token - tx, err = r.ETHZRC20.Approve(r.ZevmAuth, withdrawerAddr, approvedAmount) + tx, err = r.ETHZRC20.Approve(r.ZEVMAuth, withdrawerAddr, approvedAmount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve gas token failed") } @@ -73,7 +73,7 @@ func TestMultipleWithdraws(r *runner.E2ERunner, args []string) { // withdraw tx, err = withdrawer.RunWithdraws( - r.ZevmAuth, + r.ZEVMAuth, r.DeployerAddress.Bytes(), r.ERC20ZRC20Addr, withdrawalAmount, @@ -82,7 +82,7 @@ func TestMultipleWithdraws(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("withdraw failed") } diff --git a/e2e/e2etests/test_erc20_refund.go b/e2e/e2etests/test_erc20_refund.go index 5547117f45..4d378f91b5 100644 --- a/e2e/e2etests/test_erc20_refund.go +++ b/e2e/e2etests/test_erc20_refund.go @@ -72,7 +72,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { } r.Logger.Info("Liquidity pool created") - goerliBalance, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + erc20Balance, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } @@ -83,7 +83,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - goerliBalanceAfterSend := big.NewInt(0).Sub(goerliBalance, amount) + erc20BalanceAfterSend := big.NewInt(0).Sub(erc20Balance, amount) // there is a liquidity pool, therefore the cctx should revert cctx = utils.WaitCctxMinedByInTxHash(r.Ctx, inTxHash, r.CctxClient, r.Logger, r.CctxTimeout) @@ -99,7 +99,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { // get revert tx revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - receipt, err := r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) + receipt, err := r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } @@ -107,32 +107,32 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { panic("expected the revert tx receipt to have status 1; got 0") } - // check that the erc20 in the reverted cctx was refunded on Goerli - goerliBalanceAfterRefund, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + // check that the erc20 in the reverted cctx was refunded on EVM + erc20BalanceAfterRefund, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } // the new balance must be higher than the previous one because of the revert refund - if goerliBalanceAfterSend.Cmp(goerliBalanceAfterRefund) != -1 { + if erc20BalanceAfterSend.Cmp(erc20BalanceAfterRefund) != -1 { panic(fmt.Sprintf( "expected balance to be higher after refund than after send %s < %s", - goerliBalanceAfterSend.String(), - goerliBalanceAfterRefund.String(), + erc20BalanceAfterSend.String(), + erc20BalanceAfterRefund.String(), )) } // it must also be lower than the previous balance + the amount because of the gas fee for the revert tx - if goerliBalanceAfterRefund.Cmp(goerliBalance) != -1 { + if erc20BalanceAfterRefund.Cmp(erc20Balance) != -1 { panic(fmt.Sprintf( "expected balance to be lower after refund than before send %s < %s", - goerliBalanceAfterRefund.String(), - goerliBalance.String()), + erc20BalanceAfterRefund.String(), + erc20Balance.String()), ) } r.Logger.Info("ERC20 CCTX successfully reverted") - r.Logger.Info("\tbalance before refund: %s", goerliBalance.String()) + r.Logger.Info("\tbalance before refund: %s", erc20Balance.String()) r.Logger.Info("\tamount: %s", amount.String()) - r.Logger.Info("\tbalance after refund: %s", goerliBalanceAfterRefund.String()) + r.Logger.Info("\tbalance after refund: %s", erc20BalanceAfterRefund.String()) } func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { @@ -140,19 +140,19 @@ func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { txHash := r.DepositERC20WithAmountAndMessage(r.DeployerAddress, amount, []byte{}) utils.WaitCctxMinedByInTxHash(r.Ctx, txHash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - tx, err := r.ERC20ZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e10)) + tx, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e10)) if err != nil { return err } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { return errors.New("approve failed") } - previousValue := r.ZevmAuth.Value - r.ZevmAuth.Value = big.NewInt(1e10) + previousValue := r.ZEVMAuth.Value + r.ZEVMAuth.Value = big.NewInt(1e10) tx, err = r.UniswapV2Router.AddLiquidityETH( - r.ZevmAuth, + r.ZEVMAuth, r.ERC20ZRC20Addr, amount, big.NewInt(0), @@ -160,11 +160,11 @@ func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { r.DeployerAddress, big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) - r.ZevmAuth.Value = previousValue + r.ZEVMAuth.Value = previousValue if err != nil { return err } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { return fmt.Errorf("add liquidity failed") } @@ -173,15 +173,15 @@ func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { } func sendInvalidERC20Deposit(r *runner.E2ERunner, amount *big.Int) (string, error) { - tx, err := r.ERC20.Approve(r.GoerliAuth, r.ERC20CustodyAddr, amount) + tx, err := r.ERC20.Approve(r.EVMAuth, r.ERC20CustodyAddr, amount) if err != nil { return "", err } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) tx, err = r.ERC20Custody.Deposit( - r.GoerliAuth, + r.EVMAuth, r.DeployerAddress.Bytes(), r.ERC20Addr, amount, @@ -191,12 +191,12 @@ func sendInvalidERC20Deposit(r *runner.E2ERunner, amount *big.Int) (string, erro return "", err } - r.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", tx.Hash().String(), tx.To().Hex(), tx.Nonce()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("EVM tx sent: %s; to %s, nonce %d", tx.Hash().String(), tx.To().Hex(), tx.Nonce()) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { return "", errors.New("expected the tx receipt to have status 1; got 0") } - r.Logger.Info("GOERLI tx receipt: %d", receipt.Status) + r.Logger.Info("EVM tx receipt: %d", receipt.Status) r.Logger.Info(" tx hash: %s", receipt.TxHash.String()) r.Logger.Info(" to: %s", tx.To().String()) r.Logger.Info(" value: %d", tx.Value()) diff --git a/e2e/e2etests/test_erc20_withdraw.go b/e2e/e2etests/test_erc20_withdraw.go index d26a10dc84..26959c0eac 100644 --- a/e2e/e2etests/test_erc20_withdraw.go +++ b/e2e/e2etests/test_erc20_withdraw.go @@ -25,22 +25,22 @@ func TestERC20Withdraw(r *runner.E2ERunner, args []string) { } // approve - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, r.ERC20ZRC20Addr, approvedAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ERC20ZRC20Addr, approvedAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } r.Logger.Info("eth zrc20 approve receipt: status %d", receipt.Status) // withdraw - tx, err = r.ERC20ZRC20.Withdraw(r.ZevmAuth, r.DeployerAddress.Bytes(), withdrawalAmount) + tx, err = r.ERC20ZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("Receipt txhash %s status %d", receipt.TxHash, receipt.Status) for _, log := range receipt.Logs { event, err := r.ERC20ZRC20.ParseWithdrawal(*log) @@ -61,11 +61,11 @@ func TestERC20Withdraw(r *runner.E2ERunner, args []string) { verifyTransferAmountFromCCTX(r, cctx, withdrawalAmount.Int64()) } -// verifyTransferAmountFromCCTX verifies the transfer amount from the CCTX on Goerli +// verifyTransferAmountFromCCTX verifies the transfer amount from the CCTX on EVM func verifyTransferAmountFromCCTX(r *runner.E2ERunner, cctx *crosschaintypes.CrossChainTx, amount int64) { r.Logger.Info("outTx hash %s", cctx.GetCurrentOutTxParam().OutboundTxHash) - receipt, err := r.GoerliClient.TransactionReceipt( + receipt, err := r.EVMClient.TransactionReceipt( r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash), ) diff --git a/e2e/e2etests/test_eth_deposit.go b/e2e/e2etests/test_eth_deposit.go index d7e1663c1a..bfcc33e1a8 100644 --- a/e2e/e2etests/test_eth_deposit.go +++ b/e2e/e2etests/test_eth_deposit.go @@ -48,27 +48,27 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { } r.Logger.Info("Deploying example contract") - exampleAddr, _, exampleContract, err := testcontract.DeployExample(r.ZevmAuth, r.ZevmClient) + exampleAddr, _, exampleContract, err := testcontract.DeployExample(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } r.Logger.Info("Example contract deployed") // preparing tx - goerliClient := r.GoerliClient + evmClient := r.EVMClient gasLimit := uint64(23000) - gasPrice, err := goerliClient.SuggestGasPrice(r.Ctx) + gasPrice, err := evmClient.SuggestGasPrice(r.Ctx) if err != nil { panic(err) } - nonce, err := goerliClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) if err != nil { panic(err) } data := append(exampleAddr.Bytes(), []byte("hello sailors")...) tx := ethtypes.NewTransaction(nonce, r.TSSAddress, value, gasLimit, gasPrice, data) - chainID, err := goerliClient.NetworkID(r.Ctx) + chainID, err := evmClient.NetworkID(r.Ctx) if err != nil { panic(err) } @@ -82,11 +82,11 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { } r.Logger.Info("Sending a cross-chain call to example contract") - err = goerliClient.SendTransaction(r.Ctx, signedTx) + err = evmClient.SendTransaction(r.Ctx, signedTx) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("tx failed") } @@ -106,18 +106,18 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { r.Logger.Info("Cross-chain call succeeded") r.Logger.Info("Deploying reverter contract") - reverterAddr, _, _, err := testcontract.DeployReverter(r.ZevmAuth, r.ZevmClient) + reverterAddr, _, _, err := testcontract.DeployReverter(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } r.Logger.Info("Example reverter deployed") // preparing tx for reverter - gasPrice, err = goerliClient.SuggestGasPrice(r.Ctx) + gasPrice, err = evmClient.SuggestGasPrice(r.Ctx) if err != nil { panic(err) } - nonce, err = goerliClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err = evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) if err != nil { panic(err) } @@ -130,12 +130,12 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { } r.Logger.Info("Sending a cross-chain call to reverter contract") - err = goerliClient.SendTransaction(r.Ctx, signedTx) + err = evmClient.SendTransaction(r.Ctx, signedTx) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("tx failed") } @@ -162,22 +162,22 @@ func TestDepositAndCallRefund(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestDepositAndCallRefund.") } - goerliClient := r.GoerliClient + evmClient := r.EVMClient - nonce, err := goerliClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) if err != nil { panic(err) } gasLimit := uint64(23000) // in units - gasPrice, err := goerliClient.SuggestGasPrice(r.Ctx) + gasPrice, err := evmClient.SuggestGasPrice(r.Ctx) if err != nil { panic(err) } data := append(r.BTCZRC20Addr.Bytes(), []byte("hello sailors")...) // this data tx := ethtypes.NewTransaction(nonce, r.TSSAddress, value, gasLimit, gasPrice, data) - chainID, err := goerliClient.NetworkID(r.Ctx) + chainID, err := evmClient.NetworkID(r.Ctx) if err != nil { panic(err) } @@ -190,13 +190,13 @@ func TestDepositAndCallRefund(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - err = goerliClient.SendTransaction(r.Ctx, signedTx) + err = evmClient.SendTransaction(r.Ctx, signedTx) if err != nil { panic(err) } - r.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) - r.Logger.Info("GOERLI tx receipt: %d", receipt.Status) + r.Logger.Info("EVM tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("EVM tx receipt: %d", receipt.Status) r.Logger.Info(" tx hash: %s", receipt.TxHash.String()) r.Logger.Info(" to: %s", signedTx.To().String()) r.Logger.Info(" value: %d", signedTx.Value()) @@ -206,13 +206,13 @@ func TestDepositAndCallRefund(r *runner.E2ERunner, args []string) { cctx := utils.WaitCctxMinedByInTxHash(r.Ctx, signedTx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) r.Logger.Info("cctx status message: %s", cctx.CctxStatus.StatusMessage) revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - r.Logger.Info("GOERLI revert tx receipt: status %d", receipt.Status) + r.Logger.Info("EVM revert tx receipt: status %d", receipt.Status) - tx, _, err := r.GoerliClient.TransactionByHash(r.Ctx, ethcommon.HexToHash(revertTxHash)) + tx, _, err := r.EVMClient.TransactionByHash(r.Ctx, ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } - receipt, err := r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) + receipt, err := r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } @@ -285,7 +285,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } @@ -304,7 +304,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } @@ -339,7 +339,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } diff --git a/e2e/e2etests/test_eth_withdraw.go b/e2e/e2etests/test_eth_withdraw.go index bc9f7907ee..66e0385642 100644 --- a/e2e/e2etests/test_eth_withdraw.go +++ b/e2e/e2etests/test_eth_withdraw.go @@ -27,26 +27,26 @@ func TestEtherWithdraw(r *runner.E2ERunner, args []string) { } // approve - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, r.ETHZRC20Addr, approvedAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, approvedAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "approve") - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } r.Logger.EVMReceipt(*receipt, "approve") // withdraw - tx, err = r.ETHZRC20.Withdraw(r.ZevmAuth, r.DeployerAddress.Bytes(), withdrawalAmount) + tx, err = r.ETHZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "withdraw") - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("withdraw failed") } @@ -78,13 +78,13 @@ func TestEtherWithdrawRestricted(r *runner.E2ERunner, args []string) { } // approve - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, r.ETHZRC20Addr, approvedAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, approvedAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "approve") - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } @@ -92,13 +92,13 @@ func TestEtherWithdrawRestricted(r *runner.E2ERunner, args []string) { // withdraw restrictedAddress := ethcommon.HexToAddress(testutils.RestrictedEVMAddressTest) - tx, err = r.ETHZRC20.Withdraw(r.ZevmAuth, restrictedAddress.Bytes(), withdrawalAmount) + tx, err = r.ETHZRC20.Withdraw(r.ZEVMAuth, restrictedAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "withdraw to restricted address") - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("withdraw failed") } diff --git a/e2e/e2etests/test_message_passing.go b/e2e/e2etests/test_message_passing.go index 6dbe8addae..c01c2a92ac 100644 --- a/e2e/e2etests/test_message_passing.go +++ b/e2e/e2etests/test_message_passing.go @@ -23,20 +23,20 @@ func TestMessagePassing(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestMessagePassing.") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } r.Logger.Info("Approving ConnectorEth to spend deployer's ZetaEth") - auth := r.GoerliAuth + auth := r.EVMAuth tx, err := r.ZetaEth.Approve(auth, r.ConnectorEthAddr, amount) if err != nil { panic(err) } r.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -55,7 +55,7 @@ func TestMessagePassing(r *runner.E2ERunner, args []string) { } r.Logger.Info("ConnectorEth.Send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -82,7 +82,7 @@ func TestMessagePassing(r *runner.E2ERunner, args []string) { cctx.CctxStatus.StatusMessage, )) } - receipt, err = r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) if err != nil { panic(err) } @@ -113,18 +113,18 @@ func TestMessagePassingRevertFail(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestMessagePassingRevertFail.") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } - auth := r.GoerliAuth + auth := r.EVMAuth tx, err := r.ZetaEth.Approve(auth, r.ConnectorEthAddr, amount) if err != nil { panic(err) } r.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -142,7 +142,7 @@ func TestMessagePassingRevertFail(r *runner.E2ERunner, args []string) { panic(err) } r.Logger.Info("ConnectorEth.Send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -160,7 +160,7 @@ func TestMessagePassingRevertFail(r *runner.E2ERunner, args []string) { // expect revert tx to fail cctx := utils.WaitCctxMinedByInTxHash(r.Ctx, receipt.TxHash.String(), r.CctxClient, r.Logger, r.CctxTimeout) - receipt, err = r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) if err != nil { panic(err) } @@ -183,12 +183,12 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestMessagePassingRevertSuccess.") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } - auth := r.GoerliAuth + auth := r.EVMAuth tx, err := r.ZetaEth.Approve(auth, r.TestDAppAddr, amount) if err != nil { @@ -196,14 +196,14 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { } r.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } r.Logger.Info("Approve tx receipt: %d", receipt.Status) r.Logger.Info("Calling TestDApp.SendHello on contract address %s", r.TestDAppAddr.Hex()) - testDApp, err := testdapp.NewTestDApp(r.TestDAppAddr, r.GoerliClient) + testDApp, err := testdapp.NewTestDApp(r.TestDAppAddr, r.EVMClient) if err != nil { panic(err) } @@ -221,7 +221,7 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { panic(err) } r.Logger.Info("TestDApp.SendHello tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("TestDApp.SendHello tx receipt: status %d", receipt.Status) cctx := utils.WaitCctxMinedByInTxHash(r.Ctx, receipt.TxHash.String(), r.CctxClient, r.Logger, r.CctxTimeout) @@ -229,7 +229,7 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { panic("expected cctx to be reverted") } outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - receipt, err = r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(outTxHash)) + receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(outTxHash)) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_pause_zrc20.go b/e2e/e2etests/test_pause_zrc20.go index a682809f4a..0635fc6623 100644 --- a/e2e/e2etests/test_pause_zrc20.go +++ b/e2e/e2etests/test_pause_zrc20.go @@ -15,24 +15,24 @@ import ( func TestPauseZRC20(r *runner.E2ERunner, _ []string) { // Setup vault used to test zrc20 interactions r.Logger.Info("Deploying vault") - vaultAddr, _, vaultContract, err := vault.DeployVault(r.ZevmAuth, r.ZevmClient) + vaultAddr, _, vaultContract, err := vault.DeployVault(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } // Approving vault to spend ZRC20 - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, vaultAddr, big.NewInt(1e18)) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, vaultAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("Vault approval should succeed") } - tx, err = r.ERC20ZRC20.Approve(r.ZevmAuth, vaultAddr, big.NewInt(1e18)) + tx, err = r.ERC20ZRC20.Approve(r.ZEVMAuth, vaultAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("Vault approval should succeed") } @@ -64,30 +64,30 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { // Try operations with ETH ZRC20 r.Logger.Info("Can no longer do operations on ETH ZRC20") - tx, err = r.ETHZRC20.Transfer(r.ZevmAuth, sample.EthAddress(), big.NewInt(1e5)) + tx, err = r.ETHZRC20.Transfer(r.ZEVMAuth, sample.EthAddress(), big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic("transfer should fail") } - tx, err = r.ETHZRC20.Burn(r.ZevmAuth, big.NewInt(1e5)) + tx, err = r.ETHZRC20.Burn(r.ZEVMAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic("burn should fail") } // Operation on a contract that interact with ETH ZRC20 should fail r.Logger.Info("Vault contract can no longer interact with ETH ZRC20: %s", r.ETHZRC20Addr.Hex()) - tx, err = vaultContract.Deposit(r.ZevmAuth, r.ETHZRC20Addr, big.NewInt(1e5)) + tx, err = vaultContract.Deposit(r.ZEVMAuth, r.ETHZRC20Addr, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic("deposit should fail") } @@ -95,19 +95,19 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { // Check we can still interact with ERC20 ZRC20 r.Logger.Info("Check other ZRC20 can still be operated") - tx, err = r.ERC20ZRC20.Transfer(r.ZevmAuth, sample.EthAddress(), big.NewInt(1e3)) + tx, err = r.ERC20ZRC20.Transfer(r.ZEVMAuth, sample.EthAddress(), big.NewInt(1e3)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("ERC20 ZRC20 transfer should succeed") } - tx, err = vaultContract.Deposit(r.ZevmAuth, r.ERC20ZRC20Addr, big.NewInt(1e3)) + tx, err = vaultContract.Deposit(r.ZEVMAuth, r.ERC20ZRC20Addr, big.NewInt(1e3)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("ERC20 ZRC20 vault deposit should succeed") } @@ -117,7 +117,7 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } @@ -154,29 +154,29 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { // Try operations with ETH ZRC20 r.Logger.Info("Can do operations on ETH ZRC20 again") - tx, err = r.ETHZRC20.Transfer(r.ZevmAuth, sample.EthAddress(), big.NewInt(1e5)) + tx, err = r.ETHZRC20.Transfer(r.ZEVMAuth, sample.EthAddress(), big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("transfer should succeed") } - tx, err = r.ETHZRC20.Burn(r.ZevmAuth, big.NewInt(1e5)) + tx, err = r.ETHZRC20.Burn(r.ZEVMAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("burn should succeed") } // Can deposit tokens into the vault again - tx, err = vaultContract.Deposit(r.ZevmAuth, r.ETHZRC20Addr, big.NewInt(1e5)) + tx, err = vaultContract.Deposit(r.ZEVMAuth, r.ETHZRC20Addr, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit should succeed") } diff --git a/e2e/e2etests/test_stress_btc_withdraw.go b/e2e/e2etests/test_stress_btc_withdraw.go index f97b0d0349..ea4465b52d 100644 --- a/e2e/e2etests/test_stress_btc_withdraw.go +++ b/e2e/e2etests/test_stress_btc_withdraw.go @@ -44,14 +44,14 @@ func TestStressBTCWithdraw(r *runner.E2ERunner, args []string) { for i := 0; i < numWithdraws; i++ { i := i tx, err := r.BTCZRC20.Withdraw( - r.ZevmAuth, + r.ZEVMAuth, []byte(r.BTCDeployerAddress.EncodeAddress()), big.NewInt(int64(satAmount)), ) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { //r.Logger.Info("index %d: withdraw evm tx failed", index) panic(fmt.Sprintf("index %d: withdraw btc tx %s failed", i, tx.Hash().Hex())) diff --git a/e2e/e2etests/test_stress_eth_withdraw.go b/e2e/e2etests/test_stress_eth_withdraw.go index ebbffdba34..0122d4e623 100644 --- a/e2e/e2etests/test_stress_eth_withdraw.go +++ b/e2e/e2etests/test_stress_eth_withdraw.go @@ -39,11 +39,11 @@ func TestStressEtherWithdraw(r *runner.E2ERunner, args []string) { // send the withdraws for i := 0; i < numWithdraws; i++ { i := i - tx, err := r.ETHZRC20.Withdraw(r.ZevmAuth, r.DeployerAddress.Bytes(), withdrawalAmount) + tx, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { //r.Logger.Info("index %d: withdraw evm tx failed", index) panic(fmt.Sprintf("index %d: withdraw evm tx %s failed", i, tx.Hash().Hex())) diff --git a/e2e/e2etests/test_update_bytecode.go b/e2e/e2etests/test_update_bytecode.go index 9feb4a9d4e..6bf5bf9f70 100644 --- a/e2e/e2etests/test_update_bytecode.go +++ b/e2e/e2etests/test_update_bytecode.go @@ -16,11 +16,11 @@ import ( func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { // Random approval approved := sample.EthAddress() - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, approved, big.NewInt(1e10)) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, approved, big.NewInt(1e10)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("approval failed") } @@ -28,8 +28,8 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { // Deploy the TestZRC20 contract r.Logger.Info("Deploying contract with new bytecode") newZRC20Address, tx, newZRC20Contract, err := testzrc20.DeployTestZRC20( - r.ZevmAuth, - r.ZevmClient, + r.ZEVMAuth, + r.ZEVMClient, big.NewInt(5), // #nosec G701 test - always in range uint8(common.CoinType_Gas), @@ -39,7 +39,7 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { } // Wait for the contract to be deployed - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("contract deployment failed") } @@ -137,15 +137,15 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { } r.Logger.Info("Can interact with the new code of the contract") - testZRC20Contract, err := testzrc20.NewTestZRC20(r.ETHZRC20Addr, r.ZevmClient) + testZRC20Contract, err := testzrc20.NewTestZRC20(r.ETHZRC20Addr, r.ZEVMClient) if err != nil { panic(err) } - tx, err = testZRC20Contract.UpdateNewField(r.ZevmAuth, big.NewInt(1e10)) + tx, err = testZRC20Contract.UpdateNewField(r.ZEVMAuth, big.NewInt(1e10)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("update new field failed") } @@ -158,11 +158,11 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { } r.Logger.Info("Interacting with the bytecode contract doesn't disrupt the zrc20 contract") - tx, err = newZRC20Contract.UpdateNewField(r.ZevmAuth, big.NewInt(1e5)) + tx, err = newZRC20Contract.UpdateNewField(r.ZEVMAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("update new field failed") } @@ -183,11 +183,11 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { // can continue to operate the ZRC20 r.Logger.Info("Checking the ZRC20 can continue to operate after state change") - tx, err = r.ETHZRC20.Transfer(r.ZevmAuth, approved, big.NewInt(1e14)) + tx, err = r.ETHZRC20.Transfer(r.ZEVMAuth, approved, big.NewInt(1e14)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("transfer failed") } diff --git a/e2e/e2etests/test_zeta_withdraw.go b/e2e/e2etests/test_zeta_withdraw.go index 463c659db9..fd5d91cd14 100644 --- a/e2e/e2etests/test_zeta_withdraw.go +++ b/e2e/e2etests/test_zeta_withdraw.go @@ -23,38 +23,38 @@ func TestZetaWithdraw(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestZetaWithdraw.") } - r.ZevmAuth.Value = amount - tx, err := r.WZeta.Deposit(r.ZevmAuth) + r.ZEVMAuth.Value = amount + tx, err := r.WZeta.Deposit(r.ZEVMAuth) if err != nil { panic(err) } - r.ZevmAuth.Value = big.NewInt(0) + r.ZEVMAuth.Value = big.NewInt(0) r.Logger.Info("wzeta deposit tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "wzeta deposit") if receipt.Status == 0 { panic("deposit failed") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } - tx, err = r.WZeta.Approve(r.ZevmAuth, r.ConnectorZEVMAddr, amount) + tx, err = r.WZeta.Approve(r.ZEVMAuth, r.ConnectorZEVMAddr, amount) if err != nil { panic(err) } r.Logger.Info("wzeta approve tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "wzeta approve") if receipt.Status == 0 { panic(fmt.Sprintf("approve failed, logs: %+v", receipt.Logs)) } - tx, err = r.ConnectorZEVM.Send(r.ZevmAuth, connectorzevm.ZetaInterfacesSendInput{ + tx, err = r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: chainID, DestinationAddress: r.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(400_000), @@ -66,7 +66,7 @@ func TestZetaWithdraw(r *runner.E2ERunner, args []string) { panic(err) } r.Logger.Info("send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "send") if receipt.Status == 0 { panic(fmt.Sprintf("send failed, logs: %+v", receipt.Logs)) @@ -107,34 +107,34 @@ func TestZetaWithdrawBTCRevert(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestZetaWithdrawBTCRevert.") } - r.ZevmAuth.Value = amount - tx, err := r.WZeta.Deposit(r.ZevmAuth) + r.ZEVMAuth.Value = amount + tx, err := r.WZeta.Deposit(r.ZEVMAuth) if err != nil { panic(err) } - r.ZevmAuth.Value = big.NewInt(0) + r.ZEVMAuth.Value = big.NewInt(0) r.Logger.Info("Deposit tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "Deposit") if receipt.Status != 1 { panic("Deposit failed") } - tx, err = r.WZeta.Approve(r.ZevmAuth, r.ConnectorZEVMAddr, big.NewInt(1e18)) + tx, err = r.WZeta.Approve(r.ZEVMAuth, r.ConnectorZEVMAddr, big.NewInt(1e18)) if err != nil { panic(err) } r.Logger.Info("wzeta.approve tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "Approve") if receipt.Status != 1 { panic("Approve failed") } lessThanAmount := amount.Div(amount, big.NewInt(10)) // 1/10 of amount - tx, err = r.ConnectorZEVM.Send(r.ZevmAuth, connectorzevm.ZetaInterfacesSendInput{ + tx, err = r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: big.NewInt(common.BtcRegtestChain().ChainId), DestinationAddress: r.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(400_000), @@ -147,7 +147,7 @@ func TestZetaWithdrawBTCRevert(r *runner.E2ERunner, args []string) { } r.Logger.Info("send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "send") if receipt.Status != 0 { panic("Was able to send ZETA to BTC") diff --git a/e2e/e2etests/test_zrc20_swap.go b/e2e/e2etests/test_zrc20_swap.go index cfc0620eb8..0954fb0b7d 100644 --- a/e2e/e2etests/test_zrc20_swap.go +++ b/e2e/e2etests/test_zrc20_swap.go @@ -15,11 +15,11 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { // https://github.com/zeta-chain/node-private/issues/88 // it is kept as is for now to be consistent with the old implementation // if the tx fails due to already initialized, it will be ignored - tx, err := r.UniswapV2Factory.CreatePair(r.ZevmAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr) + tx, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr) if err != nil { r.Logger.Print("ℹ️create pair error") } else { - utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) } zrc20EthPair, err := r.UniswapV2Factory.GetPair(&bind.CallOpts{}, r.ERC20ZRC20Addr, r.ETHZRC20Addr) @@ -28,29 +28,29 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { } r.Logger.Info("ZRC20-ETH pair receipt pair addr %s", zrc20EthPair.Hex()) - tx, err = r.ERC20ZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + tx, err = r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("ERC20 ZRC20 approval receipt txhash %s status %d", receipt.TxHash, receipt.Status) - tx, err = r.ETHZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + tx, err = r.ETHZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("ETH ZRC20 approval receipt txhash %s status %d", receipt.TxHash, receipt.Status) // temporarily increase gas limit to 400000 - previousGasLimit := r.ZevmAuth.GasLimit + previousGasLimit := r.ZEVMAuth.GasLimit defer func() { - r.ZevmAuth.GasLimit = previousGasLimit + r.ZEVMAuth.GasLimit = previousGasLimit }() - r.ZevmAuth.GasLimit = 400000 + r.ZEVMAuth.GasLimit = 400000 tx, err = r.UniswapV2Router.AddLiquidity( - r.ZevmAuth, + r.ZEVMAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr, big.NewInt(90000), @@ -63,7 +63,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("Add liquidity receipt txhash %s status %d", receipt.TxHash, receipt.Status) balETHBefore, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) @@ -72,7 +72,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { } ethOutAmout := big.NewInt(1) tx, err = r.UniswapV2Router.SwapExactTokensForTokens( - r.ZevmAuth, + r.ZEVMAuth, big.NewInt(1000), ethOutAmout, []ethcommon.Address{r.ERC20ZRC20Addr, r.ETHZRC20Addr}, @@ -82,7 +82,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("Swap ERC20 ZRC20 for ETH ZRC20 %s status %d", receipt.TxHash, receipt.Status) balETHAfter, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) diff --git a/e2e/runner/accounting.go b/e2e/runner/accounting.go index da366ba265..5edc8abc8a 100644 --- a/e2e/runner/accounting.go +++ b/e2e/runner/accounting.go @@ -31,7 +31,7 @@ func (runner *E2ERunner) CheckZRC20ReserveAndSupply() error { } func (runner *E2ERunner) checkEthTSSBalance() error { - tssBal, err := runner.GoerliClient.BalanceAt(runner.Ctx, runner.TSSAddress, nil) + tssBal, err := runner.EVMClient.BalanceAt(runner.Ctx, runner.TSSAddress, nil) if err != nil { return err } diff --git a/e2e/runner/balances.go b/e2e/runner/balances.go index eb99978018..19acfd1509 100644 --- a/e2e/runner/balances.go +++ b/e2e/runner/balances.go @@ -32,7 +32,7 @@ type AccountBalancesDiff struct { // GetAccountBalances returns the account balances of the accounts used in the E2E test func (runner *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, error) { // zevm - zetaZeta, err := runner.ZevmClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) + zetaZeta, err := runner.ZEVMClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) if err != nil { return AccountBalances{}, err } @@ -54,7 +54,7 @@ func (runner *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, erro } // evm - evmEth, err := runner.GoerliClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) + evmEth, err := runner.EVMClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) if err != nil { return AccountBalances{}, err } diff --git a/e2e/runner/evm.go b/e2e/runner/evm.go index 8dbc61062a..ed7822666e 100644 --- a/e2e/runner/evm.go +++ b/e2e/runner/evm.go @@ -22,7 +22,7 @@ func (runner *E2ERunner) WaitForTxReceiptOnEvm(tx *ethtypes.Transaction) { }() runner.Lock() - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -38,11 +38,11 @@ func (runner *E2ERunner) MintERC20OnEvm(amountERC20 int64) { amount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(amountERC20)) - tx, err := runner.ERC20.Mint(runner.GoerliAuth, amount) + tx, err := runner.ERC20.Mint(runner.EVMAuth, amount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("mint failed") } @@ -62,7 +62,7 @@ func (runner *E2ERunner) SendERC20OnEvm(address ethcommon.Address, amountERC20 i amount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(amountERC20)) // transfer - tx, err := runner.ERC20.Transfer(runner.GoerliAuth, address, amount) + tx, err := runner.ERC20.Transfer(runner.EVMAuth, address, amount) if err != nil { panic(err) } @@ -77,32 +77,32 @@ func (runner *E2ERunner) DepositERC20() ethcommon.Hash { func (runner *E2ERunner) DepositERC20WithAmountAndMessage(to ethcommon.Address, amount *big.Int, msg []byte) ethcommon.Hash { // reset allowance, necessary for ERC20 - tx, err := runner.ERC20.Approve(runner.GoerliAuth, runner.ERC20CustodyAddr, big.NewInt(0)) + tx, err := runner.ERC20.Approve(runner.EVMAuth, runner.ERC20CustodyAddr, big.NewInt(0)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } runner.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) - tx, err = runner.ERC20.Approve(runner.GoerliAuth, runner.ERC20CustodyAddr, amount) + tx, err = runner.ERC20.Approve(runner.EVMAuth, runner.ERC20CustodyAddr, amount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } runner.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) - tx, err = runner.ERC20Custody.Deposit(runner.GoerliAuth, to.Bytes(), runner.ERC20Addr, amount, msg) + tx, err = runner.ERC20Custody.Deposit(runner.EVMAuth, to.Bytes(), runner.ERC20Addr, amount, msg) runner.Logger.Print("TX: %v", tx) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("deposit failed") } @@ -136,7 +136,7 @@ func (runner *E2ERunner) DepositEtherWithAmount(testHeader bool, amount *big.Int } runner.Logger.EVMTransaction(*signedTx, "send to TSS") - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, signedTx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, signedTx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("deposit failed") } @@ -151,23 +151,23 @@ func (runner *E2ERunner) DepositEtherWithAmount(testHeader bool, amount *big.Int return signedTx.Hash() } -// SendEther sends ethers to the TSS on Goerli +// SendEther sends ethers to the TSS on EVM func (runner *E2ERunner) SendEther(_ ethcommon.Address, value *big.Int, data []byte) (*ethtypes.Transaction, error) { - goerliClient := runner.GoerliClient + evmClient := runner.EVMClient - nonce, err := goerliClient.PendingNonceAt(runner.Ctx, runner.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(runner.Ctx, runner.DeployerAddress) if err != nil { return nil, err } gasLimit := uint64(30000) // in units - gasPrice, err := goerliClient.SuggestGasPrice(runner.Ctx) + gasPrice, err := evmClient.SuggestGasPrice(runner.Ctx) if err != nil { return nil, err } tx := ethtypes.NewTransaction(nonce, runner.TSSAddress, value, gasLimit, gasPrice, data) - chainID, err := goerliClient.NetworkID(runner.Ctx) + chainID, err := evmClient.NetworkID(runner.Ctx) if err != nil { return nil, err } @@ -181,7 +181,7 @@ func (runner *E2ERunner) SendEther(_ ethcommon.Address, value *big.Int, data []b if err != nil { return nil, err } - err = goerliClient.SendTransaction(runner.Ctx, signedTx) + err = evmClient.SendTransaction(runner.Ctx, signedTx) if err != nil { return nil, err } @@ -199,7 +199,7 @@ func (runner *E2ERunner) ProveEthTransaction(receipt *ethtypes.Receipt) { // #nosec G701 test - always in range txIndex := int(receipt.TransactionIndex) - block, err := runner.GoerliClient.BlockByHash(runner.Ctx, blockHash) + block, err := runner.EVMClient.BlockByHash(runner.Ctx, blockHash) if err != nil { panic(err) } diff --git a/e2e/runner/runner.go b/e2e/runner/runner.go index 4d572036b7..3b7ba5136e 100644 --- a/e2e/runner/runner.go +++ b/e2e/runner/runner.go @@ -47,8 +47,8 @@ type E2ERunner struct { FungibleAdminMnemonic string // rpc clients - ZevmClient *ethclient.Client - GoerliClient *ethclient.Client + ZEVMClient *ethclient.Client + EVMClient *ethclient.Client BtcRPCClient *rpcclient.Client // grpc clients @@ -62,8 +62,8 @@ type E2ERunner struct { ZetaTxServer txserver.ZetaTxServer // evm auth - GoerliAuth *bind.TransactOpts - ZevmAuth *bind.TransactOpts + EVMAuth *bind.TransactOpts + ZEVMAuth *bind.TransactOpts // contracts ZetaEthAddr ethcommon.Address @@ -118,7 +118,7 @@ func NewE2ERunner( deployerAddress ethcommon.Address, deployerPrivateKey string, fungibleAdminMnemonic string, - goerliClient *ethclient.Client, + evmClient *ethclient.Client, zevmClient *ethclient.Client, cctxClient crosschaintypes.QueryClient, zetaTxServer txserver.ZetaTxServer, @@ -126,7 +126,7 @@ func NewE2ERunner( authClient authtypes.QueryClient, bankClient banktypes.QueryClient, observerClient observertypes.QueryClient, - goerliAuth *bind.TransactOpts, + evmAuth *bind.TransactOpts, zevmAuth *bind.TransactOpts, btcRPCClient *rpcclient.Client, logger *Logger, @@ -140,8 +140,8 @@ func NewE2ERunner( DeployerPrivateKey: deployerPrivateKey, FungibleAdminMnemonic: fungibleAdminMnemonic, - ZevmClient: zevmClient, - GoerliClient: goerliClient, + ZEVMClient: zevmClient, + EVMClient: evmClient, ZetaTxServer: zetaTxServer, CctxClient: cctxClient, FungibleClient: fungibleClient, @@ -149,8 +149,8 @@ func NewE2ERunner( BankClient: bankClient, ObserverClient: observerClient, - GoerliAuth: goerliAuth, - ZevmAuth: zevmAuth, + EVMAuth: evmAuth, + ZEVMAuth: zevmAuth, BtcRPCClient: btcRPCClient, Logger: logger, @@ -372,60 +372,60 @@ func (runner *E2ERunner) CopyAddressesFrom(other *E2ERunner) (err error) { runner.SystemContractAddr = other.SystemContractAddr // create instances of contracts - runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.GoerliClient) + runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.EVMClient) if err != nil { return err } - runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.GoerliClient) + runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.EVMClient) if err != nil { return err } - runner.ERC20Custody, err = erc20custody.NewERC20Custody(runner.ERC20CustodyAddr, runner.GoerliClient) + runner.ERC20Custody, err = erc20custody.NewERC20Custody(runner.ERC20CustodyAddr, runner.EVMClient) if err != nil { return err } - runner.ERC20, err = erc20.NewERC20(runner.ERC20Addr, runner.GoerliClient) + runner.ERC20, err = erc20.NewERC20(runner.ERC20Addr, runner.EVMClient) if err != nil { return err } - runner.ERC20ZRC20, err = zrc20.NewZRC20(runner.ERC20ZRC20Addr, runner.ZevmClient) + runner.ERC20ZRC20, err = zrc20.NewZRC20(runner.ERC20ZRC20Addr, runner.ZEVMClient) if err != nil { return err } - runner.ETHZRC20, err = zrc20.NewZRC20(runner.ETHZRC20Addr, runner.ZevmClient) + runner.ETHZRC20, err = zrc20.NewZRC20(runner.ETHZRC20Addr, runner.ZEVMClient) if err != nil { return err } - runner.BTCZRC20, err = zrc20.NewZRC20(runner.BTCZRC20Addr, runner.ZevmClient) + runner.BTCZRC20, err = zrc20.NewZRC20(runner.BTCZRC20Addr, runner.ZEVMClient) if err != nil { return err } - runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZevmClient) + runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZEVMClient) if err != nil { return err } - runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZevmClient) + runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZEVMClient) if err != nil { return err } - runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZevmClient) + runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZEVMClient) if err != nil { return err } - runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZevmClient) + runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZEVMClient) if err != nil { return err } - runner.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(runner.ZEVMSwapAppAddr, runner.ZevmClient) + runner.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(runner.ZEVMSwapAppAddr, runner.ZEVMClient) if err != nil { return err } - runner.ContextApp, err = contextapp.NewContextApp(runner.ContextAppAddr, runner.ZevmClient) + runner.ContextApp, err = contextapp.NewContextApp(runner.ContextAppAddr, runner.ZEVMClient) if err != nil { return err } - runner.SystemContract, err = systemcontract.NewSystemContract(runner.SystemContractAddr, runner.ZevmClient) + runner.SystemContract, err = systemcontract.NewSystemContract(runner.SystemContractAddr, runner.ZEVMClient) if err != nil { return err } diff --git a/e2e/runner/setup_evm.go b/e2e/runner/setup_evm.go index f5105a8972..8e751e7f2e 100644 --- a/e2e/runner/setup_evm.go +++ b/e2e/runner/setup_evm.go @@ -28,14 +28,14 @@ func (runner *E2ERunner) SetEVMContractsFromConfig() { // Set ZetaEthAddr runner.ZetaEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ZetaEthAddress) - runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.GoerliClient) + runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.EVMClient) if err != nil { panic(err) } // Set ConnectorEthAddr runner.ConnectorEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ConnectorEthAddr) - runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.GoerliClient) + runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.EVMClient) if err != nil { panic(err) } @@ -43,7 +43,7 @@ func (runner *E2ERunner) SetEVMContractsFromConfig() { // SetupEVM setup contracts on EVM for e2e test func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { - runner.Logger.Print("⚙️ setting up Goerli network") + runner.Logger.Print("⚙️ setting up EVM network") startTime := time.Now() defer func() { runner.Logger.Info("EVM setup took %s\n", time.Since(startTime)) @@ -69,8 +69,8 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("Deploying ZetaEth contract") zetaEthAddr, txZetaEth, ZetaEth, err := zetaeth.DeployZetaEth( - runner.GoerliAuth, - runner.GoerliClient, + runner.EVMAuth, + runner.EVMClient, runner.DeployerAddress, big.NewInt(21_000_000_000), ) @@ -84,8 +84,8 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("Deploying ZetaConnectorEth contract") connectorEthAddr, txConnector, ConnectorEth, err := zetaconnectoreth.DeployZetaConnectorEth( - runner.GoerliAuth, - runner.GoerliClient, + runner.EVMAuth, + runner.EVMClient, zetaEthAddr, runner.TSSAddress, runner.DeployerAddress, @@ -102,8 +102,8 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("Deploying ERC20Custody contract") erc20CustodyAddr, txCustody, ERC20Custody, err := erc20custody.DeployERC20Custody( - runner.GoerliAuth, - runner.GoerliClient, + runner.EVMAuth, + runner.EVMClient, runner.DeployerAddress, runner.DeployerAddress, big.NewInt(0), @@ -118,7 +118,7 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("ERC20Custody contract address: %s, tx hash: %s", erc20CustodyAddr.Hex(), txCustody.Hash().Hex()) runner.Logger.Info("Deploying ERC20 contract") - erc20Addr, txERC20, erc20, err := erc20.DeployERC20(runner.GoerliAuth, runner.GoerliClient, "TESTERC20", "TESTERC20", 6) + erc20Addr, txERC20, erc20, err := erc20.DeployERC20(runner.EVMAuth, runner.EVMClient, "TESTERC20", "TESTERC20", 6) if err != nil { panic(err) } @@ -127,7 +127,7 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("ERC20 contract address: %s, tx hash: %s", erc20Addr.Hex(), txERC20.Hash().Hex()) // deploy TestDApp contract - appAddr, txApp, _, err := testdapp.DeployTestDApp(runner.GoerliAuth, runner.GoerliClient, runner.ConnectorEthAddr, runner.ZetaEthAddr) + appAddr, txApp, _, err := testdapp.DeployTestDApp(runner.EVMAuth, runner.EVMClient, runner.ConnectorEthAddr, runner.ZetaEthAddr) if err != nil { panic(err) } @@ -135,42 +135,42 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("TestDApp contract address: %s, tx hash: %s", appAddr.Hex(), txApp.Hash().Hex()) // check contract deployment receipt - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txDonation, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { - panic("GOERLI donation tx failed") + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txDonation, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + panic("EVM donation tx failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txZetaEth, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txZetaEth, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ZetaEth deployment failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txConnector, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txConnector, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ZetaConnectorEth deployment failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ERC20Custody deployment failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txERC20, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txERC20, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ERC20 deployment failed") } - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txApp, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txApp, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("TestDApp deployment failed") } // initialize custody contract runner.Logger.Info("Whitelist ERC20") - txWhitelist, err := ERC20Custody.Whitelist(runner.GoerliAuth, erc20Addr) + txWhitelist, err := ERC20Custody.Whitelist(runner.EVMAuth, erc20Addr) if err != nil { panic(err) } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txWhitelist, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txWhitelist, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ERC20 whitelist failed") } runner.Logger.Info("Set TSS address") - txCustody, err = ERC20Custody.UpdateTSSAddress(runner.GoerliAuth, runner.TSSAddress) + txCustody, err = ERC20Custody.UpdateTSSAddress(runner.EVMAuth, runner.TSSAddress) if err != nil { panic(err) } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ERC20 update TSS address failed") } runner.Logger.Info("TSS set receipt tx hash: %s", txCustody.Hash().Hex()) diff --git a/e2e/runner/setup_zeta.go b/e2e/runner/setup_zeta.go index c85996b1bb..16f8f3b64e 100644 --- a/e2e/runner/setup_zeta.go +++ b/e2e/runner/setup_zeta.go @@ -80,35 +80,35 @@ func (runner *E2ERunner) SetZEVMContracts() { // Set ERC20ZRC20Addr runner.ERC20ZRC20Addr = ethcommon.HexToAddress(erc20zrc20Addr) - runner.ERC20ZRC20, err = zrc20.NewZRC20(runner.ERC20ZRC20Addr, runner.ZevmClient) + runner.ERC20ZRC20, err = zrc20.NewZRC20(runner.ERC20ZRC20Addr, runner.ZEVMClient) if err != nil { panic(err) } // UniswapV2FactoryAddr runner.UniswapV2FactoryAddr = ethcommon.HexToAddress(uniswapV2FactoryAddr) - runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZevmClient) + runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZEVMClient) if err != nil { panic(err) } // UniswapV2RouterAddr runner.UniswapV2RouterAddr = ethcommon.HexToAddress(uniswapV2RouterAddr) - runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZevmClient) + runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZEVMClient) if err != nil { panic(err) } // ZevmConnectorAddr runner.ConnectorZEVMAddr = ethcommon.HexToAddress(zevmConnectorAddr) - runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZevmClient) + runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZEVMClient) if err != nil { panic(err) } // WZetaAddr runner.WZetaAddr = ethcommon.HexToAddress(wzetaAddr) - runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZevmClient) + runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZEVMClient) if err != nil { panic(err) } @@ -125,7 +125,7 @@ func (runner *E2ERunner) SetZEVMContracts() { SystemContract, err := systemcontract.NewSystemContract( systemContractAddr, - runner.ZevmClient, + runner.ZEVMClient, ) if err != nil { panic(err) @@ -140,8 +140,8 @@ func (runner *E2ERunner) SetZEVMContracts() { // deploy ZEVMSwapApp and ContextApp zevmSwapAppAddr, txZEVMSwapApp, zevmSwapApp, err := zevmswap.DeployZEVMSwapApp( - runner.ZevmAuth, - runner.ZevmClient, + runner.ZEVMAuth, + runner.ZEVMClient, runner.UniswapV2RouterAddr, runner.SystemContractAddr, ) @@ -149,19 +149,19 @@ func (runner *E2ERunner) SetZEVMContracts() { panic(err) } - contextAppAddr, txContextApp, contextApp, err := contextapp.DeployContextApp(runner.ZevmAuth, runner.ZevmClient) + contextAppAddr, txContextApp, contextApp, err := contextapp.DeployContextApp(runner.ZEVMAuth, runner.ZEVMClient) if err != nil { panic(err) } - receipt := utils2.MustWaitForTxReceipt(runner.Ctx, runner.ZevmClient, txZEVMSwapApp, runner.Logger, runner.ReceiptTimeout) + receipt := utils2.MustWaitForTxReceipt(runner.Ctx, runner.ZEVMClient, txZEVMSwapApp, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("ZEVMSwapApp deployment failed") } runner.ZEVMSwapAppAddr = zevmSwapAppAddr runner.ZEVMSwapApp = zevmSwapApp - receipt = utils2.MustWaitForTxReceipt(runner.Ctx, runner.ZevmClient, txContextApp, runner.Logger, runner.ReceiptTimeout) + receipt = utils2.MustWaitForTxReceipt(runner.Ctx, runner.ZEVMClient, txContextApp, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("ContextApp deployment failed") } @@ -178,7 +178,7 @@ func (runner *E2ERunner) SetupETHZRC20() { panic("eth zrc20 not found") } runner.ETHZRC20Addr = ethZRC20Addr - ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, runner.ZevmClient) + ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, runner.ZEVMClient) if err != nil { panic(err) } @@ -192,7 +192,7 @@ func (runner *E2ERunner) SetupBTCZRC20() { } runner.BTCZRC20Addr = BTCZRC20Addr runner.Logger.Info("BTCZRC20Addr: %s", BTCZRC20Addr.Hex()) - BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, runner.ZevmClient) + BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, runner.ZEVMClient) if err != nil { panic(err) } diff --git a/e2e/runner/zeta.go b/e2e/runner/zeta.go index e4bbf99ccc..ebe3d5dc0f 100644 --- a/e2e/runner/zeta.go +++ b/e2e/runner/zeta.go @@ -39,7 +39,7 @@ func (runner *E2ERunner) SendZetaOnEvm(address ethcommon.Address, zetaAmount int amount := big.NewInt(1e18) amount = amount.Mul(amount, big.NewInt(zetaAmount)) - tx, err := runner.ZetaEth.Transfer(runner.GoerliAuth, address, amount) + tx, err := runner.ZetaEth.Transfer(runner.EVMAuth, address, amount) if err != nil { panic(err) } @@ -56,25 +56,25 @@ func (runner *E2ERunner) DepositZeta() ethcommon.Hash { // DepositZetaWithAmount deposits ZETA on ZetaChain from the ZETA smart contract on EVM with the specified amount func (runner *E2ERunner) DepositZetaWithAmount(to ethcommon.Address, amount *big.Int) ethcommon.Hash { - tx, err := runner.ZetaEth.Approve(runner.GoerliAuth, runner.ConnectorEthAddr, amount) + tx, err := runner.ZetaEth.Approve(runner.EVMAuth, runner.ConnectorEthAddr, amount) if err != nil { panic(err) } runner.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils2.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils2.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) runner.Logger.EVMReceipt(*receipt, "approve") if receipt.Status != 1 { panic("approve tx failed") } // query the chain ID using zevm client - zetaChainID, err := runner.ZevmClient.ChainID(runner.Ctx) + zetaChainID, err := runner.ZEVMClient.ChainID(runner.Ctx) if err != nil { panic(err) } - tx, err = runner.ConnectorEth.Send(runner.GoerliAuth, zetaconnectoreth.ZetaInterfacesSendInput{ + tx, err = runner.ConnectorEth.Send(runner.EVMAuth, zetaconnectoreth.ZetaInterfacesSendInput{ // TODO: allow user to specify destination chain id // https://github.com/zeta-chain/node-private/issues/41 DestinationChainId: zetaChainID, @@ -89,7 +89,7 @@ func (runner *E2ERunner) DepositZetaWithAmount(to ethcommon.Address, amount *big } runner.Logger.Info("Send tx hash: %s", tx.Hash().Hex()) - receipt = utils2.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt = utils2.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) runner.Logger.EVMReceipt(*receipt, "send") if receipt.Status != 1 { panic(fmt.Sprintf("expected tx receipt status to be 1; got %d", receipt.Status))