Overview
S Balance
0 S
S Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
NftSettingsRegistry
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { IUniswapV3Pool, IUniswapV3PoolState, IUniswapV3PoolImmutables } from "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol"; import { INonfungiblePositionManager } from "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol"; import { Sickle } from "contracts/Sickle.sol"; import { INftSettingsRegistry } from "contracts/interfaces/INftSettingsRegistry.sol"; import { RewardBehavior, RewardConfig } from "contracts/structs/PositionSettingsStructs.sol"; import { NftKey, NftSettings, ExitConfig, RebalanceConfig } from "contracts/structs/NftSettingsStructs.sol"; import { SickleFactory } from "contracts/SickleFactory.sol"; interface IPreviousAutomation { function rewardAutomation( address user ) external returns (RewardBehavior); function harvestTokensOut( address user ) external returns (address); } interface IPreviousNftSettingsRegistry { struct PreviousRebalanceConfig { int24 bufferTicksBelow; int24 bufferTicksAbove; uint256 slippageBP; int24 cutoffTickLow; int24 cutoffTickHigh; uint8 delayMin; } struct PreviousNftSettings { bool autoRebalance; RewardBehavior rewardBehavior; address harvestTokenOut; PreviousRebalanceConfig rebalanceConfig; } function getNftSettings( NftKey memory key ) external returns (PreviousNftSettings memory); } contract NftSettingsRegistry is INftSettingsRegistry { error AutoHarvestNotSet(); error AutoCompoundNotSet(); error AutoRebalanceNotSet(); error AutoExitNotSet(); error CompoundOrHarvestNotSet(); error CompoundAndHarvestBothSet(); error ExitTriggersNotSet(); error InvalidTokenOut(); error InvalidMinMaxTickRange(); error InvalidSlippageBP(); error InvalidPriceImpactBP(); error InvalidDustBP(); error InvalidMinTickLow(); error InvalidMaxTickHigh(); error OnlySickle(); error RebalanceConfigNotSet(); error TickWithinRange(); error TickOutsideStopLossRange(); error SickleNotDeployed(); error InvalidWidth(uint24 actual, uint24 expected); event NftSettingsSet(NftKey key, NftSettings settings); event NftSettingsUnset(NftKey key); uint256 constant MAX_SLIPPAGE_BP = 500; uint256 constant MAX_PRICE_IMPACT_BP = 5000; uint256 constant MAX_DUST_BP = 5000; int24 constant MAX_TICK = 887_272; int24 constant MIN_TICK = -MAX_TICK; SickleFactory public immutable factory; constructor( SickleFactory _factory ) { factory = _factory; } mapping(bytes32 => NftSettings) settingsMap; /* Public functions */ function getNftSettings( NftKey memory key ) public view returns (NftSettings memory) { return settingsMap[keccak256(abi.encode(key))]; } function validateHarvestFor( NftKey memory key ) public view { NftSettings memory settings = getNftSettings(key); if ( !settings.automateRewards || settings.rewardConfig.rewardBehavior != RewardBehavior.Harvest ) { revert AutoHarvestNotSet(); } } function validateCompoundFor( NftKey memory key ) public view { NftSettings memory settings = getNftSettings(key); if ( !settings.automateRewards || settings.rewardConfig.rewardBehavior != RewardBehavior.Compound ) { revert AutoCompoundNotSet(); } } // Validate that a rebalanceFor meets the user requirements function validateRebalanceFor( NftKey memory key ) public { NftSettings memory settings = getNftSettings(key); RebalanceConfig memory config = settings.rebalanceConfig; if (!settings.autoRebalance) { revert AutoRebalanceNotSet(); } if (config.cutoffTickLow == 0) { revert RebalanceConfigNotSet(); } (,,,,, int24 tickLower, int24 tickUpper,,,,,) = key.nftManager.positions(key.tokenId); int24 tick = _get_current_tick(settings.pool); if ( tick >= tickLower - int24(config.bufferTicksBelow) && tick < tickUpper + int24(config.bufferTicksAbove) ) { revert TickWithinRange(); } if (tick <= config.cutoffTickLow || tick >= config.cutoffTickHigh) { revert TickOutsideStopLossRange(); } } function validateExitFor( NftKey memory key ) public { NftSettings memory settings = getNftSettings(key); ExitConfig memory config = settings.exitConfig; if (!settings.autoExit) { revert AutoExitNotSet(); } int24 tick = _get_current_tick(settings.pool); if (tick >= config.triggerTickLow && tick < config.triggerTickHigh) { revert TickWithinRange(); } } /* Sickle Owner functions */ function setNftSettings( INonfungiblePositionManager nftManager, uint256 tokenId, NftSettings calldata settings ) external { Sickle sickle = _get_sickle_by_owner(msg.sender); NftKey memory key = NftKey(sickle, nftManager, tokenId); _set_nft_settings(key, settings); } function unsetNftSettings( INonfungiblePositionManager nftManager, uint256 tokenId ) external { Sickle sickle = _get_sickle_by_owner(msg.sender); NftKey memory key = NftKey(sickle, nftManager, tokenId); _unset_nft_settings(key); } /* Sickle (delegatecall) functions */ function setNftSettings( NftKey calldata key, NftSettings calldata settings ) external { Sickle sickle = Sickle(payable(msg.sender)); if (key.sickle != sickle) { revert OnlySickle(); } _set_nft_settings(key, settings); } function resetNftSettings( NftKey calldata oldKey, NftKey calldata newKey, NftSettings calldata settings ) external { Sickle sickle = Sickle(payable(msg.sender)); if (oldKey.sickle != sickle || newKey.sickle != sickle) { revert OnlySickle(); } _unset_nft_settings(oldKey); _set_nft_settings(newKey, settings); } function migrateNftSettings( IPreviousAutomation automation, IPreviousNftSettingsRegistry previousNftSettingsRegistry, INonfungiblePositionManager nftManager, IUniswapV3Pool[] memory pools, uint256[] memory tokenIds ) external { Sickle sickle = _get_sickle_by_owner(msg.sender); uint256 tokenLength = tokenIds.length; for (uint256 i; i < tokenLength; i++) { NftKey memory key = NftKey(sickle, nftManager, tokenIds[i]); RebalanceConfig memory newConfig = _get_new_rebalance_config( previousNftSettingsRegistry, key, pools[i] ); NftSettings memory settings = _get_new_nft_settings(automation, sickle, pools[i], newConfig); _set_nft_settings(key, settings); } } /* Modifiers */ modifier checkConfigValues(NftKey memory key, NftSettings memory settings) { if (settings.autoRebalance) { _check_rebalance_config(settings.rebalanceConfig); _check_tick_width(key, settings); } else { if ( settings.rebalanceConfig.cutoffTickLow != 0 || settings.rebalanceConfig.cutoffTickHigh != 0 ) { revert AutoRebalanceNotSet(); } } if ( settings.rewardConfig.rewardBehavior != RewardBehavior.Harvest && settings.rewardConfig.harvestTokenOut != address(0) ) { revert InvalidTokenOut(); } if (!settings.autoExit) { if ( settings.exitConfig.triggerTickLow != 0 || settings.exitConfig.triggerTickHigh != 0 || settings.exitConfig.exitTokenOutLow != address(0) || settings.exitConfig.exitTokenOutHigh != address(0) || settings.exitConfig.slippageBP != 0 || settings.exitConfig.priceImpactBP != 0 ) { revert AutoExitNotSet(); } } else { if ( settings.exitConfig.triggerTickLow == 0 && settings.exitConfig.triggerTickHigh == 0 ) { revert ExitTriggersNotSet(); } if (settings.exitConfig.slippageBP > MAX_SLIPPAGE_BP) { revert InvalidSlippageBP(); } if ( settings.exitConfig.priceImpactBP > MAX_PRICE_IMPACT_BP || settings.exitConfig.priceImpactBP == 0 ) { revert InvalidPriceImpactBP(); } } _; } /* Internal */ function _get_sickle_by_owner( address owner ) internal view returns (Sickle) { Sickle sickle = Sickle(payable(factory.sickles(owner))); if (address(sickle) == address(0)) { revert SickleNotDeployed(); } return sickle; } function _set_nft_settings( NftKey memory key, NftSettings memory settings ) internal checkConfigValues(key, settings) { settingsMap[keccak256(abi.encode(key))] = settings; emit NftSettingsSet(key, settings); } function _unset_nft_settings( NftKey memory key ) internal { delete settingsMap[keccak256(abi.encode(key))]; emit NftSettingsUnset(key); } // Tick is the 2nd field in slot0, the rest can vary function _get_current_tick( IUniswapV3Pool pool ) internal returns (int24) { (, bytes memory result) = address(pool).call(abi.encodeCall(IUniswapV3PoolState.slot0, ())); int24 tick; assembly { tick := mload(add(result, 64)) } return tick; } // Check configuratgion parameters for errors function _check_rebalance_config( RebalanceConfig memory config ) internal pure { if (config.cutoffTickLow < MIN_TICK) { revert InvalidMinTickLow(); } if (config.cutoffTickLow >= config.cutoffTickHigh) { revert InvalidMinMaxTickRange(); } if (config.cutoffTickHigh > MAX_TICK) { revert InvalidMaxTickHigh(); } if (config.slippageBP > MAX_SLIPPAGE_BP) { revert InvalidSlippageBP(); } if ( config.priceImpactBP > MAX_PRICE_IMPACT_BP || config.priceImpactBP == 0 ) { revert InvalidPriceImpactBP(); } if (config.dustBP > MAX_DUST_BP || config.dustBP == 0) { revert InvalidDustBP(); } if ( config.rewardConfig.rewardBehavior != RewardBehavior.Harvest && config.rewardConfig.harvestTokenOut != address(0) ) { revert InvalidTokenOut(); } } function _check_tick_width( NftKey memory key, NftSettings memory settings ) internal view { (,,,,, int24 tickLower, int24 tickUpper,,,,,) = key.nftManager.positions(key.tokenId); int24 tickSpacing = settings.pool.tickSpacing(); uint24 actualWidth = uint24(tickUpper - tickLower) / uint24(tickSpacing); uint24 expectedWidth = settings.rebalanceConfig.tickSpacesBelow + settings.rebalanceConfig.tickSpacesAbove + 1; if (actualWidth != expectedWidth) { revert InvalidWidth(actualWidth, expectedWidth); } } /* Migration internals */ function _get_position_tick_spaces_each_side( NftKey memory key, IUniswapV3Pool pool ) private view returns (uint24 below, uint24 above) { (,,,,, int24 tickLower, int24 tickUpper,,,,,) = key.nftManager.positions(key.tokenId); int24 tickSpacing = pool.tickSpacing(); uint24 totalSpaces = uint24((tickUpper - tickLower) / tickSpacing - 1); below = totalSpaces / 2; above = totalSpaces / 2 + totalSpaces % 2; } function _get_new_nft_settings( IPreviousAutomation automation, Sickle sickle, IUniswapV3Pool pool, RebalanceConfig memory newConfig ) internal returns (NftSettings memory) { address sickleOwner = sickle.owner(); RewardBehavior rewardBehavior = automation.rewardAutomation(sickleOwner); return NftSettings({ pool: pool, autoRebalance: true, rebalanceConfig: newConfig, automateRewards: rewardBehavior != RewardBehavior.None, rewardConfig: RewardConfig( rewardBehavior, automation.harvestTokensOut(sickleOwner) ), autoExit: false, exitConfig: ExitConfig(0, 0, address(0), address(0), 0, 0) }); } function _get_new_rebalance_config( IPreviousNftSettingsRegistry previousNftSettingsRegistry, NftKey memory key, IUniswapV3Pool pool ) internal returns (RebalanceConfig memory) { IPreviousNftSettingsRegistry.PreviousNftSettings memory previousSettings = previousNftSettingsRegistry.getNftSettings(key); IPreviousNftSettingsRegistry.PreviousRebalanceConfig memory oldConfig = previousSettings.rebalanceConfig; (uint24 spacesBelow, uint24 spacesAbove) = _get_position_tick_spaces_each_side(key, pool); return RebalanceConfig( spacesBelow, spacesAbove, int24(oldConfig.bufferTicksBelow), int24(oldConfig.bufferTicksAbove), oldConfig.slippageBP, oldConfig.slippageBP, oldConfig.slippageBP, oldConfig.cutoffTickLow, oldConfig.cutoffTickHigh, oldConfig.delayMin, RewardConfig( previousSettings.rewardBehavior, previousSettings.harvestTokenOut ) ); } }
// 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 IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the /// IUniswapV3Factory 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); } /// @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 IUniswapV3PoolState { /// @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 /// @return 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. /// @return observationIndex The index of the last oracle observation that /// was written, /// @return observationCardinality The current maximum number of /// observations stored in the pool, /// @return observationCardinalityNext The next maximum number of /// observations, to be updated when the observation. /// @return 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, uint8 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 /// @return The liquidity at the current price of the pool 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 /// @return liquidityNet how much liquidity changes when the pool price /// crosses the tick, /// @return feeGrowthOutside0X128 the fee growth on the other side of the /// tick from the current tick in token0, /// @return feeGrowthOutside1X128 the fee growth on the other side of the /// tick from the current tick in token1, /// @return tickCumulativeOutside the cumulative tick value on the other /// side of the tick from the current tick /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity /// on the other side of the tick from the current tick, /// @return secondsOutside the seconds spent on the other side of the tick /// from the current tick, /// @return 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, /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick /// range as of the last mint/burn/poke, /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick /// range as of the last mint/burn/poke, /// @return tokensOwed0 the computed amount of token0 owed to the position /// as of the last mint/burn/poke, /// @return 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, /// @return tickCumulative the tick multiplied by seconds elapsed for the /// life of the pool as of the observation timestamp, /// @return secondsPerLiquidityCumulativeX128 the seconds per in range /// liquidity for the life of the pool as of the observation timestamp, /// @return 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 ); } interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState { function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { IERC721Enumerable } from "openzeppelin-contracts/contracts/interfaces/IERC721Enumerable.sol"; interface INonfungiblePositionManager is IERC721Enumerable { struct IncreaseLiquidityParams { uint256 tokenId; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } struct MintParams { address token0; address token1; uint24 fee; int24 tickLower; int24 tickUpper; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; } struct DecreaseLiquidityParams { uint256 tokenId; uint128 liquidity; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } struct CollectParams { uint256 tokenId; address recipient; uint128 amount0Max; uint128 amount1Max; } function increaseLiquidity(IncreaseLiquidityParams memory params) external payable returns (uint256 amount0, uint256 amount1, uint256 liquidity); function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1); function mint(MintParams memory params) external payable returns (uint256 tokenId, uint256 amount0, uint256 amount1); function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1); function burn(uint256 tokenId) external payable; function positions(uint256 tokenId) external view returns ( uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { SickleStorage } from "contracts/base/SickleStorage.sol"; import { Multicall } from "contracts/base/Multicall.sol"; import { SickleRegistry } from "contracts/SickleRegistry.sol"; /// @title Sickle contract /// @author vfat.tools /// @notice Sickle facilitates farming and interactions with Masterchef /// contracts /// @dev Base contract inheriting from all the other "manager" contracts contract Sickle is SickleStorage, Multicall { /// @notice Function to receive ETH receive() external payable { } /// @param sickleRegistry_ Address of the SickleRegistry contract constructor( SickleRegistry sickleRegistry_ ) initializer Multicall(sickleRegistry_) { _Sickle_initialize(address(0), address(0)); } /// @param sickleOwner_ Address of the Sickle owner function initialize( address sickleOwner_, address approved_ ) external initializer { _Sickle_initialize(sickleOwner_, approved_); } /// INTERNALS /// function _Sickle_initialize( address sickleOwner_, address approved_ ) internal { SickleStorage._SickleStorage_initialize(sickleOwner_, approved_); } function onERC721Received( address, // operator address, // from uint256, // tokenId bytes calldata // data ) external pure returns (bytes4) { return this.onERC721Received.selector; } function onERC1155Received( address, // operator address, // from uint256, // id uint256, // value bytes calldata // data ) external pure returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived( address, // operator address, // from uint256[] calldata, // ids uint256[] calldata, // values bytes calldata // data ) external pure returns (bytes4) { return this.onERC1155BatchReceived.selector; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { NftKey, NftSettings } from "contracts/structs/NftSettingsStructs.sol"; interface INftSettingsRegistry { function getNftSettings( NftKey calldata key ) external view returns (NftSettings memory); function setNftSettings( NftKey calldata key, NftSettings calldata settings ) external; function resetNftSettings( NftKey calldata oldKey, NftKey calldata newKey, NftSettings calldata settings ) external; function validateRebalanceFor( NftKey memory key ) external; function validateExitFor( NftKey memory key ) external; function validateHarvestFor( NftKey memory key ) external; function validateCompoundFor( NftKey memory key ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { IPool } from "contracts/interfaces/external/aerodrome/IPool.sol"; import { Sickle } from "contracts/Sickle.sol"; struct PositionKey { Sickle sickle; address stakingContract; uint256 poolIndex; } enum RewardBehavior { None, Harvest, Compound } struct RewardConfig { RewardBehavior rewardBehavior; address harvestTokenOut; } struct ExitConfig { uint256 triggerPriceHigh; uint256 triggerPriceLow; uint256 triggerReserves0; uint256 triggerReserves1; address exitTokenOutLow; address exitTokenOutHigh; uint256 priceImpactBP; uint256 slippageBP; } /** * Settings for automating an ERC20 position * @param pool: Uniswap or Aerodrome vAMM/sAMM pair for the position (requires * token0/token1/getReserves functions) * @param router: Router for the pair (requires connector registration) * @param automateRewards: Whether to automatically harvest or compound rewards * for this position, regardless of rebalance settings. * @param rewardConfig: Configuration for reward automation * Harvest as-is, harvest and convert to a different token, or compound into the * position. * @param autoExit: Whether to automatically exit the position when it goes out * of * range * @param exitConfig: Configuration for the above */ struct PositionSettings { IPool pair; address router; bool automateRewards; RewardConfig rewardConfig; bool autoExit; ExitConfig exitConfig; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { INonfungiblePositionManager } from "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol"; import { IUniswapV3Pool } from "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol"; import { Sickle } from "contracts/Sickle.sol"; import { RewardConfig, RewardBehavior } from "contracts/structs/PositionSettingsStructs.sol"; struct NftKey { Sickle sickle; INonfungiblePositionManager nftManager; uint256 tokenId; } struct ExitConfig { int24 triggerTickLow; int24 triggerTickHigh; address exitTokenOutLow; address exitTokenOutHigh; uint256 priceImpactBP; uint256 slippageBP; } /** * @notice Settings for automatic rebalancing * @param tickSpacesBelow: Position width measured in tick spaces below * Default: 0 (Position doesn't include any tick spaces below current) * @param tickSpacesAbove: Position width measured in tick spaces above * Default: 0 (Position doesn't include any tick spaces above current) * @param bufferTicksBelow: Difference from position tickLower to * rebalance below. Can be negative (rebalance before position goes under * range) * Default: 0 (always rebalance if tick < tickLower) * @param bufferTicksAbove: Difference from position tickUpper to * rebalance above. Can be negative (rebalance before position goes above range) * Default: 0 (always rebalance if tick >= tickUpper) * @param dustBP: Dust allowance in basis points * @param priceImpactBP: Price impact allowance in basis points * @param slippageBP: Slippage allowance in basis points * @param cutoffTickLow: Stop rebalancing below this tick * default: MIN_TICK (no stop loss) * @param cutoffTickHigh: Stop rebalancing above this tick * default: MAX_TICK (no stop loss) * @param delayMin: Delay in minutes before rebalancing * @param rewardConfig: Configuration for handling rewards when rebalancing */ struct RebalanceConfig { uint24 tickSpacesBelow; uint24 tickSpacesAbove; int24 bufferTicksBelow; int24 bufferTicksAbove; uint256 dustBP; uint256 priceImpactBP; uint256 slippageBP; int24 cutoffTickLow; int24 cutoffTickHigh; uint8 delayMin; RewardConfig rewardConfig; } /** * Settings for automating an NFT position * @param autoRebalance: Whether to rebalance automatically when position goes * out of range * @param rebalanceConfig: Configuration for the above * @param automateRewards: Whether to automatically harvest or compound rewards * for this position, regardless of rebalance settings. * @param rewardConfig: Configuration for reward automation * Harvest as-is, harvest and convert to a different token, or compound into the * position. */ struct NftSettings { IUniswapV3Pool pool; bool autoRebalance; RebalanceConfig rebalanceConfig; bool automateRewards; RewardConfig rewardConfig; bool autoExit; ExitConfig exitConfig; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { Clones } from "@openzeppelin/contracts/proxy/Clones.sol"; import { SickleRegistry } from "contracts/SickleRegistry.sol"; import { Sickle } from "contracts/Sickle.sol"; import { Admin } from "contracts/base/Admin.sol"; /// @title SickleFactory contract /// @author vfat.tools /// @notice Factory deploying new Sickle contracts contract SickleFactory is Admin { /// EVENTS /// /// @notice Emitted when a new Sickle contract is deployed /// @param admin Address receiving the admin rights of the Sickle contract /// @param sickle Address of the newly deployed Sickle contract event Deploy(address indexed admin, address sickle); /// @notice Thrown when the caller is not whitelisted /// @param caller Address of the non-whitelisted caller error CallerNotWhitelisted(address caller); // 0x252c8273 /// @notice Thrown when the factory is not active and a deploy is attempted error NotActive(); // 0x80cb55e2 /// @notice Thrown when a Sickle contract is already deployed for a user error SickleAlreadyDeployed(); //0xf6782ef1 /// STORAGE /// mapping(address => address) private _sickles; mapping(address => address) private _admins; mapping(address => bytes32) public _referralCodes; /// @notice Address of the SickleRegistry contract SickleRegistry public immutable registry; /// @notice Address of the Sickle implementation contract address public immutable implementation; /// @notice Address of the previous SickleFactory contract (if applicable) SickleFactory public immutable previousFactory; /// @notice Whether the factory is active (can deploy new Sickle contracts) bool public isActive = true; /// WRITE FUNCTIONS /// /// @param admin_ Address of the admin /// @param sickleRegistry_ Address of the SickleRegistry contract /// @param sickleImplementation_ Address of the Sickle implementation /// contract /// @param previousFactory_ Address of the previous SickleFactory contract /// if applicable constructor( address admin_, address sickleRegistry_, address sickleImplementation_, address previousFactory_ ) Admin(admin_) { registry = SickleRegistry(sickleRegistry_); implementation = sickleImplementation_; previousFactory = SickleFactory(previousFactory_); } /// @notice Update the isActive flag. /// @dev Effectively pauses and unpauses new Sickle deployments. /// @custom:access Restricted to protocol admin. function setActive(bool active) external onlyAdmin { isActive = active; } function _deploy( address admin, address approved, bytes32 referralCode ) internal returns (address sickle) { sickle = Clones.cloneDeterministic( implementation, keccak256(abi.encode(admin)) ); Sickle(payable(sickle)).initialize(admin, approved); _sickles[admin] = sickle; _admins[sickle] = admin; if (referralCode != bytes32(0)) { _referralCodes[sickle] = referralCode; } emit Deploy(admin, sickle); } function _getSickle(address admin) internal returns (address sickle) { sickle = _sickles[admin]; if (sickle != address(0)) { return sickle; } if (address(previousFactory) != address(0)) { sickle = previousFactory.sickles(admin); if (sickle != address(0)) { _sickles[admin] = sickle; _admins[sickle] = admin; _referralCodes[sickle] = previousFactory.referralCodes(sickle); return sickle; } } } /// @notice Predict the address of a Sickle contract for a specific user /// @param admin Address receiving the admin rights of the Sickle contract /// @return sickle Address of the predicted Sickle contract function predict(address admin) external view returns (address) { bytes32 salt = keccak256(abi.encode(admin)); return Clones.predictDeterministicAddress(implementation, salt); } /// @notice Returns the Sickle contract for a specific user /// @param admin Address that owns the Sickle contract /// @return sickle Address of the Sickle contract function sickles(address admin) external view returns (address sickle) { sickle = _sickles[admin]; if (sickle == address(0) && address(previousFactory) != address(0)) { sickle = previousFactory.sickles(admin); } } /// @notice Returns the admin for a specific Sickle contract /// @param sickle Address of the Sickle contract /// @return admin Address that owns the Sickle contract function admins(address sickle) external view returns (address admin) { admin = _admins[sickle]; if (admin == address(0) && address(previousFactory) != address(0)) { admin = previousFactory.admins(sickle); } } /// @notice Returns the referral code for a specific Sickle contract /// @param sickle Address of the Sickle contract /// @return referralCode Referral code for the user function referralCodes(address sickle) external view returns (bytes32 referralCode) { referralCode = _referralCodes[sickle]; if ( referralCode == bytes32(0) && address(previousFactory) != address(0) ) { referralCode = previousFactory.referralCodes(sickle); } } /// @notice Deploys a new Sickle contract for a specific user, or returns /// the existing one if it exists /// @param admin Address receiving the admin rights of the Sickle contract /// @param referralCode Referral code for the user /// @return sickle Address of the deployed Sickle contract function getOrDeploy( address admin, address approved, bytes32 referralCode ) external returns (address sickle) { if (!isActive) { revert NotActive(); } if (!registry.isWhitelistedCaller(msg.sender)) { revert CallerNotWhitelisted(msg.sender); } if ((sickle = _getSickle(admin)) != address(0)) { return sickle; } return _deploy(admin, approved, referralCode); } /// @notice Deploys a new Sickle contract for a specific user /// @dev Sickle contracts are deployed with create2, the address of the /// admin is used as a salt, so all the Sickle addresses can be pre-computed /// and only 1 Sickle will exist per address /// @param referralCode Referral code for the user /// @return sickle Address of the deployed Sickle contract function deploy( address approved, bytes32 referralCode ) external returns (address sickle) { if (!isActive) { revert NotActive(); } if (_getSickle(msg.sender) != address(0)) { revert SickleAlreadyDeployed(); } return _deploy(msg.sender, approved, referralCode); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../token/ERC721/extensions/IERC721Enumerable.sol";
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; library SickleStorageEvents { event ApprovedAddressChanged(address newApproved); } /// @title SickleStorage contract /// @author vfat.tools /// @notice Base storage of the Sickle contract /// @dev This contract needs to be inherited by stub contracts meant to be used /// with `delegatecall` abstract contract SickleStorage is Initializable { /// ERRORS /// /// @notice Thrown when the caller is not the owner of the Sickle contract error NotOwnerError(); // 0x74a21527 /// @notice Thrown when the caller is not a strategy contract or the /// Flashloan Stub error NotStrategyError(); // 0x4581ba62 /// STORAGE /// /// @notice Address of the owner address public owner; /// @notice An address that can be set by the owner of the Sickle contract /// in order to trigger specific functions. address public approved; /// MODIFIERS /// /// @dev Restricts a function call to the owner, however if the admin was /// not set yet, /// the modifier will not restrict the call, this allows the SickleFactory /// to perform /// some calls on the user's behalf before passing the admin rights to them modifier onlyOwner() { if (msg.sender != owner) revert NotOwnerError(); _; } /// INITIALIZATION /// /// @param owner_ Address of the owner of this Sickle contract function _SickleStorage_initialize( address owner_, address approved_ ) internal onlyInitializing { owner = owner_; approved = approved_; } /// WRITE FUNCTIONS /// /// @notice Sets the approved address of this Sickle /// @param newApproved Address meant to be approved by the owner function setApproved(address newApproved) external onlyOwner { approved = newApproved; emit SickleStorageEvents.ApprovedAddressChanged(newApproved); } /// @notice Checks if `caller` is either the owner of the Sickle contract /// or was approved by them /// @param caller Address to check /// @return True if `caller` is either the owner of the Sickle contract function isOwnerOrApproved(address caller) public view returns (bool) { return caller == owner || caller == approved; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { SickleStorage } from "contracts/base/SickleStorage.sol"; import { SickleRegistry } from "contracts/SickleRegistry.sol"; /// @title Multicall contract /// @author vfat.tools /// @notice Enables calling multiple methods in a single call to the contract abstract contract Multicall is SickleStorage { /// ERRORS /// error MulticallParamsMismatchError(); // 0xc1e637c9 /// @notice Thrown when the target contract is not whitelisted /// @param target Address of the non-whitelisted target error TargetNotWhitelisted(address target); // 0x47ccabe7 /// @notice Thrown when the caller is not whitelisted /// @param caller Address of the non-whitelisted caller error CallerNotWhitelisted(address caller); // 0x252c8273 /// STORAGE /// /// @notice Address of the SickleRegistry contract /// @dev Needs to be immutable so that it's accessible for Sickle proxies SickleRegistry public immutable registry; /// INITIALIZATION /// /// @param registry_ Address of the SickleRegistry contract constructor(SickleRegistry registry_) initializer { registry = registry_; } /// WRITE FUNCTIONS /// /// @notice Batch multiple calls together (calls or delegatecalls) /// @param targets Array of targets to call /// @param data Array of data to pass with the calls function multicall( address[] calldata targets, bytes[] calldata data ) external payable { if (targets.length != data.length) { revert MulticallParamsMismatchError(); } if (!registry.isWhitelistedCaller(msg.sender)) { revert CallerNotWhitelisted(msg.sender); } for (uint256 i = 0; i != data.length;) { if (targets[i] == address(0)) { unchecked { ++i; } continue; // No-op } if (targets[i] != address(this)) { if (!registry.isWhitelistedTarget(targets[i])) { revert TargetNotWhitelisted(targets[i]); } } (bool success, bytes memory result) = targets[i].delegatecall(data[i]); if (!success) { if (result.length == 0) revert(); assembly { revert(add(32, result), mload(result)) } } unchecked { ++i; } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { Admin } from "contracts/base/Admin.sol"; library SickleRegistryEvents { event CollectorChanged(address newCollector); event FeesUpdated(bytes32[] feeHashes, uint256[] feesInBP); event ReferralCodeCreated(bytes32 indexed code, address indexed referrer); // Multicall caller and target whitelist status changes event CallerStatusChanged(address caller, bool isWhitelisted); event TargetStatusChanged(address target, bool isWhitelisted); } /// @title SickleRegistry contract /// @author vfat.tools /// @notice Manages the whitelisted contracts and the collector address contract SickleRegistry is Admin { /// ERRORS /// error ArrayLengthMismatch(); // 0xa24a13a6 error FeeAboveMaxLimit(); // 0xd6cf7b5e error InvalidReferralCode(); // 0xe55b4629 /// STORAGE /// /// @notice Address of the fee collector address public collector; /// @notice Tracks the contracts that can be called through Sickle multicall /// @return True if the contract is a whitelisted target mapping(address => bool) public isWhitelistedTarget; /// @notice Tracks the contracts that can call Sickle multicall /// @return True if the contract is a whitelisted caller mapping(address => bool) public isWhitelistedCaller; /// @notice Keeps track of the referrers and their associated code mapping(bytes32 => address) public referralCodes; /// @notice Mapping for fee hashes (hash of the strategy contract addresses /// and the function selectors) and their associated fees /// @return The fee in basis points to apply to the transaction amount mapping(bytes32 => uint256) public feeRegistry; /// WRITE FUNCTIONS /// /// @param admin_ Address of the admin /// @param collector_ Address of the collector constructor(address admin_, address collector_) Admin(admin_) { collector = collector_; } /// @notice Updates the whitelist status for multiple multicall targets /// @param targets Addresses of the contracts to update /// @param isApproved New status for the contracts /// @custom:access Restricted to protocol admin. function setWhitelistedTargets( address[] calldata targets, bool isApproved ) external onlyAdmin { for (uint256 i; i < targets.length;) { isWhitelistedTarget[targets[i]] = isApproved; emit SickleRegistryEvents.TargetStatusChanged( targets[i], isApproved ); unchecked { ++i; } } } /// @notice Updates the fee collector address /// @param newCollector Address of the new fee collector /// @custom:access Restricted to protocol admin. function updateCollector(address newCollector) external onlyAdmin { collector = newCollector; emit SickleRegistryEvents.CollectorChanged(newCollector); } /// @notice Update the whitelist status for multiple multicall callers /// @param callers Addresses of the callers /// @param isApproved New status for the caller /// @custom:access Restricted to protocol admin. function setWhitelistedCallers( address[] calldata callers, bool isApproved ) external onlyAdmin { for (uint256 i; i < callers.length;) { isWhitelistedCaller[callers[i]] = isApproved; emit SickleRegistryEvents.CallerStatusChanged( callers[i], isApproved ); unchecked { ++i; } } } /// @notice Associates a referral code to the address of the caller function setReferralCode(bytes32 referralCode) external { if (referralCodes[referralCode] != address(0)) { revert InvalidReferralCode(); } referralCodes[referralCode] = msg.sender; emit SickleRegistryEvents.ReferralCodeCreated(referralCode, msg.sender); } /// @notice Update the fees for multiple strategy functions /// @param feeHashes Array of fee hashes /// @param feesArray Array of fees to apply (in basis points) /// @custom:access Restricted to protocol admin. function setFees( bytes32[] calldata feeHashes, uint256[] calldata feesArray ) external onlyAdmin { if (feeHashes.length != feesArray.length) { revert ArrayLengthMismatch(); } for (uint256 i = 0; i < feeHashes.length;) { if (feesArray[i] <= 500) { // maximum fee of 5% feeRegistry[feeHashes[i]] = feesArray[i]; } else { revert FeeAboveMaxLimit(); } unchecked { ++i; } } emit SickleRegistryEvents.FeesUpdated(feeHashes, feesArray); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPool { error DepositsNotEqual(); error BelowMinimumK(); error FactoryAlreadySet(); error InsufficientLiquidity(); error InsufficientLiquidityMinted(); error InsufficientLiquidityBurned(); error InsufficientOutputAmount(); error InsufficientInputAmount(); error IsPaused(); error InvalidTo(); error K(); error NotEmergencyCouncil(); event Fees(address indexed sender, uint256 amount0, uint256 amount1); event Mint(address indexed sender, uint256 amount0, uint256 amount1); event Burn(address indexed sender, address indexed to, uint256 amount0, uint256 amount1); event Swap( address indexed sender, address indexed to, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out ); event Sync(uint256 reserve0, uint256 reserve1); event Claim(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1); // Struct to capture time period obervations every 30 minutes, used for local oracles struct Observation { uint256 timestamp; uint256 reserve0Cumulative; uint256 reserve1Cumulative; } /// @notice Returns the decimal (dec), reserves (r), stable (st), and tokens (t) of token0 and token1 function metadata() external view returns (uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, bool st, address t0, address t1); /// @notice Claim accumulated but unclaimed fees (claimable0 and claimable1) function claimFees() external returns (uint256, uint256); /// @notice Returns [token0, token1] function tokens() external view returns (address, address); /// @notice Address of token in the pool with the lower address value function token0() external view returns (address); /// @notice Address of token in the poool with the higher address value function token1() external view returns (address); /// @notice Address of linked PoolFees.sol function poolFees() external view returns (address); /// @notice Address of PoolFactory that created this contract function factory() external view returns (address); /// @notice Capture oracle reading every 30 minutes (1800 seconds) function periodSize() external view returns (uint256); /// @notice Amount of token0 in pool function reserve0() external view returns (uint256); /// @notice Amount of token1 in pool function reserve1() external view returns (uint256); /// @notice Timestamp of last update to pool function blockTimestampLast() external view returns (uint256); /// @notice Cumulative of reserve0 factoring in time elapsed function reserve0CumulativeLast() external view returns (uint256); /// @notice Cumulative of reserve1 factoring in time elapsed function reserve1CumulativeLast() external view returns (uint256); /// @notice Accumulated fees of token0 (global) function index0() external view returns (uint256); /// @notice Accumulated fees of token1 (global) function index1() external view returns (uint256); /// @notice Get an LP's relative index0 to index0 function supplyIndex0(address) external view returns (uint256); /// @notice Get an LP's relative index1 to index1 function supplyIndex1(address) external view returns (uint256); /// @notice Amount of unclaimed, but claimable tokens from fees of token0 for an LP function claimable0(address) external view returns (uint256); /// @notice Amount of unclaimed, but claimable tokens from fees of token1 for an LP function claimable1(address) external view returns (uint256); /// @notice Returns the value of K in the Pool, based on its reserves. function getK() external returns (uint256); /// @notice Set pool name /// Only callable by Voter.emergencyCouncil() /// @param __name String of new name function setName(string calldata __name) external; /// @notice Set pool symbol /// Only callable by Voter.emergencyCouncil() /// @param __symbol String of new symbol function setSymbol(string calldata __symbol) external; /// @notice Get the number of observations recorded function observationLength() external view returns (uint256); /// @notice Get the value of the most recent observation function lastObservation() external view returns (Observation memory); /// @notice True if pool is stable, false if volatile function stable() external view returns (bool); /// @notice Produces the cumulative price using counterfactuals to save gas and avoid a call to sync. function currentCumulativePrices() external view returns (uint256 reserve0Cumulative, uint256 reserve1Cumulative, uint256 blockTimestamp); /// @notice Provides twap price with user configured granularity, up to the full window size /// @param tokenIn . /// @param amountIn . /// @param granularity . /// @return amountOut . function quote(address tokenIn, uint256 amountIn, uint256 granularity) external view returns (uint256 amountOut); /// @notice Returns a memory set of TWAP prices /// Same as calling sample(tokenIn, amountIn, points, 1) /// @param tokenIn . /// @param amountIn . /// @param points Number of points to return /// @return Array of TWAP prices function prices(address tokenIn, uint256 amountIn, uint256 points) external view returns (uint256[] memory); /// @notice Same as prices with with an additional window argument. /// Window = 2 means 2 * 30min (or 1 hr) between observations /// @param tokenIn . /// @param amountIn . /// @param points . /// @param window . /// @return Array of TWAP prices function sample( address tokenIn, uint256 amountIn, uint256 points, uint256 window ) external view returns (uint256[] memory); /// @notice This low-level function should be called from a contract which performs important safety checks /// @param amount0Out Amount of token0 to send to `to` /// @param amount1Out Amount of token1 to send to `to` /// @param to Address to recieve the swapped output /// @param data Additional calldata for flashloans function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external; /// @notice This low-level function should be called from a contract which performs important safety checks /// standard uniswap v2 implementation /// @param to Address to receive token0 and token1 from burning the pool token /// @return amount0 Amount of token0 returned /// @return amount1 Amount of token1 returned function burn(address to) external returns (uint256 amount0, uint256 amount1); /// @notice This low-level function should be called by addLiquidity functions in Router.sol, which performs important safety checks /// standard uniswap v2 implementation /// @param to Address to receive the minted LP token /// @return liquidity Amount of LP token minted function mint(address to) external returns (uint256 liquidity); /// @notice Update reserves and, on the first call per block, price accumulators /// @return _reserve0 . /// @return _reserve1 . /// @return _blockTimestampLast . function getReserves() external view returns (uint256 _reserve0, uint256 _reserve1, uint256 _blockTimestampLast); /// @notice Get the amount of tokenOut given the amount of tokenIn /// @param amountIn Amount of token in /// @param tokenIn Address of token /// @return Amount out function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256); /// @notice Force balances to match reserves /// @param to Address to receive any skimmed rewards function skim(address to) external; /// @notice Force reserves to match balances function sync() external; /// @notice Called on pool creation by PoolFactory /// @param _token0 Address of token0 /// @param _token1 Address of token1 /// @param _stable True if stable, false if volatile function initialize(address _token0, address _token1, bool _stable) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create(0, 0x09, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { /// @solidity memory-safe-assembly assembly { // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes // of the `implementation` address with the bytecode before the address. mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000)) // Packs the remaining 17 bytes of `implementation` with the bytecode after the address. mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3)) instance := create2(0, 0x09, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(add(ptr, 0x38), deployer) mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff) mstore(add(ptr, 0x14), implementation) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73) mstore(add(ptr, 0x58), salt) mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37)) predicted := keccak256(add(ptr, 0x43), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /// @title Admin contract /// @author vfat.tools /// @notice Provides an administration mechanism allowing restricted functions abstract contract Admin { /// ERRORS /// /// @notice Thrown when the caller is not the admin error NotAdminError(); //0xb5c42b3b /// EVENTS /// /// @notice Emitted when a new admin is set /// @param oldAdmin Address of the old admin /// @param newAdmin Address of the new admin event AdminSet(address oldAdmin, address newAdmin); /// STORAGE /// /// @notice Address of the current admin address public admin; /// MODIFIERS /// /// @dev Restricts a function to the admin modifier onlyAdmin() { if (msg.sender != admin) revert NotAdminError(); _; } /// WRITE FUNCTIONS /// /// @param admin_ Address of the admin constructor(address admin_) { emit AdminSet(admin, admin_); admin = admin_; } /// @notice Sets a new admin /// @param newAdmin Address of the new admin /// @custom:access Restricted to protocol admin. function setAdmin(address newAdmin) external onlyAdmin { emit AdminSet(admin, newAdmin); admin = newAdmin; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "solmate/=lib/solmate/src/", "@openzeppelin/=lib/openzeppelin-contracts/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@uniswap/v3-core/=lib/v3-core/", "@morpho-blue/=lib/morpho-blue/src/", "ds-test/=lib/solmate/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "morpho-blue/=lib/morpho-blue/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract SickleFactory","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AutoCompoundNotSet","type":"error"},{"inputs":[],"name":"AutoExitNotSet","type":"error"},{"inputs":[],"name":"AutoHarvestNotSet","type":"error"},{"inputs":[],"name":"AutoRebalanceNotSet","type":"error"},{"inputs":[],"name":"CompoundAndHarvestBothSet","type":"error"},{"inputs":[],"name":"CompoundOrHarvestNotSet","type":"error"},{"inputs":[],"name":"ExitTriggersNotSet","type":"error"},{"inputs":[],"name":"InvalidDustBP","type":"error"},{"inputs":[],"name":"InvalidMaxTickHigh","type":"error"},{"inputs":[],"name":"InvalidMinMaxTickRange","type":"error"},{"inputs":[],"name":"InvalidMinTickLow","type":"error"},{"inputs":[],"name":"InvalidPriceImpactBP","type":"error"},{"inputs":[],"name":"InvalidSlippageBP","type":"error"},{"inputs":[],"name":"InvalidTokenOut","type":"error"},{"inputs":[{"internalType":"uint24","name":"actual","type":"uint24"},{"internalType":"uint24","name":"expected","type":"uint24"}],"name":"InvalidWidth","type":"error"},{"inputs":[],"name":"OnlySickle","type":"error"},{"inputs":[],"name":"RebalanceConfigNotSet","type":"error"},{"inputs":[],"name":"SickleNotDeployed","type":"error"},{"inputs":[],"name":"TickOutsideStopLossRange","type":"error"},{"inputs":[],"name":"TickWithinRange","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"indexed":false,"internalType":"struct NftKey","name":"key","type":"tuple"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bool","name":"autoRebalance","type":"bool"},{"components":[{"internalType":"uint24","name":"tickSpacesBelow","type":"uint24"},{"internalType":"uint24","name":"tickSpacesAbove","type":"uint24"},{"internalType":"int24","name":"bufferTicksBelow","type":"int24"},{"internalType":"int24","name":"bufferTicksAbove","type":"int24"},{"internalType":"uint256","name":"dustBP","type":"uint256"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"},{"internalType":"int24","name":"cutoffTickLow","type":"int24"},{"internalType":"int24","name":"cutoffTickHigh","type":"int24"},{"internalType":"uint8","name":"delayMin","type":"uint8"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"}],"internalType":"struct RebalanceConfig","name":"rebalanceConfig","type":"tuple"},{"internalType":"bool","name":"automateRewards","type":"bool"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"},{"internalType":"bool","name":"autoExit","type":"bool"},{"components":[{"internalType":"int24","name":"triggerTickLow","type":"int24"},{"internalType":"int24","name":"triggerTickHigh","type":"int24"},{"internalType":"address","name":"exitTokenOutLow","type":"address"},{"internalType":"address","name":"exitTokenOutHigh","type":"address"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"}],"internalType":"struct ExitConfig","name":"exitConfig","type":"tuple"}],"indexed":false,"internalType":"struct NftSettings","name":"settings","type":"tuple"}],"name":"NftSettingsSet","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"indexed":false,"internalType":"struct NftKey","name":"key","type":"tuple"}],"name":"NftSettingsUnset","type":"event"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract SickleFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"key","type":"tuple"}],"name":"getNftSettings","outputs":[{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bool","name":"autoRebalance","type":"bool"},{"components":[{"internalType":"uint24","name":"tickSpacesBelow","type":"uint24"},{"internalType":"uint24","name":"tickSpacesAbove","type":"uint24"},{"internalType":"int24","name":"bufferTicksBelow","type":"int24"},{"internalType":"int24","name":"bufferTicksAbove","type":"int24"},{"internalType":"uint256","name":"dustBP","type":"uint256"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"},{"internalType":"int24","name":"cutoffTickLow","type":"int24"},{"internalType":"int24","name":"cutoffTickHigh","type":"int24"},{"internalType":"uint8","name":"delayMin","type":"uint8"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"}],"internalType":"struct RebalanceConfig","name":"rebalanceConfig","type":"tuple"},{"internalType":"bool","name":"automateRewards","type":"bool"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"},{"internalType":"bool","name":"autoExit","type":"bool"},{"components":[{"internalType":"int24","name":"triggerTickLow","type":"int24"},{"internalType":"int24","name":"triggerTickHigh","type":"int24"},{"internalType":"address","name":"exitTokenOutLow","type":"address"},{"internalType":"address","name":"exitTokenOutHigh","type":"address"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"}],"internalType":"struct ExitConfig","name":"exitConfig","type":"tuple"}],"internalType":"struct NftSettings","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IPreviousAutomation","name":"automation","type":"address"},{"internalType":"contract IPreviousNftSettingsRegistry","name":"previousNftSettingsRegistry","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"contract IUniswapV3Pool[]","name":"pools","type":"address[]"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"migrateNftSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"oldKey","type":"tuple"},{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"newKey","type":"tuple"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bool","name":"autoRebalance","type":"bool"},{"components":[{"internalType":"uint24","name":"tickSpacesBelow","type":"uint24"},{"internalType":"uint24","name":"tickSpacesAbove","type":"uint24"},{"internalType":"int24","name":"bufferTicksBelow","type":"int24"},{"internalType":"int24","name":"bufferTicksAbove","type":"int24"},{"internalType":"uint256","name":"dustBP","type":"uint256"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"},{"internalType":"int24","name":"cutoffTickLow","type":"int24"},{"internalType":"int24","name":"cutoffTickHigh","type":"int24"},{"internalType":"uint8","name":"delayMin","type":"uint8"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"}],"internalType":"struct RebalanceConfig","name":"rebalanceConfig","type":"tuple"},{"internalType":"bool","name":"automateRewards","type":"bool"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"},{"internalType":"bool","name":"autoExit","type":"bool"},{"components":[{"internalType":"int24","name":"triggerTickLow","type":"int24"},{"internalType":"int24","name":"triggerTickHigh","type":"int24"},{"internalType":"address","name":"exitTokenOutLow","type":"address"},{"internalType":"address","name":"exitTokenOutHigh","type":"address"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"}],"internalType":"struct ExitConfig","name":"exitConfig","type":"tuple"}],"internalType":"struct NftSettings","name":"settings","type":"tuple"}],"name":"resetNftSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bool","name":"autoRebalance","type":"bool"},{"components":[{"internalType":"uint24","name":"tickSpacesBelow","type":"uint24"},{"internalType":"uint24","name":"tickSpacesAbove","type":"uint24"},{"internalType":"int24","name":"bufferTicksBelow","type":"int24"},{"internalType":"int24","name":"bufferTicksAbove","type":"int24"},{"internalType":"uint256","name":"dustBP","type":"uint256"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"},{"internalType":"int24","name":"cutoffTickLow","type":"int24"},{"internalType":"int24","name":"cutoffTickHigh","type":"int24"},{"internalType":"uint8","name":"delayMin","type":"uint8"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"}],"internalType":"struct RebalanceConfig","name":"rebalanceConfig","type":"tuple"},{"internalType":"bool","name":"automateRewards","type":"bool"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"},{"internalType":"bool","name":"autoExit","type":"bool"},{"components":[{"internalType":"int24","name":"triggerTickLow","type":"int24"},{"internalType":"int24","name":"triggerTickHigh","type":"int24"},{"internalType":"address","name":"exitTokenOutLow","type":"address"},{"internalType":"address","name":"exitTokenOutHigh","type":"address"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"}],"internalType":"struct ExitConfig","name":"exitConfig","type":"tuple"}],"internalType":"struct NftSettings","name":"settings","type":"tuple"}],"name":"setNftSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"key","type":"tuple"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bool","name":"autoRebalance","type":"bool"},{"components":[{"internalType":"uint24","name":"tickSpacesBelow","type":"uint24"},{"internalType":"uint24","name":"tickSpacesAbove","type":"uint24"},{"internalType":"int24","name":"bufferTicksBelow","type":"int24"},{"internalType":"int24","name":"bufferTicksAbove","type":"int24"},{"internalType":"uint256","name":"dustBP","type":"uint256"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"},{"internalType":"int24","name":"cutoffTickLow","type":"int24"},{"internalType":"int24","name":"cutoffTickHigh","type":"int24"},{"internalType":"uint8","name":"delayMin","type":"uint8"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"}],"internalType":"struct RebalanceConfig","name":"rebalanceConfig","type":"tuple"},{"internalType":"bool","name":"automateRewards","type":"bool"},{"components":[{"internalType":"enum RewardBehavior","name":"rewardBehavior","type":"uint8"},{"internalType":"address","name":"harvestTokenOut","type":"address"}],"internalType":"struct RewardConfig","name":"rewardConfig","type":"tuple"},{"internalType":"bool","name":"autoExit","type":"bool"},{"components":[{"internalType":"int24","name":"triggerTickLow","type":"int24"},{"internalType":"int24","name":"triggerTickHigh","type":"int24"},{"internalType":"address","name":"exitTokenOutLow","type":"address"},{"internalType":"address","name":"exitTokenOutHigh","type":"address"},{"internalType":"uint256","name":"priceImpactBP","type":"uint256"},{"internalType":"uint256","name":"slippageBP","type":"uint256"}],"internalType":"struct ExitConfig","name":"exitConfig","type":"tuple"}],"internalType":"struct NftSettings","name":"settings","type":"tuple"}],"name":"setNftSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unsetNftSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"key","type":"tuple"}],"name":"validateCompoundFor","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"key","type":"tuple"}],"name":"validateExitFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"key","type":"tuple"}],"name":"validateHarvestFor","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"nftManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftKey","name":"key","type":"tuple"}],"name":"validateRebalanceFor","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b50604051620026d2380380620026d2833981016040819052620000349162000046565b6001600160a01b031660805262000078565b6000602082840312156200005957600080fd5b81516001600160a01b03811681146200007157600080fd5b9392505050565b6080516126376200009b60003960008181610176015261093f01526126376000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80637dd7fe63116100715780637dd7fe63146101255780638bb96a90146101385780638ca078611461014b578063bca9ca731461015e578063c45a015514610171578063f1cf4182146101b057600080fd5b80630486585a146100ae578063228ca087146100c3578063459e2684146100ec57806357181ab0146100ff5780637a3d2b7514610112575b600080fd5b6100c16100bc366004611958565b6101c3565b005b6100d66100d1366004611a4f565b610214565b6040516100e39190611c63565b60405180910390f35b6100c16100fa366004611a4f565b61044a565b6100c161010d366004611c72565b6104d8565b6100c1610120366004611cb0565b610513565b6100c1610133366004611d75565b61056f565b6100c1610146366004611a4f565b61064f565b6100c1610159366004611e71565b6107e7565b6100c161016c366004611a4f565b610871565b6101987f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100e3565b6100c16101be366004611a4f565b6108c8565b60006101ce3361091b565b604080516060810182526001600160a01b0380841682528716602082015290810185905290915061020d81610208368690038601866120d2565b6109d9565b5050505050565b61021c611834565b60008083604051602001610230919061218c565b60408051601f198184030181529181528151602092830120835282820193909352908201600020825160e0808201855282546001600160a01b038116835260ff600160a01b909104811615158386015285516101608101875260018501805462ffffff8082168452630100000080830490911698840198909852600160301b808204600290810b858c0152600160481b909204820b6060850152818801546080850152600388015460a0850152600488015460c0850152600588015480830b96850196909652978504810b610100840152969093048216610120820152865180880188526006860180549598969796890196929561014087019492939192849291169081111561034257610342611aba565b600281111561035357610353611aba565b8152905461010090046001600160a01b0316602091820152915291835250600783015460ff90811615159183019190915260408051808201825260088501805492909401939092909183911660028111156103b0576103b0611aba565b60028111156103c1576103c1611aba565b815290546001600160a01b036101009091048116602092830152918352600984015460ff161515838201526040805160c081018252600a860154600281810b835263010000008204900b93820193909352600160301b909204831682820152600b8501549092166060820152600c8401546080820152600d9093015460a0840152015292915050565b600061045582610214565b60c081015160a082015191925090610480576040516301d7fb3960e01b815260040160405180910390fd5b600061048f8360000151610ed3565b9050816000015160020b8160020b121580156104b45750816020015160020b8160020b125b156104d25760405163227b663760e11b815260040160405180910390fd5b50505050565b60006104e33361091b565b604080516060810182526001600160a01b038084168252861660208201529081018490529091506104d281610f65565b338061052260208501856121bb565b6001600160a01b0316146105495760405163b91a09e760e01b815260040160405180910390fd5b61056a61055b36859003850185611a4f565b610208368590038501856120d2565b505050565b600061057a3361091b565b825190915060005b818110156106455760006040518060600160405280856001600160a01b03168152602001886001600160a01b031681526020018684815181106105c7576105c76121d8565b6020026020010151815250905060006105fa89838986815181106105ed576105ed6121d8565b6020026020010151611087565b905060006106238b878a8781518110610615576106156121d8565b6020026020010151856111e4565b905061062f83826109d9565b505050808061063d90612204565b915050610582565b5050505050505050565b600061065a82610214565b604081015160208201519192509061068557604051631a0346d160e31b815260040160405180910390fd5b8060e0015160020b6000036106ad5760405163c20c00ad60e01b815260040160405180910390fd5b60008084602001516001600160a01b03166399fbab8886604001516040518263ffffffff1660e01b81526004016106e691815260200190565b61018060405180830381865afa158015610704573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610728919061225e565b505050505096509650505050505060006107458560000151610ed3565b9050836040015183610757919061233f565b60020b8160020b1215801561077f575060608401516107769083612364565b60020b8160020b125b1561079d5760405163227b663760e11b815260040160405180910390fd5b8360e0015160020b8160020b1315806107c1575083610100015160020b8160020b12155b156107df57604051633015515760e01b815260040160405180910390fd5b505050505050565b33806107f660208601866121bb565b6001600160a01b031614158061082a57506001600160a01b03811661081e60208501856121bb565b6001600160a01b031614155b156108485760405163b91a09e760e01b815260040160405180910390fd5b61085f61085a36869003860186611a4f565b610f65565b6104d261055b36859003850185611a4f565b600061087c82610214565b9050806060015115806108a65750600160808201515160028111156108a3576108a3611aba565b14155b156108c457604051630839792d60e41b815260040160405180910390fd5b5050565b60006108d382610214565b9050806060015115806108fd5750600260808201515160028111156108fa576108fa611aba565b14155b156108c4576040516311447fdd60e11b815260040160405180910390fd5b6040516312cfc9b560e31b81526001600160a01b03828116600483015260009182917f0000000000000000000000000000000000000000000000000000000000000000169063967e4da890602401602060405180830381865afa158015610986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109aa9190612389565b90506001600160a01b0381166109d357604051633098a45560e01b815260040160405180910390fd5b92915050565b8181806020015115610a01576109f281604001516113ee565b6109fc828261156a565b610a43565b604081015160e0015160020b151580610a2557506040810151610100015160020b15155b15610a4357604051631a0346d160e31b815260040160405180910390fd5b60016080820151516002811115610a5c57610a5c611aba565b14158015610a7a57506080810151602001516001600160a01b031615155b15610a975760405162db68fd60e51b815260040160405180910390fd5b8060a00151610b3d5760c08101515160020b151580610ac0575060c08101516020015160020b15155b80610adb575060c0810151604001516001600160a01b031615155b80610af6575060c0810151606001516001600160a01b031615155b80610b08575060c081015160a0015115155b80610b1a575060c08101516080015115155b15610b38576040516301d7fb3960e01b815260040160405180910390fd5b610be1565b60c08101515160020b158015610b5c575060c08101516020015160020b155b15610b7a57604051631463731360e21b815260040160405180910390fd5b6101f48160c0015160a001511115610ba557604051636703cded60e01b815260040160405180910390fd5b6113888160c00151608001511180610bc3575060c081015160800151155b15610be1576040516330223ae760e11b815260040160405180910390fd5b8260008086604051602001610bf6919061218c565b60408051808303601f19018152918152815160209283012083528282019390935290820160002083518154858401516001600160a01b039092166001600160a81b031990911617600160a01b91151591909102178155838301518051600180840180549584015196840151606085015162ffffff94851665ffffffffffff199889161763010000009986168a02176bffffffffffff0000000000001916600160301b92861683026bffffff000000000000000000191617600160481b91861691909102178255608085015160028088019190915560a0860151600388015560c0860151600488015560e08601516005880180546101008901516101208a015193891691909b1617999096169099029790971766ff000000000000191660ff90981602969096179091556101408201518051600685018054959794969495929490939192849260ff19909116918490811115610d5357610d53611aba565b02179055506020919091015181546001600160a01b0390911661010002610100600160a81b03199091161790555050606082015160078201805491151560ff1992831617905560808301518051600884018054929390928391166001836002811115610dc157610dc1611aba565b02179055506020918201518154610100600160a81b0319166101006001600160a01b03928316021790915560a08481015160098501805460ff191691151591909117905560c0909401518051600a850180549483015160408085015162ffffff94851665ffffffffffff199098169790971763010000009490921693909302176601000000000000600160d01b031916600160301b95851695909502949094179093556060810151600b850180546001600160a01b03191691909316179091556080810151600c84015590920151600d90910155517f642f896762c876b9b7acb3ac3aeb59ae1bd800c5aeffc1336595979592b7b5a090610ec590869086906123a6565b60405180910390a150505050565b60408051600481526024810182526020810180516001600160e01b0316633850c7bd60e01b179052905160009182916001600160a01b03851691610f16916123de565b6000604051808303816000865af19150503d8060008114610f53576040519150601f19603f3d011682016040523d82523d6000602084013e610f58565b606091505b5060400151949350505050565b60008082604051602001610f79919061218c565b60408051601f1981840301815291815281516020928301208352908201929092528101600090812080546001600160a81b031990811682556001820180546bffffffffffffffffffffffff1916905560028201839055600382018390556004820183905560058201805466ffffffffffffff191690556006820180548216905560078201805460ff199081169091556008830180549092169091556009820180549091169055600a810180546001600160d01b0319169055600b810180546001600160a01b0319169055600c8101829055600d0155517faa3b569bcc3b07fe86d5ae3e76d5d1006e3078ab36159916f288c61b95d017529061107c90839061218c565b60405180910390a150565b61108f6118bf565b60405163228ca08760e01b81526000906001600160a01b0386169063228ca087906110be90879060040161218c565b610120604051808303816000875af11580156110de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611102919061240d565b606081015190915060008061111787876116e3565b915091506040518061016001604052808362ffffff1681526020018262ffffff168152602001846000015160020b8152602001846020015160020b8152602001846040015181526020018460400151815260200184604001518152602001846060015160020b8152602001846080015160020b81526020018460a0015160ff1681526020016040518060400160405280876020015160028111156111bd576111bd611aba565b815260200187604001516001600160a01b03168152508152509450505050505b9392505050565b6111ec611834565b6000846001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561122c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112509190612389565b604051630144ee2f60e01b81526001600160a01b038083166004830152919250600091881690630144ee2f906024016020604051808303816000875af115801561129e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c291906124ee565b6040805160e0810182526001600160a01b03881681526001602082015290810186905290915060608101600083600281111561130057611300611aba565b141515158152602001604051806040016040528084600281111561132657611326611aba565b815260405163ad4b4cbb60e01b81526001600160a01b0387811660048301526020909201918c169063ad4b4cbb906024016020604051808303816000875af1158015611376573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139a9190612389565b6001600160a01b031690528152600060208083018290526040805160c081018252838152918201839052818101839052606082018390526080820183905260a0820192909252910152979650505050505050565b6113fa620d89e861250b565b60020b8160e0015160020b12156114245760405163d3d0c56960e01b815260040160405180910390fd5b80610100015160020b8160e0015160020b1261145357604051634a05b96760e11b815260040160405180910390fd5b620d89e860020b81610100015160020b1315611482576040516350f3ef1960e11b815260040160405180910390fd5b6101f48160c0015111156114a957604051636703cded60e01b815260040160405180910390fd5b6113888160a0015111806114bf575060a0810151155b156114dd576040516330223ae760e11b815260040160405180910390fd5b611388816080015111806114f357506080810151155b156115115760405163142b243360e31b815260040160405180910390fd5b600161014082015151600281111561152b5761152b611aba565b1415801561154a5750610140810151602001516001600160a01b031615155b156115675760405162db68fd60e51b815260040160405180910390fd5b50565b60008083602001516001600160a01b03166399fbab8885604001516040518263ffffffff1660e01b81526004016115a391815260200190565b61018060405180830381865afa1580156115c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e5919061225e565b5050505050965096505050505050600083600001516001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611637573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165b919061252d565b905060008161166a858561233f565b6116749190612560565b6040860151602081015190519192506000916116909190612582565b61169b906001612582565b90508062ffffff168262ffffff16146116da576040516303c906ad60e51b815262ffffff80841660048301528216602482015260440160405180910390fd5b50505050505050565b60008060008085602001516001600160a01b03166399fbab8887604001516040518263ffffffff1660e01b815260040161171f91815260200190565b61018060405180830381865afa15801561173d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611761919061225e565b50505050509650965050505050506000856001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d3919061252d565b905060006001826117e4868661233f565b6117ee91906125a5565b6117f8919061233f565b9050611805600282612560565b95506118126002826125df565b61181d600283612560565b6118279190612582565b9450505050509250929050565b6040805160e081018252600080825260208201529081016118536118bf565b815260006020820152604001611879604080518082019091526000808252602082015290565b8152600060208083018290526040805160c081018252838152918201839052818101839052606082018390526080820183905260a082019290925291015290565b905290565b604080516101608101825260008082526020808301829052828401829052606083018290526080830182905260a0830182905260c0830182905260e08301829052610100830182905261012083018290528351808501909452818452830152906101408201906118ba565b6001600160a01b038116811461156757600080fd5b6000610300828403121561195257600080fd5b50919050565b6000806000610340848603121561196e57600080fd5b83356119798161192a565b92506020840135915061198f856040860161193f565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff811182821017156119d2576119d2611998565b60405290565b60405160c0810167ffffffffffffffff811182821017156119d2576119d2611998565b6040516080810167ffffffffffffffff811182821017156119d2576119d2611998565b604051601f8201601f1916810167ffffffffffffffff81118282101715611a4757611a47611998565b604052919050565b600060608284031215611a6157600080fd5b6040516060810181811067ffffffffffffffff82111715611a8457611a84611998565b6040528235611a928161192a565b81526020830135611aa28161192a565b60208201526040928301359281019290925250919050565b634e487b7160e01b600052602160045260246000fd5b805160038110611af057634e487b7160e01b600052602160045260246000fd5b82526020908101516001600160a01b0316910152565b60018060a01b0381511682526020810151151560208301526040810151611b3560408401825162ffffff169052565b602081015162ffffff1660608401526040810151600281900b6080850152506060810151611b6860a085018260020b9052565b50608081015160c084015260a081015160e084015260c0810151610100818186015260e08301519150610120611ba28187018460020b9052565b90830151915061014090611bba8683018460020b9052565b83015160ff16610160860152909101519050611bda610180840182611ad0565b50606081015115156101c08301526080810151611bfb6101e0840182611ad0565b5060a08101518015156102208401525060c001518051600290810b6102408401526020820151900b61026083015260408101516001600160a01b039081166102808401526060820151166102a083015260808101516102c083015260a001516102e090910152565b61030081016109d38284611b06565b60008060408385031215611c8557600080fd5b8235611c908161192a565b946020939093013593505050565b60006060828403121561195257600080fd5b6000806103608385031215611cc457600080fd5b611cce8484611c9e565b9150611cdd846060850161193f565b90509250929050565b600067ffffffffffffffff821115611d0057611d00611998565b5060051b60200190565b600082601f830112611d1b57600080fd5b81356020611d30611d2b83611ce6565b611a1e565b82815260059290921b84018101918181019086841115611d4f57600080fd5b8286015b84811015611d6a5780358352918301918301611d53565b509695505050505050565b600080600080600060a08688031215611d8d57600080fd5b8535611d988161192a565b9450602086810135611da98161192a565b94506040870135611db98161192a565b9350606087013567ffffffffffffffff80821115611dd657600080fd5b818901915089601f830112611dea57600080fd5b8135611df8611d2b82611ce6565b81815260059190911b8301840190848101908c831115611e1757600080fd5b938501935b82851015611e3e578435611e2f8161192a565b82529385019390850190611e1c565b965050506080890135925080831115611e5657600080fd5b5050611e6488828901611d0a565b9150509295509295909350565b60008060006103c08486031215611e8757600080fd5b611e918585611c9e565b9250611ea08560608601611c9e565b915061198f8560c0860161193f565b801515811461156757600080fd5b8035611ec881611eaf565b919050565b62ffffff8116811461156757600080fd5b8035611ec881611ecd565b8060020b811461156757600080fd5b8035611ec881611ee9565b60ff8116811461156757600080fd5b8035611ec881611f03565b6003811061156757600080fd5b600060408284031215611f3c57600080fd5b6040516040810181811067ffffffffffffffff82111715611f5f57611f5f611998565b6040529050808235611f7081611f1d565b81526020830135611f808161192a565b6020919091015292915050565b60006101808284031215611fa057600080fd5b611fa86119ae565b9050611fb382611ede565b8152611fc160208301611ede565b6020820152611fd260408301611ef8565b6040820152611fe360608301611ef8565b60608201526080820135608082015260a082013560a082015260c082013560c082015261201260e08301611ef8565b60e0820152610100612025818401611ef8565b90820152610120612037838201611f12565b9082015261014061204a84848301611f2a565b9082015292915050565b600060c0828403121561206657600080fd5b61206e6119d8565b9050813561207b81611ee9565b8152602082013561208b81611ee9565b6020820152604082013561209e8161192a565b604082015260608201356120b18161192a565b806060830152506080820135608082015260a082013560a082015292915050565b600061030082840312156120e557600080fd5b60405160e0810181811067ffffffffffffffff8211171561210857612108611998565b60405282356121168161192a565b815261212460208401611ebd565b60208201526121368460408501611f8d565b60408201526121486101c08401611ebd565b606082015261215b846101e08501611f2a565b608082015261216d6102208401611ebd565b60a0820152612180846102408501612054565b60c08201529392505050565b81516001600160a01b0390811682526020808401519091169082015260408083015190820152606081016109d3565b6000602082840312156121cd57600080fd5b81356111dd8161192a565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612216576122166121ee565b5060010190565b8051611ec88161192a565b8051611ec881611ecd565b8051611ec881611ee9565b80516fffffffffffffffffffffffffffffffff81168114611ec857600080fd5b6000806000806000806000806000806000806101808d8f03121561228157600080fd5b8c516bffffffffffffffffffffffff8116811461229d57600080fd5b9b506122ab60208e0161221d565b9a506122b960408e0161221d565b99506122c760608e0161221d565b98506122d560808e01612228565b97506122e360a08e01612233565b96506122f160c08e01612233565b95506122ff60e08e0161223e565b94506101008d015193506101208d0151925061231e6101408e0161223e565b915061232d6101608e0161223e565b90509295989b509295989b509295989b565b600282810b9082900b03627fffff198112627fffff821317156109d3576109d36121ee565b600281810b9083900b01627fffff8113627fffff19821217156109d3576109d36121ee565b60006020828403121561239b57600080fd5b81516111dd8161192a565b82516001600160a01b039081168252602080850151909116908201526040808401519082015261036081016111dd6060830184611b06565b6000825160005b818110156123ff57602081860181015185830152016123e5565b506000920191825250919050565b600081830361012081121561242157600080fd5b6124296119fb565b835161243481611eaf565b8152602084015161244481611f1d565b602082015260408401516124578161192a565b604082015260c0605f198301121561246e57600080fd5b6124766119d8565b9150606084015161248681611ee9565b8252608084015161249681611ee9565b602083015260a0840151604083015260c08401516124b381611ee9565b606083015260e08401516124c681611ee9565b60808301526101008401516124da81611f03565b60a083015260608101919091529392505050565b60006020828403121561250057600080fd5b81516111dd81611f1d565b60008160020b627fffff198103612524576125246121ee565b60000392915050565b60006020828403121561253f57600080fd5b81516111dd81611ee9565b634e487b7160e01b600052601260045260246000fd5b600062ffffff808416806125765761257661254a565b92169190910492915050565b62ffffff81811683821601908082111561259e5761259e6121ee565b5092915050565b60008160020b8360020b806125bc576125bc61254a565b627fffff198214600019821416156125d6576125d66121ee565b90059392505050565b600062ffffff808416806125f5576125f561254a565b9216919091069291505056fea2646970667358221220f5baefef32d53b9395964aa75ab3eb272cffacd7cdc4a609ee6cff182ab3ca3564736f6c6343000813003300000000000000000000000053d9780dbd3831e3a797fd215be4131636cd5fdf
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80637dd7fe63116100715780637dd7fe63146101255780638bb96a90146101385780638ca078611461014b578063bca9ca731461015e578063c45a015514610171578063f1cf4182146101b057600080fd5b80630486585a146100ae578063228ca087146100c3578063459e2684146100ec57806357181ab0146100ff5780637a3d2b7514610112575b600080fd5b6100c16100bc366004611958565b6101c3565b005b6100d66100d1366004611a4f565b610214565b6040516100e39190611c63565b60405180910390f35b6100c16100fa366004611a4f565b61044a565b6100c161010d366004611c72565b6104d8565b6100c1610120366004611cb0565b610513565b6100c1610133366004611d75565b61056f565b6100c1610146366004611a4f565b61064f565b6100c1610159366004611e71565b6107e7565b6100c161016c366004611a4f565b610871565b6101987f00000000000000000000000053d9780dbd3831e3a797fd215be4131636cd5fdf81565b6040516001600160a01b0390911681526020016100e3565b6100c16101be366004611a4f565b6108c8565b60006101ce3361091b565b604080516060810182526001600160a01b0380841682528716602082015290810185905290915061020d81610208368690038601866120d2565b6109d9565b5050505050565b61021c611834565b60008083604051602001610230919061218c565b60408051601f198184030181529181528151602092830120835282820193909352908201600020825160e0808201855282546001600160a01b038116835260ff600160a01b909104811615158386015285516101608101875260018501805462ffffff8082168452630100000080830490911698840198909852600160301b808204600290810b858c0152600160481b909204820b6060850152818801546080850152600388015460a0850152600488015460c0850152600588015480830b96850196909652978504810b610100840152969093048216610120820152865180880188526006860180549598969796890196929561014087019492939192849291169081111561034257610342611aba565b600281111561035357610353611aba565b8152905461010090046001600160a01b0316602091820152915291835250600783015460ff90811615159183019190915260408051808201825260088501805492909401939092909183911660028111156103b0576103b0611aba565b60028111156103c1576103c1611aba565b815290546001600160a01b036101009091048116602092830152918352600984015460ff161515838201526040805160c081018252600a860154600281810b835263010000008204900b93820193909352600160301b909204831682820152600b8501549092166060820152600c8401546080820152600d9093015460a0840152015292915050565b600061045582610214565b60c081015160a082015191925090610480576040516301d7fb3960e01b815260040160405180910390fd5b600061048f8360000151610ed3565b9050816000015160020b8160020b121580156104b45750816020015160020b8160020b125b156104d25760405163227b663760e11b815260040160405180910390fd5b50505050565b60006104e33361091b565b604080516060810182526001600160a01b038084168252861660208201529081018490529091506104d281610f65565b338061052260208501856121bb565b6001600160a01b0316146105495760405163b91a09e760e01b815260040160405180910390fd5b61056a61055b36859003850185611a4f565b610208368590038501856120d2565b505050565b600061057a3361091b565b825190915060005b818110156106455760006040518060600160405280856001600160a01b03168152602001886001600160a01b031681526020018684815181106105c7576105c76121d8565b6020026020010151815250905060006105fa89838986815181106105ed576105ed6121d8565b6020026020010151611087565b905060006106238b878a8781518110610615576106156121d8565b6020026020010151856111e4565b905061062f83826109d9565b505050808061063d90612204565b915050610582565b5050505050505050565b600061065a82610214565b604081015160208201519192509061068557604051631a0346d160e31b815260040160405180910390fd5b8060e0015160020b6000036106ad5760405163c20c00ad60e01b815260040160405180910390fd5b60008084602001516001600160a01b03166399fbab8886604001516040518263ffffffff1660e01b81526004016106e691815260200190565b61018060405180830381865afa158015610704573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610728919061225e565b505050505096509650505050505060006107458560000151610ed3565b9050836040015183610757919061233f565b60020b8160020b1215801561077f575060608401516107769083612364565b60020b8160020b125b1561079d5760405163227b663760e11b815260040160405180910390fd5b8360e0015160020b8160020b1315806107c1575083610100015160020b8160020b12155b156107df57604051633015515760e01b815260040160405180910390fd5b505050505050565b33806107f660208601866121bb565b6001600160a01b031614158061082a57506001600160a01b03811661081e60208501856121bb565b6001600160a01b031614155b156108485760405163b91a09e760e01b815260040160405180910390fd5b61085f61085a36869003860186611a4f565b610f65565b6104d261055b36859003850185611a4f565b600061087c82610214565b9050806060015115806108a65750600160808201515160028111156108a3576108a3611aba565b14155b156108c457604051630839792d60e41b815260040160405180910390fd5b5050565b60006108d382610214565b9050806060015115806108fd5750600260808201515160028111156108fa576108fa611aba565b14155b156108c4576040516311447fdd60e11b815260040160405180910390fd5b6040516312cfc9b560e31b81526001600160a01b03828116600483015260009182917f00000000000000000000000053d9780dbd3831e3a797fd215be4131636cd5fdf169063967e4da890602401602060405180830381865afa158015610986573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109aa9190612389565b90506001600160a01b0381166109d357604051633098a45560e01b815260040160405180910390fd5b92915050565b8181806020015115610a01576109f281604001516113ee565b6109fc828261156a565b610a43565b604081015160e0015160020b151580610a2557506040810151610100015160020b15155b15610a4357604051631a0346d160e31b815260040160405180910390fd5b60016080820151516002811115610a5c57610a5c611aba565b14158015610a7a57506080810151602001516001600160a01b031615155b15610a975760405162db68fd60e51b815260040160405180910390fd5b8060a00151610b3d5760c08101515160020b151580610ac0575060c08101516020015160020b15155b80610adb575060c0810151604001516001600160a01b031615155b80610af6575060c0810151606001516001600160a01b031615155b80610b08575060c081015160a0015115155b80610b1a575060c08101516080015115155b15610b38576040516301d7fb3960e01b815260040160405180910390fd5b610be1565b60c08101515160020b158015610b5c575060c08101516020015160020b155b15610b7a57604051631463731360e21b815260040160405180910390fd5b6101f48160c0015160a001511115610ba557604051636703cded60e01b815260040160405180910390fd5b6113888160c00151608001511180610bc3575060c081015160800151155b15610be1576040516330223ae760e11b815260040160405180910390fd5b8260008086604051602001610bf6919061218c565b60408051808303601f19018152918152815160209283012083528282019390935290820160002083518154858401516001600160a01b039092166001600160a81b031990911617600160a01b91151591909102178155838301518051600180840180549584015196840151606085015162ffffff94851665ffffffffffff199889161763010000009986168a02176bffffffffffff0000000000001916600160301b92861683026bffffff000000000000000000191617600160481b91861691909102178255608085015160028088019190915560a0860151600388015560c0860151600488015560e08601516005880180546101008901516101208a015193891691909b1617999096169099029790971766ff000000000000191660ff90981602969096179091556101408201518051600685018054959794969495929490939192849260ff19909116918490811115610d5357610d53611aba565b02179055506020919091015181546001600160a01b0390911661010002610100600160a81b03199091161790555050606082015160078201805491151560ff1992831617905560808301518051600884018054929390928391166001836002811115610dc157610dc1611aba565b02179055506020918201518154610100600160a81b0319166101006001600160a01b03928316021790915560a08481015160098501805460ff191691151591909117905560c0909401518051600a850180549483015160408085015162ffffff94851665ffffffffffff199098169790971763010000009490921693909302176601000000000000600160d01b031916600160301b95851695909502949094179093556060810151600b850180546001600160a01b03191691909316179091556080810151600c84015590920151600d90910155517f642f896762c876b9b7acb3ac3aeb59ae1bd800c5aeffc1336595979592b7b5a090610ec590869086906123a6565b60405180910390a150505050565b60408051600481526024810182526020810180516001600160e01b0316633850c7bd60e01b179052905160009182916001600160a01b03851691610f16916123de565b6000604051808303816000865af19150503d8060008114610f53576040519150601f19603f3d011682016040523d82523d6000602084013e610f58565b606091505b5060400151949350505050565b60008082604051602001610f79919061218c565b60408051601f1981840301815291815281516020928301208352908201929092528101600090812080546001600160a81b031990811682556001820180546bffffffffffffffffffffffff1916905560028201839055600382018390556004820183905560058201805466ffffffffffffff191690556006820180548216905560078201805460ff199081169091556008830180549092169091556009820180549091169055600a810180546001600160d01b0319169055600b810180546001600160a01b0319169055600c8101829055600d0155517faa3b569bcc3b07fe86d5ae3e76d5d1006e3078ab36159916f288c61b95d017529061107c90839061218c565b60405180910390a150565b61108f6118bf565b60405163228ca08760e01b81526000906001600160a01b0386169063228ca087906110be90879060040161218c565b610120604051808303816000875af11580156110de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611102919061240d565b606081015190915060008061111787876116e3565b915091506040518061016001604052808362ffffff1681526020018262ffffff168152602001846000015160020b8152602001846020015160020b8152602001846040015181526020018460400151815260200184604001518152602001846060015160020b8152602001846080015160020b81526020018460a0015160ff1681526020016040518060400160405280876020015160028111156111bd576111bd611aba565b815260200187604001516001600160a01b03168152508152509450505050505b9392505050565b6111ec611834565b6000846001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561122c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112509190612389565b604051630144ee2f60e01b81526001600160a01b038083166004830152919250600091881690630144ee2f906024016020604051808303816000875af115801561129e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c291906124ee565b6040805160e0810182526001600160a01b03881681526001602082015290810186905290915060608101600083600281111561130057611300611aba565b141515158152602001604051806040016040528084600281111561132657611326611aba565b815260405163ad4b4cbb60e01b81526001600160a01b0387811660048301526020909201918c169063ad4b4cbb906024016020604051808303816000875af1158015611376573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139a9190612389565b6001600160a01b031690528152600060208083018290526040805160c081018252838152918201839052818101839052606082018390526080820183905260a0820192909252910152979650505050505050565b6113fa620d89e861250b565b60020b8160e0015160020b12156114245760405163d3d0c56960e01b815260040160405180910390fd5b80610100015160020b8160e0015160020b1261145357604051634a05b96760e11b815260040160405180910390fd5b620d89e860020b81610100015160020b1315611482576040516350f3ef1960e11b815260040160405180910390fd5b6101f48160c0015111156114a957604051636703cded60e01b815260040160405180910390fd5b6113888160a0015111806114bf575060a0810151155b156114dd576040516330223ae760e11b815260040160405180910390fd5b611388816080015111806114f357506080810151155b156115115760405163142b243360e31b815260040160405180910390fd5b600161014082015151600281111561152b5761152b611aba565b1415801561154a5750610140810151602001516001600160a01b031615155b156115675760405162db68fd60e51b815260040160405180910390fd5b50565b60008083602001516001600160a01b03166399fbab8885604001516040518263ffffffff1660e01b81526004016115a391815260200190565b61018060405180830381865afa1580156115c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e5919061225e565b5050505050965096505050505050600083600001516001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611637573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165b919061252d565b905060008161166a858561233f565b6116749190612560565b6040860151602081015190519192506000916116909190612582565b61169b906001612582565b90508062ffffff168262ffffff16146116da576040516303c906ad60e51b815262ffffff80841660048301528216602482015260440160405180910390fd5b50505050505050565b60008060008085602001516001600160a01b03166399fbab8887604001516040518263ffffffff1660e01b815260040161171f91815260200190565b61018060405180830381865afa15801561173d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611761919061225e565b50505050509650965050505050506000856001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d3919061252d565b905060006001826117e4868661233f565b6117ee91906125a5565b6117f8919061233f565b9050611805600282612560565b95506118126002826125df565b61181d600283612560565b6118279190612582565b9450505050509250929050565b6040805160e081018252600080825260208201529081016118536118bf565b815260006020820152604001611879604080518082019091526000808252602082015290565b8152600060208083018290526040805160c081018252838152918201839052818101839052606082018390526080820183905260a082019290925291015290565b905290565b604080516101608101825260008082526020808301829052828401829052606083018290526080830182905260a0830182905260c0830182905260e08301829052610100830182905261012083018290528351808501909452818452830152906101408201906118ba565b6001600160a01b038116811461156757600080fd5b6000610300828403121561195257600080fd5b50919050565b6000806000610340848603121561196e57600080fd5b83356119798161192a565b92506020840135915061198f856040860161193f565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff811182821017156119d2576119d2611998565b60405290565b60405160c0810167ffffffffffffffff811182821017156119d2576119d2611998565b6040516080810167ffffffffffffffff811182821017156119d2576119d2611998565b604051601f8201601f1916810167ffffffffffffffff81118282101715611a4757611a47611998565b604052919050565b600060608284031215611a6157600080fd5b6040516060810181811067ffffffffffffffff82111715611a8457611a84611998565b6040528235611a928161192a565b81526020830135611aa28161192a565b60208201526040928301359281019290925250919050565b634e487b7160e01b600052602160045260246000fd5b805160038110611af057634e487b7160e01b600052602160045260246000fd5b82526020908101516001600160a01b0316910152565b60018060a01b0381511682526020810151151560208301526040810151611b3560408401825162ffffff169052565b602081015162ffffff1660608401526040810151600281900b6080850152506060810151611b6860a085018260020b9052565b50608081015160c084015260a081015160e084015260c0810151610100818186015260e08301519150610120611ba28187018460020b9052565b90830151915061014090611bba8683018460020b9052565b83015160ff16610160860152909101519050611bda610180840182611ad0565b50606081015115156101c08301526080810151611bfb6101e0840182611ad0565b5060a08101518015156102208401525060c001518051600290810b6102408401526020820151900b61026083015260408101516001600160a01b039081166102808401526060820151166102a083015260808101516102c083015260a001516102e090910152565b61030081016109d38284611b06565b60008060408385031215611c8557600080fd5b8235611c908161192a565b946020939093013593505050565b60006060828403121561195257600080fd5b6000806103608385031215611cc457600080fd5b611cce8484611c9e565b9150611cdd846060850161193f565b90509250929050565b600067ffffffffffffffff821115611d0057611d00611998565b5060051b60200190565b600082601f830112611d1b57600080fd5b81356020611d30611d2b83611ce6565b611a1e565b82815260059290921b84018101918181019086841115611d4f57600080fd5b8286015b84811015611d6a5780358352918301918301611d53565b509695505050505050565b600080600080600060a08688031215611d8d57600080fd5b8535611d988161192a565b9450602086810135611da98161192a565b94506040870135611db98161192a565b9350606087013567ffffffffffffffff80821115611dd657600080fd5b818901915089601f830112611dea57600080fd5b8135611df8611d2b82611ce6565b81815260059190911b8301840190848101908c831115611e1757600080fd5b938501935b82851015611e3e578435611e2f8161192a565b82529385019390850190611e1c565b965050506080890135925080831115611e5657600080fd5b5050611e6488828901611d0a565b9150509295509295909350565b60008060006103c08486031215611e8757600080fd5b611e918585611c9e565b9250611ea08560608601611c9e565b915061198f8560c0860161193f565b801515811461156757600080fd5b8035611ec881611eaf565b919050565b62ffffff8116811461156757600080fd5b8035611ec881611ecd565b8060020b811461156757600080fd5b8035611ec881611ee9565b60ff8116811461156757600080fd5b8035611ec881611f03565b6003811061156757600080fd5b600060408284031215611f3c57600080fd5b6040516040810181811067ffffffffffffffff82111715611f5f57611f5f611998565b6040529050808235611f7081611f1d565b81526020830135611f808161192a565b6020919091015292915050565b60006101808284031215611fa057600080fd5b611fa86119ae565b9050611fb382611ede565b8152611fc160208301611ede565b6020820152611fd260408301611ef8565b6040820152611fe360608301611ef8565b60608201526080820135608082015260a082013560a082015260c082013560c082015261201260e08301611ef8565b60e0820152610100612025818401611ef8565b90820152610120612037838201611f12565b9082015261014061204a84848301611f2a565b9082015292915050565b600060c0828403121561206657600080fd5b61206e6119d8565b9050813561207b81611ee9565b8152602082013561208b81611ee9565b6020820152604082013561209e8161192a565b604082015260608201356120b18161192a565b806060830152506080820135608082015260a082013560a082015292915050565b600061030082840312156120e557600080fd5b60405160e0810181811067ffffffffffffffff8211171561210857612108611998565b60405282356121168161192a565b815261212460208401611ebd565b60208201526121368460408501611f8d565b60408201526121486101c08401611ebd565b606082015261215b846101e08501611f2a565b608082015261216d6102208401611ebd565b60a0820152612180846102408501612054565b60c08201529392505050565b81516001600160a01b0390811682526020808401519091169082015260408083015190820152606081016109d3565b6000602082840312156121cd57600080fd5b81356111dd8161192a565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201612216576122166121ee565b5060010190565b8051611ec88161192a565b8051611ec881611ecd565b8051611ec881611ee9565b80516fffffffffffffffffffffffffffffffff81168114611ec857600080fd5b6000806000806000806000806000806000806101808d8f03121561228157600080fd5b8c516bffffffffffffffffffffffff8116811461229d57600080fd5b9b506122ab60208e0161221d565b9a506122b960408e0161221d565b99506122c760608e0161221d565b98506122d560808e01612228565b97506122e360a08e01612233565b96506122f160c08e01612233565b95506122ff60e08e0161223e565b94506101008d015193506101208d0151925061231e6101408e0161223e565b915061232d6101608e0161223e565b90509295989b509295989b509295989b565b600282810b9082900b03627fffff198112627fffff821317156109d3576109d36121ee565b600281810b9083900b01627fffff8113627fffff19821217156109d3576109d36121ee565b60006020828403121561239b57600080fd5b81516111dd8161192a565b82516001600160a01b039081168252602080850151909116908201526040808401519082015261036081016111dd6060830184611b06565b6000825160005b818110156123ff57602081860181015185830152016123e5565b506000920191825250919050565b600081830361012081121561242157600080fd5b6124296119fb565b835161243481611eaf565b8152602084015161244481611f1d565b602082015260408401516124578161192a565b604082015260c0605f198301121561246e57600080fd5b6124766119d8565b9150606084015161248681611ee9565b8252608084015161249681611ee9565b602083015260a0840151604083015260c08401516124b381611ee9565b606083015260e08401516124c681611ee9565b60808301526101008401516124da81611f03565b60a083015260608101919091529392505050565b60006020828403121561250057600080fd5b81516111dd81611f1d565b60008160020b627fffff198103612524576125246121ee565b60000392915050565b60006020828403121561253f57600080fd5b81516111dd81611ee9565b634e487b7160e01b600052601260045260246000fd5b600062ffffff808416806125765761257661254a565b92169190910492915050565b62ffffff81811683821601908082111561259e5761259e6121ee565b5092915050565b60008160020b8360020b806125bc576125bc61254a565b627fffff198214600019821416156125d6576125d66121ee565b90059392505050565b600062ffffff808416806125f5576125f561254a565b9216919091069291505056fea2646970667358221220f5baefef32d53b9395964aa75ab3eb272cffacd7cdc4a609ee6cff182ab3ca3564736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000053d9780dbd3831e3a797fd215be4131636cd5fdf
-----Decoded View---------------
Arg [0] : _factory (address): 0x53d9780DbD3831E3A797Fd215be4131636cD5FDf
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000053d9780dbd3831e3a797fd215be4131636cd5fdf
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 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.