From 18b667411b902ea8caa831671b65673b369aa051 Mon Sep 17 00:00:00 2001 From: mehranhydary Date: Mon, 16 Sep 2024 21:09:27 -0400 Subject: [PATCH] Hiding the bfore swap hook for now.. --- contracts/script/MiladyPoolDeployer.s.sol | 4 +-- contracts/src/MiladyPoolOrderManager.sol | 10 ------- contracts/src/MiladyPoolRouter.sol | 32 ++++++++++----------- contracts/src/base/Hook.sol | 4 +-- contracts/test/utils/MiladyPoolDeployer.sol | 4 +-- 5 files changed, 22 insertions(+), 32 deletions(-) diff --git a/contracts/script/MiladyPoolDeployer.s.sol b/contracts/script/MiladyPoolDeployer.s.sol index 114380d..119f62b 100644 --- a/contracts/script/MiladyPoolDeployer.s.sol +++ b/contracts/script/MiladyPoolDeployer.s.sol @@ -376,8 +376,8 @@ contract MiladyPoolDeployer is Script, Utils { // TODO: Initalize this correctly (see variables in MiladyPoolOrderManager) uint160 flags = uint160( Hooks.AFTER_INITIALIZE_FLAG | - Hooks.BEFORE_SWAP_FLAG | - Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG | + // Hooks.BEFORE_SWAP_FLAG | + // Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG | Hooks.AFTER_SWAP_FLAG ); diff --git a/contracts/src/MiladyPoolOrderManager.sol b/contracts/src/MiladyPoolOrderManager.sol index 5840168..6b67de1 100644 --- a/contracts/src/MiladyPoolOrderManager.sol +++ b/contracts/src/MiladyPoolOrderManager.sol @@ -69,16 +69,6 @@ contract MiladyPoolOrderManager is return this.afterInitialize.selector; } - function beforeSwap( - address sender, - PoolKey calldata key, - IPoolManager.SwapParams calldata params, - bytes calldata data - ) external override returns (bytes4, BeforeSwapDelta, uint24) { - // TODO: Come back to this - return (this.beforeSwap.selector, toBeforeSwapDelta(0, 0), 0); - } - function afterSwap( address, PoolKey calldata key, diff --git a/contracts/src/MiladyPoolRouter.sol b/contracts/src/MiladyPoolRouter.sol index 417c77d..9236046 100644 --- a/contracts/src/MiladyPoolRouter.sol +++ b/contracts/src/MiladyPoolRouter.sol @@ -182,22 +182,22 @@ contract MiladyPoolRouter is WyvernInspired { // walletAddress // ); - if (deltaAfter0 < 0) { - data.key.currency0.settle( - manager, - walletAddress, - uint256(-deltaAfter0), - true - ); - } - if (deltaAfter1 < 0) { - data.key.currency1.settle( - manager, - walletAddress, - uint256(-deltaAfter1), - true - ); - } + // if (deltaAfter0 < 0) { + // data.key.currency0.settle( + // manager, + // walletAddress, + // uint256(-deltaAfter0), + // true + // ); + // } + // if (deltaAfter1 < 0) { + // data.key.currency1.settle( + // manager, + // walletAddress, + // uint256(-deltaAfter1), + // true + // ); + // } if (deltaAfter0 > 0) { data.key.currency0.take( manager, diff --git a/contracts/src/base/Hook.sol b/contracts/src/base/Hook.sol index 63dba2d..9a36494 100644 --- a/contracts/src/base/Hook.sol +++ b/contracts/src/base/Hook.sol @@ -45,11 +45,11 @@ abstract contract Hook is BaseHook { afterAddLiquidity: false, beforeRemoveLiquidity: false, afterRemoveLiquidity: false, - beforeSwap: true, + beforeSwap: false, afterSwap: true, beforeDonate: false, afterDonate: false, - beforeSwapReturnDelta: true, + beforeSwapReturnDelta: false, afterSwapReturnDelta: false, afterAddLiquidityReturnDelta: false, afterRemoveLiquidityReturnDelta: false diff --git a/contracts/test/utils/MiladyPoolDeployer.sol b/contracts/test/utils/MiladyPoolDeployer.sol index 1c41a20..2da452b 100644 --- a/contracts/test/utils/MiladyPoolDeployer.sol +++ b/contracts/test/utils/MiladyPoolDeployer.sol @@ -360,8 +360,8 @@ contract MiladyPoolDeployer is Test, Utils { uint160 flags = uint160( Hooks.AFTER_INITIALIZE_FLAG | - Hooks.BEFORE_SWAP_FLAG | - Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG | + // Hooks.BEFORE_SWAP_FLAG | + // Hooks.BEFORE_SWAP_RETURNS_DELTA_FLAG | Hooks.AFTER_SWAP_FLAG );