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

feat: Revert style quoter #73

Merged
merged 84 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
6313eb5
add PoolTicksCounter library
ConjunctiveNormalForm Nov 6, 2023
664c4ff
quoter exact input single
ConjunctiveNormalForm Nov 7, 2023
d67f597
quoter test
ConjunctiveNormalForm Nov 7, 2023
ee84418
return deltas instead
ConjunctiveNormalForm Nov 10, 2023
d68e464
safe casting to correct types
ConjunctiveNormalForm Nov 11, 2023
bc381b0
QuoteExactInput skeleton
ConjunctiveNormalForm Nov 11, 2023
3bd47d9
multiple entries
ConjunctiveNormalForm Nov 11, 2023
f75b87a
break handleRevert by type
ConjunctiveNormalForm Nov 12, 2023
a69c782
quoteExactInput and unit tests
ConjunctiveNormalForm Nov 15, 2023
4f9519f
more QuoteExactInput tests
ConjunctiveNormalForm Nov 15, 2023
7823167
remove lgos
ConjunctiveNormalForm Nov 15, 2023
e2d0c22
remove commented out struct
ConjunctiveNormalForm Nov 15, 2023
6ba70f4
via-ir in ci
ConjunctiveNormalForm Nov 15, 2023
b093a78
remove unused imports/functions
ConjunctiveNormalForm Nov 16, 2023
69c2c5b
store iteration params locally instead of editing function input
ConjunctiveNormalForm Nov 16, 2023
20af595
pull out sqrtPriceLimit to its own function
ConjunctiveNormalForm Nov 16, 2023
e3f6c7e
PathKey to its own library
ConjunctiveNormalForm Nov 16, 2023
a8a0ed1
rename initializedTicksCrossed to initializedTicksLoaded
ConjunctiveNormalForm Nov 16, 2023
bd22b11
remove manual abi encoding in yul :p
ConjunctiveNormalForm Nov 16, 2023
1e0277b
fix linter warnings for Quoter
ConjunctiveNormalForm Nov 16, 2023
ca62ec2
natspec for IQuoter
ConjunctiveNormalForm Nov 16, 2023
d526f75
feat: update v4-core
marktoda Nov 16, 2023
3e3ab5d
fix: tests
marktoda Nov 16, 2023
c5b8c22
style fixes
ConjunctiveNormalForm Nov 17, 2023
1d8f14f
inheritdoc
ConjunctiveNormalForm Nov 17, 2023
55db578
ExactInSingleBatch
ConjunctiveNormalForm Nov 17, 2023
4fe142c
fix: update tests
marktoda Nov 17, 2023
15a9c8a
fix: test router was borked
marktoda Nov 17, 2023
f12b2c3
exact out
ConjunctiveNormalForm Nov 18, 2023
0dc0c0b
fix: alice comments
marktoda Nov 20, 2023
3665d41
fix ExactOutput
ConjunctiveNormalForm Nov 20, 2023
f432926
add ExactOput unit tests
ConjunctiveNormalForm Nov 21, 2023
eb3441f
add quoteExactOutputBatch
ConjunctiveNormalForm Nov 21, 2023
94f1a20
remove solhint config
ConjunctiveNormalForm Nov 22, 2023
45fd156
remove newline
ConjunctiveNormalForm Nov 22, 2023
57330b2
add QuoteExactOutput in interface
ConjunctiveNormalForm Nov 22, 2023
c841c34
refactor lockAcquired
ConjunctiveNormalForm Nov 22, 2023
a13509b
move magic numbers to constants + doc
ConjunctiveNormalForm Nov 22, 2023
dcd6471
add more natspec
ConjunctiveNormalForm Nov 22, 2023
9fb0ab4
natspec
ConjunctiveNormalForm Nov 28, 2023
3f0e6a7
named imports
ConjunctiveNormalForm Nov 28, 2023
4a8e57a
self-call branching
ConjunctiveNormalForm Dec 4, 2023
b1c2292
remove old code
ConjunctiveNormalForm Dec 4, 2023
238a23e
remove console2 import
ConjunctiveNormalForm Dec 4, 2023
5daedb0
refactor PathKeyLib
ConjunctiveNormalForm Dec 4, 2023
b6a7373
amountOutCached
ConjunctiveNormalForm Dec 4, 2023
ebac179
inherit ILockCallback
ConjunctiveNormalForm Dec 4, 2023
1912701
add base contracts and interfaces (#75)
tinaszheng Nov 28, 2023
b683fe8
Merge branch 'main' into revert-quoter
ConjunctiveNormalForm Dec 4, 2023
7d123ac
remove unused errors
ConjunctiveNormalForm Dec 4, 2023
7bfcffb
test lockAcquired reverts
ConjunctiveNormalForm Dec 5, 2023
54373b1
remove ...Batch interface
ConjunctiveNormalForm Dec 5, 2023
6ecf72b
REASON -> RESPONSE when valid
ConjunctiveNormalForm Dec 5, 2023
a40476e
complete natspec
ConjunctiveNormalForm Dec 5, 2023
7e7b880
remove SwapInfo imports
ConjunctiveNormalForm Dec 5, 2023
cb15b3e
rename to SwapParameters
ConjunctiveNormalForm Dec 6, 2023
710705b
move quoter structs into IQuoter interface
ConjunctiveNormalForm Dec 6, 2023
311ff6f
update to latest core
snreynolds Dec 11, 2023
5f4b717
use prev values
snreynolds Dec 11, 2023
ffe3b05
change twamm to use pool getters
snreynolds Dec 11, 2023
d559965
Merge branch 'main' into update-v4-core
snreynolds Dec 11, 2023
6a72276
changes after merging main
snreynolds Dec 11, 2023
57183bd
use --via-ir in cli
snreynolds Dec 11, 2023
18d68e8
fix formatting
snreynolds Dec 14, 2023
fead64a
fix FullRange/TWAMM hook
snreynolds Dec 14, 2023
7dc6b82
Merge remote-tracking branch 'origin/update-v4-core' into revert-quoter
ConjunctiveNormalForm Dec 14, 2023
588ffde
update ticks counter
ConjunctiveNormalForm Dec 15, 2023
f6a5516
update Quoter test
ConjunctiveNormalForm Dec 15, 2023
9204cea
typo
ConjunctiveNormalForm Dec 18, 2023
678919f
typo
ConjunctiveNormalForm Dec 18, 2023
b7f737f
simplify handleRevertSingle
ConjunctiveNormalForm Dec 18, 2023
67772de
merge QuoteInput/OutputSingle structs
ConjunctiveNormalForm Dec 18, 2023
fbb6d1b
combine IQuoter structs
ConjunctiveNormalForm Dec 18, 2023
ad3a966
using ... ordering
ConjunctiveNormalForm Dec 18, 2023
b098593
Merge branch 'main' into revert-quoter
ConjunctiveNormalForm Dec 19, 2023
6a7882a
update snapshots
ConjunctiveNormalForm Dec 19, 2023
6a2b71f
move amountOutCached into inner call
ConjunctiveNormalForm Dec 19, 2023
88cbff3
using PathKeyLib for PathKey
ConjunctiveNormalForm Dec 19, 2023
c43f0f1
fix amountOutCached
ConjunctiveNormalForm Dec 19, 2023
f00e616
remove console2 import
ConjunctiveNormalForm Dec 20, 2023
753d11a
resurface revert reason
ConjunctiveNormalForm Dec 20, 2023
386a957
clean up validateRevert
ConjunctiveNormalForm Dec 20, 2023
91c018e
update natsppec
ConjunctiveNormalForm Dec 20, 2023
a657d5c
remove unused
ConjunctiveNormalForm Dec 20, 2023
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
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FOUNDRY_FUZZ_SEED=0x4444

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export FOUNDRY_SOLC="./lib/v4-core/bin/solc-static-linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
export FOUNDRY_SOLC="./lib/v4-core/bin/solc-mac"
fi
2 changes: 1 addition & 1 deletion .forge-snapshots/FullOracleObserve0After5Seconds.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2000
2687
2 changes: 1 addition & 1 deletion .forge-snapshots/FullOracleObserve200By13.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21068
22933
2 changes: 1 addition & 1 deletion .forge-snapshots/FullOracleObserve200By13Plus5.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21318
23180
2 changes: 1 addition & 1 deletion .forge-snapshots/FullOracleObserve5After5Seconds.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2076
2738
2 changes: 1 addition & 1 deletion .forge-snapshots/FullOracleObserveOldest.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20164
21892
2 changes: 1 addition & 1 deletion .forge-snapshots/FullOracleObserveOldestAfter5Seconds.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20458
22191
2 changes: 1 addition & 1 deletion .forge-snapshots/FullOracleObserveZero.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1525
2070
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddInitialLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
412696
407968
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeAddLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
206962
201962
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeFirstSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
154763
153306
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeInitialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
879542
1112212
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidity.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
200095
197519
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeRemoveLiquidityAndRebalance.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
379287
379147
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSecondSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
112303
111940
2 changes: 1 addition & 1 deletion .forge-snapshots/FullRangeSwap.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
153038
151523
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow10Slots.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
233028
254660
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow10SlotsCardinalityGreater.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
223717
245360
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow1Slot.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
32886
54869
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleGrow1SlotCardinalityGreater.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23586
45569
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleInitialize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51411
72316
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5571
6492
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleObserveCurrentTime.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1525
2070
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1525
2070
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleObserveLast20Seconds.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
75965
86878
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleObserveLatestEqual.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1525
2070
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleObserveLatestTransform.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2000
2687
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleObserveMiddle.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5746
6684
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleObserveOldest.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5277
6193
2 changes: 1 addition & 1 deletion .forge-snapshots/OracleObserveSinceMostRecent.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2615
3382
2 changes: 1 addition & 1 deletion .forge-snapshots/TWAMMSubmitOrder.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
123576
145648
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
version: nightly

- name: Run tests
run: forge test -vvv
run: forge test -vvv --via-ir
env:
FOUNDRY_PROFILE: ci
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
cache/
foundry-out/
foundry-out/
.vscode/
21 changes: 13 additions & 8 deletions contracts/BaseHook.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol";
import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol";
import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol";
import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol";
import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol";
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol";
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";

abstract contract BaseHook is IHooks {
error NotPoolManager();
Expand Down Expand Up @@ -40,16 +40,21 @@ abstract contract BaseHook is IHooks {
_;
}

function getHooksCalls() public pure virtual returns (Hooks.Calls memory);
function getHooksCalls() public pure virtual returns (Hooks.Permissions memory);

// this function is virtual so that we can override it during testing,
// which allows us to deploy an implementation to any address
// and then etch the bytecode into the correct address
function validateHookAddress(BaseHook _this) internal pure virtual {
Hooks.validateHookAddress(_this, getHooksCalls());
Hooks.validateHookPermissions(_this, getHooksCalls());
}

function lockAcquired(bytes calldata data) external virtual poolManagerOnly returns (bytes memory) {
function lockAcquired(address, /*sender*/ bytes calldata data)
external
virtual
poolManagerOnly
returns (bytes memory)
{
(bool success, bytes memory returnData) = address(this).call(data);
if (success) return returnData;
if (returnData.length == 0) revert LockFailure();
Expand Down
2 changes: 1 addition & 1 deletion contracts/base/PeripheryPayments.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.19;

import {ERC20} from "solmate/tokens/ERC20.sol";
import {Currency, CurrencyLibrary} from "@uniswap/v4-core/contracts/types/Currency.sol";
import {Currency, CurrencyLibrary} from "@uniswap/v4-core/src/types/Currency.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {IPeripheryPayments} from "../interfaces/IPeripheryPayments.sol";

Expand Down
50 changes: 28 additions & 22 deletions contracts/hooks/examples/FullRange.sol
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol";
import {PoolManager} from "@uniswap/v4-core/contracts/PoolManager.sol";
import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol";
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol";
import {BaseHook} from "../../BaseHook.sol";
import {SafeCast} from "@uniswap/v4-core/contracts/libraries/SafeCast.sol";
import {IHooks} from "@uniswap/v4-core/contracts/interfaces/IHooks.sol";
import {CurrencyLibrary, Currency} from "@uniswap/v4-core/contracts/types/Currency.sol";
import {TickMath} from "@uniswap/v4-core/contracts/libraries/TickMath.sol";
import {BalanceDelta} from "@uniswap/v4-core/contracts/types/BalanceDelta.sol";
import {IERC20Minimal} from "@uniswap/v4-core/contracts/interfaces/external/IERC20Minimal.sol";
import {ILockCallback} from "@uniswap/v4-core/contracts/interfaces/callback/ILockCallback.sol";
import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol";
import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol";
import {FullMath} from "@uniswap/v4-core/contracts/libraries/FullMath.sol";
import {SafeCast} from "@uniswap/v4-core/src/libraries/SafeCast.sol";
import {IHooks} from "@uniswap/v4-core/src/interfaces/IHooks.sol";
import {CurrencyLibrary, Currency} from "@uniswap/v4-core/src/types/Currency.sol";
import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
import {IERC20Minimal} from "@uniswap/v4-core/src/interfaces/external/IERC20Minimal.sol";
import {ILockCallback} from "@uniswap/v4-core/src/interfaces/callback/ILockCallback.sol";
import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol";
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {FullMath} from "@uniswap/v4-core/src/libraries/FullMath.sol";
import {UniswapV4ERC20} from "../../libraries/UniswapV4ERC20.sol";
import {FixedPoint96} from "@uniswap/v4-core/contracts/libraries/FixedPoint96.sol";
import {FixedPoint96} from "@uniswap/v4-core/src/libraries/FixedPoint96.sol";
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/interfaces/IERC20Metadata.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
Expand Down Expand Up @@ -87,16 +87,18 @@ contract FullRange is BaseHook, ILockCallback {
_;
}

function getHooksCalls() public pure override returns (Hooks.Calls memory) {
return Hooks.Calls({
function getHooksCalls() public pure override returns (Hooks.Permissions memory) {
return Hooks.Permissions({
beforeInitialize: true,
afterInitialize: false,
beforeModifyPosition: true,
afterModifyPosition: false,
beforeSwap: true,
afterSwap: false,
beforeDonate: false,
afterDonate: false
afterDonate: false,
noOp: false,
accessLock: false
});
}

Expand All @@ -115,7 +117,7 @@ contract FullRange is BaseHook, ILockCallback {

PoolId poolId = key.toId();

(uint160 sqrtPriceX96,,,) = poolManager.getSlot0(poolId);
(uint160 sqrtPriceX96,,) = poolManager.getSlot0(poolId);

if (sqrtPriceX96 == 0) revert PoolNotInitialized();

Expand Down Expand Up @@ -172,7 +174,7 @@ contract FullRange is BaseHook, ILockCallback {

PoolId poolId = key.toId();

(uint160 sqrtPriceX96,,,) = poolManager.getSlot0(poolId);
(uint160 sqrtPriceX96,,) = poolManager.getSlot0(poolId);

if (sqrtPriceX96 == 0) revert PoolNotInitialized();

Expand Down Expand Up @@ -247,7 +249,9 @@ contract FullRange is BaseHook, ILockCallback {
internal
returns (BalanceDelta delta)
{
delta = abi.decode(poolManager.lock(abi.encode(CallbackData(msg.sender, key, params))), (BalanceDelta));
delta = abi.decode(
poolManager.lock(address(this), abi.encode(CallbackData(msg.sender, key, params))), (BalanceDelta)
);
}

function _settleDeltas(address sender, PoolKey memory key, BalanceDelta delta) internal {
Expand Down Expand Up @@ -295,12 +299,14 @@ contract FullRange is BaseHook, ILockCallback {
pool.hasAccruedFees = false;
}

function lockAcquired(bytes calldata rawData)
function lockAcquired(address sender, bytes calldata rawData)
external
override(ILockCallback, BaseHook)
poolManagerOnly
returns (bytes memory)
{
// Now that manager can be called by EOAs with a lock target, it's necessary for lockAcquired to check the original sender if it wants to trust the data passed through.
if (sender != address(this)) revert SenderMustBeHook();
CallbackData memory data = abi.decode(rawData, (CallbackData));
BalanceDelta delta;

Expand Down Expand Up @@ -332,7 +338,7 @@ contract FullRange is BaseHook, ILockCallback {
) * FixedPointMathLib.sqrt(FixedPoint96.Q96)
).toUint160();

(uint160 sqrtPriceX96,,,) = poolManager.getSlot0(poolId);
(uint160 sqrtPriceX96,,) = poolManager.getSlot0(poolId);

poolManager.swap(
key,
Expand Down
22 changes: 12 additions & 10 deletions contracts/hooks/examples/GeomeanOracle.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import {IPoolManager} from "@uniswap/v4-core/contracts/interfaces/IPoolManager.sol";
import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/contracts/types/PoolId.sol";
import {Hooks} from "@uniswap/v4-core/contracts/libraries/Hooks.sol";
import {TickMath} from "@uniswap/v4-core/contracts/libraries/TickMath.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {PoolId, PoolIdLibrary} from "@uniswap/v4-core/src/types/PoolId.sol";
import {Hooks} from "@uniswap/v4-core/src/libraries/Hooks.sol";
import {TickMath} from "@uniswap/v4-core/src/libraries/TickMath.sol";
import {Oracle} from "../../libraries/Oracle.sol";
import {BaseHook} from "../../BaseHook.sol";
import {PoolKey} from "@uniswap/v4-core/contracts/types/PoolKey.sol";
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";

/// @notice A hook for a pool that allows a Uniswap pool to act as an oracle. Pools that use this hook must have full range
/// tick spacing and liquidity is always permanently locked in these pools. This is the suggested configuration
Expand Down Expand Up @@ -60,16 +60,18 @@ contract GeomeanOracle is BaseHook {

constructor(IPoolManager _poolManager) BaseHook(_poolManager) {}

function getHooksCalls() public pure override returns (Hooks.Calls memory) {
return Hooks.Calls({
function getHooksCalls() public pure override returns (Hooks.Permissions memory) {
return Hooks.Permissions({
beforeInitialize: true,
afterInitialize: true,
beforeModifyPosition: true,
afterModifyPosition: false,
beforeSwap: true,
afterSwap: false,
beforeDonate: false,
afterDonate: false
afterDonate: false,
noOp: false,
accessLock: false
});
}

Expand Down Expand Up @@ -101,7 +103,7 @@ contract GeomeanOracle is BaseHook {
/// @dev Called before any action that potentially modifies pool price or liquidity, such as swap or modify position
function _updatePool(PoolKey calldata key) private {
PoolId id = key.toId();
(, int24 tick,,) = poolManager.getSlot0(id);
(, int24 tick,) = poolManager.getSlot0(id);

uint128 liquidity = poolManager.getLiquidity(id);

Expand Down Expand Up @@ -146,7 +148,7 @@ contract GeomeanOracle is BaseHook {

ObservationState memory state = states[id];

(, int24 tick,,) = poolManager.getSlot0(id);
(, int24 tick,) = poolManager.getSlot0(id);

uint128 liquidity = poolManager.getLiquidity(id);

Expand Down
Loading