ETH Price: $4,023.20 (+3.48%)

Contract

0x5aCb2eC8E7755366e0F23df4579CB5cFaf14715c

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

N/A
Transaction Hash
Method
Block
From
To
Exit121694542025-09-26 18:44:251 hr ago1758912265IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002140.00100026
Simple Exit121638872025-09-26 17:11:383 hrs ago1758906698IN
0x5aCb2eC8...Faf14715c
0 ETH0.00000180.001
Rebalance121638322025-09-26 17:10:433 hrs ago1758906643IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002690.001
Simple Deposit121637662025-09-26 17:09:373 hrs ago1758906577IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001610.001
Increase121629542025-09-26 16:56:053 hrs ago1758905765IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001890.00100026
Increase121629202025-09-26 16:55:313 hrs ago1758905731IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001910.00100026
Simple Harvest121625562025-09-26 16:49:273 hrs ago1758905367IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001790.001
Simple Exit121573952025-09-26 15:23:265 hrs ago1758900206IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001970.00100978
Increase121573662025-09-26 15:22:575 hrs ago1758900177IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001890.0010105
Increase121573352025-09-26 15:22:265 hrs ago1758900146IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001750.00101098
Deposit121572322025-09-26 15:20:435 hrs ago1758900043IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002050.00101049
Move121563352025-09-26 15:05:465 hrs ago1758899146IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002460.00100549
Move121552682025-09-26 14:47:595 hrs ago1758898079IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002820.00100196
Rebalance121550252025-09-26 14:43:565 hrs ago1758897836IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002680.00097168
Simple Exit121506312025-09-26 13:30:426 hrs ago1758893442IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001830.00128081
Increase121505902025-09-26 13:30:017 hrs ago1758893401IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001780.00120026
Simple Exit121505882025-09-26 13:29:597 hrs ago1758893399IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001710.0012
Increase121505512025-09-26 13:29:227 hrs ago1758893362IN
0x5aCb2eC8...Faf14715c
0 ETH0.00000180.00120026
Deposit121505302025-09-26 13:29:017 hrs ago1758893341IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002110.00110013
Increase121504412025-09-26 13:27:327 hrs ago1758893252IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001820.00119994
Move121504152025-09-26 13:27:067 hrs ago1758893226IN
0x5aCb2eC8...Faf14715c
0 ETH0.00000250.00099996
Deposit121503542025-09-26 13:26:057 hrs ago1758893165IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001350.00000026
Exit121490042025-09-26 13:03:357 hrs ago1758891815IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002110.00099996
Increase121481612025-09-26 12:49:327 hrs ago1758890972IN
0x5aCb2eC8...Faf14715c
0 ETH0.000001820.00082046
Move121479722025-09-26 12:46:237 hrs ago1758890783IN
0x5aCb2eC8...Faf14715c
0 ETH0.000002440.001
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121694542025-09-26 18:44:251 hr ago1758912265
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
121664042025-09-26 17:53:352 hrs ago1758909215
0x5aCb2eC8...Faf14715c
0 ETH
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NftFarmStrategy

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// 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 {
    StrategyModule,
    SickleFactory,
    Sickle
} from "contracts/modules/StrategyModule.sol";
import { ConnectorRegistry } from "contracts/ConnectorRegistry.sol";
import { INftFarmConnector } from "contracts/interfaces/INftFarmConnector.sol";
import { INftLiquidityConnector } from
    "contracts/interfaces/INftLiquidityConnector.sol";
import {
    INftSettingsRegistry,
    NftKey
} from "contracts/interfaces/INftSettingsRegistry.sol";
import { INftTransferLib } from
    "contracts/interfaces/libraries/INftTransferLib.sol";
import { IFeesLib } from "contracts/interfaces/libraries/IFeesLib.sol";
import { ITransferLib } from "contracts/interfaces/libraries/ITransferLib.sol";
import { ISwapLib } from "contracts/interfaces/libraries/ISwapLib.sol";
import { INftZapLib } from "contracts/interfaces/libraries/INftZapLib.sol";
import { INftSettingsLib } from
    "contracts/interfaces/libraries/INftSettingsLib.sol";
import { NftFarmStrategyEvents } from
    "contracts/events/NftFarmStrategyEvents.sol";
import { INftAutomation } from "contracts/interfaces/INftAutomation.sol";
import { NftZapIn } from "contracts/structs/NftZapStructs.sol";
import { Farm } from "contracts/structs/FarmStrategyStructs.sol";
import {
    NftPosition,
    NftDeposit,
    NftIncrease,
    NftWithdraw,
    NftHarvest,
    NftCompound,
    NftRebalance,
    NftMove,
    SimpleNftHarvest
} from "contracts/structs/NftFarmStrategyStructs.sol";
import { NftSettings } from "contracts/structs/NftSettingsStructs.sol";

library NftFarmStrategyFees {
    bytes4 constant Deposit = bytes4(keccak256("FarmDepositFee"));
    bytes4 constant Harvest = bytes4(keccak256("FarmHarvestFee"));
    bytes4 constant Compound = bytes4(keccak256("FarmCompoundFee"));
    bytes4 constant Withdraw = bytes4(keccak256("FarmWithdrawFee"));
    bytes4 constant HarvestFor = bytes4(keccak256("FarmHarvestForFee"));
    bytes4 constant CompoundFor = bytes4(keccak256("FarmCompoundForFee"));
    bytes4 constant RebalanceLow = bytes4(keccak256("RebalanceLowFee"));
    bytes4 constant RebalanceMid = bytes4(keccak256("RebalanceMidFee"));
    bytes4 constant RebalanceHigh = bytes4(keccak256("RebalanceHighFee"));
}

