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 | |||
---|---|---|---|---|---|---|
17520441 | 427 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xa84bc307...0c0935eF6 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:
No with 200 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; uint256 public rewardGrowthGlobalX128; mapping(int24 => LmTick.Info) public lmTicks; // The old version LMPool. ILMPool public immutable oldLMPool; mapping(int24 => bool) public lmTicksFlag; 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 oldLMPool. mapping(int24 => mapping(int24 => bool)) public checkOldLMPool; 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 oldLMPoolAddress) = IPancakeV3LmPoolDeveloper( msg.sender ).parameters(); pool = IPancakeV3Pool(poolAddress); masterChef = IMasterChefV3(masterChefAddress); oldLMPool = ILMPool(oldLMPoolAddress); lastRewardTimestamp = uint32(block.timestamp); } /// @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 = oldLMPool.rewardGrowthGlobalX128(); lmLiquidity = oldLMPool.lmLiquidity(); lastRewardTimestamp = oldLMPool.lastRewardTimestamp(); } } function _getLMTicks(int24 tick) internal view returns (LmTick.Info memory info) { (info.liquidityGross, info.liquidityNet, info.rewardGrowthOutsideX128) = oldLMPool.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 oldLMPool. _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 old LMPool , use current negativeRewardGrowthInsideInitValue. if (checkOldLMPool[tickLower][tickUpper]) { initValue = negativeRewardGrowthInsideInitValue[tickLower][tickUpper]; } else { initValue = oldLMPool.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 old LMPool once , and initialize negativeRewardGrowthInsideInitValue. if (!checkOldLMPool[tickLower][tickUpper]) { checkOldLMPool[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 oldLMPool after tick flipped. if (!checkOldLMPool[tickLower][tickUpper]) checkOldLMPool[tickLower][tickUpper] = true; } function updatePosition(int24 tickLower, int24 tickUpper, int128 liquidityDelta) external onlyMasterChef { // Update the lmTicks state from the oldLMPool. _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 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); }
// 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 oldLMPool); }
// 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": false, "runs": 200 }, "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":"checkOldLMPool","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":[{"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":"oldLMPool","outputs":[{"internalType":"contract ILMPool","name":"","type":"address"}],"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":[{"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
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80638129fc1c116100a2578063c172085e11610071578063c172085e146103cf578063c3487ff8146103ef578063d3c03efe1461041f578063f8077fae14610453578063f9461601146104775761010b565b80638129fc1c146102e95780638910faf1146102f3578063a49846331461033e578063bf7e34881461037b5761010b565b8063575a86b2116100de578063575a86b2146101fe57806357806ada14610232578063702d75d2146102505780637ddb11d4146102a25761010b565b806316f0115b14610110578063214a6fe21461014457806337182c1b146101785780633d6aa5e1146101e0575b600080fd5b6101186104c9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101766004803603602081101561015a57600080fd5b81019080803563ffffffff1690602001909291905050506104ed565b005b6101a76004803603602081101561018e57600080fd5b81019080803560020b9060200190929190505050610876565b60405180846fffffffffffffffffffffffffffffffff16815260200183600f0b8152602001828152602001935050505060405180910390f35b6101e86108c9565b6040518082815260200191505060405180910390f35b6102066108d2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61023a6108f6565b6040518082815260200191505060405180910390f35b61028c6004803603604081101561026657600080fd5b81019080803560020b9060200190929190803560020b90602001909291905050506108fc565b6040518082815260200191505060405180910390f35b6102d1600480360360208110156102b857600080fd5b81019080803560020b9060200190929190505050610927565b60405180821515815260200191505060405180910390f35b6102f1610947565b005b61033c6004803603606081101561030957600080fd5b81019080803560020b9060200190929190803560020b90602001909291908035600f0b9060200190929190505050610bba565b005b6103796004803603604081101561035457600080fd5b81019080803560020b9060200190929190803515159060200190929190505050610f75565b005b6103b76004803603604081101561039157600080fd5b81019080803560020b9060200190929190803560020b9060200190929190505050611126565b60405180821515815260200191505060405180910390f35b6103d7611155565b60405180821515815260200191505060405180910390f35b6103f7611168565b60405180826fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61042761118a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61045b6111ae565b604051808263ffffffff16815260200191505060405180910390f35b6104b36004803603604081101561048d57600080fd5b81019080803560020b9060200190929190803560020b90602001909291905050506111c4565b6040518082815260200191505060405180910390f35b7f000000000000000000000000402b2bceb1415f48b413752cc0e27d76ff34ddeb81565b7f000000000000000000000000402b2bceb1415f48b413752cc0e27d76ff34ddeb73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061059257507f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610604576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420706f6f6c206f72204d4300000000000000000000000000000000000081525060200191505060405180910390fd5b600360109054906101000a900463ffffffff1663ffffffff168163ffffffff161161062e57610873565b6000600360009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1614610851576000807f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e73ffffffffffffffffffffffffffffffffffffffff1663a15ea89f7f000000000000000000000000402b2bceb1415f48b413752cc0e27d76ff34ddeb6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b15801561070f57600080fd5b505afa158015610723573d6000803e3d6000fd5b505050506040513d604081101561073957600080fd5b81019080805190602001909291908051906020019092919050505091509150600081905060008463ffffffff168263ffffffff16111561078f57600360109054906101000a900463ffffffff16850390506107ce565b600360109054906101000a900463ffffffff1663ffffffff168263ffffffff1611156107cd57600360109054906101000a900463ffffffff16820390505b5b60008163ffffffff161461084c5761083d8163ffffffff166108078670010000000000000000000000000000000064e8d4a510006111e9565b600360009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166111e9565b60008082825401925050819055505b505050505b80600360106101000a81548163ffffffff021916908363ffffffff1602179055505b50565b60016020528060005260406000206000915090508060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a9004600f0b908060010154905083565b64e8d4a5100081565b7f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e81565b60005481565b600061090883836112c3565b5080915050600061091984846115d2565b905080820391505092915050565b60026020528060005260406000206000915054906101000a900460ff1681565b600360149054906101000a900460ff16610bb8576001600360146101000a81548160ff0219169083151502179055507f0000000000000000000000004d8a7988676b9a62500beb2adfbf5915fe3534d873ffffffffffffffffffffffffffffffffffffffff166357806ada6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109dc57600080fd5b505afa1580156109f0573d6000803e3d6000fd5b505050506040513d6020811015610a0657600080fd5b81019080805190602001909291905050506000819055507f0000000000000000000000004d8a7988676b9a62500beb2adfbf5915fe3534d873ffffffffffffffffffffffffffffffffffffffff1663c3487ff86040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8357600080fd5b505afa158015610a97573d6000803e3d6000fd5b505050506040513d6020811015610aad57600080fd5b8101908080519060200190929190505050600360006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055507f0000000000000000000000004d8a7988676b9a62500beb2adfbf5915fe3534d873ffffffffffffffffffffffffffffffffffffffff1663f8077fae6040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5c57600080fd5b505afa158015610b70573d6000803e3d6000fd5b505050506040513d6020811015610b8657600080fd5b8101908080519060200190929190505050600360106101000a81548163ffffffff021916908363ffffffff1602179055505b565b7f000000000000000000000000556b9306565093c855aea9ae92a594704c2cd59e73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f4e6f74204d43000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b610c8483611712565b610c8d82611712565b60007f000000000000000000000000402b2bceb1415f48b413752cc0e27d76ff34ddeb73ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d60e0811015610d1f57600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190505050505050505091505060007f000000000000000000000000402b2bceb1415f48b413752cc0e27d76ff34ddeb73ffffffffffffffffffffffffffffffffffffffff166370cf754a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ddc57600080fd5b505afa158015610df0573d6000803e3d6000fd5b505050506040513d6020811015610e0657600080fd5b81019080805190602001909291905050509050600080549050600080600086600f0b14610e7057610e4c888688866000896001611823909695949392919063ffffffff16565b9150610e6d878688866001896001611823909695949392919063ffffffff16565b90505b8760020b8560020b12158015610e8b57508660020b8560020b125b15610ef157610eb8600360009054906101000a90046fffffffffffffffffffffffffffffffff1687611a69565b600360006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055505b600086600f0b1215610f34578115610f1857610f17886001611bc290919063ffffffff16565b5b8015610f3357610f32876001611bc290919063ffffffff16565b5b5b600086600f0b128015610f4c57508180610f4b5750805b5b15610f6057610f5b8888611c2f565b610f6b565b610f6a8888611cf5565b5b5050505050505050565b7f000000000000000000000000402b2bceb1415f48b413752cc0e27d76ff34ddeb73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611036576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f4e6f7420706f6f6c00000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b61103f82611712565b6000600160008460020b60020b815260200190815260200160002060000160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16141561109757611122565b60006110b1836000546001611e2c9092919063ffffffff16565b905081156110c0578060000390505b6110e8600360009054906101000a90046fffffffffffffffffffffffffffffffff1682611a69565b600360006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550505b5050565b60056020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600360149054906101000a900460ff1681565b600360009054906101000a90046fffffffffffffffffffffffffffffffff1681565b7f0000000000000000000000004d8a7988676b9a62500beb2adfbf5915fe3534d881565b600360109054906101000a900463ffffffff1681565b6004602052816000526040600020602052806000526040600020600091509150505481565b600080600080198587098587029250828110838203039150506000811415611224576000841161121857600080fd5b838204925050506112bc565b80841161123057600080fd5b600084868809905082811182039150808303925060008586600003169050808604955080840493506001818260000304019050808302841793506000600287600302189050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050505b9392505050565b60008060007f000000000000000000000000402b2bceb1415f48b413752cc0e27d76ff34ddeb73ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561132e57600080fd5b505afa158015611342573d6000803e3d6000fd5b505050506040513d60e081101561135857600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505050505050509150506113b5611fe8565b600260008760020b60020b815260200190815260200160002060009054906101000a900460ff161561147d57600160008760020b60020b81526020019081526020016000206040518060600160405290816000820160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016000820160109054906101000a9004600f0b600f0b600f0b81526020016001820154815250509050611489565b61148686611e74565b90505b611491611fe8565b600260008760020b60020b815260200190815260200160002060009054906101000a900460ff161561155957600160008760020b60020b81526020019081526020016000206040518060600160405290816000820160009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1681526020016000820160109054906101000a9004600f0b600f0b600f0b81526020016001820154815250509050611565565b61156286611e74565b90505b60008760020b8460020b12611580578260400151905061158c565b82604001516000540390505b60008760020b8560020b12156115a857826040015190506115b4565b82604001516000540390505b80826000540303965060005481830111955050505050509250929050565b6000600560008460020b60020b815260200190815260200160002060008360020b60020b815260200190815260200160002060009054906101000a900460ff161561164f57600460008460020b60020b815260200190815260200160002060008360020b60020b815260200190815260200160002054905061170c565b7f0000000000000000000000004d8a7988676b9a62500beb2adfbf5915fe3534d873ffffffffffffffffffffffffffffffffffffffff1663f946160184846040518363ffffffff1660e01b8152600401808360020b81526020018260020b81526020019250505060206040518083038186803b1580156116ce57600080fd5b505afa1580156116e2573d6000803e3d6000fd5b505050506040513d60208110156116f857600080fd5b810190808051906020019092919050505090505b92915050565b600260008260020b60020b815260200190815260200160002060009054906101000a900460ff16611820576001600260008360020b60020b815260200190815260200160002060006101000a81548160ff02191690831515021790555061177881611e74565b600160008360020b60020b815260200190815260200160002060008201518160000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060208201518160000160106101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff160217905550604082015181600101559050505b50565b6000808860008960020b60020b8152602001908152602001600020905060008160000160009054906101000a90046fffffffffffffffffffffffffffffffff16905060006118718289611a69565b9050846fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff16111561190d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260028152602001807f4c4f00000000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000826fffffffffffffffffffffffffffffffff161415156000826fffffffffffffffffffffffffffffffff16141515141593506000826fffffffffffffffffffffffffffffffff161415611974578860020b8a60020b13611973578683600101819055505b5b808360000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550856119eb576119e66119e189600f0b8560000160109054906101000a9004600f0b600f0b611f8990919063ffffffff16565b611fac565b611a1e565b611a1d611a1889600f0b8560000160109054906101000a9004600f0b600f0b611fc590919063ffffffff16565b611fac565b5b8360000160106101000a8154816fffffffffffffffffffffffffffffffff0219169083600f0b6fffffffffffffffffffffffffffffffff160217905550505050979650505050505050565b60008082600f0b1215611b1c57826fffffffffffffffffffffffffffffffff168260000384039150816fffffffffffffffffffffffffffffffff1610611b17576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260028152602001807f4c5300000000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b611bbc565b826fffffffffffffffffffffffffffffffff168284019150816fffffffffffffffffffffffffffffffff161015611bbb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260028152602001807f4c4100000000000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b92915050565b8160008260020b60020b8152602001908152602001600020600080820160006101000a8154906fffffffffffffffffffffffffffffffff02191690556000820160106101000a8154906fffffffffffffffffffffffffffffffff0219169055600182016000905550505050565b6000600460008460020b60020b815260200190815260200160002060008360020b60020b815260200190815260200160002081905550600560008360020b60020b815260200190815260200160002060008260020b60020b815260200190815260200160002060009054906101000a900460ff16611cf1576001600560008460020b60020b815260200190815260200160002060008360020b60020b815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b600080611d0284846112c3565b915091506000611d1285856115d2565b9050600560008660020b60020b815260200190815260200160002060008560020b60020b815260200190815260200160002060009054906101000a900460ff16611dd5576001600560008760020b60020b815260200190815260200160002060008660020b60020b815260200190815260200160002060006101000a81548160ff02191690831515021790555080600460008760020b60020b815260200190815260200160002060008660020b60020b8152602001908152602001600020819055505b8115611e25576000811480611de957508281115b15611e245782600460008760020b60020b815260200190815260200160002060008660020b60020b8152602001908152602001600020819055505b5b5050505050565b6000808460008560020b60020b815260200190815260200160002090508060010154830381600101819055508060000160109054906101000a9004600f0b9150509392505050565b611e7c611fe8565b7f0000000000000000000000004d8a7988676b9a62500beb2adfbf5915fe3534d873ffffffffffffffffffffffffffffffffffffffff166337182c1b836040518263ffffffff1660e01b8152600401808260020b815260200191505060606040518083038186803b158015611ef057600080fd5b505afa158015611f04573d6000803e3d6000fd5b505050506040513d6060811015611f1a57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050508360000184602001856040018381525083600f0b600f0b815250836fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815250505050919050565b6000808212151515838385019250821215151514611fa657600080fd5b92915050565b60008182915081600f0b14611fc057600080fd5b919050565b6000808212151515838385039250821315151514611fe257600080fd5b92915050565b604051806060016040528060006fffffffffffffffffffffffffffffffff1681526020016000600f0b815260200160008152509056fea2646970667358221220e0205a6e00b1a833d7fda67cf9e5f6910f42cb4376af20670e5bba475e1a1fbf64736f6c63430007060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 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.