Skip to content

Commit 01b54ed

Browse files
committed
add async filler lib
1 parent adefae4 commit 01b54ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libraries/AsyncFiller.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ library AsyncFiller {
2626
struct State {
2727
IPoolManager poolManager;
2828
IAlgorithm algorithm;
29-
mapping(PoolId poolId => mapping(address user => mapping(bool zeroForOne => uint256 claimable))) asyncOrders;
29+
mapping(address user => mapping(bool zeroForOne => uint256 claimable)) asyncOrders;
3030
mapping(address owner => mapping(address executor => bool)) setExecutor;
3131
}
3232

@@ -43,7 +43,7 @@ library AsyncFiller {
4343
/// @notice Error thrown when an order is of zero amount.
4444
error ZeroFillOrder();
4545

46-
function isExecutor(AsyncOrder calldata order, State storage self, address executor) public view returns (bool) {
46+
function isExecutor(AsyncOrder calldata order, State storage self, address executor) internal view returns (bool) {
4747
return self.setExecutor[order.owner][executor];
4848
}
4949

@@ -62,12 +62,12 @@ library AsyncFiller {
6262
/// @notice Fill an async order in an Async Swap AMM.
6363
/// @param order The async order to be filled.
6464
/// @param self The state of the AsyncFiller library, containing async orders and executors.
65-
function _execute(AsyncOrder calldata order, State storage self, bytes calldata) private {
65+
function _execute(AsyncOrder calldata order, State storage self, bytes calldata) internal {
6666
if (order.amountIn == 0) revert ZeroFillOrder();
6767

6868
PoolId poolId = order.key.toId();
6969
uint256 amountToFill = uint256(order.amountIn);
70-
uint256 claimableAmount = self.asyncOrders[poolId][order.owner][order.zeroForOne];
70+
uint256 claimableAmount = self.asyncOrders[order.owner][order.zeroForOne];
7171
require(amountToFill <= claimableAmount, "Max fill order limit exceed");
7272
require(isExecutor(order, self, msg.sender), "Caller is valid not excutor");
7373

@@ -82,7 +82,7 @@ library AsyncFiller {
8282
currencyFill = order.key.currency0;
8383
}
8484

85-
self.asyncOrders[poolId][order.owner][order.zeroForOne] -= amountToFill;
85+
self.asyncOrders[order.owner][order.zeroForOne] -= amountToFill;
8686
self.poolManager.transfer(order.owner, currencyTake.toId(), amountToFill);
8787
emit AsyncOrderFilled(poolId, order.owner, order.zeroForOne, amountToFill);
8888

0 commit comments

Comments
 (0)