Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/fit periphery #9

Merged
merged 9 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it might be a good idea if we keep this forge-std dependency?

1/ what we are doing means that if we somehow need to update forge-std to get newer feature, we are forced to rely on dependency -- where we might not want to touch v4-core and v4-periphery since the code has frozen

2/ and so far i think forge-std have not caused us any conflicts yet

3/ we do this for oz to prevent conflicts due to breaking changes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for forge-gas-snapshot probably

[submodule "lib/pancake-v4-core"]
path = lib/pancake-v4-core
url = https://github.com/pancakeswap/pancake-v4-core
[submodule "lib/pancake-v4-periphery"]
path = lib/pancake-v4-periphery
url = https://github.com/pancakeswap/pancake-v4-periphery
7 changes: 1 addition & 6 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ optimizer_runs = 1000
via_ir = true
evm_version = 'cancun'
ffi = true
fs_permissions = [{ access = "read-write", path = ".forge-snapshots/"}]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've put the remapping settings into remappings.txt

remappings = [
"@pancakeswap/v4-core/=lib/pancake-v4-core/",
"@pancakeswap/v4-periphery/=lib/pancake-v4-periphery/",
"@openzeppelin/=lib/pancake-v4-periphery/lib/openzeppelin-contracts/"
]
fs_permissions = [{ access = "read-write", path = ".forge-snapshots/" }]

[profile.default.fuzz]
runs = 1000
Expand Down
1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from 19891e
1 change: 0 additions & 1 deletion lib/pancake-v4-core
Submodule pancake-v4-core deleted from 52b216
2 changes: 1 addition & 1 deletion lib/pancake-v4-periphery
11 changes: 8 additions & 3 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@pancakeswap/v4-core/=lib/pancake-v4-core/
@pancakeswap/v4-periphery/=lib/pancake-v4-periphery/
@openzeppelin/=lib/pancake-v4-periphery/lib/openzeppelin-contracts/
pancake-v4-periphery/=lib/pancake-v4-periphery/
pancake-v4-core/=lib/pancake-v4-periphery/lib/pancake-v4-core/
ds-test/=lib/pancake-v4-periphery/lib/pancake-v4-core/lib/forge-std/lib/ds-test/src/
forge-std/=lib/pancake-v4-periphery/lib/pancake-v4-core/lib/forge-std/src/
forge-gas-snapshot/=lib/pancake-v4-periphery/lib/pancake-v4-core/lib/forge-gas-snapshot/src/
openzeppelin-contracts/=lib/pancake-v4-periphery/lib/pancake-v4-core/lib/openzeppelin-contracts/
solmate/=lib/pancake-v4-periphery/lib/pancake-v4-core/lib/solmate/
permit/=lib/pancake-v4-periphery/lib/permit/
20 changes: 10 additions & 10 deletions src/pool-bin/BinBaseHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import {
HOOKS_AFTER_SWAP_RETURNS_DELTA_OFFSET,
HOOKS_AFTER_MINT_RETURNS_DELTA_OFFSET,
HOOKS_AFTER_BURN_RETURNS_DELTA_OFFSET
} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {PoolKey} from "@pancakeswap/v4-core/src/types/PoolKey.sol";
import {BalanceDelta} from "@pancakeswap/v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta} from "@pancakeswap/v4-core/src/types/BeforeSwapDelta.sol";
import {IHooks} from "@pancakeswap/v4-core/src/interfaces/IHooks.sol";
import {IVault} from "@pancakeswap/v4-core/src/interfaces/IVault.sol";
import {IBinHooks} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {IBinPoolManager} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";
import {BinPoolManager} from "@pancakeswap/v4-core/src/pool-bin/BinPoolManager.sol";
} from "pancake-v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {PoolKey} from "pancake-v4-core/src/types/PoolKey.sol";
import {BalanceDelta} from "pancake-v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta} from "pancake-v4-core/src/types/BeforeSwapDelta.sol";
import {IHooks} from "pancake-v4-core/src/interfaces/IHooks.sol";
import {IVault} from "pancake-v4-core/src/interfaces/IVault.sol";
import {IBinHooks} from "pancake-v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {IBinPoolManager} from "pancake-v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";
import {BinPoolManager} from "pancake-v4-core/src/pool-bin/BinPoolManager.sol";

