diff --git a/src/interfaces/root/IRootERC20Bridge.sol b/src/interfaces/root/IRootERC20Bridge.sol index e23c8a29..ef92c2b5 100644 --- a/src/interfaces/root/IRootERC20Bridge.sol +++ b/src/interfaces/root/IRootERC20Bridge.sol @@ -46,7 +46,7 @@ interface IRootERC20BridgeEvents { uint256 amount ); event IMXDeposit(address indexed rootToken, address depositor, address indexed receiver, uint256 amount); - event WETHDeposit(address indexed rootToken, address depositor, address indexed receiver, uint256 amount); + event WETHDeposit(address indexed rootToken, address indexed childToken, address depositor, address indexed receiver, uint256 amount); event NativeEthDeposit( address indexed rootToken, address indexed childToken, diff --git a/src/root/RootERC20Bridge.sol b/src/root/RootERC20Bridge.sol index 8cd59ff6..23ae2835 100644 --- a/src/root/RootERC20Bridge.sol +++ b/src/root/RootERC20Bridge.sol @@ -153,14 +153,13 @@ contract RootERC20Bridge is function _depositToken(IERC20Metadata rootToken, address receiver, uint256 amount) private { if (address(rootToken) == rootWETHToken) { - _unwrapETH(amount); - _deposit(IERC20Metadata(rootWETHToken), receiver, amount); + _depositWrappedETH(receiver, amount); } else { _depositERC20(rootToken, receiver, amount); } } - function _unwrapETH(uint256 amount) private { + function _depositWrappedETH(address receiver, uint256 amount) private { uint256 expectedBalance = address(this).balance + amount; IERC20Metadata erc20WETH = IERC20Metadata(rootWETHToken); @@ -172,6 +171,7 @@ contract RootERC20Bridge is if (address(this).balance != expectedBalance) { revert BalanceInvariantCheckFailed(address(this).balance, expectedBalance); } + _deposit(IERC20Metadata(rootWETHToken), receiver, amount); } function _depositERC20(IERC20Metadata rootToken, address receiver, uint256 amount) private { @@ -263,7 +263,7 @@ contract RootERC20Bridge is if (address(rootToken) == NATIVE_ETH) { emit NativeEthDeposit(address(rootToken), childETHToken, msg.sender, receiver, amount); } else if (address(rootToken) == rootWETHToken) { - emit WETHDeposit(address(rootToken), msg.sender, receiver, amount); + emit WETHDeposit(address(rootToken), childETHToken, msg.sender, receiver, amount); } else if (address(rootToken) == rootIMXToken) { emit IMXDeposit(address(rootToken), msg.sender, receiver, amount); } else { diff --git a/test/integration/root/RootERC20Bridge.t.sol b/test/integration/root/RootERC20Bridge.t.sol index 691791ab..374ad9ff 100644 --- a/test/integration/root/RootERC20Bridge.t.sol +++ b/test/integration/root/RootERC20Bridge.t.sol @@ -227,7 +227,7 @@ contract RootERC20BridgeIntegrationTest is Test, IRootERC20BridgeEvents, IRootAx vm.expectEmit(address(axelarAdaptor)); emit MapTokenAxelarMessage(CHILD_CHAIN_NAME, childBridgeAdaptorString, predictedPayload); vm.expectEmit(address(rootBridge)); - emit WETHDeposit(address(WRAPPED_ETH), address(this), address(this), tokenAmount); + emit WETHDeposit(address(WRAPPED_ETH), rootBridge.childETHToken(), address(this), address(this), tokenAmount); vm.expectCall( address(axelarAdaptor), depositFee, diff --git a/test/unit/root/RootERC20Bridge.t.sol b/test/unit/root/RootERC20Bridge.t.sol index 24358c37..901a8f0b 100644 --- a/test/unit/root/RootERC20Bridge.t.sol +++ b/test/unit/root/RootERC20Bridge.t.sol @@ -349,7 +349,7 @@ contract RootERC20BridgeUnitTest is Test, IRootERC20BridgeEvents, IRootERC20Brid setupDeposit(WRAPPED_ETH, rootBridge, mapTokenFee, depositFee, amount, false); vm.expectEmit(); - emit WETHDeposit(WRAPPED_ETH, address(this), address(this), amount); + emit WETHDeposit(WRAPPED_ETH, rootBridge.childETHToken(), address(this), address(this), amount); rootBridge.deposit{value: depositFee}(IERC20Metadata(WRAPPED_ETH), amount); } @@ -359,7 +359,7 @@ contract RootERC20BridgeUnitTest is Test, IRootERC20BridgeEvents, IRootERC20Brid setupDepositTo(WRAPPED_ETH, rootBridge, mapTokenFee, depositFee, amount, receiver, false); vm.expectEmit(); - emit WETHDeposit(WRAPPED_ETH, address(this), receiver, amount); + emit WETHDeposit(WRAPPED_ETH, rootBridge.childETHToken(), address(this), receiver, amount); rootBridge.depositTo{value: depositFee}(IERC20Metadata(WRAPPED_ETH), receiver, amount); }