native currency fixes
This commit is contained in:
@@ -244,10 +244,10 @@ contract GasTest is Test {
|
||||
vm.prank(alice);
|
||||
if (i % 2 == 0) {
|
||||
// swap token0 -> token1
|
||||
testPool.swap(alice, alice, 0, 1, maxIn, 0, 0);
|
||||
testPool.swap(alice, alice, 0, 1, maxIn, 0, 0, false);
|
||||
} else {
|
||||
// swap token1 -> token0
|
||||
testPool.swap(alice, alice, 1, 0, maxIn, 0, 0);
|
||||
testPool.swap(alice, alice, 1, 0, maxIn, 0, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ contract GasTest is Test {
|
||||
// If nothing minted (numerical edge), skip burn step
|
||||
if (minted == 0) continue;
|
||||
// Immediately burn the minted LP back to tokens, targeting the same token index
|
||||
testPool.burnSwap(alice, alice, minted, 0, 0);
|
||||
testPool.burnSwap(alice, alice, minted, 0, 0, false);
|
||||
}
|
||||
|
||||
vm.stopPrank();
|
||||
@@ -368,7 +368,7 @@ contract GasTest is Test {
|
||||
}
|
||||
|
||||
// Burn via plain burn() which will transfer underlying back to alice and burn LP
|
||||
testPool.burn(alice, alice, actualMinted, 0);
|
||||
testPool.burn(alice, alice, actualMinted, 0, false);
|
||||
}
|
||||
|
||||
vm.stopPrank();
|
||||
|
||||
@@ -408,7 +408,7 @@ contract PartyPoolTest is Test {
|
||||
|
||||
// Burn by sending LP tokens from this contract (which holds initial LP from setUp)
|
||||
// Call burn(payer=this, receiver=bob, lpAmount=totalLp)
|
||||
pool.burn(address(this), bob, totalLp, 0);
|
||||
pool.burn(address(this), bob, totalLp, 0, false);
|
||||
|
||||
// After burning entire pool, totalSupply should be zero or very small (we expect zero since we withdrew all)
|
||||
assertEq(pool.totalSupply(), 0);
|
||||
@@ -434,7 +434,7 @@ contract PartyPoolTest is Test {
|
||||
|
||||
// Execute swap: token0 -> token1
|
||||
vm.prank(alice);
|
||||
(uint256 amountInUsed, uint256 amountOut, uint256 fee) = pool.swap(alice, bob, 0, 1, maxIn, 0, 0);
|
||||
(uint256 amountInUsed, uint256 amountOut, uint256 fee) = pool.swap(alice, bob, 0, 1, maxIn, 0, 0, false);
|
||||
|
||||
// Amounts should be positive and not exceed provided max
|
||||
assertTrue(amountInUsed > 0, "expected some input used");
|
||||
@@ -463,7 +463,7 @@ contract PartyPoolTest is Test {
|
||||
|
||||
vm.prank(alice);
|
||||
vm.expectRevert(bytes("LMSR: limitPrice <= current price"));
|
||||
pool.swap(alice, alice, 0, 1, 1000, limitPrice, 0);
|
||||
pool.swap(alice, alice, 0, 1, 1000, limitPrice, 0, false);
|
||||
}
|
||||
|
||||
/// @notice swapToLimit should compute input needed to reach a slightly higher price and execute.
|
||||
@@ -475,7 +475,7 @@ contract PartyPoolTest is Test {
|
||||
token0.approve(address(pool), type(uint256).max);
|
||||
|
||||
vm.prank(alice);
|
||||
(uint256 amountInUsed, uint256 amountOut, uint256 fee) = pool.swapToLimit(alice, bob, 0, 1, limitPrice, 0);
|
||||
(uint256 amountInUsed, uint256 amountOut, uint256 fee) = pool.swapToLimit(alice, bob, 0, 1, limitPrice, 0, false);
|
||||
|
||||
assertTrue(amountInUsed > 0, "expected some input used for swapToLimit");
|
||||
assertTrue(amountOut > 0, "expected some output for swapToLimit");
|
||||
@@ -637,7 +637,7 @@ contract PartyPoolTest is Test {
|
||||
uint256 b2Before = token2.balanceOf(bob);
|
||||
|
||||
// Perform burn using the computed LP amount (proportional withdrawal)
|
||||
pool.burn(address(this), bob, req, 0);
|
||||
pool.burn(address(this), bob, req, 0, false);
|
||||
|
||||
// Verify bob received exactly the expected amounts
|
||||
assertEq(token0.balanceOf(bob) - b0Before, expected[0], "token0 withdraw mismatch");
|
||||
@@ -701,7 +701,7 @@ contract PartyPoolTest is Test {
|
||||
beforeBal[8] = token8.balanceOf(bob);
|
||||
beforeBal[9] = token9.balanceOf(bob);
|
||||
|
||||
pool10.burn(address(this), bob, req, 0);
|
||||
pool10.burn(address(this), bob, req, 0, false);
|
||||
|
||||
// Verify bob received each expected amount
|
||||
assertEq(token0.balanceOf(bob) - beforeBal[0], expected[0], "t0 withdraw mismatch");
|
||||
@@ -795,7 +795,7 @@ contract PartyPoolTest is Test {
|
||||
uint256 bobBefore = token0.balanceOf(bob);
|
||||
|
||||
// Call burnSwap where this contract is the payer (it holds initial LP from setUp)
|
||||
uint256 payout = pool.burnSwap(address(this), bob, lpToBurn, target, 0);
|
||||
uint256 payout = pool.burnSwap(address(this), bob, lpToBurn, target, 0, false);
|
||||
|
||||
// Payout must be > 0
|
||||
assertTrue(payout > 0, "burnSwap should produce a payout");
|
||||
@@ -1040,8 +1040,8 @@ contract PartyPoolTest is Test {
|
||||
token0.approve(address(poolCustom), type(uint256).max);
|
||||
|
||||
// Perform identical swaps: token0 -> token1
|
||||
(uint256 amountInDefault, uint256 amountOutDefault, uint256 feeDefault) = poolDefault.swap(alice, alice, 0, 1, swapAmount, 0, 0);
|
||||
(uint256 amountInCustom, uint256 amountOutCustom, uint256 feeCustom) = poolCustom.swap(alice, alice, 0, 1, swapAmount, 0, 0);
|
||||
(uint256 amountInDefault, uint256 amountOutDefault, uint256 feeDefault) = poolDefault.swap(alice, alice, 0, 1, swapAmount, 0, 0, false);
|
||||
(uint256 amountInCustom, uint256 amountOutCustom, uint256 feeCustom) = poolCustom.swap(alice, alice, 0, 1, swapAmount, 0, 0, false);
|
||||
|
||||
// Swap results should be identical
|
||||
assertEq(amountInDefault, amountInCustom, "Swap input amounts should be identical");
|
||||
|
||||
Reference in New Issue
Block a user