Skip to content

Commit

Permalink
test: Revert out of gas when unwrap and deposit native token
Browse files Browse the repository at this point in the history
  • Loading branch information
huyhuynh3103 committed Feb 5, 2024
1 parent fd9292c commit 61fa1ec
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,28 @@ contract RequestDepositFor_MainchainGatewayV3_Test is BaseIntegration_Test {
assertEq(_mainchainMockERC721.ownerOf(tokenId), address(_mainchainGatewayV3));
assertEq(_mainchainGatewayV3.depositCount(), 1);
}

// test deposit > should be able to unwrap and deposit native.
function test_unwrapAndDepositNative() public {
vm.startPrank(_sender);
_mainchainWeth.deposit{ value: _quantity }();
_mainchainWeth.approve(address(_mainchainGatewayV3), _quantity);
vm.stopPrank();

_depositRequest.tokenAddr = address(_mainchainWeth);

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);
_mainchainGatewayV3.requestDepositFor(_depositRequest);

assertEq(address(_mainchainGatewayV3).balance, _quantity);
assertEq(_mainchainGatewayV3.depositCount(), 1);
}
}

0 comments on commit 61fa1ec

Please sign in to comment.