Skip to content

Commit

Permalink
test: add missing ETH deal in test_swapExactTokenForYt_SwapsETH
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlak committed Jul 12, 2024
1 parent d2a6d12 commit 57ae968
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/unit/SwapExactTokenForYt.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ contract SwapExactTokenForYtTest is SetUp {
PYIndex index = YT.newIndex();
(uint256 syMinted, uint256 ytOut) =
rmm.computeTokenToYT(index, address(weth), amountIn, 0, block.timestamp, 0, 1_000);
rmm.swapExactTokenForYt(
address(weth), amountIn, ytOut, syMinted, ytOut, 0, 0.005 ether, address(this)
);
rmm.swapExactTokenForYt(address(weth), amountIn, ytOut, syMinted, ytOut, 0, 0.005 ether, address(this));
}

function test_swapExactTokenForYt_SwapsETH() public useSYPool {
uint256 amountIn = 1 ether;
deal(address(this), amountIn);
uint256 preETHBalance = address(this).balance;
uint256 preYTBalance = YT.balanceOf(address(this));

uint256 amountIn = 1 ether;
PYIndex index = YT.newIndex();
(uint256 syMinted, uint256 ytOut) =
rmm.computeTokenToYT(index, address(0), amountIn, 0, block.timestamp, 0, 1_000);
(,uint256 amountOut,) = rmm.swapExactTokenForYt{value: amountIn}(
(, uint256 amountOut,) = rmm.swapExactTokenForYt{value: amountIn}(
address(0), amountIn, ytOut, syMinted, ytOut, 0, 0.005 ether, address(this)
);

Expand Down

0 comments on commit 57ae968

Please sign in to comment.