Skip to content

Commit

Permalink
fix(MainchainGateway): not createDepositAllFallback with WETHWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
nxqbao committed Mar 25, 2024
1 parent 6e98fc0 commit 515692c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/mainchain/MainchainGatewayV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,10 @@ contract MainchainGatewayV3 is WithdrawalLimitation, Initializable, AccessContro
}

/**
* @dev Receives ETH from WETH or creates deposit request if sender is not WETH.
* @dev Receives ETH from WETH or creates deposit request if sender is not WETH or WETHUnwrapper.
*/
function _fallback() internal virtual {
if (msg.sender == address(wrappedNativeToken)) {
if (msg.sender == address(wrappedNativeToken) || msg.sender == address(wethUnwrapper)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ contract RequestDepositFor_MainchainGatewayV3_Test is BaseIntegration_Test {
cachedRequest.tokenAddr = address(_mainchainWeth);

vm.expectEmit(address(_mainchainGatewayV3));
LibTransfer.Receipt memory receipt = cachedRequest.into_deposit_receipt(
_sender, _mainchainGatewayV3.depositCount(), address(_roninWeth), block.chainid
);
LibTransfer.Receipt memory receipt = cachedRequest.into_deposit_receipt(_sender, _mainchainGatewayV3.depositCount(), address(_roninWeth), block.chainid);
emit DepositRequested(receipt.hash(), receipt);

vm.prank(_sender);
Expand All @@ -70,9 +68,7 @@ contract RequestDepositFor_MainchainGatewayV3_Test is BaseIntegration_Test {
_depositRequest.tokenAddr = address(_mainchainAxs);

vm.expectEmit(address(_mainchainGatewayV3));
LibTransfer.Receipt memory receipt = _depositRequest.into_deposit_receipt(
_sender, _mainchainGatewayV3.depositCount(), address(_roninAxs), block.chainid
);
LibTransfer.Receipt memory receipt = _depositRequest.into_deposit_receipt(_sender, _mainchainGatewayV3.depositCount(), address(_roninAxs), block.chainid);
emit DepositRequested(receipt.hash(), receipt);

vm.prank(_sender);
Expand All @@ -94,9 +90,8 @@ contract RequestDepositFor_MainchainGatewayV3_Test is BaseIntegration_Test {
_depositRequest.info.id = tokenId;
_depositRequest.info.quantity = 0;

LibTransfer.Receipt memory receipt = _depositRequest.into_deposit_receipt(
_sender, _mainchainGatewayV3.depositCount(), address(_roninMockERC721), block.chainid
);
LibTransfer.Receipt memory receipt =
_depositRequest.into_deposit_receipt(_sender, _mainchainGatewayV3.depositCount(), address(_roninMockERC721), block.chainid);
vm.expectEmit(address(_mainchainGatewayV3));
emit DepositRequested(receipt.hash(), receipt);

Expand All @@ -118,15 +113,13 @@ contract RequestDepositFor_MainchainGatewayV3_Test is BaseIntegration_Test {

_depositRequest.tokenAddr = address(_mainchainWeth);

LibTransfer.Receipt memory receipt = _depositRequest.into_deposit_receipt(
_sender, _mainchainGatewayV3.depositCount(), address(_roninWeth), block.chainid
);
LibTransfer.Receipt memory receipt = _depositRequest.into_deposit_receipt(_sender, _mainchainGatewayV3.depositCount(), address(_roninWeth), block.chainid);
vm.expectEmit(address(_mainchainGatewayV3));
emit DepositRequested(receipt.hash(), receipt);

assertEq(address(_mainchainWeth).balance, _quantity);

vm.prank(_sender);
vm.startPrank(_sender);
_mainchainGatewayV3.requestDepositFor(_depositRequest);

assertEq(address(_mainchainGatewayV3).balance, _quantity);
Expand Down

0 comments on commit 515692c

Please sign in to comment.