diff --git a/script/InitializeRootContracts.s.sol b/script/InitializeRootContracts.s.sol index b28ad6df..56dc7e35 100644 --- a/script/InitializeRootContracts.s.sol +++ b/script/InitializeRootContracts.s.sol @@ -31,11 +31,7 @@ contract InitializeRootContracts is Script { vm.startBroadcast(rootPrivateKey); rootERC20Bridge.initialize( - address(rootBridgeAdaptor), - childERC20Bridge, - childBridgeAdaptor, - rootChainChildTokenTemplate, - rootIMXToken + address(rootBridgeAdaptor), childERC20Bridge, childBridgeAdaptor, rootChainChildTokenTemplate, rootIMXToken ); rootBridgeAdaptor.setChildBridgeAdaptor(); diff --git a/test/integration/root/RootERC20Bridge.t.sol b/test/integration/root/RootERC20Bridge.t.sol index 4b5ba252..bab1f5c9 100644 --- a/test/integration/root/RootERC20Bridge.t.sol +++ b/test/integration/root/RootERC20Bridge.t.sol @@ -104,13 +104,15 @@ contract RootERC20BridgeIntegrationTest is Test, IRootERC20BridgeEvents, IRootAx (, bytes memory predictedPayload) = setupDeposit(ERC20PresetMinterPauser(NATIVE_ETH), rootBridge, mapTokenFee, depositFee, tokenAmount, false); - + console2.logBytes(predictedPayload); vm.expectEmit(address(axelarAdaptor)); emit MapTokenAxelarMessage(CHILD_CHAIN_NAME, childBridgeAdaptorString, predictedPayload); vm.expectEmit(address(rootBridge)); - emit NativeEthDeposit(address(NATIVE_ETH), rootBridge.childETHToken(), address(this), address(this), tokenAmount); + emit NativeEthDeposit( + address(NATIVE_ETH), rootBridge.childETHToken(), address(this), address(this), tokenAmount + ); vm.expectCall( address(axelarAdaptor), @@ -149,7 +151,7 @@ contract RootERC20BridgeIntegrationTest is Test, IRootERC20BridgeEvents, IRootAx // Check that tokens are transferred assertEq(bridgePreBal + tokenAmount, address(rootBridge).balance, "ETH not transferred to bridge"); // Check that native asset transferred to gas service - assertEq(thisNativePreBal - (depositFee+tokenAmount), address(this).balance, "ETH not paid from user"); + assertEq(thisNativePreBal - (depositFee + tokenAmount), address(this).balance, "ETH not paid from user"); assertEq(gasServiceNativePreBal + depositFee, address(axelarGasService).balance, "ETH not paid to adaptor"); } @@ -158,9 +160,10 @@ contract RootERC20BridgeIntegrationTest is Test, IRootERC20BridgeEvents, IRootAx uint256 tokenAmount = 300; string memory childBridgeAdaptorString = Strings.toHexString(CHILD_BRIDGE_ADAPTOR); - (, bytes memory predictedPayload) = - setupDeposit(ERC20PresetMinterPauser(IMX_TOKEN_ADDRESS), rootBridge, mapTokenFee, depositFee, tokenAmount, false); - + (, bytes memory predictedPayload) = setupDeposit( + ERC20PresetMinterPauser(IMX_TOKEN_ADDRESS), rootBridge, mapTokenFee, depositFee, tokenAmount, false + ); + vm.expectEmit(address(axelarAdaptor)); emit MapTokenAxelarMessage(CHILD_CHAIN_NAME, childBridgeAdaptorString, predictedPayload); vm.expectEmit(address(rootBridge)); @@ -203,7 +206,9 @@ contract RootERC20BridgeIntegrationTest is Test, IRootERC20BridgeEvents, IRootAx // Check that tokens are transferred assertEq(thisPreBal - tokenAmount, imxToken.balanceOf(address(this)), "Tokens not transferred from user"); - assertEq(bridgePreBal + tokenAmount, imxToken.balanceOf(address(rootBridge)), "Tokens not transferred to bridge"); + assertEq( + bridgePreBal + tokenAmount, imxToken.balanceOf(address(rootBridge)), "Tokens not transferred to bridge" + ); // Check that native asset transferred to gas service assertEq(thisNativePreBal - depositFee, address(this).balance, "ETH not paid from user"); assertEq(gasServiceNativePreBal + depositFee, address(axelarGasService).balance, "ETH not paid to adaptor"); diff --git a/test/unit/root/RootERC20Bridge.t.sol b/test/unit/root/RootERC20Bridge.t.sol index 86aa82e3..cef2ad5d 100644 --- a/test/unit/root/RootERC20Bridge.t.sol +++ b/test/unit/root/RootERC20Bridge.t.sol @@ -42,9 +42,7 @@ contract RootERC20BridgeUnitTest is Test, IRootERC20BridgeEvents, IRootERC20Brid mockAxelarAdaptor = new MockAdaptor(); // The specific ERC20 token template does not matter for these unit tests - rootBridge.initialize( - address(mockAxelarAdaptor), CHILD_BRIDGE, CHILD_BRIDGE_ADAPTOR, address(token), IMX_TOKEN - ); + rootBridge.initialize(address(mockAxelarAdaptor), CHILD_BRIDGE, CHILD_BRIDGE_ADAPTOR, address(token), IMX_TOKEN); } /** @@ -59,9 +57,7 @@ contract RootERC20BridgeUnitTest is Test, IRootERC20BridgeEvents, IRootERC20Brid function test_RevertIfInitializeTwice() public { vm.expectRevert("Initializable: contract is already initialized"); - rootBridge.initialize( - address(mockAxelarAdaptor), CHILD_BRIDGE, CHILD_BRIDGE_ADAPTOR, address(token), IMX_TOKEN - ); + rootBridge.initialize(address(mockAxelarAdaptor), CHILD_BRIDGE, CHILD_BRIDGE_ADAPTOR, address(token), IMX_TOKEN); } function test_RevertIf_InitializeWithAZeroAddressRootAdapter() public { diff --git a/test/utils.t.sol b/test/utils.t.sol index f2556d03..77585442 100644 --- a/test/utils.t.sol +++ b/test/utils.t.sol @@ -31,7 +31,6 @@ contract Utils is Test { token = new ERC20PresetMinterPauser("Test", "TST"); token.mint(address(this), 1000000 ether); - deployCodeTo("ERC20PresetMinterPauser.sol", abi.encode("ImmutableX", "IMX"), imxTokenAddress); imxToken = ERC20PresetMinterPauser(imxTokenAddress); imxToken.mint(address(this), 1000000 ether); @@ -47,9 +46,7 @@ contract Utils is Test { address(axelarGasService) ); - rootBridge.initialize( - address(axelarAdaptor), childBridge, childBridgeAdaptor, address(token), imxTokenAddress - ); + rootBridge.initialize(address(axelarAdaptor), childBridge, childBridgeAdaptor, address(token), imxTokenAddress); axelarAdaptor.setChildBridgeAdaptor(); }