@@ -5,12 +5,10 @@ import { IAsyncSwapAMM } from "@async-swap/interfaces/IAsyncSwapAMM.sol";
55import { IRouter } from "@async-swap/interfaces/IRouter.sol " ;
66import { AsyncOrder } from "@async-swap/types/AsyncOrder.sol " ;
77import { CurrencySettler } from "@uniswap/v4-core/test/utils/CurrencySettler.sol " ;
8- import { console } from "forge-std/Test.sol " ;
98import { IPoolManager } from "v4-core/interfaces/IPoolManager.sol " ;
109import { IERC20Minimal } from "v4-core/interfaces/external/IERC20Minimal.sol " ;
1110import { SafeCast } from "v4-core/libraries/SafeCast.sol " ;
1211import { Currency, CurrencyLibrary } from "v4-core/types/Currency.sol " ;
13- import { PoolKey } from "v4-core/types/PoolKey.sol " ;
1412
1513/// @title Router Contract
1614/// @author Async Labs
@@ -23,9 +21,9 @@ contract Router is IRouter {
2321 using SafeCast for * ;
2422
2523 /// PoolManager contract to interact with the pools.
26- IPoolManager immutable poolManager ;
24+ IPoolManager immutable POOLMANAGER ;
2725 /// Async Swap Hook contract to execute async orders.
28- IAsyncSwapAMM immutable hook ;
26+ IAsyncSwapAMM immutable HOOK ;
2927
3028 /// keccak256("Router.ActionType") - 1
3129 bytes32 constant ACTION_LOCATION = 0xf3b150ebf41dad0872df6788629edb438733cb4a5c9ea779b1b1f3614faffc69 ;
@@ -38,13 +36,13 @@ contract Router is IRouter {
3836 /// @param _poolManager The PoolManager contract that manages the pools.
3937 /// @param _hook The Async CSMM hook contract that executes async orders.
4038 constructor (IPoolManager _poolManager , IAsyncSwapAMM _hook ) {
41- poolManager = _poolManager;
42- hook = _hook;
39+ POOLMANAGER = _poolManager;
40+ HOOK = _hook;
4341 }
4442
4543 /// Only allow the PoolManager to call certain functions.
4644 modifier onlyPoolManager () {
47- require (msg .sender == address (poolManager ));
45+ require (msg .sender == address (POOLMANAGER ));
4846 _;
4947 }
5048
@@ -58,7 +56,7 @@ contract Router is IRouter {
5856 tstore (ASYNC_FILLER_LOCATION, onBehalf)
5957 }
6058
61- poolManager .unlock (abi.encode (SwapCallback (ActionType.Swap, order)));
59+ POOLMANAGER .unlock (abi.encode (SwapCallback (ActionType.Swap, order)));
6260 }
6361
6462 /// @inheritdoc IRouter
@@ -70,7 +68,7 @@ contract Router is IRouter {
7068 tstore (ASYNC_FILLER_LOCATION, onBehalf)
7169 }
7270
73- poolManager .unlock (abi.encode (SwapCallback (ActionType.FillOrder, order)));
71+ POOLMANAGER .unlock (abi.encode (SwapCallback (ActionType.FillOrder, order)));
7472 }
7573
7674 /// Callback handler to unlock the PoolManager after a swap or fill order.
@@ -93,15 +91,15 @@ contract Router is IRouter {
9391 if (action == 0 ) {
9492 SwapCallback memory orderData = abi.decode (data, (SwapCallback));
9593
96- poolManager .swap (
94+ POOLMANAGER .swap (
9795 orderData.order.key,
9896 IPoolManager.SwapParams (
9997 orderData.order.zeroForOne, - orderData.order.amountIn.toInt256 (), orderData.order.sqrtPrice
10098 ),
10199 abi.encode (user, asyncFiller)
102100 );
103101 Currency specified = orderData.order.zeroForOne ? orderData.order.key.currency0 : orderData.order.key.currency1;
104- specified.settle (poolManager , user, orderData.order.amountIn, false ); // transfer
102+ specified.settle (POOLMANAGER , user, orderData.order.amountIn, false ); // transfer
105103 }
106104
107105 /// @notice Handle Async Order Fill
@@ -110,8 +108,8 @@ contract Router is IRouter {
110108 SwapCallback memory orderData = abi.decode (data, (SwapCallback));
111109 Currency currency = orderData.order.zeroForOne ? orderData.order.key.currency1 : orderData.order.key.currency0;
112110 assert (IERC20Minimal (Currency.unwrap (currency)).transferFrom (user, asyncFiller, orderData.order.amountIn));
113- assert (IERC20Minimal (Currency.unwrap (currency)).approve (address (hook ), orderData.order.amountIn));
114- hook .executeOrder (orderData.order, abi.encode (asyncFiller));
111+ assert (IERC20Minimal (Currency.unwrap (currency)).approve (address (HOOK ), orderData.order.amountIn));
112+ HOOK .executeOrder (orderData.order, abi.encode (asyncFiller));
115113 }
116114
117115 return "" ;
0 commit comments