Skip to content

Commit

Permalink
Hiding the bfore swap hook for now..
Browse files Browse the repository at this point in the history
  • Loading branch information
mehranhydary committed Sep 17, 2024
1 parent 957a169 commit 18b6674
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 32 deletions.
4 changes: 2 additions & 2 deletions contracts/script/MiladyPoolDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
10 changes: 0 additions & 10 deletions contracts/src/MiladyPoolOrderManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
32 changes: 16 additions & 16 deletions contracts/src/MiladyPoolRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/base/Hook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/utils/MiladyPoolDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down

0 comments on commit 18b6674

Please sign in to comment.