Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
CustomUnstakedFeeModule
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 200 runs
Other Settings:
istanbul EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; import "../interfaces/ICLPool.sol"; import "../interfaces/fees/ICustomFeeModule.sol"; contract CustomUnstakedFeeModule is ICustomFeeModule { /// @inheritdoc IFeeModule ICLFactory public override factory; /// @inheritdoc ICustomFeeModule mapping(address => uint24) public override customFee; uint256 public constant MAX_FEE = 500_000; // 50% // Override to indicate there is custom 0% fee - as a 0 value in the customFee mapping indicates // that no custom fee rate has been set uint256 public constant ZERO_FEE_INDICATOR = 420; constructor(address _factory) { factory = ICLFactory(_factory); } /// @inheritdoc ICustomFeeModule function setCustomFee(address pool, uint24 fee) external override { require(msg.sender == factory.unstakedFeeManager()); require(fee <= MAX_FEE || fee == ZERO_FEE_INDICATOR); require(factory.isPair(pool)); customFee[pool] = fee; emit SetCustomFee(pool, fee); } /// @inheritdoc IFeeModule function getFee(address pool) external view override returns (uint24) { uint24 fee = customFee[pool]; return fee == ZERO_FEE_INDICATOR ? 0 : fee != 0 ? fee : 100_000; // Default fee is 10% } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import "./pool/ICLPoolConstants.sol"; import "./pool/ICLPoolState.sol"; import "./pool/ICLPoolDerivedState.sol"; import "./pool/ICLPoolActions.sol"; import "./pool/ICLPoolOwnerActions.sol"; import "./pool/ICLPoolEvents.sol"; /// @title The interface for a CL Pool /// @notice A CL 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 ICLPool is ICLPoolConstants, ICLPoolState, ICLPoolDerivedState, ICLPoolActions, ICLPoolEvents, ICLPoolOwnerActions {}
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; import "./IFeeModule.sol"; interface ICustomFeeModule is IFeeModule { event SetCustomFee(address indexed pool, uint24 indexed fee); /// @notice Returns the custom fee for a given pool if set, otherwise returns 0 /// @dev Can use default fee by setting the fee to 0, can set zero fee by setting default fee to ZERO_FEE_INDICATOR /// @param pool The pool to get the custom fee for /// @return The custom fee for the given pool function customFee(address pool) external view returns (uint24); /// @notice Sets a custom fee for a given pool /// @dev Can use default fee by setting the fee to 0, can set zero fee by setting default fee to ZERO_FEE_INDICATOR /// @dev Must be called by the current fee manager /// @param pool The pool to set the custom fee for /// @param fee The fee to set for the given pool function setCustomFee(address pool, uint24 fee) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are not defined as immutable (due to proxy pattern) but are effectively immutable. /// @notice i.e., the methods will always return the same values interface ICLPoolConstants { /// @notice The contract that deployed the pool, which must adhere to the ICLFactory 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 gauge corresponding to this pool /// @return The gauge contract address function gauge() external view returns (address); /// @notice The nft manager /// @return The nft manager contract address function nft() external view returns (address); /// @notice The factory registry that manages pool <> gauge <> reward factory relationships /// @return The factory registry contract address function factoryRegistry() external view returns (address); /// @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 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 ICLPoolState { /// @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. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked ); /// @notice The pool's swap & flash fee in pips, i.e. 1e-6 /// @dev Can be modified in PoolFactory on a pool basis or upgraded to be dynamic. /// @return The swap & flash fee function fee() external view returns (uint24); /// @notice The pool's unstaked fee in pips, i.e. 1e-6 /// @dev Can be modified in PoolFactory on a pool basis or upgraded to be dynamic. /// @return The unstaked fee function unstakedFee() external view returns (uint24); /// @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 reward growth as a Q128.128 rewards of emission collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function rewardGrowthGlobalX128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the gauge /// @dev Gauge fees will never exceed uint128 max in either token function gaugeFees() external view returns (uint128 token0, uint128 token1); /// @notice the emission rate of time-based farming function rewardRate() external view returns (uint256); /// @notice acts as a virtual reserve that holds information on how many rewards are yet to be distributed function rewardReserve() external view returns (uint256); /// @notice timestamp of the end of the current epoch's rewards function periodFinish() external view returns (uint256); /// @notice last time the rewardReserve and rewardRate were updated function lastUpdated() external view returns (uint32); /// @notice tracks total rewards distributed when no staked liquidity in active tick for epoch ending at periodFinish /// @notice this amount is rolled over on the next call to notifyRewardAmount /// @dev rollover will always be smaller than the rewards distributed that epoch function rollover() external view returns (uint256); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks /// @dev This value includes staked liquidity function liquidity() external view returns (uint128); /// @notice The currently in range staked liquidity available to the pool /// @dev This value has no relationship to the total staked liquidity across all ticks function stakedLiquidity() 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, /// stakedLiquidityNet how much staked 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, /// rewardGrowthOutsideX128 the reward growth on the other side of the tick from the current tick in emission token /// 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, int128 stakedLiquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, uint256 rewardGrowthOutsideX128, 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 ); /// @notice Returns data about reward growth within a tick range. /// RewardGrowthGlobalX128 can be supplied as a parameter for claimable reward calculations. /// @dev Used in gauge reward/earned calculations /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @param _rewardGrowthGlobalX128 a calculated rewardGrowthGlobalX128 or 0 (in case of 0 it means we use the rewardGrowthGlobalX128 from state) /// @return rewardGrowthInsideX128 The reward growth in the range function getRewardGrowthInside(int24 tickLower, int24 tickUpper, uint256 _rewardGrowthGlobalX128) external view returns (uint256 rewardGrowthInsideX128); }
// 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 ICLPoolDerivedState { /// @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 Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface ICLPoolActions { /// @notice Initialize function used in proxy deployment /// @dev Can be called once only /// Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @dev not locked because it initializes unlocked /// @param _factory The CL factory contract address /// @param _token0 The first token of the pool by address sort order /// @param _token1 The second token of the pool by address sort order /// @param _tickSpacing The pool tick spacing /// @param _factoryRegistry The address of the factory registry managing the pool factory /// @param _sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 function initialize( address _factory, address _token0, address _token1, int24 _tickSpacing, address _factoryRegistry, uint160 _sqrtPriceX96 ) external; /// @notice Initialize gauge and nft manager /// @dev Callable only once, by the gauge factory /// @param _gauge The gauge corresponding to this pool /// @param _nft The position manager used for position management function setGaugeAndPositionManager(address _gauge, address _nft) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of ICLMintCallback#uniswapV3MintCallback /// 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 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 /// @param owner Owner of the position in the pool (nft manager or gauge) /// @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, address owner ) 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 Burn liquidity from the supplied owner 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 /// @param owner Owner of the position in the pool (nft manager or gauge) /// @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, address owner) external returns (uint256 amount0, uint256 amount1); /// @notice Convert existing liquidity into staked liquidity /// @notice Only callable by the gauge associated with this pool /// @param stakedLiquidityDelta The amount by which to increase or decrease the staked liquidity /// @param tickLower The lower tick of the position for which to stake liquidity /// @param tickUpper The upper tick of the position for which to stake liquidity /// @param positionUpdate If the nft and gauge position should be updated function stake(int128 stakedLiquidityDelta, int24 tickLower, int24 tickUpper, bool positionUpdate) external; /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of ICLSwapCallback#uniswapV3SwapCallback /// @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 ICLFlashCallback#uniswapV3FlashCallback /// @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; /// @notice Updates rewardGrowthGlobalX128 every time when any tick is crossed, /// or when any position is staked/unstaked from the gauge function updateRewardsGrowthGlobal() external; /// @notice Syncs rewards with gauge /// @param rewardRate the rate rewards being distributed during the epoch /// @param rewardReserve the available rewards to be distributed during the epoch /// @param periodFinish the end of the current period of rewards, updated once per epoch function syncReward(uint256 rewardRate, uint256 rewardReserve, uint256 periodFinish) external; }
// 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 ICLPoolOwnerActions { /// @notice Collect the gauge fee accrued to the pool /// @return amount0 The gauge fee collected in token0 /// @return amount1 The gauge fee collected in token1 function collectFees() external returns (uint128 amount0, uint128 amount1); }
// 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 ICLPoolEvents { /// @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 event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @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(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the gauge /// @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 CollectFees(address indexed recipient, uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; import "../../interfaces/ICLFactory.sol"; interface IFeeModule { /// @notice Get the factory that the fee module belongs to function factory() external view returns (ICLFactory); /// @notice Get fee for a given pool. Accounts for default and dynamic fees /// @dev Fee is denominated in bips. /// @param pool The pool to get the fee for /// @return The fee for the given pool function getFee(address pool) external view returns (uint24); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import {IVoter} from "contracts/core/interfaces/IVoter.sol"; import {IFactoryRegistry} from "contracts/core/interfaces/IFactoryRegistry.sol"; /// @title The interface for the CL Factory /// @notice The CL Factory facilitates creation of CL pools and control over the protocol fees interface ICLFactory { /// @notice Emitted when the owner of the factory is changed /// @param oldOwner The owner before the owner was changed /// @param newOwner The owner after the owner was changed event OwnerChanged(address indexed oldOwner, address indexed newOwner); /// @notice Emitted when the swapFeeManager of the factory is changed /// @param oldFeeManager The swapFeeManager before the swapFeeManager was changed /// @param newFeeManager The swapFeeManager after the swapFeeManager was changed event SwapFeeManagerChanged(address indexed oldFeeManager, address indexed newFeeManager); /// @notice Emitted when the swapFeeModule of the factory is changed /// @param oldFeeModule The swapFeeModule before the swapFeeModule was changed /// @param newFeeModule The swapFeeModule after the swapFeeModule was changed event SwapFeeModuleChanged(address indexed oldFeeModule, address indexed newFeeModule); /// @notice Emitted when the unstakedFeeManager of the factory is changed /// @param oldFeeManager The unstakedFeeManager before the unstakedFeeManager was changed /// @param newFeeManager The unstakedFeeManager after the unstakedFeeManager was changed event UnstakedFeeManagerChanged(address indexed oldFeeManager, address indexed newFeeManager); /// @notice Emitted when the unstakedFeeModule of the factory is changed /// @param oldFeeModule The unstakedFeeModule before the unstakedFeeModule was changed /// @param newFeeModule The unstakedFeeModule after the unstakedFeeModule was changed event UnstakedFeeModuleChanged(address indexed oldFeeModule, address indexed newFeeModule); /// @notice Emitted when the defaultUnstakedFee of the factory is changed /// @param oldUnstakedFee The defaultUnstakedFee before the defaultUnstakedFee was changed /// @param newUnstakedFee The defaultUnstakedFee after the unstakedFeeModule was changed event DefaultUnstakedFeeChanged(uint24 indexed oldUnstakedFee, uint24 indexed newUnstakedFee); /// @notice Emitted when a pool is created /// @param token0 The first token of the pool by address sort order /// @param token1 The second token of the pool by address sort order /// @param tickSpacing The minimum number of ticks between initialized ticks /// @param pool The address of the created pool event PoolCreated(address indexed token0, address indexed token1, int24 indexed tickSpacing, address pool); /// @notice Emitted when a new tick spacing is enabled for pool creation via the factory /// @param tickSpacing The minimum number of ticks between initialized ticks for pools /// @param fee The default fee for a pool created with a given tickSpacing event TickSpacingEnabled(int24 indexed tickSpacing, uint24 indexed fee); /// @notice The voter contract, used to create gauges /// @return The address of the voter contract function voter() external view returns (IVoter); /// @notice The address of the pool implementation contract used to deploy proxies / clones /// @return The address of the pool implementation contract function poolImplementation() external view returns (address); /// @notice Factory registry for valid pool / gauge / rewards factories /// @return The address of the factory registry function factoryRegistry() external view returns (IFactoryRegistry); /// @notice Returns the current owner of the factory /// @dev Can be changed by the current owner via setOwner /// @return The address of the factory owner function owner() external view returns (address); /// @notice Returns the current swapFeeManager of the factory /// @dev Can be changed by the current swap fee manager via setSwapFeeManager /// @return The address of the factory swapFeeManager function swapFeeManager() external view returns (address); /// @notice Returns the current swapFeeModule of the factory /// @dev Can be changed by the current swap fee manager via setSwapFeeModule /// @return The address of the factory swapFeeModule function swapFeeModule() external view returns (address); /// @notice Returns the current unstakedFeeManager of the factory /// @dev Can be changed by the current unstaked fee manager via setUnstakedFeeManager /// @return The address of the factory unstakedFeeManager function unstakedFeeManager() external view returns (address); /// @notice Returns the current unstakedFeeModule of the factory /// @dev Can be changed by the current unstaked fee manager via setUnstakedFeeModule /// @return The address of the factory unstakedFeeModule function unstakedFeeModule() external view returns (address); /// @notice Returns the current defaultUnstakedFee of the factory /// @dev Can be changed by the current unstaked fee manager via setDefaultUnstakedFee /// @return The default Unstaked Fee of the factory function defaultUnstakedFee() external view returns (uint24); /// @notice Returns a default fee for a tick spacing. /// @dev Use getFee for the most up to date fee for a given pool. /// A tick spacing can never be removed, so this value should be hard coded or cached in the calling context /// @param tickSpacing The enabled tick spacing. Returns 0 if not enabled /// @return fee The default fee for the given tick spacing function tickSpacingToFee(int24 tickSpacing) external view returns (uint24 fee); /// @notice Returns a list of enabled tick spacings. Used to iterate through pools created by the factory /// @dev Tick spacings cannot be removed. Tick spacings are not ordered /// @return List of enabled tick spacings function tickSpacings() external view returns (int24[] memory); /// @notice Returns the pool address for a given pair of tokens and a tick spacing, or address 0 if it does not exist /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param tickSpacing The tick spacing of the pool /// @return pool The pool address function getPool(address tokenA, address tokenB, int24 tickSpacing) external view returns (address pool); /// @notice Return address of pool created by this factory given its `index` /// @param index Index of the pool /// @return The pool address in the given index function allPools(uint256 index) external view returns (address); /// @notice Returns the number of pools created from this factory /// @return Number of pools created from this factory function allPoolsLength() external view returns (uint256); /// @notice Used in VotingEscrow to determine if a contract is a valid pool of the factory /// @param pool The address of the pool to check /// @return Whether the pool is a valid pool of the factory function isPair(address pool) external view returns (bool); /// @notice Get swap & flash fee for a given pool. Accounts for default and dynamic fees /// @dev Swap & flash fee is denominated in pips. i.e. 1e-6 /// @param pool The pool to get the swap & flash fee for /// @return The swap & flash fee for the given pool function getSwapFee(address pool) external view returns (uint24); /// @notice Get unstaked fee for a given pool. Accounts for default and dynamic fees /// @dev Unstaked fee is denominated in pips. i.e. 1e-6 /// @param pool The pool to get the unstaked fee for /// @return The unstaked fee for the given pool function getUnstakedFee(address pool) external view returns (uint24); /// @notice Creates a pool for the given two tokens and fee /// @param tokenA One of the two tokens in the desired pool /// @param tokenB The other of the two tokens in the desired pool /// @param tickSpacing The desired tick spacing for the pool /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. The call will /// revert if the pool already exists, the tick spacing is invalid, or the token arguments are invalid /// @return pool The address of the newly created pool function createPool(address tokenA, address tokenB, int24 tickSpacing, uint160 sqrtPriceX96) external returns (address pool); /// @notice Updates the owner of the factory /// @dev Must be called by the current owner /// @param _owner The new owner of the factory function setOwner(address _owner) external; /// @notice Updates the swapFeeManager of the factory /// @dev Must be called by the current swap fee manager /// @param _swapFeeManager The new swapFeeManager of the factory function setSwapFeeManager(address _swapFeeManager) external; /// @notice Updates the swapFeeModule of the factory /// @dev Must be called by the current swap fee manager /// @param _swapFeeModule The new swapFeeModule of the factory function setSwapFeeModule(address _swapFeeModule) external; /// @notice Updates the unstakedFeeManager of the factory /// @dev Must be called by the current unstaked fee manager /// @param _unstakedFeeManager The new unstakedFeeManager of the factory function setUnstakedFeeManager(address _unstakedFeeManager) external; /// @notice Updates the unstakedFeeModule of the factory /// @dev Must be called by the current unstaked fee manager /// @param _unstakedFeeModule The new unstakedFeeModule of the factory function setUnstakedFeeModule(address _unstakedFeeModule) external; /// @notice Updates the defaultUnstakedFee of the factory /// @dev Must be called by the current unstaked fee manager /// @param _defaultUnstakedFee The new defaultUnstakedFee of the factory function setDefaultUnstakedFee(uint24 _defaultUnstakedFee) external; /// @notice Enables a certain tickSpacing /// @dev Tick spacings may never be removed once enabled /// @param tickSpacing The spacing between ticks to be enforced in the pool /// @param fee The default fee associated with a given tick spacing function enableTickSpacing(int24 tickSpacing, uint24 fee) external; }
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma abicoder v2; import {IVotingEscrow} from "contracts/core/interfaces/IVotingEscrow.sol"; import {IFactoryRegistry} from "contracts/core/interfaces/IFactoryRegistry.sol"; interface IVoter { function ve() external view returns (IVotingEscrow); function vote(uint256 _tokenId, address[] calldata _poolVote, uint256[] calldata _weights) external; function gauges(address _pool) external view returns (address); function gaugeToFees(address _gauge) external view returns (address); function gaugeToBribes(address _gauge) external view returns (address); function createGauge(address _poolFactory, address _pool) external returns (address); function distribute(address gauge) external; function factoryRegistry() external view returns (IFactoryRegistry); /// @dev Utility to distribute to gauges of pools in array. /// @param _gauges Array of gauges to distribute to. function distribute(address[] memory _gauges) external; function isAlive(address _gauge) external view returns (bool); function killGauge(address _gauge) external; function emergencyCouncil() external view returns (address); /// @notice Claim emissions from gauges. /// @param _gauges Array of gauges to collect emissions from. function claimRewards(address[] memory _gauges) external; /// @notice Claim fees for a given NFT. /// @dev Utility to help batch fee claims. /// @param _fees Array of FeesVotingReward contracts to collect from. /// @param _tokens Array of tokens that are used as fees. /// @param _tokenId Id of veNFT that you wish to claim fees for. function claimFees(address[] memory _fees, address[][] memory _tokens, uint256 _tokenId) external; }
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; interface IFactoryRegistry { function approve(address poolFactory, address votingRewardsFactory, address gaugeFactory) external; function isPoolFactoryApproved(address poolFactory) external returns (bool); function factoriesToPoolFactory(address poolFactory) external returns (address votingRewardsFactory, address gaugeFactory); }
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; interface IVotingEscrow { function team() external returns (address); /// @notice Deposit `_value` tokens for `msg.sender` and lock for `_lockDuration` /// @param _value Amount to deposit /// @param _lockDuration Number of seconds to lock tokens for (rounded down to nearest week) /// @return TokenId of created veNFT function createLock(uint256 _value, uint256 _lockDuration) external returns (uint256); }
{ "remappings": [ "@ensdomains/=node_modules/@ensdomains/", "@solidity-parser/=node_modules/solhint/node_modules/@solidity-parser/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "hardhat/=node_modules/hardhat/", "@openzeppelin/=lib/openzeppelin-contracts/", "@nomad-xyz/=lib/ExcessivelySafeCall/", "@uniswap/=lib/solidity-lib/", "base64-sol/=lib/base64/", "ExcessivelySafeCall/=lib/ExcessivelySafeCall/src/", "base64/=lib/base64/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "solidity-lib/=lib/solidity-lib/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "istanbul", "viaIR": false, "libraries": { "contracts/periphery/libraries/NFTDescriptor.sol": { "NFTDescriptor": "0xfAE8D931A86dAe150C42c5dC1AD4Fa8fdb2f9dC3" }, "contracts/periphery/libraries/NFTSVG.sol": { "NFTSVG": "0x3965a9701A9F7cDE3914334a5D719e536af079D8" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":true,"internalType":"uint24","name":"fee","type":"uint24"}],"name":"SetCustomFee","type":"event"},{"inputs":[],"name":"MAX_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZERO_FEE_INDICATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"customFee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract ICLFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"getFee","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"setCustomFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506040516103ea3803806103ea8339818101604052602081101561003357600080fd5b5051600080546001600160a01b039092166001600160a01b0319909216919091179055610385806100656000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806338c55d46146100675780634d419abc14610081578063a89196b6146100bf578063b88c9148146100f2578063bc063e1a14610118578063c45a015514610120575b600080fd5b61006f610144565b60408051918252519081900360200190f35b6100a76004803603602081101561009757600080fd5b50356001600160a01b031661014a565b6040805162ffffff9092168252519081900360200190f35b6100f0600480360360408110156100d557600080fd5b5080356001600160a01b0316906020013562ffffff16610161565b005b6100a76004803603602081101561010857600080fd5b50356001600160a01b03166102ee565b61006f610339565b610128610340565b604080516001600160a01b039092168252519081900360200190f35b6101a481565b60016020526000908152604090205462ffffff1681565b60008054906101000a90046001600160a01b03166001600160a01b03166382e189e06040518163ffffffff1660e01b815260040160206040518083038186803b1580156101ad57600080fd5b505afa1580156101c1573d6000803e3d6000fd5b505050506040513d60208110156101d757600080fd5b50516001600160a01b031633146101ed57600080fd5b6207a1208162ffffff1611158061020a57506101a48162ffffff16145b61021357600080fd5b6000546040805163e5e31b1360e01b81526001600160a01b0385811660048301529151919092169163e5e31b13916024808301926020929190829003018186803b15801561026057600080fd5b505afa158015610274573d6000803e3d6000fd5b505050506040513d602081101561028a57600080fd5b505161029557600080fd5b6001600160a01b038216600081815260016020526040808220805462ffffff191662ffffff861690811790915590519092917fd444e1b10a2a0c61e10ee9f0167820955df343074f16b69614952caef34de21d91a35050565b6001600160a01b03811660009081526001602052604081205462ffffff166101a4811461032f5762ffffff811661032857620186a061032a565b805b610332565b60005b9392505050565b6207a12081565b6000546001600160a01b03168156fea26469706673582212204acc57ae721a8f362766fcd68a58535d773ea9a36024c0a7ad41eaa55d9786ee64736f6c63430007060033000000000000000000000000cc0bddb707055e04e497ab22a59c2af4391cd12f
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100625760003560e01c806338c55d46146100675780634d419abc14610081578063a89196b6146100bf578063b88c9148146100f2578063bc063e1a14610118578063c45a015514610120575b600080fd5b61006f610144565b60408051918252519081900360200190f35b6100a76004803603602081101561009757600080fd5b50356001600160a01b031661014a565b6040805162ffffff9092168252519081900360200190f35b6100f0600480360360408110156100d557600080fd5b5080356001600160a01b0316906020013562ffffff16610161565b005b6100a76004803603602081101561010857600080fd5b50356001600160a01b03166102ee565b61006f610339565b610128610340565b604080516001600160a01b039092168252519081900360200190f35b6101a481565b60016020526000908152604090205462ffffff1681565b60008054906101000a90046001600160a01b03166001600160a01b03166382e189e06040518163ffffffff1660e01b815260040160206040518083038186803b1580156101ad57600080fd5b505afa1580156101c1573d6000803e3d6000fd5b505050506040513d60208110156101d757600080fd5b50516001600160a01b031633146101ed57600080fd5b6207a1208162ffffff1611158061020a57506101a48162ffffff16145b61021357600080fd5b6000546040805163e5e31b1360e01b81526001600160a01b0385811660048301529151919092169163e5e31b13916024808301926020929190829003018186803b15801561026057600080fd5b505afa158015610274573d6000803e3d6000fd5b505050506040513d602081101561028a57600080fd5b505161029557600080fd5b6001600160a01b038216600081815260016020526040808220805462ffffff191662ffffff861690811790915590519092917fd444e1b10a2a0c61e10ee9f0167820955df343074f16b69614952caef34de21d91a35050565b6001600160a01b03811660009081526001602052604081205462ffffff166101a4811461032f5762ffffff811661032857620186a061032a565b805b610332565b60005b9392505050565b6207a12081565b6000546001600160a01b03168156fea26469706673582212204acc57ae721a8f362766fcd68a58535d773ea9a36024c0a7ad41eaa55d9786ee64736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cc0bddb707055e04e497ab22a59c2af4391cd12f
-----Decoded View---------------
Arg [0] : _factory (address): 0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000cc0bddb707055e04e497ab22a59c2af4391cd12f
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.