Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
17514387 | 502 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x86e9Bd5E...C7718f381 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PancakeV3LmPool
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; import '@pancakeswap/v3-core/contracts/libraries/LowGasSafeMath.sol'; import '@pancakeswap/v3-core/contracts/libraries/SafeCast.sol'; import '@pancakeswap/v3-core/contracts/libraries/FullMath.sol'; import '@pancakeswap/v3-core/contracts/libraries/FixedPoint128.sol'; import '@pancakeswap/v3-core/contracts/interfaces/IPancakeV3Pool.sol'; import './libraries/LmTick.sol'; import './interfaces/IPancakeV3LmPool.sol'; import './interfaces/ILMPool.sol'; import './interfaces/IMasterChefV3.sol'; import './interfaces/IPancakeV3LmPoolDeveloper.sol'; contract PancakeV3LmPool is IPancakeV3LmPool { using LowGasSafeMath for uint256; using LowGasSafeMath for int256; using SafeCast for uint256; using SafeCast for int256; using LmTick for mapping(int24 => LmTick.Info); uint256 public constant REWARD_PRECISION = 1e12; IPancakeV3Pool public immutable pool; IMasterChefV3 public immutable masterChef; // The first version LMPool. ILMPool public immutable firstLMPool; // The second version LMPool. ILMPool public immutable secondLMPool; // The third version LMPool. ILMPool public immutable thirdLMPool; mapping(int24 => bool) public lmTicksFlag; uint256 public rewardGrowthGlobalX128; mapping(int24 => LmTick.Info) public lmTicks; uint128 public lmLiquidity; uint32 public lastRewardTimestamp; // Need to initialize the LMPool when first call from v3 pool or MCV3. bool public initialization; // Record the first negative RewardGrowthInside value. mapping(int24 => mapping(int24 => uint256)) public negativeRewardGrowthInsideInitValue; // Read old negativeRewardGrowthInsideInitValue data from thirdLMPool. mapping(int24 => mapping(int24 => bool)) public checkThirdLMPool; modifier onlyPool() { require(msg.sender == address(pool), 'Not pool'); _; } modifier onlyMasterChef() { require(msg.sender == address(masterChef), 'Not MC'); _; } modifier onlyPoolOrMasterChef() { require(msg.sender == address(pool) || msg.sender == address(masterChef), 'Not pool or MC'); _; } constructor() { ( address poolAddress, address masterChefAddress, address firstLMPoolAddress, address secondLMPoolAddress, address thirdLMPoolAddress ) = IPancakeV3LmPoolDeveloper(msg.sender).parameters(); pool = IPancakeV3Pool(poolAddress); masterChef = IMasterChefV3(masterChefAddress); lastRewardTimestamp = uint32(block.timestamp); firstLMPool = ILMPool(firstLMPoolAddress); secondLMPool = ILMPool(secondLMPoolAddress); thirdLMPool = ILMPool(thirdLMPoolAddress); } /// @notice Will trigger this once when the first call from MasterChefV3 or V3 pool, /// this will update the latest global information from old LMPool. /// Because we will deploy new LMPool and set LMPool in v3 pool in the same transaction, so we can call initialize at the same tx. function initialize() external override { if (!initialization) { initialization = true; rewardGrowthGlobalX128 = thirdLMPool.rewardGrowthGlobalX128(); lmLiquidity = thirdLMPool.lmLiquidity(); lastRewardTimestamp = thirdLMPool.lastRewardTimestamp(); } } function _getLMTicks(int24 tick) internal view returns (LmTick.Info memory info) { // When tick had updated in thirdLMPool , read tick info from third LMPool, or read from second LMPool , if not , read from firstLMPool. if (thirdLMPool.lmTicksFlag(tick)) { (info.liquidityGross, info.liquidityNet, info.rewardGrowthOutsideX128) = thirdLMPool.lmTicks(tick); } else if (secondLMPool.lmTicksFlag(tick)) { (info.liquidityGross, info.liquidityNet, info.rewardGrowthOutsideX128) = secondLMPool.lmTicks(tick); } else { (info.liquidityGross, info.liquidityNet, info.rewardGrowthOutsideX128) = firstLMPool.lmTicks(tick); } } /// @notice Update tick information from old LMPool when need to update the tick information at the first time. /// @dev Old LMPool ticks information can be compatible. function _updateLMTicks(int24 tick) internal { if (!lmTicksFlag[tick]) { lmTicksFlag[tick] = true; lmTicks[tick] = _getLMTicks(tick); } } function accumulateReward(uint32 currTimestamp) external override onlyPoolOrMasterChef { if (currTimestamp <= lastRewardTimestamp) { return; } if (lmLiquidity != 0) { (uint256 rewardPerSecond, uint256 endTime) = masterChef.getLatestPeriodInfo(address(pool)); uint32 endTimestamp = uint32(endTime); uint32 duration; if (endTimestamp > currTimestamp) { duration = currTimestamp - lastRewardTimestamp; } else if (endTimestamp > lastRewardTimestamp) { duration = endTimestamp - lastRewardTimestamp; } if (duration != 0) { rewardGrowthGlobalX128 += FullMath.mulDiv( duration, FullMath.mulDiv(rewardPerSecond, FixedPoint128.Q128, REWARD_PRECISION), lmLiquidity ); } } lastRewardTimestamp = currTimestamp; } function crossLmTick(int24 tick, bool zeroForOne) external override onlyPool { // Update the lmTicks state from the secondLMPool. _updateLMTicks(tick); if (lmTicks[tick].liquidityGross == 0) { return; } int128 lmLiquidityNet = lmTicks.cross(tick, rewardGrowthGlobalX128); if (zeroForOne) { lmLiquidityNet = -lmLiquidityNet; } lmLiquidity = LiquidityMath.addDelta(lmLiquidity, lmLiquidityNet); } /// @notice Get the current negativeRewardGrowthInsideInitValue based on all old LMPools. function _getNegativeRewardGrowthInsideInitValue( int24 tickLower, int24 tickUpper ) internal view returns (uint256 initValue) { // If already chekced third LMPool , use current negativeRewardGrowthInsideInitValue. if (checkThirdLMPool[tickLower][tickUpper]) { initValue = negativeRewardGrowthInsideInitValue[tickLower][tickUpper]; } else { bool checkSecondLMPoolFlagInThirdLMPool = thirdLMPool.checkSecondLMPool(tickLower, tickUpper); // If already checked second LMPool , use third LMPool negativeRewardGrowthInsideInitValue. if (checkSecondLMPoolFlagInThirdLMPool) { initValue = thirdLMPool.negativeRewardGrowthInsideInitValue(tickLower, tickUpper); } else { // If not checked second LMPool , use second LMPool negativeRewardGrowthInsideInitValue. initValue = secondLMPool.negativeRewardGrowthInsideInitValue(tickLower, tickUpper); } } } /// @notice This will check the whether the range RewardGrowthInside is negative when the range ticks were initialized. /// @dev This is for fixing the issues that rewardGrowthInsideX128 can be underflow on purpose. /// If the rewardGrowthInsideX128 is negative , we will process it as a positive number. /// Because the RewardGrowthInside is self-incrementing, so we record the initial value as zero point. function _checkNegativeRewardGrowthInside(int24 tickLower, int24 tickUpper) internal { (uint256 rewardGrowthInsideX128, bool isNegative) = _getRewardGrowthInsideInternal(tickLower, tickUpper); uint256 initValue = _getNegativeRewardGrowthInsideInitValue(tickLower, tickUpper); // Only need to check third LMPool once , and initialize negativeRewardGrowthInsideInitValue. if (!checkThirdLMPool[tickLower][tickUpper]) { checkThirdLMPool[tickLower][tickUpper] = true; negativeRewardGrowthInsideInitValue[tickLower][tickUpper] = initValue; } if (isNegative) { if (initValue == 0 || initValue > rewardGrowthInsideX128) { negativeRewardGrowthInsideInitValue[tickLower][tickUpper] = rewardGrowthInsideX128; } } } /// @notice Need to rest Negative Tick info when tick flipped. function _clearNegativeTickInfo(int24 tickLower, int24 tickUpper) internal { negativeRewardGrowthInsideInitValue[tickLower][tickUpper] = 0; // No need to check thirdLMPool after tick flipped. if (!checkThirdLMPool[tickLower][tickUpper]) checkThirdLMPool[tickLower][tickUpper] = true; } function updatePosition(int24 tickLower, int24 tickUpper, int128 liquidityDelta) external onlyMasterChef { // Update the lmTicks state from the secondLMPool. _updateLMTicks(tickLower); _updateLMTicks(tickUpper); (, int24 tick, , , , , ) = pool.slot0(); uint128 maxLiquidityPerTick = pool.maxLiquidityPerTick(); uint256 _rewardGrowthGlobalX128 = rewardGrowthGlobalX128; bool flippedLower; bool flippedUpper; if (liquidityDelta != 0) { flippedLower = lmTicks.update( tickLower, tick, liquidityDelta, _rewardGrowthGlobalX128, false, maxLiquidityPerTick ); flippedUpper = lmTicks.update( tickUpper, tick, liquidityDelta, _rewardGrowthGlobalX128, true, maxLiquidityPerTick ); } if (tick >= tickLower && tick < tickUpper) { lmLiquidity = LiquidityMath.addDelta(lmLiquidity, liquidityDelta); } if (liquidityDelta < 0) { if (flippedLower) { lmTicks.clear(tickLower); } if (flippedUpper) { lmTicks.clear(tickUpper); } } // Need to rest Negative Tick info when tick flipped. if (liquidityDelta < 0 && (flippedLower || flippedUpper)) { _clearNegativeTickInfo(tickLower, tickUpper); } else { _checkNegativeRewardGrowthInside(tickLower, tickUpper); } } function getRewardGrowthInside( int24 tickLower, int24 tickUpper ) external view returns (uint256 rewardGrowthInsideX128) { (rewardGrowthInsideX128, ) = _getRewardGrowthInsideInternal(tickLower, tickUpper); uint256 initValue = _getNegativeRewardGrowthInsideInitValue(tickLower, tickUpper); rewardGrowthInsideX128 = rewardGrowthInsideX128 - initValue; } function _getRewardGrowthInsideInternal( int24 tickLower, int24 tickUpper ) internal view returns (uint256 rewardGrowthInsideX128, bool isNegative) { (, int24 tick, , , , , ) = pool.slot0(); LmTick.Info memory lower; if (lmTicksFlag[tickLower]) { lower = lmTicks[tickLower]; } else { lower = _getLMTicks(tickLower); } LmTick.Info memory upper; if (lmTicksFlag[tickUpper]) { upper = lmTicks[tickUpper]; } else { upper = _getLMTicks(tickUpper); } // calculate reward growth below uint256 rewardGrowthBelowX128; if (tick >= tickLower) { rewardGrowthBelowX128 = lower.rewardGrowthOutsideX128; } else { rewardGrowthBelowX128 = rewardGrowthGlobalX128 - lower.rewardGrowthOutsideX128; } // calculate reward growth above uint256 rewardGrowthAboveX128; if (tick < tickUpper) { rewardGrowthAboveX128 = upper.rewardGrowthOutsideX128; } else { rewardGrowthAboveX128 = rewardGrowthGlobalX128 - upper.rewardGrowthOutsideX128; } rewardGrowthInsideX128 = rewardGrowthGlobalX128 - rewardGrowthBelowX128 - rewardGrowthAboveX128; isNegative = (rewardGrowthBelowX128 + rewardGrowthAboveX128) > rewardGrowthGlobalX128; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './pool/IPancakeV3PoolImmutables.sol'; import './pool/IPancakeV3PoolState.sol'; import './pool/IPancakeV3PoolDerivedState.sol'; import './pool/IPancakeV3PoolActions.sol'; import './pool/IPancakeV3PoolOwnerActions.sol'; import './pool/IPancakeV3PoolEvents.sol'; /// @title The interface for a PancakeSwap V3 Pool /// @notice A PancakeSwap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IPancakeV3Pool is IPancakeV3PoolImmutables, IPancakeV3PoolState, IPancakeV3PoolDerivedState, IPancakeV3PoolActions, IPancakeV3PoolOwnerActions, IPancakeV3PoolEvents { }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IPancakeV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IPancakeV3MintCallback#pancakeV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IPancakeV3SwapCallback#pancakeV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IPancakeV3FlashCallback#pancakeV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IPancakeV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IPancakeV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap /// @param protocolFeesToken0 The protocol fee of token0 in the swap /// @param protocolFeesToken1 The protocol fee of token1 in the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick, uint128 protocolFeesToken0, uint128 protocolFeesToken1 ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol( uint32 feeProtocol0Old, uint32 feeProtocol1Old, uint32 feeProtocol0New, uint32 feeProtocol1New ); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IPancakeV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IPancakeV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IPancakeV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint32 feeProtocol0, uint32 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Set the LM pool to enable liquidity mining function setLmPool(address lmPool) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IPancakeV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint32 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0; /// @title FixedPoint128 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) library FixedPoint128 { uint256 internal constant Q128 = 0x100000000000000000000000000000000; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0 <0.8.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = -denominator & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Math library for liquidity library LiquidityMath { /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows /// @param x The liquidity before change /// @param y The delta by which liquidity should be changed /// @return z The liquidity delta function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) { if (y < 0) { require((z = x - uint128(-y)) < x, 'LS'); } else { require((z = x + uint128(y)) >= x, 'LA'); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.0; /// @title Optimized overflow and underflow safe math operations /// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost library LowGasSafeMath { /// @notice Returns x + y, reverts if sum overflows uint256 /// @param x The augend /// @param y The addend /// @return z The sum of x and y function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); } /// @notice Returns x - y, reverts if underflows /// @param x The minuend /// @param y The subtrahend /// @return z The difference of x and y function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x); } /// @notice Returns x * y, reverts if overflows /// @param x The multiplicand /// @param y The multiplier /// @return z The product of x and y function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(x == 0 || (z = x * y) / x == y); } /// @notice Returns x + y, reverts if overflows or underflows /// @param x The augend /// @param y The addend /// @return z The sum of x and y function add(int256 x, int256 y) internal pure returns (int256 z) { require((z = x + y) >= x == (y >= 0)); } /// @notice Returns x - y, reverts if overflows or underflows /// @param x The minuend /// @param y The subtrahend /// @return z The difference of x and y function sub(int256 x, int256 y) internal pure returns (int256 z) { require((z = x - y) <= x == (y >= 0)); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Safe casting methods /// @notice Contains methods for safely casting between types library SafeCast { /// @notice Cast a uint256 to a uint160, revert on overflow /// @param y The uint256 to be downcasted /// @return z The downcasted integer, now type uint160 function toUint160(uint256 y) internal pure returns (uint160 z) { require((z = uint160(y)) == y); } /// @notice Cast a int256 to a int128, revert on overflow or underflow /// @param y The int256 to be downcasted /// @return z The downcasted integer, now type int128 function toInt128(int256 y) internal pure returns (int128 z) { require((z = int128(y)) == y); } /// @notice Cast a uint256 to a int256, revert on overflow /// @param y The uint256 to be casted /// @return z The casted integer, now type int256 function toInt256(uint256 y) internal pure returns (int256 z) { require(y < 2**255); z = int256(y); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0 <0.8.0; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant MAX_TICK = -MIN_TICK; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 internal constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @notice Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { // second inequality must be < because the price can never reach the price at the max tick require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R'); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; interface ILMPool { function lmTicks(int24) external view returns (uint128, int128, uint256); function rewardGrowthGlobalX128() external view returns (uint256); function lmLiquidity() external view returns (uint128); function lastRewardTimestamp() external view returns (uint32); function getRewardGrowthInside(int24 tickLower, int24 tickUpper) external view returns (uint256); function OldLMPool() external view returns (address); function lmTicksFlag(int24 tick) external view returns (bool); function negativeRewardGrowthInsideFlag(int24 tickLower, int24 tickUpper) external view returns (bool); function negativeRewardGrowthInsideInitValue(int24 tickLower, int24 tickUpper) external view returns (uint256); function checkNegativeFlag(int24 tickLower, int24 tickUpper) external view returns (bool); function checkSecondLMPool(int24 tickLower, int24 tickUpper) external view returns (bool); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; interface IMasterChefV3 { function nonfungiblePositionManager() external view returns (address); function getLatestPeriodInfo(address _v3Pool) external view returns (uint256 cakePerSecond, uint256 endTime); function poolInfo(uint256 pid) external view returns (uint256, address, address, address, uint24, uint256, uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; interface IPancakeV3LmPool { function accumulateReward(uint32 currTimestamp) external; function crossLmTick(int24 tick, bool zeroForOne) external; function initialize() external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; interface IPancakeV3LmPoolDeveloper { function parameters() external view returns (address pool, address masterChef, address firstLMPool, address secondLMPool, address thirdLMPool); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0 <0.8.0; import '@pancakeswap/v3-core/contracts/libraries/LowGasSafeMath.sol'; import '@pancakeswap/v3-core/contracts/libraries/SafeCast.sol'; import '@pancakeswap/v3-core/contracts/libraries/TickMath.sol'; import '@pancakeswap/v3-core/contracts/libraries/LiquidityMath.sol'; /// @title LmTick /// @notice Contains functions for managing tick processes and relevant calculations library LmTick { using LowGasSafeMath for int256; using SafeCast for int256; // info stored for each initialized individual tick struct Info { // the total position liquidity that references this tick uint128 liquidityGross; // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left), int128 liquidityNet; // reward growth per unit of liquidity on the _other_ side of this tick (relative to the current tick) // only has relative meaning, not absolute — the value depends on when the tick is initialized uint256 rewardGrowthOutsideX128; } /// @notice Retrieves reward growth data /// @param self The mapping containing all tick information for initialized ticks /// @param tickLower The lower tick boundary of the position /// @param tickUpper The upper tick boundary of the position /// @param tickCurrent The current tick /// @param rewardGrowthGlobalX128 The all-time global reward growth, per unit of liquidity /// @return rewardGrowthInsideX128 The all-time reward growth, per unit of liquidity, inside the position's tick boundaries function getRewardGrowthInside( mapping(int24 => LmTick.Info) storage self, int24 tickLower, int24 tickUpper, int24 tickCurrent, uint256 rewardGrowthGlobalX128 ) internal view returns (uint256 rewardGrowthInsideX128) { Info storage lower = self[tickLower]; Info storage upper = self[tickUpper]; // calculate reward growth below uint256 rewardGrowthBelowX128; if (tickCurrent >= tickLower) { rewardGrowthBelowX128 = lower.rewardGrowthOutsideX128; } else { rewardGrowthBelowX128 = rewardGrowthGlobalX128 - lower.rewardGrowthOutsideX128; } // calculate reward growth above uint256 rewardGrowthAboveX128; if (tickCurrent < tickUpper) { rewardGrowthAboveX128 = upper.rewardGrowthOutsideX128; } else { rewardGrowthAboveX128 = rewardGrowthGlobalX128 - upper.rewardGrowthOutsideX128; } rewardGrowthInsideX128 = rewardGrowthGlobalX128 - rewardGrowthBelowX128 - rewardGrowthAboveX128; } /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa /// @param self The mapping containing all tick information for initialized ticks /// @param tick The tick that will be updated /// @param tickCurrent The current tick /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left) /// @param rewardGrowthGlobalX128 The all-time global reward growth, per unit of liquidity /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick /// @param maxLiquidity The maximum liquidity allocation for a single tick /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa function update( mapping(int24 => LmTick.Info) storage self, int24 tick, int24 tickCurrent, int128 liquidityDelta, uint256 rewardGrowthGlobalX128, bool upper, uint128 maxLiquidity ) internal returns (bool flipped) { LmTick.Info storage info = self[tick]; uint128 liquidityGrossBefore = info.liquidityGross; uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta); require(liquidityGrossAfter <= maxLiquidity, 'LO'); flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0); if (liquidityGrossBefore == 0) { // by convention, we assume that all growth before a tick was initialized happened _below_ the tick if (tick <= tickCurrent) { info.rewardGrowthOutsideX128 = rewardGrowthGlobalX128; } } info.liquidityGross = liquidityGrossAfter; // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed) info.liquidityNet = upper ? int256(info.liquidityNet).sub(liquidityDelta).toInt128() : int256(info.liquidityNet).add(liquidityDelta).toInt128(); } /// @notice Clears tick data /// @param self The mapping containing all initialized tick information for initialized ticks /// @param tick The tick that will be cleared function clear(mapping(int24 => LmTick.Info) storage self, int24 tick) internal { delete self[tick]; } /// @notice Transitions to next tick as needed by price movement /// @param self The mapping containing all tick information for initialized ticks /// @param tick The destination tick of the transition /// @param rewardGrowthGlobalX128 The all-time global reward growth, per unit of liquidity, in token0 /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left) function cross( mapping(int24 => LmTick.Info) storage self, int24 tick, uint256 rewardGrowthGlobalX128 ) internal returns (int128 liquidityNet) { LmTick.Info storage info = self[tick]; info.rewardGrowthOutsideX128 = rewardGrowthGlobalX128 - info.rewardGrowthOutsideX128; liquidityNet = info.liquidityNet; } }
{ "optimizer": { "enabled": true, "runs": 1000000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"REWARD_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"currTimestamp","type":"uint32"}],"name":"accumulateReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"},{"internalType":"int24","name":"","type":"int24"}],"name":"checkThirdLMPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"bool","name":"zeroForOne","type":"bool"}],"name":"crossLmTick","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"firstLMPool","outputs":[{"internalType":"contract ILMPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"getRewardGrowthInside","outputs":[{"internalType":"uint256","name":"rewardGrowthInsideX128","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialization","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastRewardTimestamp","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lmLiquidity","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"lmTicks","outputs":[{"internalType":"uint128","name":"liquidityGross","type":"uint128"},{"internalType":"int128","name":"liquidityNet","type":"int128"},{"internalType":"uint256","name":"rewardGrowthOutsideX128","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"}],"name":"lmTicksFlag","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"masterChef","outputs":[{"internalType":"contract IMasterChefV3","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"","type":"int24"},{"internalType":"int24","name":"","type":"int24"}],"name":"negativeRewardGrowthInsideInitValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract IPancakeV3Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardGrowthGlobalX128","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"secondLMPool","outputs":[{"internalType":"contract ILMPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"thirdLMPool","outputs":[{"internalType":"contract ILMPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"int128","name":"liquidityDelta","type":"int128"}],"name":"updatePosition","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101515760003560e01c80637ddb11d4116100cd578063b77efe0f11610081578063c3487ff811610066578063c3487ff814610336578063f8077fae14610363578063f94616011461038457610151565b8063b77efe0f14610326578063c172085e1461032e57610151565b80638910faf1116100b25780638910faf1146102c2578063a4984633146102f6578063ac1f40e11461031e57610151565b80637ddb11d41461029a5780638129fc1c146102ba57610151565b80634e8845e01161012457806357806ada1161010957806357806ada1461022a578063702d75d214610232578063764e94ce1461025c57610151565b80634e8845e01461021a578063575a86b21461022257610151565b806316f0115b14610156578063214a6fe21461018757806337182c1b146101ac5780633d6aa5e114610200575b600080fd5b61015e6103ae565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101aa6004803603602081101561019d57600080fd5b503563ffffffff166103d2565b005b6101cc600480360360208110156101c257600080fd5b503560020b610706565b604080516fffffffffffffffffffffffffffffffff9094168452600f9290920b602084015282820152519081900360600190f35b61020861074b565b60408051918252519081900360200190f35b61015e610754565b61015e610778565b61020861079c565b6102086004803603604081101561024857600080fd5b508035600290810b9160200135900b6107a2565b6102866004803603604081101561027257600080fd5b508035600290810b9160200135900b6107c7565b604080519115158252519081900360200190f35b610286600480360360208110156102b057600080fd5b503560020b6107e7565b6101aa6107fc565b6101aa600480360360608110156102d857600080fd5b508035600290810b91602081013590910b9060400135600f0b610b02565b6101aa6004803603604081101561030c57600080fd5b50803560020b90602001351515610e2e565b61015e610f99565b61015e610fbd565b610286610fe1565b61033e611002565b604080516fffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61036b61101a565b6040805163ffffffff9092168252519081900360200190f35b6102086004803603604081101561039a57600080fd5b508035600290810b9160200135900b61103a565b7f0000000000000000000000009b5699d18dff51fc65fb8ad6f70d93287c36349f81565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009b5699d18dff51fc65fb8ad6f70d93287c36349f16148061044b57503373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e16145b6104b657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f4e6f7420706f6f6c206f72204d43000000000000000000000000000000000000604482015290519081900360640190fd5b60035463ffffffff7001000000000000000000000000000000009091048116908216116104e257610703565b6003546fffffffffffffffffffffffffffffffff16156106bf576000807f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e73ffffffffffffffffffffffffffffffffffffffff1663a15ea89f7f0000000000000000000000009b5699d18dff51fc65fb8ad6f70d93287c36349f6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b1580156105a557600080fd5b505afa1580156105b9573d6000803e3d6000fd5b505050506040513d60408110156105cf57600080fd5b508051602090910151909250905080600063ffffffff80861690831611156106165750600354700100000000000000000000000000000000900463ffffffff16840361065f565b60035463ffffffff7001000000000000000000000000000000009091048116908316111561065f5750600354700100000000000000000000000000000000900463ffffffff1681035b63ffffffff8116156106ba576106b08163ffffffff166106968670010000000000000000000000000000000064e8d4a51000611057565b6003546fffffffffffffffffffffffffffffffff16611057565b6001805490910190555b505050505b600380547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff1670010000000000000000000000000000000063ffffffff8416021790555b50565b600260205260009081526040902080546001909101546fffffffffffffffffffffffffffffffff8216917001000000000000000000000000000000009004600f0b9083565b64e8d4a5100081565b7f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a9781565b7f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e81565b60015481565b60006107ae8383611125565b50905060006107bd848461135a565b9091039392505050565b600560209081526000928352604080842090915290825290205460ff1681565b60006020819052908152604090205460ff1681565b60035474010000000000000000000000000000000000000000900460ff16610b0057600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055604080517f57806ada000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a9716916357806ada916004808301926020929190829003018186803b1580156108e357600080fd5b505afa1580156108f7573d6000803e3d6000fd5b505050506040513d602081101561090d57600080fd5b5051600155604080517fc3487ff8000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a97169163c3487ff8916004808301926020929190829003018186803b15801561099857600080fd5b505afa1580156109ac573d6000803e3d6000fd5b505050506040513d60208110156109c257600080fd5b5051600380547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff909216919091179055604080517ff8077fae00000000000000000000000000000000000000000000000000000000815290517f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a9773ffffffffffffffffffffffffffffffffffffffff169163f8077fae916004808301926020929190829003018186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b50516003805463ffffffff909216700100000000000000000000000000000000027fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff9092169190911790555b565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e1614610ba657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600660248201527f4e6f74204d430000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b610baf836115d1565b610bb8826115d1565b60007f0000000000000000000000009b5699d18dff51fc65fb8ad6f70d93287c36349f73ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610c2057600080fd5b505afa158015610c34573d6000803e3d6000fd5b505050506040513d60e0811015610c4a57600080fd5b50602090810151604080517f70cf754a000000000000000000000000000000000000000000000000000000008152905191935060009273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009b5699d18dff51fc65fb8ad6f70d93287c36349f16926370cf754a926004808201939291829003018186803b158015610cda57600080fd5b505afa158015610cee573d6000803e3d6000fd5b505050506040513d6020811015610d0457600080fd5b5051600154909150600080600f86900b15610d4057610d2a60028987898760008a6116bc565b9150610d3d60028887898760018a6116bc565b90505b8760020b8560020b12158015610d5b57508660020b8560020b125b15610dc157600354610d7f906fffffffffffffffffffffffffffffffff16876118a5565b600380547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff929092169190911790555b600086600f0b1215610def578115610dde57610dde6002896119e9565b8015610def57610def6002886119e9565b600086600f0b128015610e0657508180610e065750805b15610e1a57610e158888611a08565b610e24565b610e248888611a9e565b5050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009b5699d18dff51fc65fb8ad6f70d93287c36349f1614610ed257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f4e6f7420706f6f6c000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b610edb826115d1565b600282810b810b600090815260209190915260409020546fffffffffffffffffffffffffffffffff16610f0d57610f95565b6000610f27836001546002611b979092919063ffffffff16565b90508115610f33576000035b600354610f52906fffffffffffffffffffffffffffffffff16826118a5565b600380547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055505b5050565b7f000000000000000000000000ab59d6ce5dbae726f2333da3b87f67e76b17ed5281565b7f000000000000000000000000ea13484cdc92d959818f12b65b14eb496ee2546381565b60035474010000000000000000000000000000000000000000900460ff1681565b6003546fffffffffffffffffffffffffffffffff1681565b600354700100000000000000000000000000000000900463ffffffff1681565b600460209081526000928352604080842090915290825290205481565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709868602925082811090839003039050806110ab57600084116110a057600080fd5b50829004905061111e565b8084116110b757600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008060007f0000000000000000000000009b5699d18dff51fc65fb8ad6f70d93287c36349f73ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561119057600080fd5b505afa1580156111a4573d6000803e3d6000fd5b505050506040513d60e08110156111ba57600080fd5b506020015190506111c9611f92565b600286810b900b60009081526020819052604090205460ff161561124f5750600285810b810b60009081526020918252604090819020815160608101835281546fffffffffffffffffffffffffffffffff811682527001000000000000000000000000000000009004600f90810b810b900b93810193909352600101549082015261125b565b61125886611bd6565b90505b611263611f92565b600286810b900b60009081526020819052604090205460ff16156112e95750600285810b810b60009081526020918252604090819020815160608101835281546fffffffffffffffffffffffffffffffff811682527001000000000000000000000000000000009004600f90810b810b900b9381019390935260010154908201526112f5565b6112f286611bd6565b90505b60008760020b8460020b1261130f5750604082015161131a565b506040820151600154035b60008760020b8560020b121561133557506040820151611340565b506040820151600154035b6001548281038290039a9290910111975095505050505050565b600282810b810b600090815260056020908152604080832085850b90940b83529290529081205460ff16156113b45750600282810b810b600090815260046020908152604080832085850b90940b835292905220546115cb565b60007f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a9773ffffffffffffffffffffffffffffffffffffffff1663a9c6abe085856040518363ffffffff1660e01b8152600401808360020b81526020018260020b81526020019250505060206040518083038186803b15801561143557600080fd5b505afa158015611449573d6000803e3d6000fd5b505050506040513d602081101561145f57600080fd5b50519050801561151b577f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a9773ffffffffffffffffffffffffffffffffffffffff1663f946160185856040518363ffffffff1660e01b8152600401808360020b81526020018260020b81526020019250505060206040518083038186803b1580156114e857600080fd5b505afa1580156114fc573d6000803e3d6000fd5b505050506040513d602081101561151257600080fd5b505191506115c9565b7f000000000000000000000000ea13484cdc92d959818f12b65b14eb496ee2546373ffffffffffffffffffffffffffffffffffffffff1663f946160185856040518363ffffffff1660e01b8152600401808360020b81526020018260020b81526020019250505060206040518083038186803b15801561159a57600080fd5b505afa1580156115ae573d6000803e3d6000fd5b505050506040513d60208110156115c457600080fd5b505191505b505b92915050565b600281810b900b60009081526020819052604090205460ff1661070357600281810b900b600090815260208190526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561163581611bd6565b600291820b820b600090815260209283526040908190208251815494840151600f0b6fffffffffffffffffffffffffffffffff908116700100000000000000000000000000000000029181167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909616959095179094169390931783550151600190910155565b600286810b900b600090815260208890526040812080546fffffffffffffffffffffffffffffffff16826116f082896118a5565b9050846fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff16111561178557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f4c4f000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6fffffffffffffffffffffffffffffffff82811615908216158114159450156117bd578860020b8a60020b136117bd57600183018790555b82547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff82161783558561183457825461182f9061182a907001000000000000000000000000000000009004600f90810b810b908b900b611f55565b611f6b565b611862565b82546118629061182a907001000000000000000000000000000000009004600f90810b810b908b900b611f7c565b8354600f9190910b6fffffffffffffffffffffffffffffffff90811670010000000000000000000000000000000002911617909255509098975050505050505050565b60008082600f0b121561195157826fffffffffffffffffffffffffffffffff168260000384039150816fffffffffffffffffffffffffffffffff161061194c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f4c53000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6115cb565b826fffffffffffffffffffffffffffffffff168284019150816fffffffffffffffffffffffffffffffff1610156115cb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f4c41000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600290810b900b60009081526020919091526040812081815560010155565b600282810b810b600081815260046020908152604080832086860b90950b808452948252808320839055928252600581528282209382529290925290205460ff16610f9557600282810b810b600090815260056020908152604080832085850b90940b83529290522080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555050565b600080611aab8484611125565b915091506000611abb858561135a565b600286810b810b600090815260056020908152604080832089850b90940b8352929052205490915060ff16611b5157600285810b810b600081815260056020908152604080832089860b90950b80845294825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055928252600481528282209382529290925290208190555b8115611b9057801580611b6357508281115b15611b9057600285810b810b600090815260046020908152604080832088850b90940b8352929052208390555b5050505050565b600291820b90910b60009081526020929092526040909120600181018054909203909155547001000000000000000000000000000000009004600f0b90565b611bde611f92565b7f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a9773ffffffffffffffffffffffffffffffffffffffff16637ddb11d4836040518263ffffffff1660e01b8152600401808260020b815260200191505060206040518083038186803b158015611c5257600080fd5b505afa158015611c66573d6000803e3d6000fd5b505050506040513d6020811015611c7c57600080fd5b505115611d5f577f0000000000000000000000005d56bcbba44d0a96c8b8608a65a61eb6d0ae0a9773ffffffffffffffffffffffffffffffffffffffff166337182c1b836040518263ffffffff1660e01b8152600401808260020b815260200191505060606040518083038186803b158015611cf757600080fd5b505afa158015611d0b573d6000803e3d6000fd5b505050506040513d6060811015611d2157600080fd5b50805160208083015160409384015193850193909352600f92830b90920b918301919091526fffffffffffffffffffffffffffffffff168152611f50565b7f000000000000000000000000ea13484cdc92d959818f12b65b14eb496ee2546373ffffffffffffffffffffffffffffffffffffffff16637ddb11d4836040518263ffffffff1660e01b8152600401808260020b815260200191505060206040518083038186803b158015611dd357600080fd5b505afa158015611de7573d6000803e3d6000fd5b505050506040513d6020811015611dfd57600080fd5b505115611e78577f000000000000000000000000ea13484cdc92d959818f12b65b14eb496ee2546373ffffffffffffffffffffffffffffffffffffffff166337182c1b836040518263ffffffff1660e01b8152600401808260020b815260200191505060606040518083038186803b158015611cf757600080fd5b7f000000000000000000000000ab59d6ce5dbae726f2333da3b87f67e76b17ed5273ffffffffffffffffffffffffffffffffffffffff166337182c1b836040518263ffffffff1660e01b8152600401808260020b815260200191505060606040518083038186803b158015611eec57600080fd5b505afa158015611f00573d6000803e3d6000fd5b505050506040513d6060811015611f1657600080fd5b50805160208083015160409384015193850193909352600f92830b90920b918301919091526fffffffffffffffffffffffffffffffff1681525b919050565b818101828112156000831215146115cb57600080fd5b80600f81900b8114611f5057600080fd5b808203828113156000831215146115cb57600080fd5b60408051606081018252600080825260208201819052918101919091529056fea2646970667358221220cf54a837df6692f9eea2b8f28632554035b93dfe28c5b5c2a02c24bd6bcba1c464736f6c63430007060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.