diff --git a/config/config.local.toml b/config/config.local.toml index 7c80b921..2fffb609 100644 --- a/config/config.local.toml +++ b/config/config.local.toml @@ -22,7 +22,7 @@ FreeGas = true [Etherman] L1URL = "http://xgon-mock-l1-network:8545" -L2URLs = ["http://xgon-node:8123"] +L2URLs = ["http://xgon-json-rpc:8123"] L1ChainId = 5 L2ChainIds = [1001] diff --git a/test/e2e/bridge_test.go b/test/e2e/bridge_test.go index 687dcd3f..03c54d84 100644 --- a/test/e2e/bridge_test.go +++ b/test/e2e/bridge_test.go @@ -250,7 +250,7 @@ func TestE2E(t *testing.T) { }) t.Run("Reversal ERC20", func(t *testing.T) { - log.Infof("TestE2E, L1-L2 token bridge start.") + log.Infof("TestE2E, Reversal ERC20 start.") // Check initial globalExitRoot. globalExitRootSMC, err := opsman.GetCurrentGlobalExitRootFromSmc(ctx) require.NoError(t, err) @@ -270,6 +270,8 @@ func TestE2E(t *testing.T) { t.Log("Token balance: ", balance, ". tokenaddress: ", tokenAddr, ". account: ", origAddr) destAddr := common.HexToAddress("0x2ecf31ece36ccac2d3222a303b1409233ecbb225") amount = new(big.Int).SetUint64(1000000000000000000) + err = opsman.ApproveERC20(ctx, tokenAddr, amount, operations.L1) + require.NoError(t, err) err = opsman.SendL2Deposit(ctx, tokenAddr, amount, destNetwork, &destAddr) require.NoError(t, err) // Check globalExitRoot @@ -342,7 +344,7 @@ func TestE2E(t *testing.T) { balance, err = opsman.CheckAccountTokenBalance(ctx, operations.L1, tokenWrapped.WrappedTokenAddress, &destAddr) require.NoError(t, err) require.Equal(t, 0, big.NewInt(400000000000000000).Cmp(balance)) - log.Infof("TestE2E, L1-L2 token bridge end.") + log.Infof("TestE2E, Reversal ERC20 end.") }) t.Run("ERC20", func(t *testing.T) { diff --git a/test/operations/manager.go b/test/operations/manager.go index 26b1ddf3..49e3284f 100644 --- a/test/operations/manager.go +++ b/test/operations/manager.go @@ -659,12 +659,20 @@ func (m *Manager) ApproveERC20OKB(ctx context.Context, okbAddress common.Address } // ApproveERC20 approves erc20 tokens -func (m *Manager) ApproveERC20(ctx context.Context, erc20Addr, bridgeAddr common.Address, amount *big.Int, network NetworkSID) error { +func (m *Manager) ApproveERC20(ctx context.Context, erc20Addr common.Address, amount *big.Int, network NetworkSID) error { client := m.clients[network] auth, err := client.GetSigner(ctx, accHexPrivateKeys[network]) if err != nil { return err } + + bridgeAddr := common.Address{} + if network == L1 { + bridgeAddr = common.HexToAddress(l1BridgeAddr) + } else { + bridgeAddr = common.HexToAddress(l2BridgeAddr) + } + return client.ApproveERC20(ctx, erc20Addr, bridgeAddr, amount, auth) }