11// SPDX-License-Identifier: GPL-2.0-or-later
22pragma solidity 0.8.26 ;
33
4- import { CLVR } from "@async-swap/algorithms/clvr.sol " ;
54import { IAlgorithm } from "@async-swap/interfaces/IAlgorithm.sol " ;
65import { IAsyncSwapAMM } from "@async-swap/interfaces/IAsyncSwapAMM.sol " ;
76import { AsyncFiller } from "@async-swap/libraries/AsyncFiller.sol " ;
@@ -18,8 +17,7 @@ import { PoolIdLibrary, PoolKey } from "v4-core/types/PoolKey.sol";
1817import { BaseHook } from "v4-periphery/src/utils/BaseHook.sol " ;
1918
2019/// @title Async Swap Contract
21- /// @author Async Labs
22- /// @notice Async swap AMM
20+ /// @author Asyncswap Labs
2321contract AsyncSwap is BaseHook , IAsyncSwapAMM {
2422
2523 using SafeCast for * ;
@@ -53,16 +51,18 @@ contract AsyncSwap is BaseHook, IAsyncSwapAMM {
5351
5452 /// Initializes the Async Swap Hook contract with the PoolManager address and sets an transaction ordering algorithm.
5553 /// @param poolManager The address of the PoolManager contract.
56- constructor (IPoolManager poolManager ) BaseHook (poolManager) {
57- ALGORITHM = new CLVR (address (this ));
54+ /// @param orderingAlgorithm The address of the ordering algorithm
55+ constructor (IPoolManager poolManager , IAlgorithm orderingAlgorithm ) BaseHook (poolManager) {
56+ ALGORITHM = orderingAlgorithm;
5857 }
5958
6059 /// @inheritdoc BaseHook
6160 function _beforeInitialize (address , PoolKey calldata key , uint160 ) internal virtual override returns (bytes4 ) {
62- require (key.fee == LPFeeLibrary.DYNAMIC_FEE_FLAG, "Dude use dynamic fees flag " );
63- /// set algorithm for the pool being initialized
61+ require (key.fee == LPFeeLibrary.DYNAMIC_FEE_FLAG, "Use dynamic fees flag " );
62+ /// Set library state for the pool being initialized
6463 asyncOrders[key.toId ()].algorithm = ALGORITHM;
6564 asyncOrders[key.toId ()].poolManager = poolManager;
65+ asyncOrders[key.toId ()].asyncOrder;
6666 return this .beforeInitialize.selector ;
6767 }
6868
0 commit comments