Skip to content

Commit 64c9815

Browse files
Fix token order
1 parent 005187b commit 64c9815

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

test/zkbob/ZkBobPool.t.sol

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,29 @@ contract ZkBobPoolTest is Test {
106106
// create BOB-USDC 0.05% pool at Uniswap V3
107107
deal(usdc, address(this), 1e9);
108108
IERC20(usdc).approve(uniV3Positions, 1e9);
109-
INonfungiblePositionManager(uniV3Positions).createAndInitializePoolIfNecessary(
110-
usdc, address(bob), 500, TickMath.getSqrtRatioAtTick(276320)
111-
);
109+
address token0 = usdc;
110+
address token1 = address(bob);
111+
int24 tickLower = 276320;
112+
int24 tickUpper = 276330;
113+
uint256 amount0Desired = 1e9;
114+
uint256 amount1Desired = 0;
115+
uint160 price = TickMath.getSqrtRatioAtTick(tickLower);
116+
if (token1 < token0) {
117+
(token0, token1) = (token1, token0);
118+
(tickLower, tickUpper) = (-tickUpper, -tickLower);
119+
(amount0Desired, amount1Desired) = (amount1Desired, amount0Desired);
120+
price = TickMath.getSqrtRatioAtTick(tickUpper);
121+
}
122+
INonfungiblePositionManager(uniV3Positions).createAndInitializePoolIfNecessary(token0, token1, 500, price);
112123
INonfungiblePositionManager(uniV3Positions).mint(
113124
INonfungiblePositionManager.MintParams({
114-
token0: usdc,
115-
token1: address(bob),
125+
token0: token0,
126+
token1: token1,
116127
fee: 500,
117-
tickLower: 276320,
118-
tickUpper: 276330,
119-
amount0Desired: 1e9,
120-
amount1Desired: 0,
128+
tickLower: tickLower,
129+
tickUpper: tickUpper,
130+
amount0Desired: amount0Desired,
131+
amount1Desired: amount1Desired,
121132
amount0Min: 0,
122133
amount1Min: 0,
123134
recipient: address(this),

0 commit comments

Comments
 (0)