Skip to content

Commit

Permalink
optimization: getter method for easy access tick and bitmap (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
chefburger authored Apr 10, 2024
1 parent b615117 commit b93ad15
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/CLPoolManagerTest#setLmPool.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
26272
26295
2 changes: 1 addition & 1 deletion .forge-snapshots/CLPoolManagerTest#setMasterChef.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30715
30760
11 changes: 10 additions & 1 deletion src/pool-cl/CLPoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (C) 2024 PancakeSwap
pragma solidity ^0.8.24;

import "./interfaces/ICLHooks.sol";
import {Fees} from "../Fees.sol";
import {ICLPoolManager} from "./interfaces/ICLPoolManager.sol";
import {IVault} from "../interfaces/IVault.sol";
Expand All @@ -10,9 +11,9 @@ import {CLPool} from "./libraries/CLPool.sol";
import {CLPosition} from "./libraries/CLPosition.sol";
import {PoolKey} from "../types/PoolKey.sol";
import {IPoolManager} from "../interfaces/IPoolManager.sol";
import "./interfaces/ICLHooks.sol";
import {ICLDynamicFeeManager} from "./interfaces/ICLDynamicFeeManager.sol";
import {Hooks} from "../libraries/Hooks.sol";
import {Tick} from "./libraries/Tick.sol";
import {CLPoolParametersHelper} from "./libraries/CLPoolParametersHelper.sol";
import {FeeLibrary} from "../libraries/FeeLibrary.sol";
import {PoolId, PoolIdLibrary} from "../types/PoolId.sol";
Expand Down Expand Up @@ -293,6 +294,14 @@ contract CLPoolManager is ICLPoolManager, Fees, Extsload {
}
}

function getPoolTickInfo(PoolId id, int24 tick) external view returns (Tick.Info memory) {
return pools[id].ticks[tick];
}

function getPoolBitmapInfo(PoolId id, int16 word) external view returns (uint256 tickBitmap) {
return pools[id].tickBitmap[word];
}

/// @inheritdoc ICLPoolManager
function setMasterChef(address _masterChef) external override onlyOwner {
masterChef = _masterChef;
Expand Down

0 comments on commit b93ad15

Please sign in to comment.