contract NftFarmStrategy is
    StrategyModule,
    NftFarmStrategyEvents,
    INftAutomation
{
    uint256 constant REBALANCE_LOW_FEE_BPS = 500; // 0.05%
    uint256 constant REBALANCE_MID_FEE_BPS = 3000; // 0.3%

    error PleaseUseIncrease();
    error PleaseUseDeposit();
    error NftSupplyChanged();
    error NftSupplyDidntIncrease();

    struct Libraries {
        INftTransferLib nftTransferLib;
        ITransferLib transferLib;
        ISwapLib swapLib;
        IFeesLib feesLib;
        INftZapLib nftZapLib;
        INftSettingsLib nftSettingsLib;
    }

    INftTransferLib public immutable nftTransferLib;
    INftZapLib public immutable nftZapLib;
    ISwapLib public immutable swapLib;
    ITransferLib public immutable transferLib;
    IFeesLib public immutable feesLib;
    INftSettingsLib public immutable nftSettingsLib;

    INftSettingsRegistry public immutable nftSettingsRegistry;

    address public immutable strategyAddress;

    constructor(
        SickleFactory factory,
        ConnectorRegistry connectorRegistry,
        INftSettingsRegistry nftSettingsRegistry_,
        Libraries memory libraries
    ) StrategyModule(factory, connectorRegistry) {
        nftTransferLib = libraries.nftTransferLib;
        nftZapLib = libraries.nftZapLib;
        swapLib = libraries.swapLib;
        transferLib = libraries.transferLib;
        feesLib = libraries.feesLib;
        nftSettingsLib = libraries.nftSettingsLib;
        nftSettingsRegistry = nftSettingsRegistry_;
        strategyAddress = address(this);
    }

    /**
     * @notice Deposits tokens into the farm, creating a new NFT position.
     * @param params The parameters for the deposit.
     * @param settings The automation settings to be applied to the NFT.
     * @param sweepTokens The tokens to be swept at the end of the deposit.
     * @param approved The address approved to manage automation (used when
     * deploying a new Sickle only).
     * @param referralCode The referral code for tracking purposes (used when
     * deploying a new Sickle only).
     */
    function deposit(
        NftDeposit calldata params,
        NftSettings calldata settings,
        address[] calldata sweepTokens,
        address approved,
        bytes32 referralCode
    ) external payable {
        if (params.increase.zap.addLiquidityParams.tokenId != 0) {
            revert PleaseUseIncrease();
        }
        INftLiquidityConnector liquidityConnector = INftLiquidityConnector(
            connectorRegistry.connectorOf(address(params.nft))
        );
        uint256 initialSupply =
            liquidityConnector.totalSupply(address(params.nft));

        Sickle sickle = getOrDeploySickle(msg.sender, approved, referralCode);

        _transferInTokens(sickle, params.increase);

        _zapIn(sickle, params.increase.zap);

        uint256 tokenId =
            liquidityConnector.getTokenId(address(params.nft), address(sickle));

        _depositNft(
            sickle,
            NftPosition({ farm: params.farm, nft: params.nft, tokenId: tokenId }),
            params.increase.extraData
        );

        _setNftSettings(sickle, params.nft, tokenId, settings);

        _sweep(sickle, sweepTokens);

        if (
            initialSupply >= liquidityConnector.totalSupply(address(params.nft))
        ) {
            revert NftSupplyDidntIncrease();
        }
    }

    /**
     * @notice Withdraws from the NFT farm and breaks the NFT position.
     * @param position The position details of the NFT to be withdrawn.
     * @param params The parameters for the withdrawal.
     * @param sweepTokens The tokens to be swept at the end of the withdrawal.
     */
    function withdraw(
        NftPosition calldata position,
        NftWithdraw calldata params,
        address[] calldata sweepTokens
    ) external {
        Sickle sickle = getSickle(msg.sender);

        bytes4 fee = params.zap.swaps.length > 0
            ? NftFarmStrategyFees.Withdraw
            : bytes4(0);

        _withdraw(sickle, position, params, fee);

        _sweep(sickle, sweepTokens);
    }

    /**
     * @notice Harvests rewards from the NFT farm.
     * @param position The position details of the NFT to be harvested.
     * @param params The parameters for the harvest.
     */
    function harvest(
        NftPosition calldata position,
        NftHarvest calldata params
    ) external {
        Sickle sickle = getSickle(msg.sender);

        _harvest(sickle, position, params, NftFarmStrategyFees.Harvest);
    }

    /**
     * @notice Compounds the NFT farm.
     * @param position The position details of the NFT to be compounded.
     * @param params The parameters for the compound.
     * @param inPlace Whether to compound in place (without withdrawing).
     * @param sweepTokens The tokens to be swept at the end of the compound.
     */
    function compound(
        NftPosition calldata position,
        NftCompound calldata params,
        bool inPlace, // Compound without withdrawing
        address[] calldata sweepTokens
    ) external nftSupplyUnchanged(position.nft) {
        Sickle sickle = getSickle(msg.sender);

        _compound(
            sickle,
            position,
            params,
            inPlace,
            sweepTokens,
            NftFarmStrategyFees.Compound
        );
    }

    /**
     * @notice Exits an NFT from the NFT farm (harvests and withdraws).
     * @param position The position details of the NFT to be exited.
     * @param harvestParams The parameters for the harvest.
     * @param withdrawParams The parameters for the withdrawal.
     * @param sweepTokens The tokens to be swept at the end of the exit.
     */
    function exit(
        NftPosition calldata position,
        NftHarvest calldata harvestParams,
        NftWithdraw calldata withdrawParams,
        address[] calldata sweepTokens
    ) external {
        Sickle sickle = getSickle(msg.sender);

        _exit(sickle, position, harvestParams, withdrawParams, sweepTokens);
    }

    /**
     * @notice Rebalances the NFT position.
     * @param params The parameters for the rebalance.
     * @param sweepTokens The tokens to be swept at the end of the rebalance.
     */
    function rebalance(
        NftRebalance calldata params,
        address[] calldata sweepTokens
    ) external {
        Sickle sickle = getSickle(msg.sender);

        _rebalance(sickle, params, sweepTokens, NftFarmStrategyFees.Harvest);
    }

    /**
     * @notice Withdraws from the current farm and deposits into a new farm.
     * @param params The parameters for the move.
     * @param settings The automation settings to be applied to the new NFT.
     * @param sweepTokens The tokens to be swept at the end of the move.
     */
    function move(
        NftMove calldata params,
        NftSettings calldata settings,
        address[] calldata sweepTokens
    ) external {
        Sickle sickle = getSickle(msg.sender);

        _harvest(
            sickle, params.position, params.harvest, NftFarmStrategyFees.Harvest
        );

        _withdraw(
            sickle,
            params.position,
            params.withdraw,
            _getRebalanceFee(
                params.position.nft, params.pool, params.position.tokenId
            )
        );

        _zapIn(sickle, params.deposit.increase.zap);

        uint256 tokenId = INftLiquidityConnector(
            connectorRegistry.connectorOf(address(params.position.nft))
        ).getTokenId(address(params.position.nft), address(sickle));

        _depositNft(
            sickle,
            NftPosition({
                farm: params.deposit.farm,
                nft: params.deposit.nft,
                tokenId: tokenId
            }),
            params.deposit.increase.extraData
        );

        _setNftSettings(sickle, params.deposit.nft, tokenId, settings);

        _sweep(sickle, sweepTokens);

        _emitMoveEvent(
            sickle,
            params.position,
            params.deposit.nft,
            params.deposit.farm,
            tokenId
        );
    }

    // Required due to stack too deep error
    function _emitMoveEvent(
        Sickle sickle,
        NftPosition calldata positionFrom,
        INonfungiblePositionManager nftTo,
        Farm calldata farmTo,
        uint256 tokenId
    ) internal {
        emit SickleMovedNft(
            sickle,
            positionFrom.nft,
            positionFrom.tokenId,
            positionFrom.farm.stakingContract,
            positionFrom.farm.poolIndex,
            nftTo,
            tokenId,
            farmTo.stakingContract,
            farmTo.poolIndex
        );
    }

    /**
     * @notice Increases the NFT position.
     * @param position The position details of the NFT to be increased.
     * @param harvestParams The parameters for the harvest.
     * @param increaseParams The parameters for the increase.
     * @param inPlace Whether to increase in place (without withdrawing).
     * @param sweepTokens The tokens to be swept at the end of the increase.
     */
    function increase(
        NftPosition calldata position,
        NftHarvest calldata harvestParams,
        NftIncrease calldata increaseParams,
        bool inPlace, // Increase without withdrawing
        address[] calldata sweepTokens
    ) external payable nftSupplyUnchanged(position.nft) {
        if (increaseParams.zap.addLiquidityParams.tokenId == 0) {
            revert PleaseUseDeposit();
        }

        Sickle sickle = getSickle(msg.sender);

        if (!inPlace) {
            _harvest(
                sickle, position, harvestParams, NftFarmStrategyFees.Harvest
            );
            _withdrawNft(sickle, position, increaseParams.extraData);
        }

        _transferInTokens(sickle, increaseParams);

        _zapIn(sickle, increaseParams.zap);

        if (!inPlace) {
            _depositNft(sickle, position, increaseParams.extraData);
        }

        _sweep(sickle, sweepTokens);

        emit SickleIncreasedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    /**
     * @notice Decreases the NFT position.
     * @param position The position details of the NFT to be decreased.
     * @param harvestParams The parameters for the harvest.
     * @param withdrawParams The parameters for the withdrawal.
     * @param inPlace Whether to decrease in place (without withdrawing).
     * @param sweepTokens The tokens to be swept at the end of the decrease.
     */
    function decrease(
        NftPosition calldata position,
        NftHarvest calldata harvestParams,
        NftWithdraw calldata withdrawParams,
        bool inPlace,
        address[] calldata sweepTokens
    ) external nftSupplyUnchanged(position.nft) {
        Sickle sickle = getSickle(msg.sender);

        if (!inPlace) {
            _harvest(
                sickle, position, harvestParams, NftFarmStrategyFees.Harvest
            );

            _withdrawNft(sickle, position, withdrawParams.extraData);
        }

        bytes4 fee = withdrawParams.zap.swaps.length > 0
            ? NftFarmStrategyFees.Withdraw
            : bytes4(0);

        _zapOut(sickle, withdrawParams, fee);

        if (!inPlace) {
            _depositNft(sickle, position, withdrawParams.extraData);
        }

        _sweep(sickle, sweepTokens);

        _emitDecreaseEvent(sickle, position);
    }

    function _emitDecreaseEvent(
        Sickle sickle,
        NftPosition calldata position
    ) internal {
        emit SickleDecreasedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    /* Simple actions (non-swap) */

    /**
     * @notice Deposits an NFT into the farm strategy.
     * @param position The position details of the NFT to be deposited.
     * @param extraData Additional data required for the deposit (optional).
     * @param settings The automation settings to be applied to the NFT.
     * @param approved The address approved to manage automation (used when
     * deploying a new Sickle only).
     * @param referralCode The referral code for tracking purposes (used when
     * deploying a new Sickle only).
     */
    function simpleDeposit(
        NftPosition calldata position,
        bytes calldata extraData,
        NftSettings calldata settings,
        address approved,
        bytes32 referralCode
    ) public {
        Sickle sickle = getOrDeploySickle(msg.sender, approved, referralCode);

        _transferInNft(sickle, position.nft, position.tokenId);

        _depositNft(sickle, position, extraData);

        _setNftSettings(sickle, position.nft, position.tokenId, settings);
    }

    /**
     * @notice Harvests rewards from the NFT farm without swapping.
     * @param position The position details of the NFT to be harvested.
     * @param params The parameters for the harvest.
     */
    function simpleHarvest(
        NftPosition calldata position,
        SimpleNftHarvest calldata params
    ) external {
        Sickle sickle = getSickle(msg.sender);

        _simpleHarvest(sickle, position, params);
    }

    /**
     * @notice Withdraws an NFT from the NFT farm.
     * @param position The position details of the NFT to be withdrawn.
     * @param extraData Additional data required for the withdrawal (optional).
     */
    function simpleWithdraw(
        NftPosition calldata position,
        bytes calldata extraData
    ) public {
        Sickle sickle = getSickle(msg.sender);

        _withdrawNft(sickle, position, extraData);

        _transferOutNft(sickle, position.nft, position.tokenId);

        emit SickleWithdrewNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    /**
     * @notice Exits an NFT from the NFT farm without swapping.
     * @param position The position details of the NFT to be exited.
     * @param harvestParams The parameters for the harvest.
     * @param withdrawExtraData Additional data required for the withdrawal
     * (optional).
     */
    function simpleExit(
        NftPosition calldata position,
        SimpleNftHarvest calldata harvestParams,
        bytes calldata withdrawExtraData
    ) public {
        Sickle sickle = getSickle(msg.sender);

        _simpleHarvest(sickle, position, harvestParams);

        _withdrawNft(sickle, position, withdrawExtraData);

        _transferOutNft(sickle, position.nft, position.tokenId);

        emit SickleExitedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    /* Automation */

    /**
     * @notice Harvests rewards from the NFT farm.
     * Can only be called by the approved address on the Sickle.
     * @param position The position details of the NFT to be harvested.
     * @param params The parameters for the harvest.
     */
    function harvestFor(
        Sickle sickle,
        NftPosition calldata position,
        NftHarvest calldata params
    ) external override onlyApproved(sickle) {
        nftSettingsRegistry.validateHarvestFor(
            NftKey({
                sickle: sickle,
                nftManager: position.nft,
                tokenId: position.tokenId
            })
        );
        _harvest(sickle, position, params, NftFarmStrategyFees.HarvestFor);
    }

    /**
     * @notice Compounds the NFT farm.
     * Can only be called by the approved address on the Sickle.
     * @param position The position details of the NFT to be compounded.
     * @param params The parameters for the compound.
     * @param inPlace Whether to compound in place.
     * @param sweepTokens The tokens to be swept.
     */
    function compoundFor(
        Sickle sickle,
        NftPosition calldata position,
        NftCompound calldata params,
        bool inPlace,
        address[] calldata sweepTokens
    ) external override onlyApproved(sickle) {
        nftSettingsRegistry.validateCompoundFor(
            NftKey({
                sickle: sickle,
                nftManager: position.nft,
                tokenId: position.tokenId
            })
        );
        _compound(
            sickle,
            position,
            params,
            inPlace,
            sweepTokens,
            NftFarmStrategyFees.CompoundFor
        );
    }

    /**
     * @notice Exits an NFT from the NFT farm.
     * Can only be called by the approved address on the Sickle.
     * @param position The position details of the NFT to be exited.
     * @param harvestParams The parameters for the harvest.
     * @param withdrawParams The parameters for the withdrawal.
     * @param sweepTokens The tokens to be swept.
     */
    function exitFor(
        Sickle sickle,
        NftPosition calldata position,
        NftHarvest calldata harvestParams,
        NftWithdraw calldata withdrawParams,
        address[] calldata sweepTokens
    ) external override onlyApproved(sickle) {
        nftSettingsRegistry.validateExitFor(
            NftKey({
                sickle: sickle,
                nftManager: position.nft,
                tokenId: position.tokenId
            })
        );
        _exit(sickle, position, harvestParams, withdrawParams, sweepTokens);
    }

    /**
     * @notice Rebalances the NFT farm.
     * Can only be called by the approved address on the Sickle.
     * @param params The parameters for the rebalance.
     * @param sweepTokens The tokens to be swept.
     */
    function rebalanceFor(
        Sickle sickle,
        NftRebalance calldata params,
        address[] calldata sweepTokens
    ) external override onlyApproved(sickle) {
        nftSettingsRegistry.validateRebalanceFor(
            NftKey({
                sickle: sickle,
                nftManager: params.position.nft,
                tokenId: params.position.tokenId
            })
        );
        _rebalance(sickle, params, sweepTokens, NftFarmStrategyFees.HarvestFor);
    }

    /* Modifiers */

    modifier nftSupplyUnchanged(
        INonfungiblePositionManager nft
    ) {
        INftLiquidityConnector liquidityConnector =
            INftLiquidityConnector(connectorRegistry.connectorOf(address(nft)));
        uint256 initialSupply = liquidityConnector.totalSupply(address(nft));
        _;
        if (initialSupply != liquidityConnector.totalSupply(address(nft))) {
            revert NftSupplyChanged();
        }
    }

    /* Private */

    function _withdraw(
        Sickle sickle,
        NftPosition calldata position,
        NftWithdraw calldata params,
        bytes4 withdrawalFee
    ) internal {
        _withdrawNft(sickle, position, params.extraData);

        _zapOut(sickle, params, withdrawalFee);
    }

    function _harvest(
        Sickle sickle,
        NftPosition calldata position,
        NftHarvest calldata params,
        bytes4 fee
    ) private {
        if (params.swaps.length > 0) {
            _claimAndSwap(sickle, position, params);
        } else {
            _claim(sickle, position, params.harvest, fee);
        }

        if (params.sweepTokens.length > 0) {
            _sweep(sickle, params.sweepTokens);
        }

        emit SickleHarvestedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    function _simpleHarvest(
        Sickle sickle,
        NftPosition calldata position,
        SimpleNftHarvest calldata params
    ) private {
        _claim(sickle, position, params, NftFarmStrategyFees.Harvest);

        _sweep(sickle, params.rewardTokens);

        emit SickleHarvestedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    function _compound(
        Sickle sickle,
        NftPosition calldata position,
        NftCompound calldata params,
        bool inPlace,
        address[] calldata sweepTokens,
        bytes4 fee
    ) private {
        _claim(sickle, position, params.harvest, fee);

        if (!inPlace) {
            _withdrawNft(sickle, position, params.harvest.extraData);
        }

        _zapIn(sickle, params.zap);

        if (!inPlace) {
            _depositNft(sickle, position, params.harvest.extraData);
        }

        _sweep(sickle, sweepTokens);

        emit SickleCompoundedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    function _exit(
        Sickle sickle,
        NftPosition calldata position,
        NftHarvest calldata harvestParams,
        NftWithdraw calldata withdrawParams,
        address[] calldata sweepTokens
    ) private {
        _harvest(sickle, position, harvestParams, NftFarmStrategyFees.Harvest);

        _withdraw(
            sickle, position, withdrawParams, NftFarmStrategyFees.Withdraw
        );

        _sweep(sickle, sweepTokens);

        emit SickleExitedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    function _rebalance(
        Sickle sickle,
        NftRebalance calldata params,
        address[] calldata sweepTokens,
        bytes4 harvestFee
    ) private {
        _harvest(sickle, params.position, params.harvest, harvestFee);

        _withdraw(
            sickle,
            params.position,
            params.withdraw,
            _getRebalanceFee(
                params.position.nft, params.pool, params.position.tokenId
            )
        );

        _zapIn(sickle, params.increase.zap);

        _resetNftSettings(sickle, params.position.nft, params.position.tokenId);

        uint256 tokenId = INftLiquidityConnector(
            connectorRegistry.connectorOf(address(params.position.nft))
        ).getTokenId(address(params.position.nft), address(sickle));

        _depositNft(
            sickle,
            NftPosition({
                farm: params.position.farm,
                nft: params.position.nft,
                tokenId: tokenId
            }),
            params.increase.extraData
        );

        _sweep(sickle, sweepTokens);

        emit SickleRebalancedNft(
            sickle,
            params.position.nft,
            params.position.tokenId,
            params.position.farm.stakingContract,
            params.position.farm.poolIndex
        );
    }

    /* Building blocks */

    function _transferInTokens(
        Sickle sickle,
        NftIncrease calldata params
    ) private {
        bytes4 fee = params.zap.swaps.length > 0
            ? NftFarmStrategyFees.Deposit
            : bytes4(0);

        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = address(transferLib);
        data[0] = abi.encodeCall(
            ITransferLib.transferTokensFromUser,
            (params.tokensIn, params.amountsIn, strategyAddress, fee)
        );

        sickle.multicall{ value: msg.value }(targets, data);
    }

    function _transferInNft(
        Sickle sickle,
        INonfungiblePositionManager nft,
        uint256 tokenId
    ) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = address(nftTransferLib);
        data[0] = abi.encodeCall(
            INftTransferLib.transferErc721FromUser, (nft, tokenId)
        );

        sickle.multicall(targets, data);
    }

    function _transferOutNft(
        Sickle sickle,
        INonfungiblePositionManager nft,
        uint256 tokenId
    ) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = address(nftTransferLib);
        data[0] =
            abi.encodeCall(INftTransferLib.transferErc721ToUser, (nft, tokenId));

        sickle.multicall(targets, data);
    }

    function _depositNft(
        Sickle sickle,
        NftPosition memory position,
        bytes calldata extraData
    ) private {
        address farmConnector =
            connectorRegistry.connectorOf(position.farm.stakingContract);

        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = farmConnector;
        data[0] = abi.encodeCall(
            INftFarmConnector.depositExistingNft, (position, extraData)
        );

        sickle.multicall(targets, data);

        emit SickleDepositedNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    function _withdrawNft(
        Sickle sickle,
        NftPosition calldata position,
        bytes calldata extraData
    ) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        address farmConnector =
            connectorRegistry.connectorOf(position.farm.stakingContract);

        targets[0] = farmConnector;
        data[0] =
            abi.encodeCall(INftFarmConnector.withdrawNft, (position, extraData));

        sickle.multicall(targets, data);

        emit SickleWithdrewNft(
            sickle,
            position.nft,
            position.tokenId,
            position.farm.stakingContract,
            position.farm.poolIndex
        );
    }

    // Claim, swap then charge fees on the output
    function _claimAndSwap(
        Sickle sickle,
        NftPosition calldata position,
        NftHarvest calldata params
    ) private {
        address farmConnector =
            connectorRegistry.connectorOf(position.farm.stakingContract);

        address[] memory targets = new address[](3);
        bytes[] memory data = new bytes[](3);

        targets[0] = farmConnector;
        data[0] = abi.encodeCall(
            INftFarmConnector.claim,
            (
                position,
                params.harvest.rewardTokens,
                params.harvest.amount0Max,
                params.harvest.amount1Max,
                params.harvest.extraData
            )
        );

        targets[1] = address(swapLib);
        data[1] = abi.encodeCall(ISwapLib.swapMultiple, (params.swaps));

        targets[2] = address(feesLib);
        data[2] = abi.encodeCall(
            IFeesLib.chargeFees,
            (strategyAddress, NftFarmStrategyFees.Harvest, params.outputTokens)
        );
        sickle.multicall(targets, data);
    }

    // Claim then charge fees on the reward tokens
    function _claim(
        Sickle sickle,
        NftPosition calldata position,
        SimpleNftHarvest calldata params,
        bytes4 fee
    ) private {
        address farmConnector =
            connectorRegistry.connectorOf(position.farm.stakingContract);

        address[] memory targets = new address[](2);
        bytes[] memory data = new bytes[](2);

        targets[0] = farmConnector;
        data[0] = abi.encodeCall(
            INftFarmConnector.claim,
            (
                position,
                params.rewardTokens,
                params.amount0Max,
                params.amount1Max,
                params.extraData
            )
        );

        targets[1] = address(feesLib);
        data[1] = abi.encodeCall(
            IFeesLib.chargeFees, (strategyAddress, fee, params.rewardTokens)
        );

        sickle.multicall(targets, data);
    }

    function _zapIn(Sickle sickle, NftZapIn calldata zap) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = address(nftZapLib);
        data[0] = abi.encodeCall(INftZapLib.zapIn, (zap));

        sickle.multicall(targets, data);
    }

    function _zapOut(
        Sickle sickle,
        NftWithdraw calldata params,
        bytes4 withdrawalFee
    ) private {
        address[] memory targets = new address[](2);
        bytes[] memory data = new bytes[](2);

        targets[0] = address(nftZapLib);
        data[0] = abi.encodeCall(INftZapLib.zapOut, (params.zap));

        targets[1] = address(feesLib);
        data[1] = abi.encodeCall(
            IFeesLib.chargeFees,
            (strategyAddress, withdrawalFee, params.tokensOut)
        );

        sickle.multicall(targets, data);
    }

    function _setNftSettings(
        Sickle sickle,
        INonfungiblePositionManager nft,
        uint256 tokenId,
        NftSettings calldata settings
    ) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = address(nftSettingsLib);
        data[0] = abi.encodeCall(
            INftSettingsLib.setNftSettings,
            (nftSettingsRegistry, nft, tokenId, settings)
        );

        sickle.multicall(targets, data);
    }

    function _resetNftSettings(
        Sickle sickle,
        INonfungiblePositionManager nft,
        uint256 tokenId
    ) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = address(nftSettingsLib);
        data[0] = abi.encodeCall(
            INftSettingsLib.transferNftSettings,
            (nftSettingsRegistry, nft, tokenId)
        );

        sickle.multicall(targets, data);
    }

    function _sweep(Sickle sickle, address[] calldata sweepTokens) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);
        targets[0] = address(transferLib);
        data[0] =
            abi.encodeCall(ITransferLib.transferTokensToUser, (sweepTokens));

        sickle.multicall(targets, data);
    }

    function _getRebalanceFee(
        INonfungiblePositionManager nft,
        IUniswapV3Pool pool,
        uint256 tokenId
    ) internal view returns (bytes4) {
        INftLiquidityConnector liquidityConnector =
            INftLiquidityConnector(connectorRegistry.connectorOf(address(nft)));
        uint24 fee = liquidityConnector.fee(address(pool), tokenId);
        if (fee <= REBALANCE_LOW_FEE_BPS) {
            return NftFarmStrategyFees.RebalanceLow;
        } else if (fee <= REBALANCE_MID_FEE_BPS) {
            return NftFarmStrategyFees.RebalanceMid;
        } else {
            return NftFarmStrategyFees.RebalanceHigh;
        }
    }
}

// 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
        );

    function factory() external view returns (address);
}

// 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.17;

import { SickleFactory, Sickle } from "contracts/SickleFactory.sol";
import { ConnectorRegistry } from "contracts/ConnectorRegistry.sol";
import { AccessControlModule } from "contracts/modules/AccessControlModule.sol";

