callback-style funding option

This commit is contained in:
tim
2025-11-11 00:21:18 -04:00
parent 64c2245f25
commit 46e38ec996
6 changed files with 97 additions and 43 deletions

View File

@@ -423,7 +423,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, false);
(uint256 amountInUsed, uint256 amountOut, uint256 fee) = pool.swap(alice, bytes4(0), bob, 0, 1, maxIn, 0, 0, false);
// Amounts should be positive and not exceed provided max
assertTrue(amountInUsed > 0, "expected some input used");
@@ -452,7 +452,7 @@ contract PartyPoolTest is Test {
vm.prank(alice);
vm.expectRevert(bytes("LMSR: limitPrice <= current price"));
pool.swap(alice, alice, 0, 1, 1000, limitPrice, 0, false);
pool.swap(alice, bytes4(0), alice, 0, 1, 1000, limitPrice, 0, false);
}
/// @notice swapToLimit should compute input needed to reach a slightly higher price and execute.
@@ -1024,8 +1024,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, false);
(uint256 amountInCustom, uint256 amountOutCustom, uint256 feeCustom) = poolCustom.swap(alice, alice, 0, 1, swapAmount, 0, 0, false);
(uint256 amountInDefault, uint256 amountOutDefault, uint256 feeDefault) = poolDefault.swap(alice, bytes4(0), alice, 0, 1, swapAmount, 0, 0, false);
(uint256 amountInCustom, uint256 amountOutCustom, uint256 feeCustom) = poolCustom.swap(alice, bytes4(0), alice, 0, 1, swapAmount, 0, 0, false);
// Swap results should be identical
assertEq(amountInDefault, amountInCustom, "Swap input amounts should be identical");