Skip to content

Commit 8bf8b53

Browse files
committed
fix test
1 parent 3e02b60 commit 8bf8b53

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

test/AsyncCSMM.t.sol

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ contract AsyncCsmmTest is SetupHook {
6060
vm.stopPrank();
6161
}
6262

63-
function testFuzzAsyncSwapAndFillOrder(AsyncOrder memory order) public {
64-
vm.assume(order.amountIn >= 1);
65-
vm.assume(order.amountIn < 2 ** 128 / 2 - 2);
66-
vm.assume(order.owner != address(manager));
67-
vm.assume(order.owner != address(hook));
68-
topUp(order.owner, order.amountIn);
69-
topUp(user2, order.amountIn);
70-
user = order.owner;
71-
order.key = key;
63+
function testFuzzAsyncSwapAndFillOrder(address _user, uint256 amountIn, bool zeroForOne) public {
64+
vm.assume(amountIn >= 1);
65+
vm.assume(amountIn < 2 ** 128 / 2);
66+
user = _user;
67+
topUp(user, amountIn);
68+
topUp(user2, amountIn);
69+
70+
AsyncOrder memory order =
71+
AsyncOrder({ key: key, owner: user, zeroForOne: zeroForOne, amountIn: amountIn, sqrtPrice: 2 ** 96 });
7272

7373
uint256 balance0Before = currency0.balanceOf(user);
7474
uint256 balance1Before = currency1.balanceOf(user);
@@ -79,14 +79,14 @@ contract AsyncCsmmTest is SetupHook {
7979
uint256 balance0After = currency0.balanceOf(user);
8080
uint256 balance1After = currency1.balanceOf(user);
8181

82-
if (order.zeroForOne) {
83-
assertEq(balance0Before - balance0After, order.amountIn);
82+
if (zeroForOne) {
83+
assertEq(balance0Before - balance0After, amountIn);
8484
assertEq(balance1Before, balance1After);
8585
} else {
86-
assertEq(balance1Before - balance1After, order.amountIn);
86+
assertEq(balance1Before - balance1After, amountIn);
8787
assertEq(balance0Before, balance0After);
8888
}
89-
assertEq(hook.asyncOrders(poolId, user, order.zeroForOne), order.amountIn);
89+
assertEq(hook.asyncOrders(poolId, user, zeroForOne), amountIn);
9090
assertEq(hook.setExecutor(user, asyncFiller), true);
9191

9292
balance0Before = currency0.balanceOf(user2);
@@ -98,19 +98,19 @@ contract AsyncCsmmTest is SetupHook {
9898
balance0After = currency0.balanceOf(user2);
9999
balance1After = currency1.balanceOf(user2);
100100

101-
if (order.zeroForOne) {
101+
if (zeroForOne) {
102102
assertEq(balance0Before, balance0After);
103-
assertEq(balance1Before - balance1After, order.amountIn);
104-
assertEq(hook.asyncOrders(poolId, user, order.zeroForOne), 0);
103+
assertEq(balance1Before - balance1After, amountIn);
104+
assertEq(hook.asyncOrders(poolId, user, zeroForOne), 0);
105105
} else {
106106
assertEq(balance1Before, balance1After);
107-
assertEq(balance0Before - balance0After, order.amountIn);
108-
assertEq(hook.asyncOrders(poolId, user, order.zeroForOne), 0);
107+
assertEq(balance0Before - balance0After, amountIn);
108+
assertEq(hook.asyncOrders(poolId, user, zeroForOne), 0);
109109
}
110-
if (order.zeroForOne) {
111-
assertEq(manager.balanceOf(user, currency0.toId()), uint256(order.amountIn));
110+
if (zeroForOne) {
111+
assertEq(manager.balanceOf(user, currency0.toId()), uint256(amountIn));
112112
} else {
113-
assertEq(manager.balanceOf(user, currency1.toId()), uint256(order.amountIn));
113+
assertEq(manager.balanceOf(user, currency1.toId()), uint256(amountIn));
114114
}
115115
}
116116

0 commit comments

Comments
 (0)