contract StrategyModule is AccessControlModule {
    ConnectorRegistry public immutable connectorRegistry;

    constructor(
        SickleFactory factory,
        ConnectorRegistry connectorRegistry_
    ) AccessControlModule(factory) {
        connectorRegistry = connectorRegistry_;
    }

    function getSickle(
        address owner
    ) public view returns (Sickle) {
        Sickle sickle = Sickle(payable(factory.sickles(owner)));
        if (address(sickle) == address(0)) {
            revert SickleNotDeployed();
        }
        return sickle;
    }

    function getOrDeploySickle(
        address owner,
        address approved,
        bytes32 referralCode
    ) public returns (Sickle) {
        return
            Sickle(payable(factory.getOrDeploy(owner, approved, referralCode)));
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Admin } from "contracts/base/Admin.sol";
import { TimelockAdmin } from "contracts/base/TimelockAdmin.sol";

error ConnectorNotRegistered(address target);
error CustomRegistryAlreadyRegistered();

interface ICustomConnectorRegistry {
    function connectorOf(
        address target
    ) external view returns (address);
}

contract ConnectorRegistry is Admin, TimelockAdmin {
    event ConnectorChanged(address target, address connector);
    event CustomRegistryAdded(address registry);
    event CustomRegistryRemoved(address registry);

    error ConnectorAlreadySet(address target);
    error ConnectorNotSet(address target);
    error ArrayLengthMismatch();

    ICustomConnectorRegistry[] public customRegistries;

    mapping(address target => address connector) private connectors_;

    constructor(
        address admin_,
        address timelockAdmin_
    ) Admin(admin_) TimelockAdmin(timelockAdmin_) { }

    /// Admin functions

    /// @notice Update connector addresses for a batch of targets.
    /// @dev Controls which connector contracts are used for the specified
    /// targets.
    /// @custom:access Restricted to protocol admin.
    function setConnectors(
        address[] calldata targets,
        address[] calldata connectors
    ) external onlyAdmin {
        if (targets.length != connectors.length) {
            revert ArrayLengthMismatch();
        }
        for (uint256 i; i != targets.length;) {
            if (connectors_[targets[i]] != address(0)) {
                revert ConnectorAlreadySet(targets[i]);
            }
            connectors_[targets[i]] = connectors[i];
            emit ConnectorChanged(targets[i], connectors[i]);

            unchecked {
                ++i;
            }
        }
    }

    function updateConnectors(
        address[] calldata targets,
        address[] calldata connectors
    ) external onlyTimelockAdmin {
        if (targets.length != connectors.length) {
            revert ArrayLengthMismatch();
        }
        for (uint256 i; i != targets.length;) {
            if (connectors_[targets[i]] == address(0)) {
                revert ConnectorNotSet(targets[i]);
            }
            connectors_[targets[i]] = connectors[i];
            emit ConnectorChanged(targets[i], connectors[i]);

            unchecked {
                ++i;
            }
        }
    }

    /// @notice Append an address to the custom registries list.
    /// @custom:access Restricted to protocol admin.
    function addCustomRegistry(
        ICustomConnectorRegistry registry
    ) external onlyAdmin {
        if (isCustomRegistry(registry)) {
            revert CustomRegistryAlreadyRegistered();
        }

        customRegistries.push(registry);
        emit CustomRegistryAdded(address(registry));
    }

    /// @notice Replace an address in the custom registries list.
    /// @custom:access Restricted to protocol admin.
    function updateCustomRegistry(
        uint256 index,
        ICustomConnectorRegistry newRegistry
    ) external onlyTimelockAdmin {
        ICustomConnectorRegistry oldRegistry = customRegistries[index];
        emit CustomRegistryRemoved(address(oldRegistry));
        customRegistries[index] = newRegistry;
        if (address(newRegistry) != address(0)) {
            emit CustomRegistryAdded(address(newRegistry));
        }
    }

    /// Public functions

    function connectorOf(
        address target
    ) external view returns (address) {
        address connector = _getConnector(target);

        if (connector != address(0)) {
            return connector;
        }

        revert ConnectorNotRegistered(target);
    }

    function hasConnector(
        address target
    ) external view returns (bool) {
        return _getConnector(target) != address(0);
    }

    function isCustomRegistry(
        ICustomConnectorRegistry registry
    ) public view returns (bool) {
        for (uint256 i; i != customRegistries.length;) {
            if (address(customRegistries[i]) == address(registry)) {
                return true;
            }
            unchecked {
                ++i;
            }
        }
        return false;
    }

    /// Internal functions

    function _getConnector(
        address target
    ) internal view returns (address) {
        address connector = connectors_[target];
        if (connector != address(0)) {
            return connector;
        }
        uint256 length = customRegistries.length;
        for (uint256 i; i != length;) {
            if (address(customRegistries[i]) != address(0)) {
                (bool success, bytes memory data) = address(customRegistries[i])
                    .staticcall(
                    abi.encodeWithSelector(
                        ICustomConnectorRegistry.connectorOf.selector, target
                    )
                );
                if (success && data.length == 32) {
                    address _connector = abi.decode(data, (address));
                    if (_connector != address(0)) {
                        return _connector;
                    }
                }
            }

            unchecked {
                ++i;
            }
        }

        return address(0);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { NftPosition } from "contracts/structs/NftFarmStrategyStructs.sol";

interface INftFarmConnector {
    function depositExistingNft(
        NftPosition calldata position,
        bytes calldata extraData
    ) external payable;

    function withdrawNft(
        NftPosition calldata position,
        bytes calldata extraData
    ) external payable;
    // Payable in case an NFT is withdrawn to be increased with ETH

    function claim(
        NftPosition calldata position,
        address[] memory rewardTokens,
        uint128 maxAmount0, // For collecting
        uint128 maxAmount1,
        bytes calldata extraData
    ) external payable;

    function earned(
        address user,
        NftPosition calldata position,
        address[] memory rewardTokens
    ) external view returns (uint256[] memory);

    function isStaked(
        address user,
        NftPosition calldata position
    ) external view returns (bool);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {
    NftAddLiquidity,
    NftRemoveLiquidity,
    NftPoolKey,
    NftPoolInfo,
    NftPositionInfo
} from "contracts/structs/NftLiquidityStructs.sol";

interface INftLiquidityConnector {
    function addLiquidity(
        NftAddLiquidity memory addLiquidityParams
    ) external payable;

    function removeLiquidity(
        NftRemoveLiquidity memory removeLiquidityParams
    ) external;

    function fee(
        address pool,
        uint256 tokenId // Used by UniswapV4
    ) external view returns (uint24);

    function totalSupply(
        address nftManager
    ) external view returns (uint256);

    function getTokenId(
        address nftManager,
        address owner
    ) external view returns (uint256);

    function earnedFees(
        address nftManager,
        address pool,
        uint256 tokenId
    ) external view returns (uint256 fees0, uint256 fees1);

    function positionLiquidity(
        address nftManager,
        uint256 tokenId
    )
        external
        view
        returns (int24 tickLower, int24 tickUpper, uint128 liquidity);

    function positionPoolKey(
        address poolFactory,
        address nftManager,
        uint256 tokenId
    ) external view returns (NftPoolKey memory);

    function poolInfo(
        address pool,
        bytes32 poolId
    ) external view returns (NftPoolInfo memory);

    // Maintained for backwards compatibility with NftSettingsRegistry
    function positionInfo(
        address nftManager,
        uint256 tokenId
    ) external view returns (NftPositionInfo memory);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { NftKey, NftSettings } from "contracts/structs/NftSettingsStructs.sol";

interface INftSettingsRegistry {
    error InvalidNftManager();
    error AutoHarvestNotSet();
    error AutoCompoundNotSet();
    error AutoRebalanceNotSet();
    error AutoExitNotSet();
    error ExitTriggersNotSet();
    error InvalidExitTriggers();
    error InvalidTokenOut();
    error InvalidMinMaxTickRange();
    error InvalidSlippageBP();
    error InvalidPriceImpactBP();
    error InvalidDustBP();
    error InvalidMinTickLow();
    error InvalidMaxTickHigh();
    error InvalidBufferTicksAbove();
    error InvalidBufferTicksBelow();
    error OnlySickle();
    error RebalanceConfigNotSet();
    error TickWithinRange();
    error TickOutsideStopLossRange();
    error SickleNotDeployed();
    error InvalidWidth(uint24 actual, uint24 expected);
    error TokenIdUnchanged();

    event NftSettingsSet(NftKey key, NftSettings settings);
    event NftSettingsUnset(NftKey key);
    event ConnectionRegistrySet(address connectorRegistry);

    function getNftSettings(
        NftKey calldata key
    ) external view returns (NftSettings memory);

    function setNftSettings(
        NftKey calldata key,
        NftSettings calldata settings
    ) external;

    function transferNftSettings(
        NftKey calldata oldKey,
        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 { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import { IERC1155 } from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

interface INftTransferLib {
    /// @dev Transfers the ERC721 NFT with {tokenId} from the user to the Sickle
    function transferErc721FromUser(IERC721 nft, uint256 tokenId) external;

    /// @dev Transfers the ERC721 NFT with {tokenId} from the Sickle to the user
    function transferErc721ToUser(IERC721 nft, uint256 tokenId) external;

    /// @dev Transfers the ERC1155 NFT with {tokenId} from the user to Sickle
    function transferErc1155FromUser(
        IERC1155 nft,
        uint256 tokenId,
        uint256 amount
    ) external;

    /// @dev Transfers the ERC1155 NFT with {tokenId} from Sickle to the user
    function transferErc1155ToUser(
        IERC1155 nft,
        uint256 tokenId,
        uint256 amount
    ) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Sickle } from "contracts/Sickle.sol";

interface IFeesLib {
    event FeeCharged(
        address strategy, bytes4 feeDescriptor, uint256 amount, address token
    );
    event TransactionCostCharged(address recipient, uint256 amount);

    function chargeFee(
        address strategy,
        bytes4 feeDescriptor,
        address feeToken,
        uint256 feeBasis
    ) external payable returns (uint256 remainder);

    function chargeFees(
        address strategy,
        bytes4 feeDescriptor,
        address[] memory feeTokens
    ) external payable;

    function getBalance(
        Sickle sickle,
        address token
    ) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface ITransferLib {
    error ArrayLengthMismatch();
    error TokenInRequired();
    error AmountInRequired();
    error DuplicateTokenIn();
    error TokenOutRequired();
    error IncompatibleEthTokens();

    function transferTokenToUser(
        address token
    ) external payable;

    function transferTokensToUser(
        address[] memory tokens
    ) external payable;

    function transferTokenFromUser(
        address tokenIn,
        uint256 amountIn,
        address strategy,
        bytes4 feeSelector
    ) external payable;

    function transferTokensFromUser(
        address[] memory tokensIn,
        uint256[] memory amountsIn,
        address strategy,
        bytes4 feeSelector
    ) external payable;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { SwapParams } from "contracts/structs/SwapStructs.sol";

interface ISwapLib {
    function swap(
        SwapParams memory swap
    ) external payable;

    function swapMultiple(
        SwapParams[] memory swaps
    ) external payable;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { NftZapIn, NftZapOut } from "contracts/structs/NftZapStructs.sol";

interface INftZapLib {
    function zapIn(
        NftZapIn memory zap
    ) external payable;

    function zapOut(
        NftZapOut memory zap
    ) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { INonfungiblePositionManager } from
    "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol";

import {
    INftSettingsRegistry,
    NftSettings
} from "contracts/interfaces/INftSettingsRegistry.sol";

interface INftSettingsLib {
    error InvalidTokenId();

    function transferNftSettings(
        INftSettingsRegistry nftSettingsRegistry,
        INonfungiblePositionManager nftManager,
        uint256 tokenId
    ) external;

    function setNftSettings(
        INftSettingsRegistry nftSettingsRegistry,
        INonfungiblePositionManager nftManager,
        uint256 tokenId,
        NftSettings calldata settings
    ) external;
}

File 15 of 41 : NftFarmStrategyEvents.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { INonfungiblePositionManager } from
    "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol";

import { Sickle } from "contracts/Sickle.sol";

abstract contract NftFarmStrategyEvents {
    event SickleDepositedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleIncreasedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleHarvestedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleCompoundedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleWithdrewNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleDecreasedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleExitedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleRebalancedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed nft,
        uint256 indexed tokenId,
        address stakingContract,
        uint256 poolIndex
    );

    event SickleMovedNft(
        Sickle indexed sickle,
        INonfungiblePositionManager indexed fromNft,
        uint256 indexed fromTokenId,
        address fromStakingContract,
        uint256 fromPoolIndex,
        INonfungiblePositionManager toNft,
        uint256 toTokenId,
        address toStakingContract,
        uint256 toPoolIndex
    );
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Sickle } from "contracts/Sickle.sol";
import {
    NftPosition,
    NftRebalance,
    NftHarvest,
    NftWithdraw,
    NftCompound
} from "contracts/structs/NftFarmStrategyStructs.sol";

interface INftAutomation {
    function rebalanceFor(
        Sickle sickle,
        NftRebalance calldata rebalance,
        address[] calldata sweepTokens
    ) external;

    function harvestFor(
        Sickle sickle,
        NftPosition calldata position,
        NftHarvest calldata params
    ) external;

    function compoundFor(
        Sickle sickle,
        NftPosition calldata position,
        NftCompound calldata params,
        bool inPlace,
        address[] memory sweepTokens
    ) external;

    function exitFor(
        Sickle sickle,
        NftPosition calldata position,
        NftHarvest calldata harvestParams,
        NftWithdraw calldata withdrawParams,
        address[] memory sweepTokens
    ) external;
}

File 17 of 41 : NftZapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { SwapParams } from "contracts/structs/SwapStructs.sol";
import {
    NftAddLiquidity,
    NftRemoveLiquidity
} from "contracts/structs/NftLiquidityStructs.sol";

struct NftZapIn {
    SwapParams[] swaps;
    NftAddLiquidity addLiquidityParams;
}

struct NftZapOut {
    NftRemoveLiquidity removeLiquidityParams;
    SwapParams[] swaps;
}

File 18 of 41 : FarmStrategyStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ZapIn, ZapOut } from "contracts/structs/ZapStructs.sol";
import { SwapParams } from "contracts/structs/SwapStructs.sol";

struct Farm {
    address stakingContract;
    uint256 poolIndex;
}

struct DepositParams {
    Farm farm;
    address[] tokensIn;
    uint256[] amountsIn;
    ZapIn zap;
    bytes extraData;
}

struct WithdrawParams {
    bytes extraData;
    ZapOut zap;
    address[] tokensOut;
}

struct HarvestParams {
    SwapParams[] swaps;
    bytes extraData;
    address[] tokensOut;
}

struct CompoundParams {
    Farm claimFarm;
    bytes claimExtraData;
    address[] rewardTokens;
    ZapIn zap;
    Farm depositFarm;
    bytes depositExtraData;
}

struct SimpleDepositParams {
    Farm farm;
    address lpToken;
    uint256 amountIn;
    bytes extraData;
}

struct SimpleHarvestParams {
    address[] rewardTokens;
    bytes extraData;
}

struct SimpleWithdrawParams {
    address lpToken;
    uint256 amountOut;
    bytes extraData;
}

File 19 of 41 : NftFarmStrategyStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IUniswapV3Pool } from
    "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol";
import { INonfungiblePositionManager } from
    "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol";
import { NftZapIn, NftZapOut } from "contracts/structs/NftZapStructs.sol";
import { SwapParams } from "contracts/structs/SwapStructs.sol";
import { Farm } from "contracts/structs/FarmStrategyStructs.sol";

struct NftPosition {
    Farm farm;
    INonfungiblePositionManager nft;
    uint256 tokenId;
}

struct NftIncrease {
    address[] tokensIn;
    uint256[] amountsIn;
    NftZapIn zap;
    bytes extraData;
}

struct NftDeposit {
    Farm farm;
    INonfungiblePositionManager nft;
    NftIncrease increase;
}

struct NftWithdraw {
    NftZapOut zap;
    address[] tokensOut;
    bytes extraData;
}

struct SimpleNftHarvest {
    address[] rewardTokens;
    uint128 amount0Max;
    uint128 amount1Max;
    bytes extraData;
}

struct NftHarvest {
    SimpleNftHarvest harvest;
    SwapParams[] swaps;
    address[] outputTokens;
    address[] sweepTokens;
}

struct NftCompound {
    SimpleNftHarvest harvest;
    NftZapIn zap;
}

struct NftRebalance {
    IUniswapV3Pool pool;
    NftPosition position;
    NftHarvest harvest;
    NftWithdraw withdraw;
    NftIncrease increase;
}

struct NftMove {
    IUniswapV3Pool pool;
    NftPosition position;
    NftHarvest harvest;
    NftWithdraw withdraw;
    NftDeposit deposit;
}

File 20 of 41 : NftSettingsStructs.sol
// 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 } 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;
    bytes32 poolId;
    bool autoRebalance;
    RebalanceConfig rebalanceConfig;
    bool automateRewards;
    RewardConfig rewardConfig;
    bool autoExit;
    ExitConfig exitConfig;
    bytes extraData;
}

File 21 of 41 : IERC721Enumerable.sol
// 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 { Clones } from "@openzeppelin/contracts/proxy/Clones.sol";

import { Sickle } from "contracts/Sickle.sol";
import { SickleRegistry } from "contracts/SickleRegistry.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_);
    }

    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 approved Address approved to manage automation
    /// @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 approved Address approved to manage automation
    /// @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);
    }
}

File 23 of 41 : AccessControlModule.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Sickle } from "contracts/Sickle.sol";
import { SickleFactory } from "contracts/SickleFactory.sol";

contract AccessControlModule {
    SickleFactory public immutable factory;

    error NotOwner(address sender); // 30cd7471
    error NotApproved();
    error SickleNotDeployed();
    error NotRegisteredSickle();

    constructor(
        SickleFactory factory_
    ) {
        factory = factory_;
    }

    modifier onlyRegisteredSickle() {
        if (factory.admins(address(this)) == address(0)) {
            revert NotRegisteredSickle();
        }

        _;
    }

    // @dev allow access only to the sickle's owner or addresses approved by him
    // to use only for functions such as claiming rewards or compounding rewards
    modifier onlyApproved(
        Sickle sickle
    ) {
        // Here we check if the Sickle was really deployed, this gives use the
        // guarantee that the contract that we are going to call is genuine
        if (factory.admins(address(sickle)) == address(0)) {
            revert SickleNotDeployed();
        }

        if (sickle.approved() != msg.sender) revert NotApproved();

        _;
    }
}

File 24 of 41 : Admin.sol
// 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(address(0), 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;
    }
}

File 25 of 41 : TimelockAdmin.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @title TimelockAdmin contract
/// @author vfat.tools
/// @notice Provides an timelockAdministration mechanism allowing restricted
/// functions
abstract contract TimelockAdmin {
    /// ERRORS ///

    /// @notice Thrown when the caller is not the timelockAdmin
    error NotTimelockAdminError();

    /// EVENTS ///

    /// @notice Emitted when a new timelockAdmin is set
    /// @param oldTimelockAdmin Address of the old timelockAdmin
    /// @param newTimelockAdmin Address of the new timelockAdmin
    event TimelockAdminSet(address oldTimelockAdmin, address newTimelockAdmin);

    /// STORAGE ///

    /// @notice Address of the current timelockAdmin
    address public timelockAdmin;

    /// MODIFIERS ///

    /// @dev Restricts a function to the timelockAdmin
    modifier onlyTimelockAdmin() {
        if (msg.sender != timelockAdmin) revert NotTimelockAdminError();
        _;
    }

    /// WRITE FUNCTIONS ///

    /// @param timelockAdmin_ Address of the timelockAdmin
    constructor(
        address timelockAdmin_
    ) {
        emit TimelockAdminSet(timelockAdmin, timelockAdmin_);
        timelockAdmin = timelockAdmin_;
    }

    /// @notice Sets a new timelockAdmin
    /// @dev Can only be called by the current timelockAdmin
    /// @param newTimelockAdmin Address of the new timelockAdmin
    function setTimelockAdmin(
        address newTimelockAdmin
    ) external onlyTimelockAdmin {
        emit TimelockAdminSet(timelockAdmin, newTimelockAdmin);
        timelockAdmin = newTimelockAdmin;
    }
}

File 26 of 41 : NftLiquidityStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { INonfungiblePositionManager } from
    "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol";

struct Pool {
    address token0;
    address token1;
    uint24 fee;
}

struct NftPoolKey {
    address poolAddress;
    bytes32 poolId;
}

struct NftPoolInfo {
    address token0;
    address token1;
    uint24 fee;
    uint24 tickSpacing;
    uint160 sqrtPriceX96;
    int24 tick;
    uint128 liquidity;
    uint256 feeGrowthGlobal0X128;
    uint256 feeGrowthGlobal1X128;
}

// Maintained for backwards compatibility with NftSettingsRegistry
struct NftPositionInfo {
    uint128 liquidity;
    int24 tickLower;
    int24 tickUpper;
}

struct NftAddLiquidity {
    INonfungiblePositionManager nft;
    uint256 tokenId;
    Pool pool;
    int24 tickLower;
    int24 tickUpper;
    uint256 amount0Desired;
    uint256 amount1Desired;
    uint256 amount0Min;
    uint256 amount1Min;
    bytes extraData;
}

struct NftRemoveLiquidity {
    INonfungiblePositionManager nft;
    uint256 tokenId;
    uint128 liquidity;
    uint256 amount0Min; // For decreasing
    uint256 amount1Min;
    uint128 amount0Max; // For collecting
    uint128 amount1Max;
    bytes extraData;
}

// 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.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

// 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_
    ) Multicall(sickleRegistry_) {
        _disableInitializers();
    }

    /// @param sickleOwner_ Address of the Sickle owner
    function initialize(
        address sickleOwner_,
        address approved_
    ) external initializer {
        SickleStorage._initializeSickleStorage(sickleOwner_, approved_);
    }

    /// INTERNALS ///

    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;
    }
}

