diff --git a/src/child/ChildERC20Bridge.sol b/src/child/ChildERC20Bridge.sol index 410968a0..7fff259b 100644 --- a/src/child/ChildERC20Bridge.sol +++ b/src/child/ChildERC20Bridge.sol @@ -139,7 +139,7 @@ contract ChildERC20Bridge is _withdrawIMX(msg.sender, amount); } - function withdrawToIMX(address receiver, uint256 amount) external payable { + function withdrawIMXTo(address receiver, uint256 amount) external payable { _withdrawIMX(receiver, amount); } diff --git a/test/integration/child/withdrawals/ChildAxelarBridgeWithdrawToIMX.t.sol b/test/integration/child/withdrawals/ChildAxelarBridgeWithdrawToIMX.t.sol index 46fab829..8c6e1fea 100644 --- a/test/integration/child/withdrawals/ChildAxelarBridgeWithdrawToIMX.t.sol +++ b/test/integration/child/withdrawals/ChildAxelarBridgeWithdrawToIMX.t.sol @@ -17,7 +17,7 @@ import {Utils} from "../../../utils.t.sol"; import {WETH} from "../../../../src/test/root/WETH.sol"; import {ChildERC20} from "../../../../src/child/ChildERC20.sol"; -contract ChildERC20BridgeWithdrawToIMXIntegrationTest is +contract ChildERC20BridgewithdrawIMXToIntegrationTest is Test, IChildERC20BridgeEvents, IChildAxelarBridgeAdaptorEvents, @@ -44,7 +44,7 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is childIntegrationSetup(); } - function test_WithdrawToIMX_CallsBridgeAdaptor() public { + function test_withdrawIMXTo_CallsBridgeAdaptor() public { uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -56,10 +56,10 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is abi.encodeWithSelector(axelarAdaptor.sendMessage.selector, predictedPayload, address(this)) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); } - function test_WithdrawToIMXWithDifferentAccount_CallsBridgeAdaptor() public { + function test_withdrawIMXToWithDifferentAccount_CallsBridgeAdaptor() public { address receiver = address(0xabcd); uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -72,10 +72,10 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is abi.encodeWithSelector(axelarAdaptor.sendMessage.selector, predictedPayload, address(this)) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); } - function test_WithdrawToIMX_CallsAxelarGateway() public { + function test_withdrawIMXTo_CallsAxelarGateway() public { uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -92,10 +92,10 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is ) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); } - function test_WithdrawToIMXWithDifferentAccount_CallsAxelarGateway() public { + function test_withdrawIMXToWithDifferentAccount_CallsAxelarGateway() public { address receiver = address(0xabcd); uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -113,10 +113,10 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is ) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); } - function test_WithdrawToIMX_CallsGasService() public { + function test_withdrawIMXTo_CallsGasService() public { uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -136,10 +136,10 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is ) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); } - function test_WithdrawToIMXWithDifferentAccount_CallsGasService() public { + function test_withdrawIMXToWithDifferentAccount_CallsGasService() public { address receiver = address(0xabcd); uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -160,10 +160,10 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is ) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); } - function test_WithdrawToIMX_EmitsAxelarMessageEvent() public { + function test_withdrawIMXTo_EmitsAxelarMessageEvent() public { uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -173,10 +173,10 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is vm.expectEmit(address(axelarAdaptor)); emit AxelarMessage(childBridge.rootChain(), childBridge.rootERC20BridgeAdaptor(), predictedPayload); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); } - function test_WithdrawToIMXWithDifferentAccount_EmitsAxelarMessageEvent() public { + function test_withdrawIMXToWithDifferentAccount_EmitsAxelarMessageEvent() public { address receiver = address(0xabcd); uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -187,17 +187,17 @@ contract ChildERC20BridgeWithdrawToIMXIntegrationTest is vm.expectEmit(address(axelarAdaptor)); emit AxelarMessage(childBridge.rootChain(), childBridge.rootERC20BridgeAdaptor(), predictedPayload); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); } - function test_WithdrawToIMX_ReducesBalance() public { + function test_withdrawIMXTo_ReducesBalance() public { uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; uint256 preBal = address(this).balance; uint256 preGasBal = address(axelarGasService).balance; - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); uint256 postBal = address(this).balance; uint256 postGasBal = address(axelarGasService).balance; diff --git a/test/unit/child/withdrawals/ChildERC20BridgeWithdrawToIMX.t.sol b/test/unit/child/withdrawals/ChildERC20BridgeWithdrawToIMX.t.sol index 1f5a1f9b..c8d997ea 100644 --- a/test/unit/child/withdrawals/ChildERC20BridgeWithdrawToIMX.t.sol +++ b/test/unit/child/withdrawals/ChildERC20BridgeWithdrawToIMX.t.sol @@ -16,7 +16,7 @@ import {ChildERC20} from "../../../../src/child/ChildERC20.sol"; import {MockAdaptor} from "../../../../src/test/root/MockAdaptor.sol"; import {Utils} from "../../../utils.t.sol"; -contract ChildERC20BridgeWithdrawToIMXUnitTest is Test, IChildERC20BridgeEvents, IChildERC20BridgeErrors, Utils { +contract ChildERC20BridgewithdrawIMXToUnitTest is Test, IChildERC20BridgeEvents, IChildERC20BridgeErrors, Utils { address constant ROOT_BRIDGE = address(3); string public ROOT_BRIDGE_ADAPTOR = Strings.toHexString(address(4)); string constant ROOT_CHAIN_NAME = "test"; @@ -41,21 +41,21 @@ contract ChildERC20BridgeWithdrawToIMXUnitTest is Test, IChildERC20BridgeEvents, ); } - function test_RevertsIf_WithdrawToIMXCalledWithInsufficientFund() public { + function test_RevertsIf_withdrawIMXToCalledWithInsufficientFund() public { uint256 withdrawAmount = 7 ether; vm.expectRevert(InsufficientValue.selector); - childBridge.withdrawToIMX{value: withdrawAmount - 1}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawAmount - 1}(address(this), withdrawAmount); } function test_RevertIf_ZeroAmountIsProvided() public { uint256 withdrawFee = 300; vm.expectRevert(ZeroAmount.selector); - childBridge.withdrawToIMX{value: withdrawFee}(address(this), 0); + childBridge.withdrawIMXTo{value: withdrawFee}(address(this), 0); } - function test_WithdrawToIMX_CallsBridgeAdaptor() public { + function test_withdrawIMXTo_CallsBridgeAdaptor() public { uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -67,10 +67,10 @@ contract ChildERC20BridgeWithdrawToIMXUnitTest is Test, IChildERC20BridgeEvents, withdrawFee, abi.encodeWithSelector(mockAdaptor.sendMessage.selector, predictedPayload, address(this)) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); } - function test_WithdrawToIMXWithDifferentAccount_CallsBridgeAdaptor() public { + function test_withdrawIMXToWithDifferentAccount_CallsBridgeAdaptor() public { address receiver = address(0xabcd); uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; @@ -83,26 +83,26 @@ contract ChildERC20BridgeWithdrawToIMXUnitTest is Test, IChildERC20BridgeEvents, withdrawFee, abi.encodeWithSelector(mockAdaptor.sendMessage.selector, predictedPayload, address(this)) ); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); } - function test_WithdrawToIMX_EmitsNativeIMXWithdrawEvent() public { + function test_withdrawIMXTo_EmitsNativeIMXWithdrawEvent() public { uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; vm.expectEmit(address(childBridge)); emit ChildChainNativeIMXWithdraw(ROOT_IMX_TOKEN, address(this), address(this), withdrawAmount); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); } - function test_WithdrawToIMXWithDifferentAccount_EmitsNativeIMXWithdrawEvent() public { + function test_withdrawIMXToWithDifferentAccount_EmitsNativeIMXWithdrawEvent() public { address receiver = address(0xabcd); uint256 withdrawFee = 300; uint256 withdrawAmount = 7 ether; vm.expectEmit(address(childBridge)); emit ChildChainNativeIMXWithdraw(ROOT_IMX_TOKEN, address(this), receiver, withdrawAmount); - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(receiver, withdrawAmount); } function test_WithdrawIMX_ReducesBalance() public { @@ -111,7 +111,7 @@ contract ChildERC20BridgeWithdrawToIMXUnitTest is Test, IChildERC20BridgeEvents, uint256 preBal = address(this).balance; - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); uint256 postBal = address(this).balance; assertEq(postBal, preBal - withdrawAmount - withdrawFee, "Balance not reduced"); @@ -123,7 +123,7 @@ contract ChildERC20BridgeWithdrawToIMXUnitTest is Test, IChildERC20BridgeEvents, uint256 preBal = address(mockAdaptor).balance; - childBridge.withdrawToIMX{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); + childBridge.withdrawIMXTo{value: withdrawFee + withdrawAmount}(address(this), withdrawAmount); uint256 postBal = address(mockAdaptor).balance; assertEq(postBal, preBal + withdrawFee, "Adaptor balance not increased");