@@ -30,8 +30,7 @@ contract AsyncSwapCSMM is BaseHook, IAsyncSwapAMM {
3030 /// @notice Algorithm used for ordering transactions in our Async Swap AMM.
3131 IAlgorithm public algorithm;
3232 /// @notice Mapping to store async orders.
33- mapping (PoolId poolId => mapping (address user = > mapping (bool zeroForOne = > uint256 claimable ))) public asyncOrders;
34- // mapping(PoolId poolId => AsyncFiller.State) public asyncOrders;
33+ mapping (PoolId poolId => AsyncFiller.State) public asyncOrders;
3534 /// @notice Mapping to store executor permissions for users.
3635 mapping (address owner = > mapping (address executor = > bool )) public setExecutor;
3736
@@ -102,6 +101,10 @@ contract AsyncSwapCSMM is BaseHook, IAsyncSwapAMM {
102101 return setExecutor[owner][executor];
103102 }
104103
104+ function asyncOrder (PoolId poolId , address user , bool zeroForOne ) external view returns (uint256 claimable ) {
105+ return asyncOrders[poolId].asyncOrders[user][zeroForOne];
106+ }
107+
105108 function calculateHookFee (uint256 ) public pure returns (uint256 ) {
106109 return 0 ;
107110 }
@@ -136,7 +139,7 @@ contract AsyncSwapCSMM is BaseHook, IAsyncSwapAMM {
136139 /// TODO: Document what this does
137140 uint256 amountToFill = uint256 (amountIn);
138141 // AsyncFiller.State storage _asyncOrders = asyncOrders[poolId];
139- uint256 claimableAmount = asyncOrders[poolId][owner][zeroForOne];
142+ uint256 claimableAmount = asyncOrders[poolId].asyncOrders [owner][zeroForOne];
140143 require (amountToFill <= claimableAmount, "Max fill order limit exceed " );
141144 require (isExecutor (owner, msg .sender ), "Caller is valid not excutor " );
142145
@@ -151,7 +154,7 @@ contract AsyncSwapCSMM is BaseHook, IAsyncSwapAMM {
151154 currencyFill = currency0;
152155 }
153156
154- asyncOrders[poolId][owner][zeroForOne] -= amountToFill;
157+ asyncOrders[poolId].asyncOrders [owner][zeroForOne] -= amountToFill;
155158 /// TODO: check if this is needed, we could just burn
156159 poolManager.transfer (owner, currencyTake.toId (), amountToFill);
157160 emit AsyncOrderFilled (poolId, owner, zeroForOne, amountToFill);
@@ -192,8 +195,8 @@ contract AsyncSwapCSMM is BaseHook, IAsyncSwapAMM {
192195
193196 /// @dev Issue 1:1 claimableAmount - pool fee to user
194197 /// @dev Add amount taken to previous claimableAmount
195- uint256 currClaimables = asyncOrders[poolId][hookData.user][params.zeroForOne];
196- asyncOrders[poolId][hookData.user][params.zeroForOne] = currClaimables + finalTaken;
198+ uint256 currClaimables = asyncOrders[poolId].asyncOrders [hookData.user][params.zeroForOne];
199+ asyncOrders[poolId].asyncOrders [hookData.user][params.zeroForOne] = currClaimables + finalTaken;
197200
198201 /// @dev Hook event
199202 /// @reference
0 commit comments