File 30 of 41 : SwapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct SwapParams {
    address tokenApproval;
    address router;
    uint256 amountIn;
    uint256 desiredAmountOut;
    uint256 minAmountOut;
    address tokenIn;
    address tokenOut;
    bytes extraData;
}

File 31 of 41 : ZapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { SwapParams } from "contracts/structs/SwapStructs.sol";

import {
    AddLiquidityParams,
    RemoveLiquidityParams
} from "contracts/structs/LiquidityStructs.sol";

struct ZapIn {
    SwapParams[] swaps;
    AddLiquidityParams addLiquidityParams;
}

struct ZapOut {
    RemoveLiquidityParams removeLiquidityParams;
    SwapParams[] swaps;
}

File 32 of 41 : PositionSettingsStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

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 baseTokenIndex;
    uint256 quoteTokenIndex;
    uint256 triggerPriceLow;
    address exitTokenOutLow;
    uint256 triggerPriceHigh;
    address exitTokenOutHigh;
    uint256[] triggerReservesLow;
    address[] triggerReservesTokensOut;
    uint256 priceImpactBP;
    uint256 slippageBP;
}

/**
 * Settings for automating an ERC20 position
 * @param pool: Uniswap or Aerodrome vAMM/sAMM pair for the position (requires
 * ILiquidityConnector connector registered)
 * @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 {
    address pool;
    address router;
    bool automateRewards;
    RewardConfig rewardConfig;
    bool autoExit;
    ExitConfig exitConfig;
    bytes extraData;
}

// 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.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;

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 {
    /// CONSTANTS ///

    uint256 constant MAX_FEE = 500; // 5%

    /// 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] <= MAX_FEE) {
                feeRegistry[feeHashes[i]] = feesArray[i];
            } else {
                revert FeeAboveMaxLimit();
            }
            unchecked {
                ++i;
            }
        }

        emit SickleRegistryEvents.FeesUpdated(feeHashes, feesArray);
    }
}

// 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);
}

// 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 of the Sickle contract
    modifier onlyOwner() {
        if (msg.sender != owner) revert NotOwnerError();
        _;
    }

    /// INITIALIZATION ///

    /// @param owner_ Address of the owner of this Sickle contract
    function _initializeSickleStorage(
        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;
    }
}

File 38 of 41 : Multicall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

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 {
    /// 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_
    ) {
        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;
            }
        }
    }
}

File 39 of 41 : LiquidityStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct AddLiquidityParams {
    address router;
    address lpToken;
    address[] tokens;
    uint256[] desiredAmounts;
    uint256[] minAmounts;
    bytes extraData;
}

struct RemoveLiquidityParams {
    address router;
    address lpToken;
    address[] tokens;
    uint256 lpAmountIn;
    uint256[] minAmountsOut;
    bytes extraData;
}

// 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) (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);
        }
    }
}

Settings
{
  "remappings": [
    "solmate/=lib/solmate/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@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
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract SickleFactory","name":"factory","type":"address"},{"internalType":"contract ConnectorRegistry","name":"connectorRegistry","type":"address"},{"internalType":"contract INftSettingsRegistry","name":"nftSettingsRegistry_","type":"address"},{"components":[{"internalType":"contract INftTransferLib","name":"nftTransferLib","type":"address"},{"internalType":"contract ITransferLib","name":"transferLib","type":"address"},{"internalType":"contract ISwapLib","name":"swapLib","type":"address"},{"internalType":"contract IFeesLib","name":"feesLib","type":"address"},{"internalType":"contract INftZapLib","name":"nftZapLib","type":"address"},{"internalType":"contract INftSettingsLib","name":"nftSettingsLib","type":"address"}],"internalType":"struct NftFarmStrategy.Libraries","name":"libraries","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NftSupplyChanged","type":"error"},{"inputs":[],"name":"NftSupplyDidntIncrease","type":"error"},{"inputs":[],"name":"NotApproved","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"NotOwner","type":"error"},{"inputs":[],"name":"NotRegisteredSickle","type":"error"},{"inputs":[],"name":"PleaseUseDeposit","type":"error"},{"inputs":[],"name":"PleaseUseIncrease","type":"error"},{"inputs":[],"name":"SickleNotDeployed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleCompoundedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleDecreasedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleDepositedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleExitedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleHarvestedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleIncreasedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"fromNft","type":"address"},{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"fromStakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"fromPoolIndex","type":"uint256"},{"indexed":false,"internalType":"contract INonfungiblePositionManager","name":"toNft","type":"address"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"toStakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"toPoolIndex","type":"uint256"}],"name":"SickleMovedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleRebalancedNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleWithdrewNft","type":"event"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"}],"internalType":"struct NftCompound","name":"params","type":"tuple"},{"internalType":"bool","name":"inPlace","type":"bool"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"compound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"}],"internalType":"struct NftCompound","name":"params","type":"tuple"},{"internalType":"bool","name":"inPlace","type":"bool"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"compoundFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"connectorRegistry","outputs":[{"internalType":"contract ConnectorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"harvestParams","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftWithdraw","name":"withdrawParams","type":"tuple"},{"internalType":"bool","name":"inPlace","type":"bool"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"decrease","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"components":[{"internalType":"address[]","name":"tokensIn","type":"address[]"},{"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftIncrease","name":"increase","type":"tuple"}],"internalType":"struct NftDeposit","name":"params","type":"tuple"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"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":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftSettings","name":"settings","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"},{"internalType":"address","name":"approved","type":"address"},{"internalType":"bytes32","name":"referralCode","type":"bytes32"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"harvestParams","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftWithdraw","name":"withdrawParams","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"harvestParams","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftWithdraw","name":"withdrawParams","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"exitFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract SickleFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feesLib","outputs":[{"internalType":"contract IFeesLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"approved","type":"address"},{"internalType":"bytes32","name":"referralCode","type":"bytes32"}],"name":"getOrDeploySickle","outputs":[{"internalType":"contract Sickle","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"getSickle","outputs":[{"internalType":"contract Sickle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"params","type":"tuple"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"params","type":"tuple"}],"name":"harvestFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"harvestParams","type":"tuple"},{"components":[{"internalType":"address[]","name":"tokensIn","type":"address[]"},{"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftIncrease","name":"increaseParams","type":"tuple"},{"internalType":"bool","name":"inPlace","type":"bool"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"increase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"harvest","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftWithdraw","name":"withdraw","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"components":[{"internalType":"address[]","name":"tokensIn","type":"address[]"},{"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftIncrease","name":"increase","type":"tuple"}],"internalType":"struct NftDeposit","name":"deposit","type":"tuple"}],"internalType":"struct NftMove","name":"params","type":"tuple"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"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":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftSettings","name":"settings","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"move","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nftSettingsLib","outputs":[{"internalType":"contract INftSettingsLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftSettingsRegistry","outputs":[{"internalType":"contract INftSettingsRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftTransferLib","outputs":[{"internalType":"contract INftTransferLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftZapLib","outputs":[{"internalType":"contract INftZapLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"harvest","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftWithdraw","name":"withdraw","type":"tuple"},{"components":[{"internalType":"address[]","name":"tokensIn","type":"address[]"},{"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftIncrease","name":"increase","type":"tuple"}],"internalType":"struct NftRebalance","name":"params","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"rebalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvest","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"internalType":"address[]","name":"outputTokens","type":"address[]"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"internalType":"struct NftHarvest","name":"harvest","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftWithdraw","name":"withdraw","type":"tuple"},{"components":[{"internalType":"address[]","name":"tokensIn","type":"address[]"},{"internalType":"uint256[]","name":"amountsIn","type":"uint256[]"},{"components":[{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"},{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct Pool","name":"pool","type":"tuple"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftAddLiquidity","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct NftZapIn","name":"zap","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftIncrease","name":"increase","type":"tuple"}],"internalType":"struct NftRebalance","name":"params","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"rebalanceFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"components":[{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"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":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftSettings","name":"settings","type":"tuple"},{"internalType":"address","name":"approved","type":"address"},{"internalType":"bytes32","name":"referralCode","type":"bytes32"}],"name":"simpleDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"harvestParams","type":"tuple"},{"internalType":"bytes","name":"withdrawExtraData","type":"bytes"}],"name":"simpleExit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleNftHarvest","name":"params","type":"tuple"}],"name":"simpleHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"simpleWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapLib","outputs":[{"internalType":"contract ISwapLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferLib","outputs":[{"internalType":"contract ITransferLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"components":[{"components":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftRemoveLiquidity","name":"removeLiquidityParams","type":"tuple"},{"components":[{"internalType":"address","name":"tokenApproval","type":"address"},{"internalType":"address","name":"router","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"desiredAmountOut","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SwapParams[]","name":"swaps","type":"tuple[]"}],"internalType":"struct NftZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct NftWithdraw","name":"params","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101c06040523480156200001257600080fd5b5060405162005785380380620057858339810160408190526200003591620000c3565b6001600160a01b03938416608090815292841660a09081528151851660c05292810151841660e052604081015184166101005260208101518416610120526060810151841661014052909101518216610160521661018052306101a052620001d4565b6001600160a01b0381168114620000ae57600080fd5b50565b8051620000be8162000098565b919050565b600080600080848603610120811215620000dc57600080fd5b8551620000e98162000098565b6020870151909550620000fc8162000098565b60408701519094506200010f8162000098565b925060c0605f19820112156200012457600080fd5b5060405160c081016001600160401b03811182821017156200015657634e487b7160e01b600052604160045260246000fd5b6040526200016760608701620000b1565b81526200017760808701620000b1565b60208201526200018a60a08701620000b1565b60408201526200019d60c08701620000b1565b6060820152620001b060e08701620000b1565b6080820152620001c46101008701620000b1565b60a0820152939692955090935050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a05161542462000361600039600081816104a20152818161249501528181613511015281816139df0152613c7801526000818161025e01528181610a8701528181610e28015281816118f301528181611b28015281816131990152613e0801526000818161020e015281816131450152613dbb015260008181610292015281816134c6015281816139930152613c2c0152600081816102fa0152818161243201526129520152600081816102c601526138e101526000818161059e015281816125c1015261341801526000818161052a01528181612de1015261365301526000818161046e015281816106650152818161106e015281816112ce0152818161159b01528181611c6c01528181612190015281816126ed01528181612b8801528181612f5b015281816137010152613a780152600081816104d60152818161096001528181610d0101528181610f21015281816114f0015281816117cc0152611a0101526154246000f3fe6080604052600436106101c25760003560e01c80639b5c1ee5116100f7578063cce5b8c611610095578063e3aa469211610064578063e3aa4692146105c0578063ee72c09a146105e0578063f0d84750146105f3578063ffb29fbd1461061357600080fd5b8063cce5b8c614610518578063cf586c5c1461054c578063d839d9451461056c578063d996cef71461058c57600080fd5b8063b53c86d2116100d1578063b53c86d21461045c578063bc6b74ab14610490578063c45a0155146104c4578063c85b67f5146104f857600080fd5b80639b5c1ee5146103fc578063a9eca88e1461041c578063b3fb68d51461043c57600080fd5b80634db46eab1161016457806372cdc6e21161013e57806372cdc6e21461037c578063759cb2341461039c5780638896bd16146103bc57806397bf3431146103dc57600080fd5b80634db46eab1461031c578063541bb89e1461033c5780636e2f91d51461035c57600080fd5b806324f450db116101a057806324f450db1461024c5780632af3fa1b146102805780633faa6e30146102b45780633fb53a0d146102e857600080fd5b806310404af4146101c75780631d06722b146101dc5780631de7354b146101fc575b600080fd5b6101da6101d5366004613ef5565b610633565b005b3480156101e857600080fd5b506101da6101f7366004613fa6565b61091f565b34801561020857600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b34801561025857600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b34801561028c57600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b3480156102c057600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b3480156102f457600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b34801561032857600080fd5b506101da61033736600461401f565b61093c565b34801561034857600080fd5b506101da6103573660046140d8565b610b81565b34801561036857600080fd5b506101da61037736600461412b565b610c29565b34801561038857600080fd5b506101da6103973660046141a8565b610cdd565b3480156103a857600080fd5b506102306103b7366004614231565b610efd565b3480156103c857600080fd5b506101da6103d7366004614261565b610fbb565b3480156103e857600080fd5b506101da6103f73660046142ce565b61129c565b34801561040857600080fd5b506101da61041736600461435a565b61147d565b34801561042857600080fd5b506101da610437366004613fa6565b611498565b34801561044857600080fd5b506102306104573660046143c6565b6114bf565b34801561046857600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b34801561049c57600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b3480156104d057600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b34801561050457600080fd5b506101da610513366004614407565b611569565b34801561052457600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b34801561055857600080fd5b506101da610567366004614475565b61177a565b34801561057857600080fd5b506101da6105873660046144d0565b6117a8565b34801561059857600080fd5b506102307f000000000000000000000000000000000000000000000000000000000000000081565b3480156105cc57600080fd5b506101da6105db366004614530565b6119dd565b6101da6105ee36600461458c565b611c15565b3480156105ff57600080fd5b506101da61060e366004614636565b611f90565b34801561061f57600080fd5b506101da61062e3660046146ce565b611ff6565b6106436060870160408801614231565b6040516363cd755760e11b81526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063c79aeaae90602401602060405180830381865afa1580156106ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d2919061472c565b6040516339370aa960e21b81526001600160a01b03848116600483015291925060009183169063e4dc2aa490602401602060405180830381865afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190614749565b90506107516040880188614762565b61075f906020810190614782565b602001356000036107835760405163059707b960e41b815260040160405180910390fd5b600061078e33610efd565b9050866107c6576107af818b8b6000805160206153cf833981519152612067565b6107c6818b6107c160608c018c614799565b612133565b6107d08189612391565b6107e6816107e160408b018b614762565b61256e565b8661081057610810816107fe368d90038d018d614845565b61080b60608c018c614799565b6126c8565b61081b8187876128ff565b60608a0180359061082f9060408d01614231565b6001600160a01b039081169083167fb00138e527e12645ad7a5a8d608b107cf2fcd3525d2b5d09973ed652f87b4f3961086b60208f018f614231565b8e600001602001356040516108819291906148bb565b60405180910390a4506040516339370aa960e21b81526001600160a01b03848116600483015283169063e4dc2aa4906024015b602060405180830381865afa1580156108d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f59190614749565b81146109145760405163648873f960e01b815260040160405180910390fd5b505050505050505050565b600061092a33610efd565b9050610937818484612a5b565b505050565b60405163429b62e560e01b81526001600160a01b03808616600483015285916000917f0000000000000000000000000000000000000000000000000000000000000000169063429b62e590602401602060405180830381865afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb919061472c565b6001600160a01b0316036109f257604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5e919061472c565b6001600160a01b031614610a855760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638bb96a906040518060600160405280886001600160a01b03168152602001876020016040016020810190610ae49190614231565b6001600160a01b0316815260808801356020909101526040516001600160e01b031960e084901b168152610b1b91906004016148d4565b600060405180830381600087803b158015610b3557600080fd5b505af1158015610b49573d6000803e3d6000fd5b50505050610b7a858585857f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612af3565b5050505050565b6000610b8c33610efd565b9050610b9a81858585612133565b610bb881610bae6060870160408801614231565b8660600135612d8e565b60608401803590610bcc9060408701614231565b6001600160a01b039081169083167f976f9aa1da6d0f0e23405b12b4e2b446c12615150624819f4bebe8060fa39f61610c086020890189614231565b604051610c1b919060208b0135906148bb565b60405180910390a450505050565b6000610c3433610efd565b9050610c41818686612a5b565b610c4d81868585612133565b610c6b81610c616060880160408901614231565b8760600135612d8e565b60608501803590610c7f9060408801614231565b6001600160a01b039081169083167fc9a3d0888f5ab83eb0fcd2e948c80035fd02319ad2f57c4bc68b1513a0f78ea0610cbb60208a018a614231565b604051610cce919060208c0135906148bb565b60405180910390a45050505050565b60405163429b62e560e01b81526001600160a01b03808816600483015287916000917f0000000000000000000000000000000000000000000000000000000000000000169063429b62e590602401602060405180830381865afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c919061472c565b6001600160a01b031603610d9357604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff919061472c565b6001600160a01b031614610e265760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663459e268460405180606001604052808a6001600160a01b03168152602001896040016020810190610e829190614231565b6001600160a01b0316815260200189606001358152506040518263ffffffff1660e01b8152600401610eb491906148d4565b600060405180830381600087803b158015610ece57600080fd5b505af1158015610ee2573d6000803e3d6000fd5b50505050610ef4878787878787612e83565b50505050505050565b6040516312cfc9b560e31b81526001600160a01b03828116600483015260009182917f0000000000000000000000000000000000000000000000000000000000000000169063967e4da890602401602060405180830381865afa158015610f68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8c919061472c565b90506001600160a01b038116610fb557604051633098a45560e01b815260040160405180910390fd5b92915050565b6000610fc633610efd565b9050610ff18160208701610fdd60a0890189614903565b6000805160206153cf833981519152612067565b611035816020870161100660c0890189614919565b61103061101960808b0160608c01614231565b61102660208c018c614231565b60808c0135612f37565b6130d5565b6110628161104660e0880188614903565b611054906060810190614903565b6107e1906040810190614762565b60006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae6110a36080890160608a01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156110e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110b919061472c565b6001600160a01b031663b943855e6111296080890160608a01614231565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529085166024820152604401602060405180830381865afa158015611175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111999190614749565b9050611227826040518060600160405280898060e001906111ba9190614903565b6111ca903681900381019061492f565b81526020016111dc60e08b018b614903565b6111ed906060810190604001614231565b6001600160a01b0316815260200184905261120b60e08a018a614903565b611219906060810190614903565b61080b906060810190614799565b6112508261123860e0890189614903565b611249906060810190604001614231565b83886130f2565b61125b8285856128ff565b611294826020880161127060e08a018a614903565b611281906060810190604001614231565b61128e60e08b018b614903565b8561325e565b505050505050565b6112ac6060860160408701614231565b6040516363cd755760e11b81526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063c79aeaae90602401602060405180830381865afa158015611317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133b919061472c565b6040516339370aa960e21b81526001600160a01b03848116600483015291925060009183169063e4dc2aa490602401602060405180830381865afa158015611387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ab9190614749565b905060006113b833610efd565b90506113e9818a8a8a8a8a7f1d5b8de553017a3bd388578aeece0183b79c5ca87ec64628b3f76b39487f0231613306565b506040516339370aa960e21b81526001600160a01b03848116600483015283169063e4dc2aa490602401602060405180830381865afa158015611430573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114549190614749565b81146114735760405163648873f960e01b815260040160405180910390fd5b5050505050505050565b600061148833610efd565b9050611294818787878787612e83565b60006114a333610efd565b90506109378184846000805160206153cf833981519152612067565b60405163de0d95ed60e01b81526001600160a01b0384811660048301528381166024830152604482018390526000917f00000000000000000000000000000000000000000000000000000000000000009091169063de0d95ed906064016020604051808303816000875af115801561153b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155f919061472c565b90505b9392505050565b6115796060870160408801614231565b6040516363cd755760e11b81526001600160a01b0382811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063c79aeaae90602401602060405180830381865afa1580156115e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611608919061472c565b6040516339370aa960e21b81526001600160a01b03848116600483015291925060009183169063e4dc2aa490602401602060405180830381865afa158015611654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116789190614749565b9050600061168533610efd565b9050866116b8576116a6818b8b6000805160206153cf833981519152612067565b6116b8818b6107c160408c018c614799565b6000806116c58a80614762565b6116d390602081019061494b565b9050116116e1576000611703565b7fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b9050611710828a836133c5565b876117355761173582611728368e90038e018e614845565b61080b60408d018d614799565b6117408288886128ff565b61174a828c613591565b50506040516339370aa960e21b81526001600160a01b03848116600483015283169063e4dc2aa4906024016108b4565b600061178533610efd565b90506117a2818585856000805160206153cf833981519152612af3565b50505050565b60405163429b62e560e01b81526001600160a01b03808516600483015284916000917f0000000000000000000000000000000000000000000000000000000000000000169063429b62e590602401602060405180830381865afa158015611813573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611837919061472c565b6001600160a01b03160361185e57604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ca919061472c565b6001600160a01b0316146118f15760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bca9ca736040518060600160405280876001600160a01b0316815260200186604001602081019061194d9190614231565b6001600160a01b0316815260200186606001358152506040518263ffffffff1660e01b815260040161197f91906148d4565b600060405180830381600087803b15801561199957600080fd5b505af11580156119ad573d6000803e3d6000fd5b505050506117a28484847f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612067565b60405163429b62e560e01b81526001600160a01b03808816600483015287916000917f0000000000000000000000000000000000000000000000000000000000000000169063429b62e590602401602060405180830381865afa158015611a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6c919061472c565b6001600160a01b031603611a9357604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff919061472c565b6001600160a01b031614611b265760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663f1cf418260405180606001604052808a6001600160a01b03168152602001896040016020810190611b829190614231565b6001600160a01b0316815260200189606001358152506040518263ffffffff1660e01b8152600401611bb491906148d4565b600060405180830381600087803b158015611bce57600080fd5b505af1158015611be2573d6000803e3d6000fd5b50505050610ef48787878787877f6b277b6f647b7a0d8000e4fc1460639f589d3e1262b3f1a2f378cce0a5da40bb613306565b611c226060870187614903565b611c30906040810190614762565b611c3e906020810190614782565b6020013515611c60576040516379bb579b60e11b815260040160405180910390fd5b60006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae611ca160608a0160408b01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611ce5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d09919061472c565b905060006001600160a01b03821663e4dc2aa4611d2c60608b0160408c01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d949190614749565b90506000611da33386866114bf565b9050611dbb81611db660608c018c614903565b612391565b611dcc8161105460608c018c614903565b60006001600160a01b03841663b943855e611ded60608d0160408e01614231565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529085166024820152604401602060405180830381865afa158015611e39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5d9190614749565b9050611eb88260405180606001604052808d600001803603810190611e82919061492f565b81526020018d6040016020810190611e9a9190614231565b6001600160a01b0316815260200184905261121960608e018e614903565b611ed382611ecc60608d0160408e01614231565b838c6130f2565b611ede8289896128ff565b6001600160a01b03841663e4dc2aa4611efd60608d0160408e01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f659190614749565b8310611f8457604051638480c32560e01b815260040160405180910390fd5b50505050505050505050565b6000611f9d3384846114bf565b9050611fbd81611fb360608a0160408b01614231565b8960600135613600565b611fd781611fd0368a90038a018a614845565b88886126c8565b610ef481611feb60608a0160408b01614231565b8960600135876130f2565b600061200133610efd565b90506000806120108680614762565b61201e90602081019061494b565b90501161202c57600061204e565b7fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b905061205c828787846130d5565b6112948285856128ff565b6000612076602084018461494b565b9050111561208e576120898484846136f5565b6120a3565b6120a3848461209d8580614903565b84613a6c565b60006120b2606084018461494b565b905011156120d0576120d0846120cb606085018561494b565b6128ff565b606083018035906120e49060408601614231565b6001600160a01b039081169086167fbf9d03ac543e8f596c6f4af5ab5e75f366a57d2d6c28d2ff9c024bd3f88e87716121206020880188614231565b604051610c1b919060208a0135906148bb565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161216d57905050905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae6121c26020890189614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612206573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222a919061472c565b9050808360008151811061224057612240614994565b60200260200101906001600160a01b031690816001600160a01b03168152505085858560405160240161227593929190614a15565b60408051601f198184030181529190526020810180516001600160e01b0316631423e67960e11b179052825183906000906122b2576122b2614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038816906363fb0b96906122eb9086908690600401614a3f565b600060405180830381600087803b15801561230557600080fd5b505af1158015612319573d6000803e3d6000fd5b50505060608701803591506123319060408901614231565b6001600160a01b039081169089167f976f9aa1da6d0f0e23405b12b4e2b446c12615150624819f4bebe8060fa39f6161236d60208b018b614231565b604051612380919060208d0135906148bb565b60405180910390a450505050505050565b6000806123a16040840184614762565b6123ab908061494b565b9050116123b95760006123db565b7fab273376f9efdd920b41b30b3f02b3dee877874951e3c14bf87bc60060efebcc5b604080516001808252818301909252919250600091906020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816124195790505090507f00000000000000000000000000000000000000000000000000000000000000008260008151811061246457612464614994565b6001600160a01b0390921660209283029190910190910152612486848061494b565b612493602087018761494b565b7f0000000000000000000000000000000000000000000000000000000000000000876040516024016124ca96959493929190614b58565b60408051601f198184030181529190526020810180516001600160e01b03166312f5760360e01b1790528151829060009061250757612507614994565b6020026020010181905250846001600160a01b03166363fb0b963484846040518463ffffffff1660e01b8152600401612541929190614a3f565b6000604051808303818588803b15801561255a57600080fd5b505af1158015611f84573d6000803e3d6000fd5b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816125a85790505090507f0000000000000000000000000000000000000000000000000000000000000000826000815181106125f3576125f3614994565b60200260200101906001600160a01b031690816001600160a01b031681525050826040516024016126249190614de8565b60408051601f198184030181529190526020810180516001600160e01b031663ac98b56360e01b1790528151829060009061266157612661614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038516906363fb0b969061269a9085908590600401614a3f565b600060405180830381600087803b1580156126b457600080fd5b505af1158015611473573d6000803e3d6000fd5b8251516040516363cd755760e11b81526001600160a01b0391821660048201526000917f0000000000000000000000000000000000000000000000000000000000000000169063c79aeaae90602401602060405180830381865afa158015612734573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612758919061472c565b604080516001808252818301909252919250600091906020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161279657905050905082826000815181106127c1576127c1614994565b60200260200101906001600160a01b031690816001600160a01b0316815250508585856040516024016127f693929190614eff565b60408051601f198184030181529190526020810180516001600160e01b03166001624236cd60e11b03191790528151829060009061283657612836614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038816906363fb0b969061286f9085908590600401614a3f565b600060405180830381600087803b15801561288957600080fd5b505af115801561289d573d6000803e3d6000fd5b50505050856040015186602001516001600160a01b0316886001600160a01b03167f53375fafff3a4a00460af1c1347b8f0dd0d35cce6b2bd5661346bc8ad1d37a008960000151600001518a60000151602001516040516123809291906148bb565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816129395790505090507f00000000000000000000000000000000000000000000000000000000000000008260008151811061298457612984614994565b60200260200101906001600160a01b031690816001600160a01b03168152505083836040516024016129b7929190614f47565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b179052815182906000906129f4576129f4614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038616906363fb0b9690612a2d9085908590600401614a3f565b600060405180830381600087803b158015612a4757600080fd5b505af1158015610914573d6000803e3d6000fd5b612a758383836000805160206153cf833981519152613a6c565b612a83836120cb838061494b565b60608201803590612a979060408501614231565b6001600160a01b039081169085167fbf9d03ac543e8f596c6f4af5ab5e75f366a57d2d6c28d2ff9c024bd3f88e8771612ad36020870187614231565b604051612ae691906020890135906148bb565b60405180910390a4505050565b612b0e8560208601612b0860a0880188614903565b84612067565b612b4d8560208601612b2360c0880188614919565b611030612b3660808a0160608b01614231565b612b4360208b018b614231565b60808b0135612f37565b612b5e8561105460e0870187614903565b612b7c85612b726080870160608801614231565b6080870135613d68565b60006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae612bbd6080880160608901614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c25919061472c565b6001600160a01b031663b943855e612c436080880160608901614231565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529089166024820152604401602060405180830381865afa158015612c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb39190614749565b9050612d0e86604051806060016040528088602001600001803603810190612cdb919061492f565b8152602001612cf060808a0160608b01614231565b6001600160a01b0316815260200184905261121960e0890189614903565b612d198685856128ff565b60808501803590612d2d9060608801614231565b6001600160a01b039081169088167f550ef6ca72911d6a82dfa1fade2d87ed10c69661f1bf04376add792b5d1e5437612d6c60408a0160208b01614231565b60408051612d7e92918c0135906148bb565b60405180910390a4505050505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081612dc85790505090507f000000000000000000000000000000000000000000000000000000000000000082600081518110612e1357612e13614994565b60200260200101906001600160a01b031690816001600160a01b0316815250508383604051602401612e469291906148bb565b60408051601f198184030181529190526020810180516001600160e01b0316631df6a96160e31b179052815182906000906129f4576129f4614994565b612e9d8686866000805160206153cf833981519152612067565b612ec98686857fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af646130d5565b612ed48683836128ff565b60608501803590612ee89060408801614231565b6001600160a01b039081169088167fc9a3d0888f5ab83eb0fcd2e948c80035fd02319ad2f57c4bc68b1513a0f78ea0612f2460208a018a614231565b604051612d7e919060208c0135906148bb565b6040516363cd755760e11b81526001600160a01b03848116600483015260009182917f0000000000000000000000000000000000000000000000000000000000000000169063c79aeaae90602401602060405180830381865afa158015612fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc6919061472c565b90506000816001600160a01b0316639e6eda1886866040518363ffffffff1660e01b8152600401612ff89291906148bb565b602060405180830381865afa158015613015573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130399190614f5b565b90506101f48162ffffff1611613073577fcb922c4d36cde61b3660729b33f36eff74a31440cf3e852d4467b4bd6045011c92505050611562565b610bb88162ffffff16116130ab577fc552bcd88e8785f8a0d9f9c5b9dc4e198659e68e9f6645642142b2900cde564d92505050611562565b7fa7e26cbd23588e6e87ee40cb01079e973bf8a0910c2edb6bc11ba3240a81480b92505050611562565b6130e784846107c16040860186614799565b6117a28483836133c5565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161312c5790505090507f00000000000000000000000000000000000000000000000000000000000000008260008151811061317757613177614994565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008585856040516024016131ce949392919061510a565b60408051601f198184030181529190526020810180516001600160e01b0316636505c9ff60e11b1790528151829060009061320b5761320b614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038716906363fb0b96906132449085908590600401614a3f565b600060405180830381600087803b15801561255a57600080fd5b606084018035906132729060408701614231565b6001600160a01b039081169087167f8181f528787b6f5d64998fce6130134048cf712961e4d1554465276932df54cc6132ae6020890189614231565b6020808a013590899088906132c5908b018b614231565b604080516001600160a01b039687168152602080820196909652938616908401526060830191909152909216608083015287013560a082015260c001610cce565b613315878761209d8880614903565b836133375761333787876133298880614903565b6107c1906060810190614799565b613348876107e16020880188614762565b8361336a5761336a8761336036899003890189614845565b6112198880614903565b6133758784846128ff565b606086018035906133899060408901614231565b6001600160a01b039081169089167f504180eddec0aa4ed3bb8edcf99b13013e1d8ae52be37f0f4f38d14ccf0c99a561236d60208b018b614231565b6040805160028082526060820183526000926020830190803683375050604080516002808252606082019092529293506000929150602082015b60608152602001906001900390816133ff5790505090507f00000000000000000000000000000000000000000000000000000000000000008260008151811061344a5761344a614994565b6001600160a01b039092166020928302919091019091015261346c8480614762565b60405160240161347c919061520a565b60408051601f198184030181529190526020810180516001600160e01b0316632bbb931b60e01b179052815182906000906134b9576134b9614994565b60200260200101819052507f0000000000000000000000000000000000000000000000000000000000000000826001815181106134f8576134f8614994565b6001600160a01b039092166020928302919091018201527f000000000000000000000000000000000000000000000000000000000000000090849061353f9087018761494b565b604051602401613552949392919061530e565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b1790528151829060019081106129f4576129f4614994565b606081018035906135a59060408401614231565b6001600160a01b039081169084167f3d988581b5d3b2ed8c77b357af36f383c9a6d036a423cb9f82be3b03211cfd146135e16020860186614231565b6040516135f491906020880135906148bb565b60405180910390a45050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161363a5790505090507f00000000000000000000000000000000000000000000000000000000000000008260008151811061368557613685614994565b60200260200101906001600160a01b031690816001600160a01b03168152505083836040516024016136b89291906148bb565b60408051601f198184030181529190526020810180516001600160e01b03166306c530b960e41b179052815182906000906129f4576129f4614994565b60006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae6137336020860186614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015613777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379b919061472c565b6040805160038082526080820190925291925060009190602082016060803683375050604080516003808252608082019092529293506000929150602082015b60608152602001906001900390816137db579050509050828260008151811061380657613806614994565b6001600160a01b0390921660209283029190910190910152846138298580614903565b613833908061494b565b61383d8780614903565b61384e906040810190602001615343565b6138588880614903565b613869906060810190604001615343565b6138738980614903565b613881906060810190614799565b604051602401613897979695949392919061535e565b60408051601f198184030181529190526020810180516001600160e01b0316636f4621e360e01b179052815182906000906138d4576138d4614994565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008260018151811061391357613913614994565b6001600160a01b039092166020928302919091018201526139369085018561494b565b6040516024016139479291906153ba565b60408051601f198184030181529190526020810180516001600160e01b03166321e9d05b60e01b17905281518290600190811061398657613986614994565b60200260200101819052507f0000000000000000000000000000000000000000000000000000000000000000826002815181106139c5576139c5614994565b6001600160a01b03909216602092830291909101909101527f00000000000000000000000000000000000000000000000000000000000000006000805160206153cf833981519152613a1a604087018761494b565b604051602401613a2d949392919061530e565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b17905281518290600290811061320b5761320b614994565b60006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae613aaa6020870187614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015613aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b12919061472c565b60408051600280825260608201835292935060009290916020830190803683375050604080516002808252606082019092529293506000929150602082015b6060815260200190600190039081613b515790505090508282600081518110613b7c57613b7c614994565b6001600160a01b039092166020928302919091019091015285613b9f868061494b565b613baf6040890160208a01615343565b613bbf60608a0160408b01615343565b613bcc60608b018b614799565b604051602401613be2979695949392919061535e565b60408051601f198184030181529190526020810180516001600160e01b0316636f4621e360e01b17905281518290600090613c1f57613c1f614994565b60200260200101819052507f000000000000000000000000000000000000000000000000000000000000000082600181518110613c5e57613c5e614994565b6001600160a01b03909216602092830291909101909101527f000000000000000000000000000000000000000000000000000000000000000084613ca2878061494b565b604051602401613cb5949392919061530e565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b179052815182906001908110613cf457613cf4614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038816906363fb0b9690613d2d9085908590600401614a3f565b600060405180830381600087803b158015613d4757600080fd5b505af1158015613d5b573d6000803e3d6000fd5b5050505050505050505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081613da25790505090507f000000000000000000000000000000000000000000000000000000000000000082600081518110613ded57613ded614994565b6001600160a01b0392831660209182029290920101526040517f00000000000000000000000000000000000000000000000000000000000000008216602482015290851660448201526064810184905260840160408051601f198184030181529190526020810180516001600160e01b0316631f5cecd560e01b179052815182906000906129f4576129f4614994565b600060808284031215613e8f57600080fd5b50919050565b80358015158114613ea557600080fd5b919050565b60008083601f840112613ebc57600080fd5b5081356001600160401b03811115613ed357600080fd5b6020830191508360208260051b8501011115613eee57600080fd5b9250929050565b6000806000806000806101008789031215613f0f57600080fd5b613f198888613e7d565b955060808701356001600160401b0380821115613f3557600080fd5b613f418a838b01613e7d565b965060a0890135915080821115613f5757600080fd5b613f638a838b01613e7d565b9550613f7160c08a01613e95565b945060e0890135915080821115613f8757600080fd5b50613f9489828a01613eaa565b979a9699509497509295939492505050565b60008060a08385031215613fb957600080fd5b613fc38484613e7d565b915060808301356001600160401b03811115613fde57600080fd5b613fea85828601613e7d565b9150509250929050565b6001600160a01b038116811461400957600080fd5b50565b60006101008284031215613e8f57600080fd5b6000806000806060858703121561403557600080fd5b843561404081613ff4565b935060208501356001600160401b038082111561405c57600080fd5b6140688883890161400c565b9450604087013591508082111561407e57600080fd5b5061408b87828801613eaa565b95989497509550505050565b60008083601f8401126140a957600080fd5b5081356001600160401b038111156140c057600080fd5b602083019150836020828501011115613eee57600080fd5b600080600060a084860312156140ed57600080fd5b6140f78585613e7d565b925060808401356001600160401b0381111561411257600080fd5b61411e86828701614097565b9497909650939450505050565b60008060008060c0858703121561414157600080fd5b61414b8686613e7d565b935060808501356001600160401b038082111561416757600080fd5b61417388838901613e7d565b945060a087013591508082111561418957600080fd5b5061408b87828801614097565b600060608284031215613e8f57600080fd5b60008060008060008061010087890312156141c257600080fd5b86356141cd81613ff4565b95506141dc8860208901613e7d565b945060a08701356001600160401b03808211156141f857600080fd5b6142048a838b01613e7d565b955060c089013591508082111561421a57600080fd5b613f718a838b01614196565b8035613ea581613ff4565b60006020828403121561424357600080fd5b813561156281613ff4565b60006103408284031215613e8f57600080fd5b6000806000806060858703121561427757600080fd5b84356001600160401b038082111561428e57600080fd5b61429a8883890161400c565b955060208701359150808211156142b057600080fd5b6140688883890161424e565b600060408284031215613e8f57600080fd5b600080600080600060e086880312156142e657600080fd5b6142f08787613e7d565b945060808601356001600160401b038082111561430c57600080fd5b61431889838a016142bc565b955061432660a08901613e95565b945060c088013591508082111561433c57600080fd5b5061434988828901613eaa565b969995985093965092949392505050565b600080600080600060e0868803121561437257600080fd5b61437c8787613e7d565b945060808601356001600160401b038082111561439857600080fd5b6143a489838a01613e7d565b955060a08801359150808211156143ba57600080fd5b61432689838a01614196565b6000806000606084860312156143db57600080fd5b83356143e681613ff4565b925060208401356143f681613ff4565b929592945050506040919091013590565b600080600080600080610100878903121561442157600080fd5b61442b8888613e7d565b955060808701356001600160401b038082111561444757600080fd5b6144538a838b01613e7d565b965060a089013591508082111561446957600080fd5b613f638a838b01614196565b60008060006040848603121561448a57600080fd5b83356001600160401b03808211156144a157600080fd5b6144ad8783880161400c565b945060208601359150808211156144c357600080fd5b5061411e86828701613eaa565b600080600060c084860312156144e557600080fd5b83356144f081613ff4565b92506144ff8560208601613e7d565b915060a08401356001600160401b0381111561451a57600080fd5b61452686828701613e7d565b9150509250925092565b600080600080600080610100878903121561454a57600080fd5b863561455581613ff4565b95506145648860208901613e7d565b945060a08701356001600160401b038082111561458057600080fd5b613f638a838b016142bc565b60008060008060008060a087890312156145a557600080fd5b86356001600160401b03808211156145bc57600080fd5b6145c88a838b01613e7d565b975060208901359150808211156145de57600080fd5b6145ea8a838b0161424e565b9650604089013591508082111561460057600080fd5b5061460d89828a01613eaa565b909550935050606087013561462181613ff4565b80925050608087013590509295509295509295565b600080600080600080610100878903121561465057600080fd5b61465a8888613e7d565b955060808701356001600160401b038082111561467657600080fd5b6146828a838b01614097565b909750955060a089013591508082111561469b57600080fd5b506146a889828a0161424e565b93505060c08701356146b981613ff4565b8092505060e087013590509295509295509295565b60008060008060c085870312156146e457600080fd5b6146ee8686613e7d565b935060808501356001600160401b038082111561470a57600080fd5b61471688838901614196565b945060a087013591508082111561407e57600080fd5b60006020828403121561473e57600080fd5b815161156281613ff4565b60006020828403121561475b57600080fd5b5051919050565b60008235603e1983360301811261477857600080fd5b9190910192915050565b6000823561017e1983360301811261477857600080fd5b6000808335601e198436030181126147b057600080fd5b8301803591506001600160401b038211156147ca57600080fd5b602001915036819003821315613eee57600080fd5b6000604082840312156147f157600080fd5b604051604081018181106001600160401b038211171561482157634e487b7160e01b600052604160045260246000fd5b604052905080823561483281613ff4565b8152602092830135920191909152919050565b60006080828403121561485757600080fd5b604051606081018181106001600160401b038211171561488757634e487b7160e01b600052604160045260246000fd5b60405261489484846147df565b815260408301356148a481613ff4565b602082015260609290920135604083015250919050565b6001600160a01b03929092168252602082015260400190565b81516001600160a01b039081168252602080840151909116908201526040918201519181019190915260600190565b60008235607e1983360301811261477857600080fd5b60008235605e1983360301811261477857600080fd5b60006040828403121561494157600080fd5b61156283836147df565b6000808335601e1984360301811261496257600080fd5b8301803591506001600160401b0382111561497c57600080fd5b6020019150600581901b3603821315613eee57600080fd5b634e487b7160e01b600052603260045260246000fd5b80356149b581613ff4565b6001600160a01b039081168352602082810135908401526040820135906149db82613ff4565b166040830152606090810135910152565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b614a1f81856149aa565b60a060808201526000614a3660a0830184866149ec565b95945050505050565b604080825283519082018190526000906020906060840190828701845b82811015614a815781516001600160a01b031684529284019290840190600101614a5c565b50505083810382850152845180825282820190600581901b8301840187850160005b83811015614b0057601f19808785030186528251805180865260005b81811015614ada578281018b01518782018c01528a01614abf565b5060008682018b015296890196601f019091169093018701925090860190600101614aa3565b50909998505050505050505050565b8183526000602080850194508260005b85811015614b4d578135614b3281613ff4565b6001600160a01b031687529582019590820190600101614b1f565b509495945050505050565b608081526000614b6c60808301888a614b0f565b82810360208401528581526001600160fb1b03861115614b8b57600080fd5b8560051b808860208401376001600160a01b039590951660408401526001600160e01b0319939093166060909201919091525001602001949350505050565b6000808335601e19843603018112614be157600080fd5b83016020810192503590506001600160401b03811115614c0057600080fd5b8060051b3603821315613eee57600080fd5b6000808335601e19843603018112614c2957600080fd5b83016020810192503590506001600160401b03811115614c4857600080fd5b803603821315613eee57600080fd5b6000823560fe19833603018112614c6d57600080fd5b90910192915050565b81835260006020808501808196508560051b810191508460005b87811015614d62578284038952614ca78288614c57565b6101008135614cb581613ff4565b6001600160a01b03168652614ccb828801614226565b6001600160a01b03168787015260408281013590870152606080830135908701526080808301359087015260a0614d03818401614226565b6001600160a01b03169087015260c0614d1d838201614226565b6001600160a01b03169087015260e0614d3883820184614c12565b93508282890152614d4c83890185836149ec565b9c89019c97505050928601925050600101614c90565b5091979650505050505050565b62ffffff8116811461400957600080fd5b8035613ea581614d6f565b8035614d9681613ff4565b6001600160a01b039081168352602082013590614db282613ff4565b1660208301526040810135614dc681614d6f565b62ffffff81166040840152505050565b8035600281900b8114613ea557600080fd5b602081526000614df88384614bca565b60406020850152614e0d606085018284614c76565b915050602084013561017e19853603018112614e2857600080fd5b838203601f190160408501528401610180614e5383614e4684614226565b6001600160a01b03169052565b60208201356020840152614e6d6040840160408401614d8b565b614e7960a08301614dd6565b614e8860a085018260020b9052565b50614e9560c08301614dd6565b614ea460c085018260020b9052565b5060e08281013590840152610100808301359084015261012080830135908401526101408083013590840152610160614edf81840184614c12565b93508282860152614ef383860185836149ec565b98975050505050505050565b6000845160018060a01b038082511684526020820151602085015280602088015116604085015250506040850151606083015260a06080830152614a3660a0830184866149ec565b60208152600061155f602083018486614b0f565b600060208284031215614f6d57600080fd5b815161156281614d6f565b803560ff81168114613ea557600080fd5b803560038110614f9857600080fd5b82526020810135614fa881613ff4565b6001600160a01b03166020929092019190915250565b614fd482614fcb83614d80565b62ffffff169052565b614fe060208201614d80565b62ffffff166020830152614ff660408201614dd6565b615005604084018260020b9052565b5061501260608201614dd6565b615021606084018260020b9052565b506080810135608083015260a081013560a083015260c081013560c083015261504c60e08201614dd6565b61505b60e084018260020b9052565b5061010061506a818301614dd6565b6150788285018260020b9052565b5050610120615088818301614f78565b60ff1690830152610140610937818401838301614f89565b6150a981614dd6565b60020b82526150ba60208201614dd6565b60020b602083015260408101356150d081613ff4565b6001600160a01b0390811660408401526060820135906150ef82613ff4565b1660608301526080818101359083015260a090810135910152565b6001600160a01b0385811682528416602082015260408101839052608060608201526000823561513981613ff4565b6001600160a01b03166080830152602083013560a083015261515d60408401613e95565b151560c083015261517460e0830160608501614fbe565b6151816101e08401613e95565b6102606151918185018315159052565b6151a361028085016102008701614f89565b6151b06102408601613e95565b8015156102c086015291506151cb6102e085018287016150a0565b50506151db610320840184614c12565b6103406103a0850152614ef36103c0850182846149ec565b80356001600160801b0381168114613ea557600080fd5b60208152600061521a8384614c57565b60406020840152803561522c81613ff4565b6001600160a01b0316606084015260208101356080840152615250604082016151f3565b6001600160801b03811660a085015250606081013560c0840152608081013560e084015261528060a082016151f3565b610100615297818601836001600160801b03169052565b6152a360c084016151f3565b6001600160801b03811661012087015291506152c260e0840184614c12565b9350915080610140860152506152dd610160850183836149ec565b9150506152ed6020850185614bca565b848303601f19016040860152615304838284614c76565b9695505050505050565b6001600160a01b03851681526001600160e01b0319841660208201526060604082018190526000906153049083018486614b0f565b60006020828403121561535557600080fd5b611562826151f3565b600061010061536d838b6149aa565b806080840152615380818401898b614b0f565b6001600160801b0388811660a0860152871660c085015283810360e085015290506153ac8185876149ec565b9a9950505050505050505050565b60208152600061155f602083018486614c7656fee400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa3a264697066735822122034f00bc1d25dd420a040b135c419051d799def04fd907c0404bcec7e8463aa3a64736f6c63430008130033000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99000000000000000000000000372e7761997858be1ee3c492dfa01091282c5083000000000000000000000000188f3b2b1c40e3bc77bc0993c6c951ce4030c9430000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d000000000000000000000000ac371d6e651b6450ea8c4ce346ddd44b62d851b50000000000000000000000000f592f2ee1779fa7d81a8482f4cc6d216a0fe04f

Deployed Bytecode

0x6080604052600436106101c25760003560e01c80639b5c1ee5116100f7578063cce5b8c611610095578063e3aa469211610064578063e3aa4692146105c0578063ee72c09a146105e0578063f0d84750146105f3578063ffb29fbd1461061357600080fd5b8063cce5b8c614610518578063cf586c5c1461054c578063d839d9451461056c578063d996cef71461058c57600080fd5b8063b53c86d2116100d1578063b53c86d21461045c578063bc6b74ab14610490578063c45a0155146104c4578063c85b67f5146104f857600080fd5b80639b5c1ee5146103fc578063a9eca88e1461041c578063b3fb68d51461043c57600080fd5b80634db46eab1161016457806372cdc6e21161013e57806372cdc6e21461037c578063759cb2341461039c5780638896bd16146103bc57806397bf3431146103dc57600080fd5b80634db46eab1461031c578063541bb89e1461033c5780636e2f91d51461035c57600080fd5b806324f450db116101a057806324f450db1461024c5780632af3fa1b146102805780633faa6e30146102b45780633fb53a0d146102e857600080fd5b806310404af4146101c75780631d06722b146101dc5780631de7354b146101fc575b600080fd5b6101da6101d5366004613ef5565b610633565b005b3480156101e857600080fd5b506101da6101f7366004613fa6565b61091f565b34801561020857600080fd5b506102307f0000000000000000000000000f592f2ee1779fa7d81a8482f4cc6d216a0fe04f81565b6040516001600160a01b03909116815260200160405180910390f35b34801561025857600080fd5b506102307f000000000000000000000000372e7761997858be1ee3c492dfa01091282c508381565b34801561028c57600080fd5b506102307f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d81565b3480156102c057600080fd5b506102307f00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b81565b3480156102f457600080fd5b506102307f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b81565b34801561032857600080fd5b506101da61033736600461401f565b61093c565b34801561034857600080fd5b506101da6103573660046140d8565b610b81565b34801561036857600080fd5b506101da61037736600461412b565b610c29565b34801561038857600080fd5b506101da6103973660046141a8565b610cdd565b3480156103a857600080fd5b506102306103b7366004614231565b610efd565b3480156103c857600080fd5b506101da6103d7366004614261565b610fbb565b3480156103e857600080fd5b506101da6103f73660046142ce565b61129c565b34801561040857600080fd5b506101da61041736600461435a565b61147d565b34801561042857600080fd5b506101da610437366004613fa6565b611498565b34801561044857600080fd5b506102306104573660046143c6565b6114bf565b34801561046857600080fd5b506102307f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c9981565b34801561049c57600080fd5b506102307f0000000000000000000000005acb2ec8e7755366e0f23df4579cb5cfaf14715c81565b3480156104d057600080fd5b506102307f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d56716881565b34801561050457600080fd5b506101da610513366004614407565b611569565b34801561052457600080fd5b506102307f000000000000000000000000188f3b2b1c40e3bc77bc0993c6c951ce4030c94381565b34801561055857600080fd5b506101da610567366004614475565b61177a565b34801561057857600080fd5b506101da6105873660046144d0565b6117a8565b34801561059857600080fd5b506102307f000000000000000000000000ac371d6e651b6450ea8c4ce346ddd44b62d851b581565b3480156105cc57600080fd5b506101da6105db366004614530565b6119dd565b6101da6105ee36600461458c565b611c15565b3480156105ff57600080fd5b506101da61060e366004614636565b611f90565b34801561061f57600080fd5b506101da61062e3660046146ce565b611ff6565b6106436060870160408801614231565b6040516363cd755760e11b81526001600160a01b0382811660048301526000917f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c999091169063c79aeaae90602401602060405180830381865afa1580156106ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d2919061472c565b6040516339370aa960e21b81526001600160a01b03848116600483015291925060009183169063e4dc2aa490602401602060405180830381865afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190614749565b90506107516040880188614762565b61075f906020810190614782565b602001356000036107835760405163059707b960e41b815260040160405180910390fd5b600061078e33610efd565b9050866107c6576107af818b8b6000805160206153cf833981519152612067565b6107c6818b6107c160608c018c614799565b612133565b6107d08189612391565b6107e6816107e160408b018b614762565b61256e565b8661081057610810816107fe368d90038d018d614845565b61080b60608c018c614799565b6126c8565b61081b8187876128ff565b60608a0180359061082f9060408d01614231565b6001600160a01b039081169083167fb00138e527e12645ad7a5a8d608b107cf2fcd3525d2b5d09973ed652f87b4f3961086b60208f018f614231565b8e600001602001356040516108819291906148bb565b60405180910390a4506040516339370aa960e21b81526001600160a01b03848116600483015283169063e4dc2aa4906024015b602060405180830381865afa1580156108d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f59190614749565b81146109145760405163648873f960e01b815260040160405180910390fd5b505050505050505050565b600061092a33610efd565b9050610937818484612a5b565b505050565b60405163429b62e560e01b81526001600160a01b03808616600483015285916000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063429b62e590602401602060405180830381865afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb919061472c565b6001600160a01b0316036109f257604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5e919061472c565b6001600160a01b031614610a855760405163c19f17a960e01b815260040160405180910390fd5b7f000000000000000000000000372e7761997858be1ee3c492dfa01091282c50836001600160a01b0316638bb96a906040518060600160405280886001600160a01b03168152602001876020016040016020810190610ae49190614231565b6001600160a01b0316815260808801356020909101526040516001600160e01b031960e084901b168152610b1b91906004016148d4565b600060405180830381600087803b158015610b3557600080fd5b505af1158015610b49573d6000803e3d6000fd5b50505050610b7a858585857f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612af3565b5050505050565b6000610b8c33610efd565b9050610b9a81858585612133565b610bb881610bae6060870160408801614231565b8660600135612d8e565b60608401803590610bcc9060408701614231565b6001600160a01b039081169083167f976f9aa1da6d0f0e23405b12b4e2b446c12615150624819f4bebe8060fa39f61610c086020890189614231565b604051610c1b919060208b0135906148bb565b60405180910390a450505050565b6000610c3433610efd565b9050610c41818686612a5b565b610c4d81868585612133565b610c6b81610c616060880160408901614231565b8760600135612d8e565b60608501803590610c7f9060408801614231565b6001600160a01b039081169083167fc9a3d0888f5ab83eb0fcd2e948c80035fd02319ad2f57c4bc68b1513a0f78ea0610cbb60208a018a614231565b604051610cce919060208c0135906148bb565b60405180910390a45050505050565b60405163429b62e560e01b81526001600160a01b03808816600483015287916000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063429b62e590602401602060405180830381865afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c919061472c565b6001600160a01b031603610d9357604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff919061472c565b6001600160a01b031614610e265760405163c19f17a960e01b815260040160405180910390fd5b7f000000000000000000000000372e7761997858be1ee3c492dfa01091282c50836001600160a01b031663459e268460405180606001604052808a6001600160a01b03168152602001896040016020810190610e829190614231565b6001600160a01b0316815260200189606001358152506040518263ffffffff1660e01b8152600401610eb491906148d4565b600060405180830381600087803b158015610ece57600080fd5b505af1158015610ee2573d6000803e3d6000fd5b50505050610ef4878787878787612e83565b50505050505050565b6040516312cfc9b560e31b81526001600160a01b03828116600483015260009182917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063967e4da890602401602060405180830381865afa158015610f68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8c919061472c565b90506001600160a01b038116610fb557604051633098a45560e01b815260040160405180910390fd5b92915050565b6000610fc633610efd565b9050610ff18160208701610fdd60a0890189614903565b6000805160206153cf833981519152612067565b611035816020870161100660c0890189614919565b61103061101960808b0160608c01614231565b61102660208c018c614231565b60808c0135612f37565b6130d5565b6110628161104660e0880188614903565b611054906060810190614903565b6107e1906040810190614762565b60006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae6110a36080890160608a01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156110e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110b919061472c565b6001600160a01b031663b943855e6111296080890160608a01614231565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529085166024820152604401602060405180830381865afa158015611175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111999190614749565b9050611227826040518060600160405280898060e001906111ba9190614903565b6111ca903681900381019061492f565b81526020016111dc60e08b018b614903565b6111ed906060810190604001614231565b6001600160a01b0316815260200184905261120b60e08a018a614903565b611219906060810190614903565b61080b906060810190614799565b6112508261123860e0890189614903565b611249906060810190604001614231565b83886130f2565b61125b8285856128ff565b611294826020880161127060e08a018a614903565b611281906060810190604001614231565b61128e60e08b018b614903565b8561325e565b505050505050565b6112ac6060860160408701614231565b6040516363cd755760e11b81526001600160a01b0382811660048301526000917f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c999091169063c79aeaae90602401602060405180830381865afa158015611317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133b919061472c565b6040516339370aa960e21b81526001600160a01b03848116600483015291925060009183169063e4dc2aa490602401602060405180830381865afa158015611387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ab9190614749565b905060006113b833610efd565b90506113e9818a8a8a8a8a7f1d5b8de553017a3bd388578aeece0183b79c5ca87ec64628b3f76b39487f0231613306565b506040516339370aa960e21b81526001600160a01b03848116600483015283169063e4dc2aa490602401602060405180830381865afa158015611430573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114549190614749565b81146114735760405163648873f960e01b815260040160405180910390fd5b5050505050505050565b600061148833610efd565b9050611294818787878787612e83565b60006114a333610efd565b90506109378184846000805160206153cf833981519152612067565b60405163de0d95ed60e01b81526001600160a01b0384811660048301528381166024830152604482018390526000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d5671689091169063de0d95ed906064016020604051808303816000875af115801561153b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155f919061472c565b90505b9392505050565b6115796060870160408801614231565b6040516363cd755760e11b81526001600160a01b0382811660048301526000917f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c999091169063c79aeaae90602401602060405180830381865afa1580156115e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611608919061472c565b6040516339370aa960e21b81526001600160a01b03848116600483015291925060009183169063e4dc2aa490602401602060405180830381865afa158015611654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116789190614749565b9050600061168533610efd565b9050866116b8576116a6818b8b6000805160206153cf833981519152612067565b6116b8818b6107c160408c018c614799565b6000806116c58a80614762565b6116d390602081019061494b565b9050116116e1576000611703565b7fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b9050611710828a836133c5565b876117355761173582611728368e90038e018e614845565b61080b60408d018d614799565b6117408288886128ff565b61174a828c613591565b50506040516339370aa960e21b81526001600160a01b03848116600483015283169063e4dc2aa4906024016108b4565b600061178533610efd565b90506117a2818585856000805160206153cf833981519152612af3565b50505050565b60405163429b62e560e01b81526001600160a01b03808516600483015284916000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063429b62e590602401602060405180830381865afa158015611813573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611837919061472c565b6001600160a01b03160361185e57604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ca919061472c565b6001600160a01b0316146118f15760405163c19f17a960e01b815260040160405180910390fd5b7f000000000000000000000000372e7761997858be1ee3c492dfa01091282c50836001600160a01b031663bca9ca736040518060600160405280876001600160a01b0316815260200186604001602081019061194d9190614231565b6001600160a01b0316815260200186606001358152506040518263ffffffff1660e01b815260040161197f91906148d4565b600060405180830381600087803b15801561199957600080fd5b505af11580156119ad573d6000803e3d6000fd5b505050506117a28484847f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612067565b60405163429b62e560e01b81526001600160a01b03808816600483015287916000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063429b62e590602401602060405180830381865afa158015611a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6c919061472c565b6001600160a01b031603611a9357604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff919061472c565b6001600160a01b031614611b265760405163c19f17a960e01b815260040160405180910390fd5b7f000000000000000000000000372e7761997858be1ee3c492dfa01091282c50836001600160a01b031663f1cf418260405180606001604052808a6001600160a01b03168152602001896040016020810190611b829190614231565b6001600160a01b0316815260200189606001358152506040518263ffffffff1660e01b8152600401611bb491906148d4565b600060405180830381600087803b158015611bce57600080fd5b505af1158015611be2573d6000803e3d6000fd5b50505050610ef48787878787877f6b277b6f647b7a0d8000e4fc1460639f589d3e1262b3f1a2f378cce0a5da40bb613306565b611c226060870187614903565b611c30906040810190614762565b611c3e906020810190614782565b6020013515611c60576040516379bb579b60e11b815260040160405180910390fd5b60006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae611ca160608a0160408b01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611ce5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d09919061472c565b905060006001600160a01b03821663e4dc2aa4611d2c60608b0160408c01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d949190614749565b90506000611da33386866114bf565b9050611dbb81611db660608c018c614903565b612391565b611dcc8161105460608c018c614903565b60006001600160a01b03841663b943855e611ded60608d0160408e01614231565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529085166024820152604401602060405180830381865afa158015611e39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5d9190614749565b9050611eb88260405180606001604052808d600001803603810190611e82919061492f565b81526020018d6040016020810190611e9a9190614231565b6001600160a01b0316815260200184905261121960608e018e614903565b611ed382611ecc60608d0160408e01614231565b838c6130f2565b611ede8289896128ff565b6001600160a01b03841663e4dc2aa4611efd60608d0160408e01614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f659190614749565b8310611f8457604051638480c32560e01b815260040160405180910390fd5b50505050505050505050565b6000611f9d3384846114bf565b9050611fbd81611fb360608a0160408b01614231565b8960600135613600565b611fd781611fd0368a90038a018a614845565b88886126c8565b610ef481611feb60608a0160408b01614231565b8960600135876130f2565b600061200133610efd565b90506000806120108680614762565b61201e90602081019061494b565b90501161202c57600061204e565b7fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b905061205c828787846130d5565b6112948285856128ff565b6000612076602084018461494b565b9050111561208e576120898484846136f5565b6120a3565b6120a3848461209d8580614903565b84613a6c565b60006120b2606084018461494b565b905011156120d0576120d0846120cb606085018561494b565b6128ff565b606083018035906120e49060408601614231565b6001600160a01b039081169086167fbf9d03ac543e8f596c6f4af5ab5e75f366a57d2d6c28d2ff9c024bd3f88e87716121206020880188614231565b604051610c1b919060208a0135906148bb565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161216d57905050905060006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae6121c26020890189614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612206573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222a919061472c565b9050808360008151811061224057612240614994565b60200260200101906001600160a01b031690816001600160a01b03168152505085858560405160240161227593929190614a15565b60408051601f198184030181529190526020810180516001600160e01b0316631423e67960e11b179052825183906000906122b2576122b2614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038816906363fb0b96906122eb9086908690600401614a3f565b600060405180830381600087803b15801561230557600080fd5b505af1158015612319573d6000803e3d6000fd5b50505060608701803591506123319060408901614231565b6001600160a01b039081169089167f976f9aa1da6d0f0e23405b12b4e2b446c12615150624819f4bebe8060fa39f6161236d60208b018b614231565b604051612380919060208d0135906148bb565b60405180910390a450505050505050565b6000806123a16040840184614762565b6123ab908061494b565b9050116123b95760006123db565b7fab273376f9efdd920b41b30b3f02b3dee877874951e3c14bf87bc60060efebcc5b604080516001808252818301909252919250600091906020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816124195790505090507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b8260008151811061246457612464614994565b6001600160a01b0390921660209283029190910190910152612486848061494b565b612493602087018761494b565b7f0000000000000000000000005acb2ec8e7755366e0f23df4579cb5cfaf14715c876040516024016124ca96959493929190614b58565b60408051601f198184030181529190526020810180516001600160e01b03166312f5760360e01b1790528151829060009061250757612507614994565b6020026020010181905250846001600160a01b03166363fb0b963484846040518463ffffffff1660e01b8152600401612541929190614a3f565b6000604051808303818588803b15801561255a57600080fd5b505af1158015611f84573d6000803e3d6000fd5b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816125a85790505090507f000000000000000000000000ac371d6e651b6450ea8c4ce346ddd44b62d851b5826000815181106125f3576125f3614994565b60200260200101906001600160a01b031690816001600160a01b031681525050826040516024016126249190614de8565b60408051601f198184030181529190526020810180516001600160e01b031663ac98b56360e01b1790528151829060009061266157612661614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038516906363fb0b969061269a9085908590600401614a3f565b600060405180830381600087803b1580156126b457600080fd5b505af1158015611473573d6000803e3d6000fd5b8251516040516363cd755760e11b81526001600160a01b0391821660048201526000917f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99169063c79aeaae90602401602060405180830381865afa158015612734573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612758919061472c565b604080516001808252818301909252919250600091906020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161279657905050905082826000815181106127c1576127c1614994565b60200260200101906001600160a01b031690816001600160a01b0316815250508585856040516024016127f693929190614eff565b60408051601f198184030181529190526020810180516001600160e01b03166001624236cd60e11b03191790528151829060009061283657612836614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038816906363fb0b969061286f9085908590600401614a3f565b600060405180830381600087803b15801561288957600080fd5b505af115801561289d573d6000803e3d6000fd5b50505050856040015186602001516001600160a01b0316886001600160a01b03167f53375fafff3a4a00460af1c1347b8f0dd0d35cce6b2bd5661346bc8ad1d37a008960000151600001518a60000151602001516040516123809291906148bb565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b60608152602001906001900390816129395790505090507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b8260008151811061298457612984614994565b60200260200101906001600160a01b031690816001600160a01b03168152505083836040516024016129b7929190614f47565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b179052815182906000906129f4576129f4614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038616906363fb0b9690612a2d9085908590600401614a3f565b600060405180830381600087803b158015612a4757600080fd5b505af1158015610914573d6000803e3d6000fd5b612a758383836000805160206153cf833981519152613a6c565b612a83836120cb838061494b565b60608201803590612a979060408501614231565b6001600160a01b039081169085167fbf9d03ac543e8f596c6f4af5ab5e75f366a57d2d6c28d2ff9c024bd3f88e8771612ad36020870187614231565b604051612ae691906020890135906148bb565b60405180910390a4505050565b612b0e8560208601612b0860a0880188614903565b84612067565b612b4d8560208601612b2360c0880188614919565b611030612b3660808a0160608b01614231565b612b4360208b018b614231565b60808b0135612f37565b612b5e8561105460e0870187614903565b612b7c85612b726080870160608801614231565b6080870135613d68565b60006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae612bbd6080880160608901614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612c01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c25919061472c565b6001600160a01b031663b943855e612c436080880160608901614231565b6040516001600160e01b031960e084901b1681526001600160a01b0391821660048201529089166024820152604401602060405180830381865afa158015612c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb39190614749565b9050612d0e86604051806060016040528088602001600001803603810190612cdb919061492f565b8152602001612cf060808a0160608b01614231565b6001600160a01b0316815260200184905261121960e0890189614903565b612d198685856128ff565b60808501803590612d2d9060608801614231565b6001600160a01b039081169088167f550ef6ca72911d6a82dfa1fade2d87ed10c69661f1bf04376add792b5d1e5437612d6c60408a0160208b01614231565b60408051612d7e92918c0135906148bb565b60405180910390a4505050505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081612dc85790505090507f000000000000000000000000188f3b2b1c40e3bc77bc0993c6c951ce4030c94382600081518110612e1357612e13614994565b60200260200101906001600160a01b031690816001600160a01b0316815250508383604051602401612e469291906148bb565b60408051601f198184030181529190526020810180516001600160e01b0316631df6a96160e31b179052815182906000906129f4576129f4614994565b612e9d8686866000805160206153cf833981519152612067565b612ec98686857fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af646130d5565b612ed48683836128ff565b60608501803590612ee89060408801614231565b6001600160a01b039081169088167fc9a3d0888f5ab83eb0fcd2e948c80035fd02319ad2f57c4bc68b1513a0f78ea0612f2460208a018a614231565b604051612d7e919060208c0135906148bb565b6040516363cd755760e11b81526001600160a01b03848116600483015260009182917f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99169063c79aeaae90602401602060405180830381865afa158015612fa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc6919061472c565b90506000816001600160a01b0316639e6eda1886866040518363ffffffff1660e01b8152600401612ff89291906148bb565b602060405180830381865afa158015613015573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130399190614f5b565b90506101f48162ffffff1611613073577fcb922c4d36cde61b3660729b33f36eff74a31440cf3e852d4467b4bd6045011c92505050611562565b610bb88162ffffff16116130ab577fc552bcd88e8785f8a0d9f9c5b9dc4e198659e68e9f6645642142b2900cde564d92505050611562565b7fa7e26cbd23588e6e87ee40cb01079e973bf8a0910c2edb6bc11ba3240a81480b92505050611562565b6130e784846107c16040860186614799565b6117a28483836133c5565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161312c5790505090507f0000000000000000000000000f592f2ee1779fa7d81a8482f4cc6d216a0fe04f8260008151811061317757613177614994565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000372e7761997858be1ee3c492dfa01091282c50838585856040516024016131ce949392919061510a565b60408051601f198184030181529190526020810180516001600160e01b0316636505c9ff60e11b1790528151829060009061320b5761320b614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038716906363fb0b96906132449085908590600401614a3f565b600060405180830381600087803b15801561255a57600080fd5b606084018035906132729060408701614231565b6001600160a01b039081169087167f8181f528787b6f5d64998fce6130134048cf712961e4d1554465276932df54cc6132ae6020890189614231565b6020808a013590899088906132c5908b018b614231565b604080516001600160a01b039687168152602080820196909652938616908401526060830191909152909216608083015287013560a082015260c001610cce565b613315878761209d8880614903565b836133375761333787876133298880614903565b6107c1906060810190614799565b613348876107e16020880188614762565b8361336a5761336a8761336036899003890189614845565b6112198880614903565b6133758784846128ff565b606086018035906133899060408901614231565b6001600160a01b039081169089167f504180eddec0aa4ed3bb8edcf99b13013e1d8ae52be37f0f4f38d14ccf0c99a561236d60208b018b614231565b6040805160028082526060820183526000926020830190803683375050604080516002808252606082019092529293506000929150602082015b60608152602001906001900390816133ff5790505090507f000000000000000000000000ac371d6e651b6450ea8c4ce346ddd44b62d851b58260008151811061344a5761344a614994565b6001600160a01b039092166020928302919091019091015261346c8480614762565b60405160240161347c919061520a565b60408051601f198184030181529190526020810180516001600160e01b0316632bbb931b60e01b179052815182906000906134b9576134b9614994565b60200260200101819052507f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d826001815181106134f8576134f8614994565b6001600160a01b039092166020928302919091018201527f0000000000000000000000005acb2ec8e7755366e0f23df4579cb5cfaf14715c90849061353f9087018761494b565b604051602401613552949392919061530e565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b1790528151829060019081106129f4576129f4614994565b606081018035906135a59060408401614231565b6001600160a01b039081169084167f3d988581b5d3b2ed8c77b357af36f383c9a6d036a423cb9f82be3b03211cfd146135e16020860186614231565b6040516135f491906020880135906148bb565b60405180910390a45050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161363a5790505090507f000000000000000000000000188f3b2b1c40e3bc77bc0993c6c951ce4030c9438260008151811061368557613685614994565b60200260200101906001600160a01b031690816001600160a01b03168152505083836040516024016136b89291906148bb565b60408051601f198184030181529190526020810180516001600160e01b03166306c530b960e41b179052815182906000906129f4576129f4614994565b60006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae6137336020860186614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015613777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061379b919061472c565b6040805160038082526080820190925291925060009190602082016060803683375050604080516003808252608082019092529293506000929150602082015b60608152602001906001900390816137db579050509050828260008151811061380657613806614994565b6001600160a01b0390921660209283029190910190910152846138298580614903565b613833908061494b565b61383d8780614903565b61384e906040810190602001615343565b6138588880614903565b613869906060810190604001615343565b6138738980614903565b613881906060810190614799565b604051602401613897979695949392919061535e565b60408051601f198184030181529190526020810180516001600160e01b0316636f4621e360e01b179052815182906000906138d4576138d4614994565b60200260200101819052507f00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b8260018151811061391357613913614994565b6001600160a01b039092166020928302919091018201526139369085018561494b565b6040516024016139479291906153ba565b60408051601f198184030181529190526020810180516001600160e01b03166321e9d05b60e01b17905281518290600190811061398657613986614994565b60200260200101819052507f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d826002815181106139c5576139c5614994565b6001600160a01b03909216602092830291909101909101527f0000000000000000000000005acb2ec8e7755366e0f23df4579cb5cfaf14715c6000805160206153cf833981519152613a1a604087018761494b565b604051602401613a2d949392919061530e565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b17905281518290600290811061320b5761320b614994565b60006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae613aaa6020870187614231565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015613aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b12919061472c565b60408051600280825260608201835292935060009290916020830190803683375050604080516002808252606082019092529293506000929150602082015b6060815260200190600190039081613b515790505090508282600081518110613b7c57613b7c614994565b6001600160a01b039092166020928302919091019091015285613b9f868061494b565b613baf6040890160208a01615343565b613bbf60608a0160408b01615343565b613bcc60608b018b614799565b604051602401613be2979695949392919061535e565b60408051601f198184030181529190526020810180516001600160e01b0316636f4621e360e01b17905281518290600090613c1f57613c1f614994565b60200260200101819052507f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d82600181518110613c5e57613c5e614994565b6001600160a01b03909216602092830291909101909101527f0000000000000000000000005acb2ec8e7755366e0f23df4579cb5cfaf14715c84613ca2878061494b565b604051602401613cb5949392919061530e565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b179052815182906001908110613cf457613cf4614994565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038816906363fb0b9690613d2d9085908590600401614a3f565b600060405180830381600087803b158015613d4757600080fd5b505af1158015613d5b573d6000803e3d6000fd5b5050505050505050505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081613da25790505090507f0000000000000000000000000f592f2ee1779fa7d81a8482f4cc6d216a0fe04f82600081518110613ded57613ded614994565b6001600160a01b0392831660209182029290920101526040517f000000000000000000000000372e7761997858be1ee3c492dfa01091282c50838216602482015290851660448201526064810184905260840160408051601f198184030181529190526020810180516001600160e01b0316631f5cecd560e01b179052815182906000906129f4576129f4614994565b600060808284031215613e8f57600080fd5b50919050565b80358015158114613ea557600080fd5b919050565b60008083601f840112613ebc57600080fd5b5081356001600160401b03811115613ed357600080fd5b6020830191508360208260051b8501011115613eee57600080fd5b9250929050565b6000806000806000806101008789031215613f0f57600080fd5b613f198888613e7d565b955060808701356001600160401b0380821115613f3557600080fd5b613f418a838b01613e7d565b965060a0890135915080821115613f5757600080fd5b613f638a838b01613e7d565b9550613f7160c08a01613e95565b945060e0890135915080821115613f8757600080fd5b50613f9489828a01613eaa565b979a9699509497509295939492505050565b60008060a08385031215613fb957600080fd5b613fc38484613e7d565b915060808301356001600160401b03811115613fde57600080fd5b613fea85828601613e7d565b9150509250929050565b6001600160a01b038116811461400957600080fd5b50565b60006101008284031215613e8f57600080fd5b6000806000806060858703121561403557600080fd5b843561404081613ff4565b935060208501356001600160401b038082111561405c57600080fd5b6140688883890161400c565b9450604087013591508082111561407e57600080fd5b5061408b87828801613eaa565b95989497509550505050565b60008083601f8401126140a957600080fd5b5081356001600160401b038111156140c057600080fd5b602083019150836020828501011115613eee57600080fd5b600080600060a084860312156140ed57600080fd5b6140f78585613e7d565b925060808401356001600160401b0381111561411257600080fd5b61411e86828701614097565b9497909650939450505050565b60008060008060c0858703121561414157600080fd5b61414b8686613e7d565b935060808501356001600160401b038082111561416757600080fd5b61417388838901613e7d565b945060a087013591508082111561418957600080fd5b5061408b87828801614097565b600060608284031215613e8f57600080fd5b60008060008060008061010087890312156141c257600080fd5b86356141cd81613ff4565b95506141dc8860208901613e7d565b945060a08701356001600160401b03808211156141f857600080fd5b6142048a838b01613e7d565b955060c089013591508082111561421a57600080fd5b613f718a838b01614196565b8035613ea581613ff4565b60006020828403121561424357600080fd5b813561156281613ff4565b60006103408284031215613e8f57600080fd5b6000806000806060858703121561427757600080fd5b84356001600160401b038082111561428e57600080fd5b61429a8883890161400c565b955060208701359150808211156142b057600080fd5b6140688883890161424e565b600060408284031215613e8f57600080fd5b600080600080600060e086880312156142e657600080fd5b6142f08787613e7d565b945060808601356001600160401b038082111561430c57600080fd5b61431889838a016142bc565b955061432660a08901613e95565b945060c088013591508082111561433c57600080fd5b5061434988828901613eaa565b969995985093965092949392505050565b600080600080600060e0868803121561437257600080fd5b61437c8787613e7d565b945060808601356001600160401b038082111561439857600080fd5b6143a489838a01613e7d565b955060a08801359150808211156143ba57600080fd5b61432689838a01614196565b6000806000606084860312156143db57600080fd5b83356143e681613ff4565b925060208401356143f681613ff4565b929592945050506040919091013590565b600080600080600080610100878903121561442157600080fd5b61442b8888613e7d565b955060808701356001600160401b038082111561444757600080fd5b6144538a838b01613e7d565b965060a089013591508082111561446957600080fd5b613f638a838b01614196565b60008060006040848603121561448a57600080fd5b83356001600160401b03808211156144a157600080fd5b6144ad8783880161400c565b945060208601359150808211156144c357600080fd5b5061411e86828701613eaa565b600080600060c084860312156144e557600080fd5b83356144f081613ff4565b92506144ff8560208601613e7d565b915060a08401356001600160401b0381111561451a57600080fd5b61452686828701613e7d565b9150509250925092565b600080600080600080610100878903121561454a57600080fd5b863561455581613ff4565b95506145648860208901613e7d565b945060a08701356001600160401b038082111561458057600080fd5b613f638a838b016142bc565b60008060008060008060a087890312156145a557600080fd5b86356001600160401b03808211156145bc57600080fd5b6145c88a838b01613e7d565b975060208901359150808211156145de57600080fd5b6145ea8a838b0161424e565b9650604089013591508082111561460057600080fd5b5061460d89828a01613eaa565b909550935050606087013561462181613ff4565b80925050608087013590509295509295509295565b600080600080600080610100878903121561465057600080fd5b61465a8888613e7d565b955060808701356001600160401b038082111561467657600080fd5b6146828a838b01614097565b909750955060a089013591508082111561469b57600080fd5b506146a889828a0161424e565b93505060c08701356146b981613ff4565b8092505060e087013590509295509295509295565b60008060008060c085870312156146e457600080fd5b6146ee8686613e7d565b935060808501356001600160401b038082111561470a57600080fd5b61471688838901614196565b945060a087013591508082111561407e57600080fd5b60006020828403121561473e57600080fd5b815161156281613ff4565b60006020828403121561475b57600080fd5b5051919050565b60008235603e1983360301811261477857600080fd5b9190910192915050565b6000823561017e1983360301811261477857600080fd5b6000808335601e198436030181126147b057600080fd5b8301803591506001600160401b038211156147ca57600080fd5b602001915036819003821315613eee57600080fd5b6000604082840312156147f157600080fd5b604051604081018181106001600160401b038211171561482157634e487b7160e01b600052604160045260246000fd5b604052905080823561483281613ff4565b8152602092830135920191909152919050565b60006080828403121561485757600080fd5b604051606081018181106001600160401b038211171561488757634e487b7160e01b600052604160045260246000fd5b60405261489484846147df565b815260408301356148a481613ff4565b602082015260609290920135604083015250919050565b6001600160a01b03929092168252602082015260400190565b81516001600160a01b039081168252602080840151909116908201526040918201519181019190915260600190565b60008235607e1983360301811261477857600080fd5b60008235605e1983360301811261477857600080fd5b60006040828403121561494157600080fd5b61156283836147df565b6000808335601e1984360301811261496257600080fd5b8301803591506001600160401b0382111561497c57600080fd5b6020019150600581901b3603821315613eee57600080fd5b634e487b7160e01b600052603260045260246000fd5b80356149b581613ff4565b6001600160a01b039081168352602082810135908401526040820135906149db82613ff4565b166040830152606090810135910152565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b614a1f81856149aa565b60a060808201526000614a3660a0830184866149ec565b95945050505050565b604080825283519082018190526000906020906060840190828701845b82811015614a815781516001600160a01b031684529284019290840190600101614a5c565b50505083810382850152845180825282820190600581901b8301840187850160005b83811015614b0057601f19808785030186528251805180865260005b81811015614ada578281018b01518782018c01528a01614abf565b5060008682018b015296890196601f019091169093018701925090860190600101614aa3565b50909998505050505050505050565b8183526000602080850194508260005b85811015614b4d578135614b3281613ff4565b6001600160a01b031687529582019590820190600101614b1f565b509495945050505050565b608081526000614b6c60808301888a614b0f565b82810360208401528581526001600160fb1b03861115614b8b57600080fd5b8560051b808860208401376001600160a01b039590951660408401526001600160e01b0319939093166060909201919091525001602001949350505050565b6000808335601e19843603018112614be157600080fd5b83016020810192503590506001600160401b03811115614c0057600080fd5b8060051b3603821315613eee57600080fd5b6000808335601e19843603018112614c2957600080fd5b83016020810192503590506001600160401b03811115614c4857600080fd5b803603821315613eee57600080fd5b6000823560fe19833603018112614c6d57600080fd5b90910192915050565b81835260006020808501808196508560051b810191508460005b87811015614d62578284038952614ca78288614c57565b6101008135614cb581613ff4565b6001600160a01b03168652614ccb828801614226565b6001600160a01b03168787015260408281013590870152606080830135908701526080808301359087015260a0614d03818401614226565b6001600160a01b03169087015260c0614d1d838201614226565b6001600160a01b03169087015260e0614d3883820184614c12565b93508282890152614d4c83890185836149ec565b9c89019c97505050928601925050600101614c90565b5091979650505050505050565b62ffffff8116811461400957600080fd5b8035613ea581614d6f565b8035614d9681613ff4565b6001600160a01b039081168352602082013590614db282613ff4565b1660208301526040810135614dc681614d6f565b62ffffff81166040840152505050565b8035600281900b8114613ea557600080fd5b602081526000614df88384614bca565b60406020850152614e0d606085018284614c76565b915050602084013561017e19853603018112614e2857600080fd5b838203601f190160408501528401610180614e5383614e4684614226565b6001600160a01b03169052565b60208201356020840152614e6d6040840160408401614d8b565b614e7960a08301614dd6565b614e8860a085018260020b9052565b50614e9560c08301614dd6565b614ea460c085018260020b9052565b5060e08281013590840152610100808301359084015261012080830135908401526101408083013590840152610160614edf81840184614c12565b93508282860152614ef383860185836149ec565b98975050505050505050565b6000845160018060a01b038082511684526020820151602085015280602088015116604085015250506040850151606083015260a06080830152614a3660a0830184866149ec565b60208152600061155f602083018486614b0f565b600060208284031215614f6d57600080fd5b815161156281614d6f565b803560ff81168114613ea557600080fd5b803560038110614f9857600080fd5b82526020810135614fa881613ff4565b6001600160a01b03166020929092019190915250565b614fd482614fcb83614d80565b62ffffff169052565b614fe060208201614d80565b62ffffff166020830152614ff660408201614dd6565b615005604084018260020b9052565b5061501260608201614dd6565b615021606084018260020b9052565b506080810135608083015260a081013560a083015260c081013560c083015261504c60e08201614dd6565b61505b60e084018260020b9052565b5061010061506a818301614dd6565b6150788285018260020b9052565b5050610120615088818301614f78565b60ff1690830152610140610937818401838301614f89565b6150a981614dd6565b60020b82526150ba60208201614dd6565b60020b602083015260408101356150d081613ff4565b6001600160a01b0390811660408401526060820135906150ef82613ff4565b1660608301526080818101359083015260a090810135910152565b6001600160a01b0385811682528416602082015260408101839052608060608201526000823561513981613ff4565b6001600160a01b03166080830152602083013560a083015261515d60408401613e95565b151560c083015261517460e0830160608501614fbe565b6151816101e08401613e95565b6102606151918185018315159052565b6151a361028085016102008701614f89565b6151b06102408601613e95565b8015156102c086015291506151cb6102e085018287016150a0565b50506151db610320840184614c12565b6103406103a0850152614ef36103c0850182846149ec565b80356001600160801b0381168114613ea557600080fd5b60208152600061521a8384614c57565b60406020840152803561522c81613ff4565b6001600160a01b0316606084015260208101356080840152615250604082016151f3565b6001600160801b03811660a085015250606081013560c0840152608081013560e084015261528060a082016151f3565b610100615297818601836001600160801b03169052565b6152a360c084016151f3565b6001600160801b03811661012087015291506152c260e0840184614c12565b9350915080610140860152506152dd610160850183836149ec565b9150506152ed6020850185614bca565b848303601f19016040860152615304838284614c76565b9695505050505050565b6001600160a01b03851681526001600160e01b0319841660208201526060604082018190526000906153049083018486614b0f565b60006020828403121561535557600080fd5b611562826151f3565b600061010061536d838b6149aa565b806080840152615380818401898b614b0f565b6001600160801b0388811660a0860152871660c085015283810360e085015290506153ac8185876149ec565b9a9950505050505050505050565b60208152600061155f602083018486614c7656fee400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa3a264697066735822122034f00bc1d25dd420a040b135c419051d799def04fd907c0404bcec7e8463aa3a64736f6c63430008130033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99000000000000000000000000372e7761997858be1ee3c492dfa01091282c5083000000000000000000000000188f3b2b1c40e3bc77bc0993c6c951ce4030c9430000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d000000000000000000000000ac371d6e651b6450ea8c4ce346ddd44b62d851b50000000000000000000000000f592f2ee1779fa7d81a8482f4cc6d216a0fe04f

-----Decoded View---------------
Arg [0] : factory (address): 0x233D9067677dCf1a161954D45B4C965B9d567168
Arg [1] : connectorRegistry (address): 0xc6013E57a0811C7111A8fB07ACd2E248D9489C99
Arg [2] : nftSettingsRegistry_ (address): 0x372e7761997858BE1ee3c492DFa01091282c5083
Arg [3] : libraries (tuple):
Arg [1] : nftTransferLib (address): 0x188f3B2B1C40e3Bc77BC0993C6C951ce4030c943
Arg [2] : transferLib (address): 0x0626Bd067fF557AE86Ee5c7CE44281aDbf10298B
Arg [3] : swapLib (address): 0x23eb5CE64769b969b58f008154d396957A7aDE3b
Arg [4] : feesLib (address): 0x46292986Df2FEE3a048Dd6753918e62e93806C2d
Arg [5] : nftZapLib (address): 0xAc371D6E651b6450ea8c4cE346Ddd44B62d851B5
Arg [6] : nftSettingsLib (address): 0x0f592f2Ee1779Fa7d81a8482f4CC6D216a0FE04f


-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168
Arg [1] : 000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99
Arg [2] : 000000000000000000000000372e7761997858be1ee3c492dfa01091282c5083
Arg [3] : 000000000000000000000000188f3b2b1c40e3bc77bc0993c6c951ce4030c943
Arg [4] : 0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b
Arg [5] : 00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b
Arg [6] : 00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d
Arg [7] : 000000000000000000000000ac371d6e651b6450ea8c4ce346ddd44b62d851b5
Arg [8] : 0000000000000000000000000f592f2ee1779fa7d81a8482f4cc6d216a0fe04f


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.