Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zjg555543 committed Oct 30, 2023
1 parent 51a3143 commit 7219be7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/config.local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
6 changes: 4 additions & 2 deletions test/e2e/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 9 additions & 1 deletion test/operations/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}

Check failure on line 669 in test/operations/manager.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to bridgeAddr (ineffassign)
if network == L1 {
bridgeAddr = common.HexToAddress(l1BridgeAddr)
} else {
bridgeAddr = common.HexToAddress(l2BridgeAddr)
}

return client.ApproveERC20(ctx, erc20Addr, bridgeAddr, amount, auth)
}

Expand Down

0 comments on commit 7219be7

Please sign in to comment.