/// @notice BaseHook abstract contract for Bin pool hooks to inherit
abstract contract BinBaseHook is IBinHooks {
Expand Down Expand Up @@ -124,7 +124,7 @@ abstract contract BinBaseHook is IBinHooks {
function beforeMint(address, PoolKey calldata, IBinPoolManager.MintParams calldata, bytes calldata)
external
virtual
returns (bytes4)
returns (bytes4, uint24)
{
revert HookNotImplemented();
}
Expand Down
20 changes: 10 additions & 10 deletions src/pool-bin/geomean-oracle/BinGeomeanOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.19;

import {IBinPoolManager} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";
import {IBinPoolManager} from "pancake-v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";
import {
HOOKS_BEFORE_INITIALIZE_OFFSET,
HOOKS_AFTER_INITIALIZE_OFFSET,
Expand All @@ -14,13 +14,13 @@ import {
HOOKS_AFTER_SWAP_OFFSET,
HOOKS_BEFORE_DONATE_OFFSET,
HOOKS_AFTER_DONATE_OFFSET
} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {IPoolManager} from "@pancakeswap/v4-core/src/interfaces/IPoolManager.sol";
import {PoolId, PoolIdLibrary} from "@pancakeswap/v4-core/src/types/PoolId.sol";
import {PoolKey} from "@pancakeswap/v4-core/src/types/PoolKey.sol";
import {BalanceDelta, BalanceDeltaLibrary} from "@pancakeswap/v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "@pancakeswap/v4-core/src/types/BeforeSwapDelta.sol";
import {Hooks} from "@pancakeswap/v4-core/src/libraries/Hooks.sol";
} from "pancake-v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {IPoolManager} from "pancake-v4-core/src/interfaces/IPoolManager.sol";
import {PoolId, PoolIdLibrary} from "pancake-v4-core/src/types/PoolId.sol";
import {PoolKey} from "pancake-v4-core/src/types/PoolKey.sol";
import {BalanceDelta, BalanceDeltaLibrary} from "pancake-v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "pancake-v4-core/src/types/BeforeSwapDelta.sol";
import {Hooks} from "pancake-v4-core/src/libraries/Hooks.sol";

import {BinBaseHook} from "../BinBaseHook.sol";
import {OracleHelper} from "./libraries/OracleHelper.sol";
Expand Down Expand Up @@ -92,9 +92,9 @@ contract BinGeomeanOracle is BinBaseHook {
PoolKey calldata key,
IBinPoolManager.MintParams calldata params,
bytes calldata hookData
) external override poolManagerOnly returns (bytes4) {
) external override poolManagerOnly returns (bytes4, uint24) {
_updatePool(key);
return this.beforeMint.selector;
return (this.beforeMint.selector, 0);
}

function beforeBurn(
Expand Down
40 changes: 20 additions & 20 deletions src/pool-bin/limit-order/BinLimitOrder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.19;

import {IBinPoolManager} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";
import {IBinPoolManager} from "pancake-v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";
import {
HOOKS_BEFORE_INITIALIZE_OFFSET,
HOOKS_AFTER_INITIALIZE_OFFSET,
Expand All @@ -14,23 +14,23 @@ import {
HOOKS_AFTER_SWAP_OFFSET,
HOOKS_BEFORE_DONATE_OFFSET,
HOOKS_AFTER_DONATE_OFFSET
} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {FullMath} from "@pancakeswap/v4-core/src/pool-cl/libraries/FullMath.sol";
import {SafeCast} from "@pancakeswap/v4-core/src/libraries/SafeCast.sol";
import {BinPoolParametersHelper} from "@pancakeswap/v4-core/src/pool-bin/libraries/BinPoolParametersHelper.sol";
import {IPoolManager} from "@pancakeswap/v4-core/src/interfaces/IPoolManager.sol";
import {IVault} from "@pancakeswap/v4-core/src/interfaces/IVault.sol";
import {PoolId, PoolIdLibrary} from "@pancakeswap/v4-core/src/types/PoolId.sol";
import {PoolKey} from "@pancakeswap/v4-core/src/types/PoolKey.sol";
import {Currency, CurrencyLibrary} from "@pancakeswap/v4-core/src/types/Currency.sol";
import {BalanceDelta} from "@pancakeswap/v4-core/src/types/BalanceDelta.sol";
import {Hooks} from "@pancakeswap/v4-core/src/libraries/Hooks.sol";
import {BinPoolManager} from "@pancakeswap/v4-core/src/pool-bin/BinPoolManager.sol";
import {LiquidityConfigurations} from "@pancakeswap/v4-core/src/pool-bin/libraries/math/LiquidityConfigurations.sol";
import {PackedUint128Math} from "@pancakeswap/v4-core/src/pool-bin/libraries/math/PackedUint128Math.sol";
import {BinPool} from "@pancakeswap/v4-core/src/pool-bin/libraries/BinPool.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
} from "pancake-v4-core/src/pool-bin/interfaces/IBinHooks.sol";
import {FullMath} from "pancake-v4-core/src/pool-cl/libraries/FullMath.sol";
import {SafeCast} from "pancake-v4-core/src/libraries/SafeCast.sol";
import {BinPoolParametersHelper} from "pancake-v4-core/src/pool-bin/libraries/BinPoolParametersHelper.sol";
import {IPoolManager} from "pancake-v4-core/src/interfaces/IPoolManager.sol";
import {IVault} from "pancake-v4-core/src/interfaces/IVault.sol";
import {PoolId, PoolIdLibrary} from "pancake-v4-core/src/types/PoolId.sol";
import {PoolKey} from "pancake-v4-core/src/types/PoolKey.sol";
import {Currency, CurrencyLibrary} from "pancake-v4-core/src/types/Currency.sol";
import {BalanceDelta} from "pancake-v4-core/src/types/BalanceDelta.sol";
import {Hooks} from "pancake-v4-core/src/libraries/Hooks.sol";
import {BinPoolManager} from "pancake-v4-core/src/pool-bin/BinPoolManager.sol";
import {LiquidityConfigurations} from "pancake-v4-core/src/pool-bin/libraries/math/LiquidityConfigurations.sol";
import {PackedUint128Math} from "pancake-v4-core/src/pool-bin/libraries/math/PackedUint128Math.sol";
import {BinPool} from "pancake-v4-core/src/pool-bin/libraries/BinPool.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";

import {BinBaseHook} from "../BinBaseHook.sol";

Expand Down Expand Up @@ -315,13 +315,13 @@ contract BinLimitOrder is BinBaseHook {
IERC20(Currency.unwrap(key.currency0)).safeTransferFrom(
owner, address(vault), uint256(uint128(-delta.amount0()))
);
vault.settle(key.currency0);
vault.settle();
} else {
vault.sync(key.currency1);
IERC20(Currency.unwrap(key.currency1)).safeTransferFrom(
owner, address(vault), uint256(uint128(-delta.amount1()))
);
vault.settle(key.currency1);
vault.settle();
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/pool-bin/vecake-exclusive/BinVeCakeExclusiveHook.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;

import {PoolKey} from "@pancakeswap/v4-core/src/types/PoolKey.sol";
import {PoolId, PoolIdLibrary} from "@pancakeswap/v4-core/src/types/PoolId.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "@pancakeswap/v4-core/src/types/BeforeSwapDelta.sol";
import {IBinPoolManager} from "@pancakeswap/v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";
import {PoolKey} from "pancake-v4-core/src/types/PoolKey.sol";
import {PoolId, PoolIdLibrary} from "pancake-v4-core/src/types/PoolId.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "pancake-v4-core/src/types/BeforeSwapDelta.sol";
import {IBinPoolManager} from "pancake-v4-core/src/pool-bin/interfaces/IBinPoolManager.sol";

import {BinBaseHook} from "../BinBaseHook.sol";

Expand Down
18 changes: 9 additions & 9 deletions src/pool-cl/CLBaseHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import {
HOOKS_AFTER_SWAP_RETURNS_DELTA_OFFSET,
HOOKS_AFTER_ADD_LIQUIDIY_RETURNS_DELTA_OFFSET,
HOOKS_AFTER_REMOVE_LIQUIDIY_RETURNS_DELTA_OFFSET
} from "@pancakeswap/v4-core/src/pool-cl/interfaces/ICLHooks.sol";
import {PoolKey} from "@pancakeswap/v4-core/src/types/PoolKey.sol";
import {BalanceDelta} from "@pancakeswap/v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta} from "@pancakeswap/v4-core/src/types/BeforeSwapDelta.sol";
import {IHooks} from "@pancakeswap/v4-core/src/interfaces/IHooks.sol";
import {IVault} from "@pancakeswap/v4-core/src/interfaces/IVault.sol";
import {ICLHooks} from "@pancakeswap/v4-core/src/pool-cl/interfaces/ICLHooks.sol";
import {ICLPoolManager} from "@pancakeswap/v4-core/src/pool-cl/interfaces/ICLPoolManager.sol";
import {CLPoolManager} from "@pancakeswap/v4-core/src/pool-cl/CLPoolManager.sol";
} from "pancake-v4-core/src/pool-cl/interfaces/ICLHooks.sol";
import {PoolKey} from "pancake-v4-core/src/types/PoolKey.sol";
import {BalanceDelta} from "pancake-v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta} from "pancake-v4-core/src/types/BeforeSwapDelta.sol";
import {IHooks} from "pancake-v4-core/src/interfaces/IHooks.sol";
import {IVault} from "pancake-v4-core/src/interfaces/IVault.sol";
import {ICLHooks} from "pancake-v4-core/src/pool-cl/interfaces/ICLHooks.sol";
import {ICLPoolManager} from "pancake-v4-core/src/pool-cl/interfaces/ICLPoolManager.sol";
import {CLPoolManager} from "pancake-v4-core/src/pool-cl/CLPoolManager.sol";

/// @notice BaseHook abstract contract for CL pool hooks to inherit
abstract contract CLBaseHook is ICLHooks {
Expand Down
48 changes: 24 additions & 24 deletions src/pool-cl/full-range/CLFullRange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

pragma solidity ^0.8.19;

import {ICLPoolManager} from "@pancakeswap/v4-core/src/pool-cl/interfaces/ICLPoolManager.sol";
import {TickMath} from "@pancakeswap/v4-core/src/pool-cl/libraries/TickMath.sol";
import {TickBitmap} from "@pancakeswap/v4-core/src/pool-cl/libraries/TickBitmap.sol";
import {SqrtPriceMath} from "@pancakeswap/v4-core/src/pool-cl/libraries/SqrtPriceMath.sol";
import {FixedPoint96} from "@pancakeswap/v4-core/src/pool-cl/libraries/FixedPoint96.sol";
import {CLPoolParametersHelper} from "@pancakeswap/v4-core/src/pool-cl/libraries/CLPoolParametersHelper.sol";
import {IPoolManager} from "@pancakeswap/v4-core/src/interfaces/IPoolManager.sol";
import {IVault} from "@pancakeswap/v4-core/src/interfaces/IVault.sol";
import {PoolId, PoolIdLibrary} from "@pancakeswap/v4-core/src/types/PoolId.sol";
import {Currency, CurrencyLibrary} from "@pancakeswap/v4-core/src/types/Currency.sol";
import {BalanceDelta} from "@pancakeswap/v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "@pancakeswap/v4-core/src/types/BeforeSwapDelta.sol";
import {PoolKey} from "@pancakeswap/v4-core/src/types/PoolKey.sol";
import {Hooks} from "@pancakeswap/v4-core/src/libraries/Hooks.sol";
import {SafeCast} from "@pancakeswap/v4-core/src/libraries/SafeCast.sol";
import {FullMath} from "@pancakeswap/v4-core/src/pool-cl/libraries/FullMath.sol";
import {CLPoolManager} from "@pancakeswap/v4-core/src/pool-cl/CLPoolManager.sol";
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/interfaces/IERC20Metadata.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ICLPoolManager} from "pancake-v4-core/src/pool-cl/interfaces/ICLPoolManager.sol";
import {TickMath} from "pancake-v4-core/src/pool-cl/libraries/TickMath.sol";
import {TickBitmap} from "pancake-v4-core/src/pool-cl/libraries/TickBitmap.sol";
import {SqrtPriceMath} from "pancake-v4-core/src/pool-cl/libraries/SqrtPriceMath.sol";
import {FixedPoint96} from "pancake-v4-core/src/pool-cl/libraries/FixedPoint96.sol";
import {CLPoolParametersHelper} from "pancake-v4-core/src/pool-cl/libraries/CLPoolParametersHelper.sol";
import {IPoolManager} from "pancake-v4-core/src/interfaces/IPoolManager.sol";
import {IVault} from "pancake-v4-core/src/interfaces/IVault.sol";
import {PoolId, PoolIdLibrary} from "pancake-v4-core/src/types/PoolId.sol";
import {Currency, CurrencyLibrary} from "pancake-v4-core/src/types/Currency.sol";
import {BalanceDelta} from "pancake-v4-core/src/types/BalanceDelta.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "pancake-v4-core/src/types/BeforeSwapDelta.sol";
import {PoolKey} from "pancake-v4-core/src/types/PoolKey.sol";
import {Hooks} from "pancake-v4-core/src/libraries/Hooks.sol";
import {SafeCast} from "pancake-v4-core/src/libraries/SafeCast.sol";
import {FullMath} from "pancake-v4-core/src/pool-cl/libraries/FullMath.sol";
import {CLPoolManager} from "pancake-v4-core/src/pool-cl/CLPoolManager.sol";
import {FixedPointMathLib} from "solmate/src/utils/FixedPointMathLib.sol";
import {IERC20Metadata} from "openzeppelin-contracts/contracts/interfaces/IERC20Metadata.sol";
import {Strings} from "openzeppelin-contracts/contracts/utils/Strings.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";

import {CLBaseHook} from "../CLBaseHook.sol";
import {LiquidityAmounts} from "./libraries/LiquidityAmounts.sol";
Expand Down Expand Up @@ -331,15 +331,15 @@ contract CLFullRange is CLBaseHook {

function _settleDelta(address sender, Currency currency, uint128 amount) internal {
if (currency.isNative()) {
vault.settle{value: amount}(currency);
vault.settle{value: amount}();
} else {
vault.sync(currency);
if (sender == address(this)) {
IERC20(Currency.unwrap(currency)).safeTransfer(address(vault), amount);
} else {
IERC20(Currency.unwrap(currency)).safeTransferFrom(sender, address(vault), amount);
}
vault.settle(currency);
vault.settle();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/pool-cl/full-range/libraries/LiquidityAmounts.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.19;

import "@pancakeswap/v4-core/src/pool-cl/libraries/FullMath.sol";
import "@pancakeswap/v4-core/src/pool-cl/libraries/FixedPoint96.sol";
import "pancake-v4-core/src/pool-cl/libraries/FullMath.sol";
import "pancake-v4-core/src/pool-cl/libraries/FixedPoint96.sol";

/// @title Liquidity amount functions
/// @notice Provides functions for computing liquidity amounts from token amounts and prices
Expand Down
4 changes: 2 additions & 2 deletions src/pool-cl/full-range/libraries/PancakeV4ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma solidity ^0.8.19;

import {ERC20} from "solmate/tokens/ERC20.sol";
import {Owned} from "solmate/auth/Owned.sol";
import {ERC20} from "solmate/src/tokens/ERC20.sol";
import {Owned} from "solmate/src/auth/Owned.sol";

contract PancakeV4ERC20 is ERC20, Owned {
constructor(string memory name, string memory symbol) ERC20(name, symbol, 18) Owned(msg.sender) {}
Expand Down
20 changes: 10 additions & 10 deletions src/pool-cl/geomean-oracle/CLGeomeanOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

pragma solidity ^0.8.19;

import {ICLPoolManager} from "@pancakeswap/v4-core/src/pool-cl/interfaces/ICLPoolManager.sol";
import {TickMath} from "@pancakeswap/v4-core/src/pool-cl/libraries/TickMath.sol";
import {CLPoolParametersHelper} from "@pancakeswap/v4-core/src/pool-cl/libraries/CLPoolParametersHelper.sol";
import {IPoolManager} from "@pancakeswap/v4-core/src/interfaces/IPoolManager.sol";
import {PoolId, PoolIdLibrary} from "@pancakeswap/v4-core/src/types/PoolId.sol";
import {PoolKey} from "@pancakeswap/v4-core/src/types/PoolKey.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "@pancakeswap/v4-core/src/types/BeforeSwapDelta.sol";
import {Hooks} from "@pancakeswap/v4-core/src/libraries/Hooks.sol";
import {ICLPoolManager} from "pancake-v4-core/src/pool-cl/interfaces/ICLPoolManager.sol";
import {TickMath} from "pancake-v4-core/src/pool-cl/libraries/TickMath.sol";
import {CLPoolParametersHelper} from "pancake-v4-core/src/pool-cl/libraries/CLPoolParametersHelper.sol";
import {IPoolManager} from "pancake-v4-core/src/interfaces/IPoolManager.sol";
import {PoolId, PoolIdLibrary} from "pancake-v4-core/src/types/PoolId.sol";
import {PoolKey} from "pancake-v4-core/src/types/PoolKey.sol";
import {BeforeSwapDelta, BeforeSwapDeltaLibrary} from "pancake-v4-core/src/types/BeforeSwapDelta.sol";
import {Hooks} from "pancake-v4-core/src/libraries/Hooks.sol";

import {CLBaseHook} from "../CLBaseHook.sol";
import {Oracle} from "./libraries/Oracle.sol";
Expand Down Expand Up @@ -98,7 +98,7 @@ contract CLGeomeanOracle is CLBaseHook {
// In other words, there may only be one pool per pair of tokens that use
// this hook. The tick spacing is set to the maximum because we only allow
// full range liquidity in this pool.
if (key.fee != 0 || key.parameters.getTickSpacing() != poolManager.MAX_TICK_SPACING()) {
if (key.fee != 0 || key.parameters.getTickSpacing() != TickMath.MAX_TICK_SPACING) {
revert OnlyOneOraclePoolAllowed();
}
return this.beforeInitialize.selector;
Expand Down Expand Up @@ -133,7 +133,7 @@ contract CLGeomeanOracle is CLBaseHook {
ICLPoolManager.ModifyLiquidityParams calldata params,
bytes calldata hookData
) external override returns (bytes4) {
int24 maxTickSpacing = poolManager.MAX_TICK_SPACING();
int24 maxTickSpacing = TickMath.MAX_TICK_SPACING;
if (
params.tickLower != TickMath.minUsableTick(maxTickSpacing)
|| params.tickUpper != TickMath.maxUsableTick(maxTickSpacing)
Expand Down
Loading