Verified contractPartialGPL-2.0-or-later
TickLens
Address0xbb9757cb480a08730f372dfe3068a6e86f35c63a
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 1,000,000 runs
- EVM version
- cancun
- Via IR
- yes
- License
- GPL-2.0-or-later
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,697,710
- Creation transaction
- 0x30f6cc2643…59acc945eb
172 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/pool-cl/lens/TickLens.solmain2.6 KB
- ../flux-core/src/interfaces/IERC20Minimal.sol3.04 KB
- ../flux-core/src/interfaces/IExtsload.sol593 B
- ../flux-core/src/interfaces/IHooks.sol151 B
- ../flux-core/src/interfaces/IPoolManager.sol1.77 KB
- ../flux-core/src/interfaces/IProtocolFeeController.sol836 B
- ../flux-core/src/interfaces/IProtocolFees.sol3.08 KB
- ../flux-core/src/interfaces/IVault.sol6.51 KB
- ../flux-core/src/interfaces/IVaultToken.sol2.92 KB
- ../flux-core/src/libraries/CustomRevert.sol2.36 KB
- ../flux-core/src/libraries/LPFeeLibrary.sol3.75 KB
- ../flux-core/src/libraries/ProtocolFeeLibrary.sol2.85 KB
- ../flux-core/src/libraries/SafeCast.sol2.03 KB
- ../flux-core/src/libraries/math/Encoded.sol3.91 KB
- ../flux-core/src/libraries/math/UnsafeMath.sol1.18 KB
- ../flux-core/src/pool-cl/interfaces/ICLPoolManager.sol9.87 KB
- ../flux-core/src/pool-cl/libraries/BitMath.sol2.65 KB
- ../flux-core/src/pool-cl/libraries/CLPool.sol21.47 KB
- ../flux-core/src/pool-cl/libraries/CLPoolParametersHelper.sol1.44 KB
- ../flux-core/src/pool-cl/libraries/CLPosition.sol4.81 KB
- ../flux-core/src/pool-cl/libraries/FixedPoint128.sol310 B
- ../flux-core/src/pool-cl/libraries/FixedPoint96.sol379 B
- ../flux-core/src/pool-cl/libraries/FullMath.sol5.48 KB
- ../flux-core/src/pool-cl/libraries/LiquidityMath.sol832 B
- ../flux-core/src/pool-cl/libraries/SqrtPriceMath.sol14.13 KB
- ../flux-core/src/pool-cl/libraries/SwapMath.sol6.71 KB
- ../flux-core/src/pool-cl/libraries/Tick.sol9.98 KB
- ../flux-core/src/pool-cl/libraries/TickBitmap.sol6.38 KB
- ../flux-core/src/pool-cl/libraries/TickMath.sol12.59 KB
- ../flux-core/src/pool-cl/types/CLSlot0.sol3.81 KB
- ../flux-core/src/types/BalanceDelta.sol2.36 KB
- ../flux-core/src/types/Currency.sol5.29 KB
- ../flux-core/src/types/PoolId.sol468 B
- ../flux-core/src/types/PoolKey.sol1.02 KB
- ../pumex-v4-core/src/interfaces/IERC20Minimal.sol3.03 KB
- ../pumex-v4-core/src/interfaces/IExtsload.sol593 B
- ../pumex-v4-core/src/interfaces/IHooks.sol151 B
- ../pumex-v4-core/src/interfaces/IPoolManager.sol1.66 KB
- ../pumex-v4-core/src/interfaces/IProtocolFeeController.sol836 B
- ../pumex-v4-core/src/interfaces/IProtocolFees.sol3.08 KB
- ../pumex-v4-core/src/interfaces/IVault.sol6.51 KB
- ../pumex-v4-core/src/interfaces/IVaultToken.sol2.92 KB
- ../pumex-v4-core/src/libraries/CustomRevert.sol2.36 KB
- ../pumex-v4-core/src/libraries/LPFeeLibrary.sol3.65 KB
- ../pumex-v4-core/src/libraries/ProtocolFeeLibrary.sol2.82 KB
- ../pumex-v4-core/src/libraries/SafeCast.sol2.03 KB
- ../pumex-v4-core/src/libraries/math/Encoded.sol3.91 KB
- ../pumex-v4-core/src/libraries/math/UnsafeMath.sol1.18 KB
- ../pumex-v4-core/src/pool-cl/interfaces/ICLPoolManager.sol9.87 KB
- ../pumex-v4-core/src/pool-cl/libraries/BitMath.sol2.65 KB
- ../pumex-v4-core/src/pool-cl/libraries/CLPool.sol21.47 KB
- ../pumex-v4-core/src/pool-cl/libraries/CLPoolParametersHelper.sol1.44 KB
- ../pumex-v4-core/src/pool-cl/libraries/CLPosition.sol4.81 KB
- ../pumex-v4-core/src/pool-cl/libraries/FixedPoint128.sol310 B
- ../pumex-v4-core/src/pool-cl/libraries/FixedPoint96.sol379 B
- ../pumex-v4-core/src/pool-cl/libraries/FullMath.sol5.48 KB
- ../pumex-v4-core/src/pool-cl/libraries/LiquidityMath.sol832 B
- ../pumex-v4-core/src/pool-cl/libraries/SqrtPriceMath.sol14.13 KB
- ../pumex-v4-core/src/pool-cl/libraries/SwapMath.sol6.71 KB
- ../pumex-v4-core/src/pool-cl/libraries/Tick.sol9.98 KB
- ../pumex-v4-core/src/pool-cl/libraries/TickBitmap.sol6.38 KB
- ../pumex-v4-core/src/pool-cl/libraries/TickMath.sol12.59 KB
- ../pumex-v4-core/src/pool-cl/types/CLSlot0.sol3.81 KB
- ../pumex-v4-core/src/types/BalanceDelta.sol2.36 KB
- ../pumex-v4-core/src/types/Currency.sol5.29 KB
- ../pumex-v4-core/src/types/PoolId.sol468 B
- ../pumex-v4-core/src/types/PoolKey.sol1 KB
- ../squadswap-v4-core/src/interfaces/IERC20Minimal.sol3.03 KB
- ../squadswap-v4-core/src/interfaces/IExtsload.sol593 B
- ../squadswap-v4-core/src/interfaces/IHooks.sol151 B
- ../squadswap-v4-core/src/interfaces/IPoolManager.sol1.77 KB
- ../squadswap-v4-core/src/interfaces/IProtocolFeeController.sol836 B
- ../squadswap-v4-core/src/interfaces/IProtocolFees.sol3.08 KB
- ../squadswap-v4-core/src/interfaces/IVault.sol6.51 KB
- ../squadswap-v4-core/src/interfaces/IVaultToken.sol2.92 KB
- ../squadswap-v4-core/src/libraries/CustomRevert.sol2.36 KB
- ../squadswap-v4-core/src/libraries/LPFeeLibrary.sol3.82 KB
- ../squadswap-v4-core/src/libraries/ProtocolFeeLibrary.sol2.92 KB
- ../squadswap-v4-core/src/libraries/SafeCast.sol2.09 KB
- ../squadswap-v4-core/src/libraries/math/Encoded.sol3.98 KB
- ../squadswap-v4-core/src/libraries/math/UnsafeMath.sol1.24 KB
- ../squadswap-v4-core/src/pool-cl/interfaces/ICLPoolManager.sol9.87 KB
- ../squadswap-v4-core/src/pool-cl/libraries/BitMath.sol2.72 KB
- ../squadswap-v4-core/src/pool-cl/libraries/CLPool.sol21.53 KB
- ../squadswap-v4-core/src/pool-cl/libraries/CLPoolParametersHelper.sol1.5 KB
- ../squadswap-v4-core/src/pool-cl/libraries/CLPosition.sol4.88 KB
- ../squadswap-v4-core/src/pool-cl/libraries/FixedPoint128.sol376 B
- ../squadswap-v4-core/src/pool-cl/libraries/FixedPoint96.sol445 B
- ../squadswap-v4-core/src/pool-cl/libraries/FullMath.sol5.54 KB
- ../squadswap-v4-core/src/pool-cl/libraries/LiquidityMath.sol898 B
- ../squadswap-v4-core/src/pool-cl/libraries/SqrtPriceMath.sol14.2 KB
- ../squadswap-v4-core/src/pool-cl/libraries/SwapMath.sol6.77 KB
- ../squadswap-v4-core/src/pool-cl/libraries/Tick.sol10.05 KB
- ../squadswap-v4-core/src/pool-cl/libraries/TickBitmap.sol6.45 KB
- ../squadswap-v4-core/src/pool-cl/libraries/TickMath.sol12.66 KB
- ../squadswap-v4-core/src/pool-cl/types/CLSlot0.sol3.81 KB
- ../squadswap-v4-core/src/types/BalanceDelta.sol2.36 KB
- ../squadswap-v4-core/src/types/Currency.sol5.29 KB
- ../squadswap-v4-core/src/types/PoolId.sol468 B
- ../squadswap-v4-core/src/types/PoolKey.sol1.02 KB
- infinity-core/src/pool-cl/interfaces/ICLPoolManager.sol9.87 KB
- infinity-core/src/pool-cl/libraries/CLPoolParametersHelper.sol1.47 KB
- infinity-core/src/pool-cl/libraries/Tick.sol10.01 KB
- infinity-core/src/types/PoolId.sol468 B
- infinity-core/src/types/PoolKey.sol1.02 KB
- lib/infinity-core/src/interfaces/IERC20Minimal.sol3.04 KB
- lib/infinity-core/src/interfaces/IExtsload.sol593 B
- lib/infinity-core/src/interfaces/IHooks.sol151 B
- lib/infinity-core/src/interfaces/IPoolManager.sol1.77 KB
- lib/infinity-core/src/interfaces/IProtocolFeeController.sol836 B
- lib/infinity-core/src/interfaces/IProtocolFees.sol3.08 KB
- lib/infinity-core/src/interfaces/IVault.sol6.51 KB
- lib/infinity-core/src/interfaces/IVaultToken.sol2.92 KB
- lib/infinity-core/src/libraries/CustomRevert.sol2.36 KB
- lib/infinity-core/src/libraries/LPFeeLibrary.sol3.79 KB
- lib/infinity-core/src/libraries/ProtocolFeeLibrary.sol2.88 KB
- lib/infinity-core/src/libraries/SafeCast.sol2.06 KB
- lib/infinity-core/src/libraries/math/Encoded.sol3.95 KB
- lib/infinity-core/src/libraries/math/UnsafeMath.sol1.21 KB
- lib/infinity-core/src/pool-cl/interfaces/ICLPoolManager.sol9.87 KB
- lib/infinity-core/src/pool-cl/libraries/BitMath.sol2.68 KB
- lib/infinity-core/src/pool-cl/libraries/CLPool.sol21.5 KB
- lib/infinity-core/src/pool-cl/libraries/CLPoolParametersHelper.sol1.47 KB
- lib/infinity-core/src/pool-cl/libraries/CLPosition.sol4.85 KB
- lib/infinity-core/src/pool-cl/libraries/FixedPoint128.sol344 B
- lib/infinity-core/src/pool-cl/libraries/FixedPoint96.sol413 B
- lib/infinity-core/src/pool-cl/libraries/FullMath.sol5.51 KB
- lib/infinity-core/src/pool-cl/libraries/LiquidityMath.sol866 B
- lib/infinity-core/src/pool-cl/libraries/SqrtPriceMath.sol14.17 KB
- lib/infinity-core/src/pool-cl/libraries/SwapMath.sol6.74 KB
- lib/infinity-core/src/pool-cl/libraries/Tick.sol10.01 KB
- lib/infinity-core/src/pool-cl/libraries/TickBitmap.sol6.42 KB
- lib/infinity-core/src/pool-cl/libraries/TickMath.sol12.63 KB
- lib/infinity-core/src/pool-cl/types/CLSlot0.sol3.81 KB
- lib/infinity-core/src/types/BalanceDelta.sol2.36 KB
- lib/infinity-core/src/types/Currency.sol5.29 KB
- lib/infinity-core/src/types/PoolId.sol468 B
- lib/infinity-core/src/types/PoolKey.sol1.02 KB
- lib/squadswap-v4-core/src/interfaces/IERC20Minimal.sol3.03 KB
- lib/squadswap-v4-core/src/interfaces/IExtsload.sol593 B
- lib/squadswap-v4-core/src/interfaces/IHooks.sol151 B
- lib/squadswap-v4-core/src/interfaces/IPoolManager.sol1.77 KB
- lib/squadswap-v4-core/src/interfaces/IProtocolFeeController.sol836 B
- lib/squadswap-v4-core/src/interfaces/IProtocolFees.sol3.08 KB
- lib/squadswap-v4-core/src/interfaces/IVault.sol6.51 KB
- lib/squadswap-v4-core/src/interfaces/IVaultToken.sol2.92 KB
- lib/squadswap-v4-core/src/libraries/CustomRevert.sol2.36 KB
- lib/squadswap-v4-core/src/libraries/LPFeeLibrary.sol3.82 KB
- lib/squadswap-v4-core/src/libraries/ProtocolFeeLibrary.sol2.92 KB
- lib/squadswap-v4-core/src/libraries/SafeCast.sol2.09 KB
- lib/squadswap-v4-core/src/libraries/math/Encoded.sol3.98 KB
- lib/squadswap-v4-core/src/libraries/math/UnsafeMath.sol1.24 KB
- lib/squadswap-v4-core/src/pool-cl/interfaces/ICLPoolManager.sol9.87 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/BitMath.sol2.72 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/CLPool.sol21.53 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/CLPoolParametersHelper.sol1.5 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/CLPosition.sol4.88 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/FixedPoint128.sol376 B
- lib/squadswap-v4-core/src/pool-cl/libraries/FixedPoint96.sol445 B
- lib/squadswap-v4-core/src/pool-cl/libraries/FullMath.sol5.54 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/LiquidityMath.sol898 B
- lib/squadswap-v4-core/src/pool-cl/libraries/SqrtPriceMath.sol14.2 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/SwapMath.sol6.77 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/Tick.sol10.05 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/TickBitmap.sol6.45 KB
- lib/squadswap-v4-core/src/pool-cl/libraries/TickMath.sol12.66 KB
- lib/squadswap-v4-core/src/pool-cl/types/CLSlot0.sol3.81 KB
- lib/squadswap-v4-core/src/types/BalanceDelta.sol2.36 KB
- lib/squadswap-v4-core/src/types/Currency.sol5.29 KB
- lib/squadswap-v4-core/src/types/PoolId.sol468 B
- lib/squadswap-v4-core/src/types/PoolKey.sol1.02 KB
- src/pool-cl/interfaces/ITickLens.sol1.79 KB
src/pool-cl/lens/TickLens.sol
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (C) 2024 PancakeSwap
pragma solidity 0.8.26;
import {PoolKey} from "infinity-core/src/types/PoolKey.sol";
import {PoolId} from "infinity-core/src/types/PoolId.sol";
import {ICLPoolManager} from "infinity-core/src/pool-cl/interfaces/ICLPoolManager.sol";
import {CLPoolParametersHelper} from "infinity-core/src/pool-cl/libraries/CLPoolParametersHelper.sol";
import {Tick} from "infinity-core/src/pool-cl/libraries/Tick.sol";
import {ITickLens} from "../interfaces/ITickLens.sol";
/// @title Tick Lens contract
contract TickLens is ITickLens {
using CLPoolParametersHelper for bytes32;
ICLPoolManager public immutable poolManager;
constructor(ICLPoolManager _poolManager) {
poolManager = _poolManager;
}
/// @inheritdoc ITickLens
function getPopulatedTicksInWord(PoolKey memory key, int16 tickBitmapIndex)
external
view
override
returns (PopulatedTick[] memory populatedTicks)
{
return getPopulatedTicksInWord(key.toId(), tickBitmapIndex);
}
/// @inheritdoc ITickLens
function getPopulatedTicksInWord(PoolId id, int16 tickBitmapIndex)
public
view
override
returns (PopulatedTick[] memory populatedTicks)
{
// retrieve tickSpacing
(,,,,, bytes32 poolParams) = poolManager.poolIdToPoolKey(id);
int24 tickSpacing = poolParams.getTickSpacing();
// check if pool is initialized
(uint160 sqrtPriceX96,,,) = poolManager.getSlot0(id);
if (sqrtPriceX96 == 0) revert PoolNotInitialized();
// fetch bitmap
uint256 bitmap = poolManager.getPoolBitmapInfo(id, tickBitmapIndex);
// calculate the number of populated ticks
uint256 numberOfPopulatedTicks;
for (uint256 i = 0; i < 256; i++) {
if (bitmap & (1 << i) > 0) numberOfPopulatedTicks++;
}
// fetch populated tick data
populatedTicks = new PopulatedTick[](numberOfPopulatedTicks);
for (uint256 i = 0; i < 256; i++) {
if (bitmap & (1 << i) > 0) {
int24 populatedTick = ((int24(tickBitmapIndex) << 8) + int24(int256(i))) * tickSpacing;
Tick.Info memory tickInfo = poolManager.getPoolTickInfo(id, populatedTick);
populatedTicks[--numberOfPopulatedTicks] = PopulatedTick({
tick: populatedTick,
liquidityNet: tickInfo.liquidityNet,
liquidityGross: tickInfo.liquidityGross
});
}
}
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "none",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 1000000,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"infinity-core/=lib/infinity-core/",
"ds-test/=lib/infinity-core/lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/infinity-core/lib/forge-std/src/",
"openzeppelin-contracts/=lib/infinity-core/lib/openzeppelin-contracts/",
"solmate/=lib/infinity-core/lib/solmate/",
"permit2/=lib/permit2/",
"@openzeppelin/=lib/infinity-core/lib/openzeppelin-contracts/",
"erc4626-tests/=lib/infinity-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/infinity-core/lib/forge-gas-snapshot/src/",
"halmos-cheatcodes/=lib/infinity-core/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"pancake-create3-factory/=lib/pancake-create3-factory/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.