ETH Price: $4,430.89 (-1.17%)

Contract

0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FarmStrategy

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 {
    StrategyModule,
    SickleFactory,
    Sickle,
    ConnectorRegistry
} from "contracts/modules/StrategyModule.sol";
import { IFarmConnector, Farm } from "contracts/interfaces/IFarmConnector.sol";
import {
    Farm,
    DepositParams,
    HarvestParams,
    WithdrawParams,
    CompoundParams,
    SimpleDepositParams,
    SimpleWithdrawParams,
    SimpleHarvestParams
} from "contracts/structs/FarmStrategyStructs.sol";
import { IFeesLib } from "contracts/interfaces/libraries/IFeesLib.sol";
import { ISwapLib } from "contracts/interfaces/libraries/ISwapLib.sol";
import { ITransferLib } from "contracts/interfaces/libraries/ITransferLib.sol";
import { IPositionSettingsLib } from
    "contracts/interfaces/libraries/IPositionSettingsLib.sol";
import { IZapLib } from "contracts/interfaces/libraries/IZapLib.sol";
import { IAutomation } from "contracts/interfaces/IAutomation.sol";
import { IPositionSettingsRegistry } from
    "contracts/interfaces/IPositionSettingsRegistry.sol";
import {
    PositionKey,
    PositionSettings
} from "contracts/structs/PositionSettingsStructs.sol";
import { FarmStrategyEvents } from "contracts/events/FarmStrategyEvents.sol";

library FarmStrategyFees {
    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"));
}

contract FarmStrategy is StrategyModule, IAutomation, FarmStrategyEvents {
    struct Libraries {
        ITransferLib transferLib;
        ISwapLib swapLib;
        IFeesLib feesLib;
        IZapLib zapLib;
        IPositionSettingsLib positionSettingsLib;
    }

    IZapLib public immutable zapLib;
    ISwapLib public immutable swapLib;
    ITransferLib public immutable transferLib;
    IFeesLib public immutable feesLib;
    IPositionSettingsLib public immutable positionSettingsLib;

    IPositionSettingsRegistry public immutable positionSettingsRegistry;

    address public immutable strategyAddress;

    constructor(
        SickleFactory factory,
        ConnectorRegistry connectorRegistry,
        Libraries memory libraries,
        IPositionSettingsRegistry _positionSettingsRegistry
    ) StrategyModule(factory, connectorRegistry) {
        zapLib = libraries.zapLib;
        swapLib = libraries.swapLib;
        transferLib = libraries.transferLib;
        feesLib = libraries.feesLib;
        positionSettingsLib = libraries.positionSettingsLib;
        positionSettingsRegistry = _positionSettingsRegistry;
        strategyAddress = address(this);
    }

    /**
     * @notice Deposits tokens into the specified farm and sets position
     * settings.
     * @param params The parameters for the deposit, including farm details and
     * token amounts.
     * @param positionSettings The settings for the position, including reward
     * configurations and exit configurations.
     * @param sweepTokens The list of tokens to be swept.
     * @param approved The address approved to manage the position (used on
     * first deposit only).
     * @param referralCode The referral code for tracking referrals (used on
     * first deposit only).
     */
    function deposit(
        DepositParams calldata params,
        PositionSettings calldata positionSettings,
        address[] calldata sweepTokens,
        address approved,
        bytes32 referralCode
    ) public payable {
        Sickle sickle = getOrDeploySickle(msg.sender, approved, referralCode);

        bytes4 fee =
            params.zap.swaps.length > 0 ? FarmStrategyFees.Deposit : bytes4(0);

        _increase(sickle, params, sweepTokens, fee);

        _setPositionSettings(sickle, params.farm, positionSettings);

        emit SickleDeposited(
            sickle, params.farm.stakingContract, params.farm.poolIndex
        );
    }

    /**
     * @notice Increases the position by depositing additional tokens into the
     * specified farm.
     * @param params The parameters for the deposit, including farm details and
     * token amounts.
     * @param sweepTokens The list of tokens to be swept.
     */
    function increase(
        DepositParams calldata params,
        address[] calldata sweepTokens
    ) public payable {
        Sickle sickle = getSickle(msg.sender);

        bytes4 fee =
            params.zap.swaps.length > 0 ? FarmStrategyFees.Deposit : bytes4(0);

        _increase(sickle, params, sweepTokens, fee);

        emit SickleDeposited(
            sickle, params.farm.stakingContract, params.farm.poolIndex
        );
    }

    /**
     * @notice Compounds the position by claiming rewards and reinvesting them
     * into the specified farm.
     * @param params The parameters for the compound, including farm details and
     * reward tokens.
     * @param sweepTokens The list of tokens to be swept.
     */
    function compound(
        CompoundParams calldata params,
        address[] calldata sweepTokens
    ) public {
        Sickle sickle = getSickle(msg.sender);

        _compound(sickle, params, sweepTokens, FarmStrategyFees.Compound);

        emit SickleCompounded(
            sickle,
            params.claimFarm.stakingContract,
            params.claimFarm.poolIndex,
            params.depositFarm.stakingContract,
            params.depositFarm.poolIndex
        );
    }

    /**
     * @notice Withdraws tokens from the specified farm.
     * @param farm The farm details.
     * @param params The parameters for the withdrawal, including zap details.
     * @param sweepTokens The list of tokens to be swept.
     */
    function withdraw(
        Farm calldata farm,
        WithdrawParams calldata params,
        address[] calldata sweepTokens
    ) public {
        Sickle sickle = getSickle(msg.sender);

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

        _withdraw(sickle, farm, params, sweepTokens, fee);

        emit SickleWithdrawn(sickle, farm.stakingContract, farm.poolIndex);
    }

    /**
     * @notice Claims rewards from the specified farm.
     * @param farm The farm details.
     * @param params The parameters for the harvest, including zap details.
     * @param sweepTokens The list of tokens to be swept.
     */
    function harvest(
        Farm calldata farm,
        HarvestParams calldata params,
        address[] calldata sweepTokens
    ) public {
        Sickle sickle = getSickle(msg.sender);

        _harvest(sickle, farm, params, sweepTokens, FarmStrategyFees.Harvest);

        emit SickleHarvested(sickle, farm.stakingContract, farm.poolIndex);
    }

    /**
     * @notice Exits the position by claiming rewards and withdrawing tokens
     * from the specified farm.
     * @param farm The farm details.
     * @param harvestParams The parameters for the harvest, including zap
     * details.
     * @param harvestSweepTokens The list of tokens to be swept from the
     * harvest.
     * @param withdrawParams The parameters for the withdrawal, including zap
     * details.
     * @param withdrawSweepTokens The list of tokens to be swept from the
     * withdrawal.
     */
    function exit(
        Farm calldata farm,
        HarvestParams calldata harvestParams,
        address[] calldata harvestSweepTokens,
        WithdrawParams calldata withdrawParams,
        address[] calldata withdrawSweepTokens
    ) public {
        Sickle sickle = getSickle(msg.sender);

        _exit(
            sickle,
            farm,
            harvestParams,
            harvestSweepTokens,
            withdrawParams,
            withdrawSweepTokens,
            FarmStrategyFees.Harvest
        );

        emit SickleExited(sickle, farm.stakingContract, farm.poolIndex);
    }

    /* Simple (non-zap) */

    /**
     * @notice Deposits tokens into the specified farm and sets position
     * settings.
     * @param params The parameters for the deposit, including farm details and
     * token amounts.
     * @param positionSettings The settings for the position, including reward
     * configurations and exit configurations.
     * @param approved The address approved to manage the position (used on
     * first deposit only).
     * @param referralCode The referral code for tracking referrals (used on
     * first deposit only).
     */
    function simpleDeposit(
        SimpleDepositParams calldata params,
        PositionSettings calldata positionSettings,
        address approved,
        bytes32 referralCode
    ) public payable {
        Sickle sickle = getOrDeploySickle(msg.sender, approved, referralCode);

        _simpleIncrease(sickle, params);

        _setPositionSettings(sickle, params.farm, positionSettings);

        emit SickleDeposited(
            sickle, params.farm.stakingContract, params.farm.poolIndex
        );
    }

    /**
     * @notice Increases the position by depositing additional tokens into the
     * specified farm.
     * @param params The parameters for the deposit, including farm details and
     * token amounts.
     */
    function simpleIncrease(
        SimpleDepositParams calldata params
    ) public {
        Sickle sickle = getSickle(msg.sender);

        _simpleIncrease(sickle, params);

        emit SickleDeposited(
            sickle, params.farm.stakingContract, params.farm.poolIndex
        );
    }

    /**
     * @notice Claims rewards from the specified farm.
     * @param farm The farm details.
     * @param params The parameters for the harvest, including zap details.
     */
    function simpleHarvest(
        Farm calldata farm,
        SimpleHarvestParams calldata params
    ) external {
        Sickle sickle = getSickle(msg.sender);

        _simpleHarvest(sickle, farm, params);

        emit SickleHarvested(sickle, farm.stakingContract, farm.poolIndex);
    }

    /**
     * @notice Withdraws tokens from the specified farm.
     * @param farm The farm details.
     * @param params The parameters for the withdrawal, including zap details.
     */
    function simpleWithdraw(
        Farm calldata farm,
        SimpleWithdrawParams calldata params
    ) public {
        Sickle sickle = getSickle(msg.sender);

        _simpleWithdraw(sickle, farm, params);

        emit SickleWithdrawn(sickle, farm.stakingContract, farm.poolIndex);
    }

    /**
     * @notice Exits the position by claiming rewards and withdrawing tokens
     * from the specified farm.
     * @param farm The farm details.
     * @param harvestParams The parameters for the harvest, including zap
     * details.
     * @param withdrawParams The parameters for the withdrawal, including zap
     * details.
     */
    function simpleExit(
        Farm calldata farm,
        SimpleHarvestParams calldata harvestParams,
        SimpleWithdrawParams calldata withdrawParams
    ) external {
        Sickle sickle = getSickle(msg.sender);

        _simpleHarvest(sickle, farm, harvestParams);
        _simpleWithdraw(sickle, farm, withdrawParams);

        emit SickleExited(sickle, farm.stakingContract, farm.poolIndex);
    }

    /* Automation */

    /**
     * @notice Claims rewards from the specified farm.
     * Used by Automation contract only.
     * @param farm The farm details.
     * @param params The parameters for the harvest, including zap details.
     * @param sweepTokens The list of tokens to be swept.
     */
    function harvestFor(
        Sickle sickle,
        Farm calldata farm,
        HarvestParams calldata params,
        address[] calldata sweepTokens
    ) external override onlyApproved(sickle) {
        positionSettingsRegistry.validateHarvestFor(
            PositionKey({
                sickle: sickle,
                stakingContract: farm.stakingContract,
                poolIndex: farm.poolIndex
            })
        );
        _harvest(sickle, farm, params, sweepTokens, FarmStrategyFees.HarvestFor);
    }

    /**
     * @notice Compounds the position by claiming rewards and reinvesting them
     * into the specified farm.
     * @param params The parameters for the compound, including farm details and
     * reward tokens.
     * @param sweepTokens The list of tokens to be swept.
     */
    function compoundFor(
        Sickle sickle,
        CompoundParams calldata params,
        address[] calldata sweepTokens
    ) external override onlyApproved(sickle) {
        positionSettingsRegistry.validateCompoundFor(
            PositionKey({
                sickle: sickle,
                stakingContract: params.claimFarm.stakingContract,
                poolIndex: params.claimFarm.poolIndex
            })
        );
        _compound(sickle, params, sweepTokens, FarmStrategyFees.CompoundFor);
    }

    /**
     * @notice Exits the position by claiming rewards and withdrawing tokens
     * from the specified farm.
     * @param farm The farm details.
     * @param harvestParams The parameters for the harvest, including zap
     * details.
     * @param harvestSweepTokens The list of tokens to be swept from the
     * harvest.
     * @param withdrawParams The parameters for the withdrawal, including zap
     * details.
     * @param withdrawSweepTokens The list of tokens to be swept from the
     * withdrawal.
     */
    function exitFor(
        Sickle sickle,
        Farm calldata farm,
        HarvestParams calldata harvestParams,
        address[] calldata harvestSweepTokens,
        WithdrawParams calldata withdrawParams,
        address[] calldata withdrawSweepTokens
    ) external override onlyApproved(sickle) {
        positionSettingsRegistry.validateExitFor(
            PositionKey({
                sickle: sickle,
                stakingContract: farm.stakingContract,
                poolIndex: farm.poolIndex
            })
        );
        _exit(
            sickle,
            farm,
            harvestParams,
            harvestSweepTokens,
            withdrawParams,
            withdrawSweepTokens,
            FarmStrategyFees.HarvestFor
        );
    }

    /* Simple Private */

    function _simpleIncrease(
        Sickle sickle,
        SimpleDepositParams calldata params
    ) private {
        address[] memory targets = new address[](2);
        bytes[] memory data = new bytes[](2);

        targets[0] = address(transferLib);
        data[0] = abi.encodeCall(
            ITransferLib.transferTokenFromUser,
            (params.lpToken, params.amountIn, strategyAddress, bytes4(0))
        );

        targets[1] = connectorRegistry.connectorOf(params.farm.stakingContract);
        data[1] = abi.encodeCall(
            IFarmConnector.deposit,
            (params.farm, params.lpToken, params.extraData)
        );

        sickle.multicall(targets, data);
    }

    function _simpleWithdraw(
        Sickle sickle,
        Farm calldata farm,
        SimpleWithdrawParams calldata params
    ) private {
        address[] memory targets = new address[](2);
        bytes[] memory data = new bytes[](2);

        address farmConnector =
            connectorRegistry.connectorOf(farm.stakingContract);
        targets[0] = farmConnector;
        data[0] = abi.encodeCall(
            IFarmConnector.withdraw, (farm, params.amountOut, params.extraData)
        );

        targets[1] = address(transferLib);
        data[1] =
            abi.encodeCall(ITransferLib.transferTokenToUser, (params.lpToken));

        sickle.multicall(targets, data);
    }

    function _simpleHarvest(
        Sickle sickle,
        Farm calldata farm,
        SimpleHarvestParams calldata params
    ) private {
        address[] memory targets = new address[](3);
        bytes[] memory data = new bytes[](3);

        address farmConnector =
            connectorRegistry.connectorOf(farm.stakingContract);
        targets[0] = farmConnector;
        data[0] = abi.encodeCall(IFarmConnector.claim, (farm, params.extraData));

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

        targets[2] = address(transferLib);
        data[2] = abi.encodeCall(
            ITransferLib.transferTokensToUser, (params.rewardTokens)
        );

        sickle.multicall(targets, data);
    }

    /* Private */

    function _setPositionSettings(
        Sickle sickle,
        Farm calldata farm,
        PositionSettings calldata settings
    ) private {
        address[] memory targets = new address[](1);
        bytes[] memory data = new bytes[](1);

        targets[0] = address(positionSettingsLib);
        data[0] = abi.encodeCall(
            positionSettingsLib.setPositionSettings,
            (positionSettingsRegistry, farm, settings)
        );

        sickle.multicall(targets, data);
    }

    function _increase(
        Sickle sickle,
        DepositParams calldata params,
        address[] calldata sweepTokens,
        bytes4 fee
    ) private {
        address[] memory targets = new address[](4);
        bytes[] memory data = new bytes[](4);

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

        targets[1] = address(zapLib);
        data[1] = abi.encodeCall(IZapLib.zapIn, (params.zap));

        targets[2] = connectorRegistry.connectorOf(params.farm.stakingContract);
        data[2] = abi.encodeCall(
            IFarmConnector.deposit,
            (
                params.farm,
                params.zap.addLiquidityParams.lpToken,
                params.extraData
            )
        );

        targets[3] = address(transferLib);
        data[3] =
            abi.encodeCall(ITransferLib.transferTokensToUser, (sweepTokens));

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

    function _harvest(
        Sickle sickle,
        Farm calldata farm,
        HarvestParams calldata params,
        address[] calldata sweepTokens,
        bytes4 fee
    ) private {
        address[] memory targets = new address[](4);
        bytes[] memory data = new bytes[](4);

        address farmConnector =
            connectorRegistry.connectorOf(farm.stakingContract);
        targets[0] = farmConnector;
        data[0] = abi.encodeCall(IFarmConnector.claim, (farm, params.extraData));

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

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

        targets[3] = address(transferLib);
        data[3] =
            abi.encodeCall(ITransferLib.transferTokensToUser, (sweepTokens));

        sickle.multicall(targets, data);
    }

    function _withdraw(
        Sickle sickle,
        Farm calldata farm,
        WithdrawParams calldata params,
        address[] calldata sweepTokens,
        bytes4 fee
    ) private {
        address[] memory targets = new address[](4);
        bytes[] memory data = new bytes[](4);

        address farmConnector =
            connectorRegistry.connectorOf(farm.stakingContract);
        targets[0] = farmConnector;
        data[0] = abi.encodeCall(
            IFarmConnector.withdraw,
            (
                farm,
                params.zap.removeLiquidityParams.lpAmountIn,
                params.extraData
            )
        );

        targets[1] = address(zapLib);
        data[1] = abi.encodeCall(IZapLib.zapOut, (params.zap));

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

        targets[3] = address(transferLib);
        data[3] =
            abi.encodeCall(ITransferLib.transferTokensToUser, (sweepTokens));

        sickle.multicall(targets, data);
    }

    function _exit(
        Sickle sickle,
        Farm calldata farm,
        HarvestParams calldata harvestParams,
        address[] calldata harvestSweepTokens,
        WithdrawParams calldata withdrawParams,
        address[] calldata withdrawSweepTokens,
        bytes4 harvestFee
    ) private {
        _harvest(sickle, farm, harvestParams, harvestSweepTokens, harvestFee);
        _withdraw(
            sickle,
            farm,
            withdrawParams,
            withdrawSweepTokens,
            FarmStrategyFees.Withdraw
        );
    }

    function _compound(
        Sickle sickle,
        CompoundParams calldata params,
        address[] calldata sweepTokens,
        bytes4 fee
    ) private {
        address[] memory targets = new address[](5);
        bytes[] memory data = new bytes[](5);

        address farmConnector =
            connectorRegistry.connectorOf(params.claimFarm.stakingContract);

        targets[0] = farmConnector;
        data[0] = abi.encodeCall(
            IFarmConnector.claim, (params.claimFarm, params.claimExtraData)
        );

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

        targets[2] = address(zapLib);
        data[2] = abi.encodeCall(IZapLib.zapIn, (params.zap));

        address depositConnector =
            connectorRegistry.connectorOf(params.depositFarm.stakingContract);

        targets[3] = depositConnector;
        data[3] = abi.encodeCall(
            IFarmConnector.deposit,
            (
                params.depositFarm,
                params.zap.addLiquidityParams.lpToken,
                params.depositExtraData
            )
        );

        targets[4] = address(transferLib);
        data[4] =
            abi.encodeCall(ITransferLib.transferTokensToUser, (sweepTokens));

        sickle.multicall(targets, data);
    }
}

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

import { Farm } from "contracts/structs/FarmStrategyStructs.sol";

interface IFarmConnector {
    function deposit(
        Farm calldata farm,
        address token,
        bytes memory extraData
    ) external payable;

    function withdraw(
        Farm calldata farm,
        uint256 amount,
        bytes memory extraData
    ) external;

    function claim(Farm calldata farm, bytes memory extraData) external;

    function balanceOf(
        Farm calldata farm,
        address user
    ) external view returns (uint256);

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

    function isStaked(
        Farm calldata farm,
        address user
    ) external view returns (bool);
}

File 4 of 28 : 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;
}

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

File 8 of 28 : IPositionSettingsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { Farm } from "contracts/structs/FarmStrategyStructs.sol";
import { PositionSettings } from "contracts/structs/PositionSettingsStructs.sol";
import { IPositionSettingsRegistry } from
    "contracts/interfaces/IPositionSettingsRegistry.sol";

interface IPositionSettingsLib {
    function setPositionSettings(
        IPositionSettingsRegistry nftSettingsRegistry,
        Farm calldata farm,
        PositionSettings calldata settings
    ) external;
}

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

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

interface IZapLib {
    function zapIn(
        ZapIn memory zap
    ) external payable;

    function zapOut(
        ZapOut memory zap
    ) external;
}

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

import { Sickle } from "contracts/Sickle.sol";
import {
    Farm,
    HarvestParams,
    CompoundParams,
    WithdrawParams
} from "contracts/structs/FarmStrategyStructs.sol";

interface IAutomation {
    function harvestFor(
        Sickle sickle,
        Farm calldata farm,
        HarvestParams calldata params,
        address[] calldata sweepTokens
    ) external;

    function compoundFor(
        Sickle sickle,
        CompoundParams calldata params,
        address[] calldata sweepTokens
    ) external;

    function exitFor(
        Sickle sickle,
        Farm calldata farm,
        HarvestParams calldata harvestParams,
        address[] calldata harvestSweepTokens,
        WithdrawParams calldata withdrawParams,
        address[] calldata withdrawSweepTokens
    ) external;
}

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

import {
    PositionKey,
    PositionSettings
} from "contracts/structs/PositionSettingsStructs.sol";

interface IPositionSettingsRegistry {
    error InvalidStakingContract();
    error InvalidPool();
    error InvalidRouter();
    error SickleNotDeployed();
    error AutoHarvestNotSet();
    error AutoCompoundNotSet();
    error RewardBehaviorNotSet();
    error AutoExitNotSet();
    error ConditionsNotMet();
    error InvalidPrice();
    error InvalidTokenOut();
    error ExitTriggersNotSet();
    error InvalidSlippageBP();
    error InvalidPriceImpactBP();
    error OnlySickle();
    error NonZeroRewardConfig();
    error NonZeroExitConfig();
    error InvalidTriggerReserves();
    error InvalidTokenIndices();
    error InvalidExitTriggers();

    event PositionSettingsSet(PositionKey key, PositionSettings settings);
    event ConnectionRegistrySet(address connectorRegistry);

    function getPositionSettings(
        PositionKey calldata key
    ) external view returns (PositionSettings memory);

    function setPositionSettings(
        PositionKey calldata key,
        PositionSettings calldata settings
    ) external;

    function validateExitFor(
        PositionKey memory key
    ) external;

    function validateHarvestFor(
        PositionKey memory key
    ) external;

    function validateCompoundFor(
        PositionKey memory key
    ) external;
}

File 12 of 28 : 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;
}

File 13 of 28 : FarmStrategyEvents.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

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

abstract contract FarmStrategyEvents {
    event SickleDeposited(
        Sickle indexed sickle,
        address indexed stakingContract,
        uint256 indexed poolIndex
    );

    event SickleHarvested(
        Sickle indexed sickle,
        address indexed stakingContract,
        uint256 indexed poolIndex
    );

    event SickleCompounded(
        Sickle indexed sickle,
        address indexed claimStakingContract,
        uint256 claimPoolIndex,
        address indexed depositStakingContract,
        uint256 depositPoolIndex
    );

    event SickleWithdrawn(
        Sickle indexed sickle,
        address indexed stakingContract,
        uint256 indexed poolIndex
    );

    event SickleExited(
        Sickle indexed sickle,
        address indexed stakingContract,
        uint256 indexed poolIndex
    );
}

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

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

File 16 of 28 : 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 17 of 28 : 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 18 of 28 : 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;
}

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

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

File 22 of 28 : 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 23 of 28 : 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 24 of 28 : 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
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 26 of 28 : 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;
            }
        }
    }
}

// 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"},{"components":[{"internalType":"contract ITransferLib","name":"transferLib","type":"address"},{"internalType":"contract ISwapLib","name":"swapLib","type":"address"},{"internalType":"contract IFeesLib","name":"feesLib","type":"address"},{"internalType":"contract IZapLib","name":"zapLib","type":"address"},{"internalType":"contract IPositionSettingsLib","name":"positionSettingsLib","type":"address"}],"internalType":"struct FarmStrategy.Libraries","name":"libraries","type":"tuple"},{"internalType":"contract IPositionSettingsRegistry","name":"_positionSettingsRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NotApproved","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"NotOwner","type":"error"},{"inputs":[],"name":"NotRegisteredSickle","type":"error"},{"inputs":[],"name":"SickleNotDeployed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"address","name":"claimStakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"claimPoolIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"depositStakingContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"depositPoolIndex","type":"uint256"}],"name":"SickleCompounded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleExited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleHarvested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Sickle","name":"sickle","type":"address"},{"indexed":true,"internalType":"address","name":"stakingContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"poolIndex","type":"uint256"}],"name":"SickleWithdrawn","type":"event"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"claimFarm","type":"tuple"},{"internalType":"bytes","name":"claimExtraData","type":"bytes"},{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"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":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"desiredAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmounts","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct AddLiquidityParams","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct ZapIn","name":"zap","type":"tuple"},{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"depositFarm","type":"tuple"},{"internalType":"bytes","name":"depositExtraData","type":"bytes"}],"internalType":"struct CompoundParams","name":"params","type":"tuple"},{"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":"claimFarm","type":"tuple"},{"internalType":"bytes","name":"claimExtraData","type":"bytes"},{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"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":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"desiredAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmounts","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct AddLiquidityParams","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct ZapIn","name":"zap","type":"tuple"},{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"depositFarm","type":"tuple"},{"internalType":"bytes","name":"depositExtraData","type":"bytes"}],"internalType":"struct CompoundParams","name":"params","type":"tuple"},{"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":"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":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"desiredAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmounts","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct AddLiquidityParams","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct ZapIn","name":"zap","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct DepositParams","name":"params","type":"tuple"},{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"router","type":"address"},{"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":"uint256","name":"baseTokenIndex","type":"uint256"},{"internalType":"uint256","name":"quoteTokenIndex","type":"uint256"},{"internalType":"uint256","name":"triggerPriceLow","type":"uint256"},{"internalType":"address","name":"exitTokenOutLow","type":"address"},{"internalType":"uint256","name":"triggerPriceHigh","type":"uint256"},{"internalType":"address","name":"exitTokenOutHigh","type":"address"},{"internalType":"uint256[]","name":"triggerReservesLow","type":"uint256[]"},{"internalType":"address[]","name":"triggerReservesTokensOut","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 PositionSettings","name":"positionSettings","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":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","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[]"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"address[]","name":"tokensOut","type":"address[]"}],"internalType":"struct HarvestParams","name":"harvestParams","type":"tuple"},{"internalType":"address[]","name":"harvestSweepTokens","type":"address[]"},{"components":[{"internalType":"bytes","name":"extraData","type":"bytes"},{"components":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256","name":"lpAmountIn","type":"uint256"},{"internalType":"uint256[]","name":"minAmountsOut","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct RemoveLiquidityParams","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 ZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"}],"internalType":"struct WithdrawParams","name":"withdrawParams","type":"tuple"},{"internalType":"address[]","name":"withdrawSweepTokens","type":"address[]"}],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","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[]"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"address[]","name":"tokensOut","type":"address[]"}],"internalType":"struct HarvestParams","name":"harvestParams","type":"tuple"},{"internalType":"address[]","name":"harvestSweepTokens","type":"address[]"},{"components":[{"internalType":"bytes","name":"extraData","type":"bytes"},{"components":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256","name":"lpAmountIn","type":"uint256"},{"internalType":"uint256[]","name":"minAmountsOut","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct RemoveLiquidityParams","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 ZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"}],"internalType":"struct WithdrawParams","name":"withdrawParams","type":"tuple"},{"internalType":"address[]","name":"withdrawSweepTokens","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":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","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[]"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"address[]","name":"tokensOut","type":"address[]"}],"internalType":"struct HarvestParams","name":"params","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Sickle","name":"sickle","type":"address"},{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","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[]"},{"internalType":"bytes","name":"extraData","type":"bytes"},{"internalType":"address[]","name":"tokensOut","type":"address[]"}],"internalType":"struct HarvestParams","name":"params","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"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":"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":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"desiredAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"minAmounts","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct AddLiquidityParams","name":"addLiquidityParams","type":"tuple"}],"internalType":"struct ZapIn","name":"zap","type":"tuple"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct DepositParams","name":"params","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"increase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"positionSettingsLib","outputs":[{"internalType":"contract IPositionSettingsLib","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionSettingsRegistry","outputs":[{"internalType":"contract IPositionSettingsRegistry","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":"address","name":"lpToken","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleDepositParams","name":"params","type":"tuple"},{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"router","type":"address"},{"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":"uint256","name":"baseTokenIndex","type":"uint256"},{"internalType":"uint256","name":"quoteTokenIndex","type":"uint256"},{"internalType":"uint256","name":"triggerPriceLow","type":"uint256"},{"internalType":"address","name":"exitTokenOutLow","type":"address"},{"internalType":"uint256","name":"triggerPriceHigh","type":"uint256"},{"internalType":"address","name":"exitTokenOutHigh","type":"address"},{"internalType":"uint256[]","name":"triggerReservesLow","type":"uint256[]"},{"internalType":"address[]","name":"triggerReservesTokensOut","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 PositionSettings","name":"positionSettings","type":"tuple"},{"internalType":"address","name":"approved","type":"address"},{"internalType":"bytes32","name":"referralCode","type":"bytes32"}],"name":"simpleDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleHarvestParams","name":"harvestParams","type":"tuple"},{"components":[{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleWithdrawParams","name":"withdrawParams","type":"tuple"}],"name":"simpleExit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"components":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleHarvestParams","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":"address","name":"lpToken","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleDepositParams","name":"params","type":"tuple"}],"name":"simpleIncrease","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"components":[{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct SimpleWithdrawParams","name":"params","type":"tuple"}],"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":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"components":[{"internalType":"bytes","name":"extraData","type":"bytes"},{"components":[{"components":[{"internalType":"address","name":"router","type":"address"},{"internalType":"address","name":"lpToken","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256","name":"lpAmountIn","type":"uint256"},{"internalType":"uint256[]","name":"minAmountsOut","type":"uint256[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct RemoveLiquidityParams","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 ZapOut","name":"zap","type":"tuple"},{"internalType":"address[]","name":"tokensOut","type":"address[]"}],"internalType":"struct WithdrawParams","name":"params","type":"tuple"},{"internalType":"address[]","name":"sweepTokens","type":"address[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zapLib","outputs":[{"internalType":"contract IZapLib","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101a06040523480156200001257600080fd5b50604051620042f8380380620042f88339810160408190526200003591620000b6565b6001600160a01b03938416608090815292841660a0526060820151841660c0526020820151841660e0528151841661010052604082015184166101205291015182166101405216610160523061018052620001b2565b6001600160a01b0381168114620000a157600080fd5b50565b8051620000b1816200008b565b919050565b600080600080848603610100811215620000cf57600080fd5b8551620000dc816200008b565b6020870151909550620000ef816200008b565b935060a0603f19820112156200010457600080fd5b5060405160a081016001600160401b03811182821017156200013657634e487b7160e01b600052604160045260246000fd5b80604052506200014960408701620000a4565b81526200015960608701620000a4565b60208201526200016c60808701620000a4565b60408201526200017f60a08701620000a4565b60608201526200019260c08701620000a4565b60808201529150620001a760e08601620000a4565b905092959194509250565b60805160a05160c05160e0516101005161012051610140516101605161018051613fcb6200032d600039600081816103f80152818161180001528181611c96015281816123550152818161269a01526128a20152600081816102aa015281816107060152818161098e015281816111cb0152611f9e01526000818161042c01528181611f1b0152611f6f0152600081816101bf015281816117b401528181612309015261264e0152600081816102560152818161150601528181611ab001528181611c1d015281816123e1015281816127430152818161283c0152612b430152600081816102220152612dec0152600081816104d40152818161188c0152818161225801526129210152600081816103c4015281816113d1015281816116820152818161194901528181611d110152818161210f0152818161251d015281816129d40152612cbb015260008181610460015281816105c70152818161086701528181610e2d01528181610ef801526110a40152613fcb6000f3fe6080604052600436106101665760003560e01c80636a7295f7116100d1578063c0df2c001161008a578063e0974da711610064578063e0974da7146104a2578063ee360f24146104c2578063ee972cea146104f6578063f61456f51461051657600080fd5b8063c0df2c001461041a578063c45a01551461044e578063d9fa226f1461048257600080fd5b80636a7295f71461033f5780636e6164101461035f578063759cb23414610372578063b3fb68d514610392578063b53c86d2146103b2578063bc6b74ab146103e657600080fd5b806341c801581161012357806341c80158146102785780634380e666146102985780634be3dde5146102cc5780636277c7d6146102ec57806369dbeadf1461030c5780636a6793ba1461031f57600080fd5b806302b570031461016b5780630de11c741461018d5780632af3fa1b146101ad5780633f56bfb5146101fd5780633faa6e30146102105780633fb53a0d14610244575b600080fd5b34801561017757600080fd5b5061018b610186366004612eba565b610536565b005b34801561019957600080fd5b5061018b6101a8366004612f8e565b6105a3565b3480156101b957600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b61018b61020b366004613018565b6107da565b34801561021c57600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b34801561025057600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b34801561028457600080fd5b5061018b610293366004613095565b610843565b3480156102a457600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d857600080fd5b5061018b6102e736600461316f565b610a88565b3480156102f857600080fd5b5061018b6103073660046131cd565b610b4b565b61018b61031a366004613223565b610bb8565b34801561032b57600080fd5b5061018b61033a36600461316f565b610c73565b34801561034b57600080fd5b5061018b61035a3660046132cd565b610d05565b61018b61036d366004613301565b610d5e565b34801561037e57600080fd5b506101e161038d366004613369565b610e09565b34801561039e57600080fd5b506101e16103ad36600461338d565b610ec7565b3480156103be57600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b3480156103f257600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b34801561042657600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b34801561045a57600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b34801561048e57600080fd5b5061018b61049d3660046133ce565b610f6f565b3480156104ae57600080fd5b5061018b6104bd366004613498565b611007565b3480156104ce57600080fd5b506101e17f000000000000000000000000000000000000000000000000000000000000000081565b34801561050257600080fd5b5061018b61051136600461350c565b611080565b34801561052257600080fd5b5061018b61053136600461359a565b6112bf565b600061054133610e09565b905061054e818484611374565b6020830180359061055f9085613369565b6001600160a01b0316826001600160a01b03167fe9c66e9e1d796f55a0a4ff881f3c8040b01b7ce5f10ef67228ee2d5d3fe61c2a60405160405180910390a4505050565b60405163429b62e560e01b81526001600160a01b03808616600483015285916000917f0000000000000000000000000000000000000000000000000000000000000000169063429b62e590602401602060405180830381865afa15801561060e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906135d2565b6001600160a01b03160361065957604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c591906135d2565b6001600160a01b0316146106ec5760405163c19f17a960e01b815260040160405180910390fd5b60408051606081019091526001600160a01b0386811682527f0000000000000000000000000000000000000000000000000000000000000000169063f1cf41829060208082019061073f90890189613369565b6001600160a01b031681526020888101359101526040516001600160e01b031960e084901b16815261077491906004016135ef565b600060405180830381600087803b15801561078e57600080fd5b505af11580156107a2573d6000803e3d6000fd5b505050506107d3858585857f6b277b6f647b7a0d8000e4fc1460639f589d3e1262b3f1a2f378cce0a5da40bb611623565b5050505050565b60006107e7338484610ec7565b90506107f38186611bca565b6107fe818686611ec8565b6020850180359061080f9087613369565b6001600160a01b0316826001600160a01b0316600080516020613f7683398151915260405160405180910390a45050505050565b60405163429b62e560e01b81526001600160a01b03808a16600483015289916000917f0000000000000000000000000000000000000000000000000000000000000000169063429b62e590602401602060405180830381865afa1580156108ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d291906135d2565b6001600160a01b0316036108f957604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610941573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096591906135d2565b6001600160a01b03161461098c5760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663459e268460405180606001604052808c6001600160a01b031681526020018b60000160208101906109e89190613369565b6001600160a01b031681526020018b602001358152506040518263ffffffff1660e01b8152600401610a1a91906135ef565b600060405180830381600087803b158015610a3457600080fd5b505af1158015610a48573d6000803e3d6000fd5b50505050610a7d89898989898989897f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612078565b505050505050505050565b6000610a9333610e09565b9050600080610aa5602087018761361e565b610ab390602081019061363e565b905011610ac1576000610ae3565b7fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b9050610af38287878787866120b0565b60208601803590610b049088613369565b6001600160a01b0316836001600160a01b03167fe9c66e9e1d796f55a0a4ff881f3c8040b01b7ce5f10ef67228ee2d5d3fe61c2a60405160405180910390a4505050505050565b6000610b5633610e09565b9050610b638184846124be565b60208301803590610b749085613369565b6001600160a01b0316826001600160a01b03167f37da49704c95bce31298d9d965163d5953283973279e35728e6666bd9abe1e7a60405160405180910390a4505050565b6000610bc5338484610ec7565b9050600080610bd760808a018a61361e565b610be1908061363e565b905011610bef576000610c11565b7fab273376f9efdd920b41b30b3f02b3dee877874951e3c14bf87bc60060efebcc5b9050610c2082898888856127e7565b610c2b828989611ec8565b60208801803590610c3c908a613369565b6001600160a01b0316836001600160a01b0316600080516020613f7683398151915260405160405180910390a45050505050505050565b6000610c7e33610e09565b9050610cae81868686867fe400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa3612c5c565b60208501803590610cbf9087613369565b6001600160a01b0316826001600160a01b03167f37da49704c95bce31298d9d965163d5953283973279e35728e6666bd9abe1e7a60405160405180910390a45050505050565b6000610d1033610e09565b9050610d1c8183611bca565b60208201803590610d2d9084613369565b6001600160a01b0316826001600160a01b0316600080516020613f7683398151915260405160405180910390a45050565b6000610d6933610e09565b9050600080610d7b608087018761361e565b610d85908061363e565b905011610d93576000610db5565b7fab273376f9efdd920b41b30b3f02b3dee877874951e3c14bf87bc60060efebcc5b9050610dc482868686856127e7565b60208501803590610dd59087613369565b6001600160a01b0316836001600160a01b0316600080516020613f7683398151915260405160405180910390a45050505050565b6040516312cfc9b560e31b81526001600160a01b03828116600483015260009182917f0000000000000000000000000000000000000000000000000000000000000000169063967e4da890602401602060405180830381865afa158015610e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9891906135d2565b90506001600160a01b038116610ec157604051633098a45560e01b815260040160405180910390fd5b92915050565b60405163de0d95ed60e01b81526001600160a01b0384811660048301528381166024830152604482018390526000917f00000000000000000000000000000000000000000000000000000000000000009091169063de0d95ed906064016020604051808303816000875af1158015610f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6791906135d2565b949350505050565b6000610f7a33610e09565b9050610fad81898989898989897fe400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa3612078565b60208801803590610fbe908a613369565b6001600160a01b0316826001600160a01b03167fb87a6e19b5097564ab5587b8f33a8c71a8521d60e54d580717be695d4f47535c60405160405180910390a45050505050505050565b600061101233610e09565b905061101f8185856124be565b61102a818584611374565b6020840180359061103b9086613369565b6001600160a01b0316826001600160a01b03167fb87a6e19b5097564ab5587b8f33a8c71a8521d60e54d580717be695d4f47535c60405160405180910390a450505050565b60405163429b62e560e01b81526001600160a01b03808716600483015286916000917f0000000000000000000000000000000000000000000000000000000000000000169063429b62e590602401602060405180830381865afa1580156110eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110f91906135d2565b6001600160a01b03160361113657604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa15801561117e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a291906135d2565b6001600160a01b0316146111c95760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663bca9ca736040518060600160405280896001600160a01b031681526020018860000160208101906112259190613369565b6001600160a01b0316815260200188602001358152506040518263ffffffff1660e01b815260040161125791906135ef565b600060405180830381600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506112b786868686867f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612c5c565b505050505050565b60006112ca33610e09565b90506112f9818585857f1d5b8de553017a3bd388578aeece0183b79c5ca87ec64628b3f76b39487f0231611623565b61130960c0850160a08601613369565b6001600160a01b031661131f6020860186613369565b60408051602080890135825260c0890135908201526001600160a01b03928316928516917f052db0f97f7329c6cb05c89ccab89a2ad3acd05ac8d5678a6c1d46c309afbad1910160405180910390a450505050565b6040805160028082526060820183526000926020830190803683375050604080516002808252606082019092529293506000929150602082015b60608152602001906001900390816113ae57905050905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae6114036020880188613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146b91906135d2565b9050808360008151811061148157611481613687565b6001600160a01b0390921660209283029190910182015285908501356114aa604087018761369d565b6040516024016114bd949392919061372d565b60408051601f198184030181529190526020810180516001600160e01b0316620dc4f960e91b179052825183906000906114f9576114f9613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008360018151811061153857611538613687565b6001600160a01b0390921660209283029190910182015261155b90850185613369565b6040516001600160a01b03909116602482015260440160408051601f198184030181529190526020810180516001600160e01b0316630dba98cb60e11b1790528251839060019081106115b0576115b0613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038716906363fb0b96906115e9908690869060040161375e565b600060405180830381600087803b15801561160357600080fd5b505af1158015611617573d6000803e3d6000fd5b50505050505050505050565b60408051600580825260c082019092526000916020820160a080368337505060408051600580825260c082019092529293506000929150602082015b606081526020019060019003908161165f57905050905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae6116b460208a018a613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c91906135d2565b9050808360008151811061173257611732613687565b6001600160a01b039092166020928302919091019091015286611758604082018261369d565b60405160240161176a9392919061382e565b60408051601f198184030181529190526020810180516001600160e01b0316638bddf18760e01b179052825183906000906117a7576117a7613687565b60200260200101819052507f0000000000000000000000000000000000000000000000000000000000000000836001815181106117e6576117e6613687565b6001600160a01b03909216602092830291909101909101527f00000000000000000000000000000000000000000000000000000000000000008461182d60608a018a61363e565b60405160240161184094939291906138a1565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b17905282518390600190811061187f5761187f613687565b60200260200101819052507f0000000000000000000000000000000000000000000000000000000000000000836002815181106118be576118be613687565b6001600160a01b03909216602092830291909101909101526118e3608088018861361e565b6040516024016118f39190613ac3565b60408051601f198184030181529190526020810180516001600160e01b0316635bdcfb0d60e01b17905282518390600290811061193257611932613687565b602090810291909101015260006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae61197e60c08b0160a08c01613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e691906135d2565b905080846003815181106119fc576119fc613687565b6001600160a01b039092166020928302919091019091015260a08801611a2560808a018a61361e565b611a33906020810190613bcb565b611a44906040810190602001613369565b611a5160e08b018b61369d565b604051602401611a649493929190613be1565b60408051601f198184030181529190526020810180516001600160e01b0316636ec4f1e960e11b179052835184906003908110611aa357611aa3613687565b60200260200101819052507f000000000000000000000000000000000000000000000000000000000000000084600481518110611ae257611ae2613687565b60200260200101906001600160a01b031690816001600160a01b0316815250508686604051602401611b15929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b179052835184906004908110611b5457611b54613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038a16906363fb0b9690611b8d908790879060040161375e565b600060405180830381600087803b158015611ba757600080fd5b505af1158015611bbb573d6000803e3d6000fd5b50505050505050505050505050565b6040805160028082526060820183526000926020830190803683375050604080516002808252606082019092529293506000929150602082015b6060815260200190600190039081611c045790505090507f000000000000000000000000000000000000000000000000000000000000000082600081518110611c4f57611c4f613687565b6001600160a01b0390921660209283029190910190910152611c776060840160408501613369565b6040516001600160a01b039182166024820152606085013560448201527f000000000000000000000000000000000000000000000000000000000000000090911660648201526000608482015260a40160408051601f198184030181529190526020810180516001600160e01b031663054eeefb60e21b17905281518290600090611d0457611d04613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c79aeaae846000016000016020810190611d549190613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbc91906135d2565b82600181518110611dcf57611dcf613687565b6001600160a01b039092166020928302919091019091015282611df86060820160408301613369565b611e05608086018661369d565b604051602401611e189493929190613be1565b60408051601f198184030181529190526020810180516001600160e01b0316636ec4f1e960e11b179052815182906001908110611e5757611e57613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038516906363fb0b9690611e90908590859060040161375e565b600060405180830381600087803b158015611eaa57600080fd5b505af1158015611ebe573d6000803e3d6000fd5b5050505050505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081611f025790505090507f000000000000000000000000000000000000000000000000000000000000000082600081518110611f4d57611f4d613687565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663028bba217f00000000000000000000000000000000000000000000000000000000000000008686604051602401611fd193929190613d45565b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050508160008151811061201157612011613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038616906363fb0b969061204a908590859060040161375e565b600060405180830381600087803b15801561206457600080fd5b505af1158015610a7d573d6000803e3d6000fd5b612086898989898986612c5c565b610a7d89898686867fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b60408051600480825260a0820190925260009160208201608080368337505060408051600480825260a082019092529293506000929150602082015b60608152602001906001900390816120ec57905050905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae61214160208b018b613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121a991906135d2565b905080836000815181106121bf576121bf613687565b6001600160a01b0390921660209283029190910182015288906121e49089018961361e565b6121ee9080613bcb565b606001356121fc898061369d565b60405160240161220f949392919061372d565b60408051601f198184030181529190526020810180516001600160e01b0316620dc4f960e91b1790528251839060009061224b5761224b613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008360018151811061228a5761228a613687565b6001600160a01b039092166020928302919091018201526122ad9088018861361e565b6040516024016122bd9190613e1d565b60408051601f198184030181529190526020810180516001600160e01b031663f3defcd560e01b1790528251839060019081106122fc576122fc613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008360028151811061233b5761233b613687565b6001600160a01b03909216602092830291909101909101527f00000000000000000000000000000000000000000000000000000000000000008461238260408a018a61363e565b60405160240161239594939291906138a1565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b1790528251839060029081106123d4576123d4613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008360038151811061241357612413613687565b60200260200101906001600160a01b031690816001600160a01b0316815250508585604051602401612446929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b17905282518390600390811061248557612485613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038a16906363fb0b9690611b8d908690869060040161375e565b60408051600380825260808201909252600091602082016060803683375050604080516003808252608082019092529293506000929150602082015b60608152602001906001900390816124fa57905050905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae61254f6020880188613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b791906135d2565b905080836000815181106125cd576125cd613687565b6001600160a01b0390921660209283029190910182015285906125f29086018661369d565b6040516024016126049392919061382e565b60408051601f198184030181529190526020810180516001600160e01b0316638bddf18760e01b1790528251839060009061264157612641613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008360018151811061268057612680613687565b6001600160a01b03909216602092830291909101909101527f00000000000000000000000000000000000000000000000000000000000000007fe400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa36126e4868061363e565b6040516024016126f794939291906138a1565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b17905282518390600190811061273657612736613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008360028151811061277557612775613687565b6001600160a01b0390921660209283029190910190910152612797848061363e565b6040516024016127a8929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b1790528251839060029081106115b0576115b0613687565b60408051600480825260a0820190925260009160208201608080368337505060408051600480825260a082019092529293506000929150602082015b60608152602001906001900390816128235790505090507f00000000000000000000000000000000000000000000000000000000000000008260008151811061286e5761286e613687565b6001600160a01b0390921660209283029190910190910152612893604087018761363e565b6128a0606089018961363e565b7f0000000000000000000000000000000000000000000000000000000000000000876040516024016128d796959493929190613f0c565b60408051601f198184030181529190526020810180516001600160e01b03166312f5760360e01b1790528151829060009061291457612914613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000008260018151811061295357612953613687565b6001600160a01b0390921660209283029190910190910152612978608087018761361e565b6040516024016129889190613ac3565b60408051601f198184030181529190526020810180516001600160e01b0316635bdcfb0d60e01b1790528151829060019081106129c7576129c7613687565b60200260200101819052507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c79aeaae876000016000016020810190612a179190613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7f91906135d2565b82600281518110612a9257612a92613687565b6001600160a01b039092166020928302919091019091015285612ab8608082018261361e565b612ac6906020810190613bcb565b612ad7906040810190602001613369565b612ae460a089018961369d565b604051602401612af79493929190613be1565b60408051601f198184030181529190526020810180516001600160e01b0316636ec4f1e960e11b179052815182906002908110612b3657612b36613687565b60200260200101819052507f000000000000000000000000000000000000000000000000000000000000000082600381518110612b7557612b75613687565b60200260200101906001600160a01b031690816001600160a01b0316815250508484604051602401612ba8929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b179052815182906003908110612be757612be7613687565b6020026020010181905250866001600160a01b03166363fb0b963484846040518463ffffffff1660e01b8152600401612c2192919061375e565b6000604051808303818588803b158015612c3a57600080fd5b505af1158015612c4e573d6000803e3d6000fd5b505050505050505050505050565b60408051600480825260a0820190925260009160208201608080368337505060408051600480825260a082019092529293506000929150602082015b6060815260200190600190039081612c9857905050905060006001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663c79aeaae612ced60208b018b613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d5591906135d2565b90508083600081518110612d6b57612d6b613687565b6001600160a01b039092166020928302919091018201528890612d909089018961369d565b604051602401612da29392919061382e565b60408051601f198184030181529190526020810180516001600160e01b0316638bddf18760e01b17905282518390600090612ddf57612ddf613687565b60200260200101819052507f000000000000000000000000000000000000000000000000000000000000000083600181518110612e1e57612e1e613687565b6001600160a01b0390921660209283029190910190910152612e40878061363e565b604051602401612e51929190613f61565b60408051601f198184030181529190526020810180516001600160e01b03166321e9d05b60e01b1790528251839060019081106122fc576122fc613687565b600060408284031215612ea257600080fd5b50919050565b600060608284031215612ea257600080fd5b60008060608385031215612ecd57600080fd5b612ed78484612e90565b915060408301356001600160401b03811115612ef257600080fd5b612efe85828601612ea8565b9150509250929050565b6001600160a01b0381168114612f1d57600080fd5b50565b8035612f2b81612f08565b919050565b60006101008284031215612ea257600080fd5b60008083601f840112612f5557600080fd5b5081356001600160401b03811115612f6c57600080fd5b6020830191508360208260051b8501011115612f8757600080fd5b9250929050565b60008060008060608587031215612fa457600080fd5b8435612faf81612f08565b935060208501356001600160401b0380821115612fcb57600080fd5b612fd788838901612f30565b94506040870135915080821115612fed57600080fd5b50612ffa87828801612f43565b95989497509550505050565b600060a08284031215612ea257600080fd5b6000806000806080858703121561302e57600080fd5b84356001600160401b038082111561304557600080fd5b61305188838901613006565b9550602087013591508082111561306757600080fd5b5061307487828801612f30565b935050604085013561308581612f08565b9396929550929360600135925050565b60008060008060008060008060e0898b0312156130b157600080fd5b6130ba89612f20565b97506130c98a60208b01612e90565b965060608901356001600160401b03808211156130e557600080fd5b6130f18c838d01612ea8565b975060808b013591508082111561310757600080fd5b6131138c838d01612f43565b909750955060a08b013591508082111561312c57600080fd5b6131388c838d01612ea8565b945060c08b013591508082111561314e57600080fd5b5061315b8b828c01612f43565b999c989b5096995094979396929594505050565b6000806000806080858703121561318557600080fd5b61318f8686612e90565b935060408501356001600160401b03808211156131ab57600080fd5b6131b788838901612ea8565b94506060870135915080821115612fed57600080fd5b600080606083850312156131e057600080fd5b6131ea8484612e90565b915060408301356001600160401b0381111561320557600080fd5b612efe85828601612e90565b600060c08284031215612ea257600080fd5b60008060008060008060a0878903121561323c57600080fd5b86356001600160401b038082111561325357600080fd5b61325f8a838b01613211565b9750602089013591508082111561327557600080fd5b6132818a838b01612f30565b9650604089013591508082111561329757600080fd5b506132a489828a01612f43565b90955093505060608701356132b881612f08565b80925050608087013590509295509295509295565b6000602082840312156132df57600080fd5b81356001600160401b038111156132f557600080fd5b610f6784828501613006565b60008060006040848603121561331657600080fd5b83356001600160401b038082111561332d57600080fd5b61333987838801613211565b9450602086013591508082111561334f57600080fd5b5061335c86828701612f43565b9497909650939450505050565b60006020828403121561337b57600080fd5b813561338681612f08565b9392505050565b6000806000606084860312156133a257600080fd5b83356133ad81612f08565b925060208401356133bd81612f08565b929592945050506040919091013590565b600080600080600080600060c0888a0312156133e957600080fd5b6133f38989612e90565b965060408801356001600160401b038082111561340f57600080fd5b61341b8b838c01612ea8565b975060608a013591508082111561343157600080fd5b61343d8b838c01612f43565b909750955060808a013591508082111561345657600080fd5b6134628b838c01612ea8565b945060a08a013591508082111561347857600080fd5b506134858a828b01612f43565b989b979a50959850939692959293505050565b6000806000608084860312156134ad57600080fd5b6134b78585612e90565b925060408401356001600160401b03808211156134d357600080fd5b6134df87838801612e90565b935060608601359150808211156134f557600080fd5b5061350286828701612ea8565b9150509250925092565b600080600080600060a0868803121561352457600080fd5b853561352f81612f08565b945061353e8760208801612e90565b935060608601356001600160401b038082111561355a57600080fd5b61356689838a01612ea8565b9450608088013591508082111561357c57600080fd5b5061358988828901612f43565b969995985093965092949392505050565b6000806000604084860312156135af57600080fd5b83356001600160401b03808211156135c657600080fd5b61333987838801612f30565b6000602082840312156135e457600080fd5b815161338681612f08565b81516001600160a01b039081168252602080840151909116908201526040918201519181019190915260600190565b60008235603e1983360301811261363457600080fd5b9190910192915050565b6000808335601e1984360301811261365557600080fd5b8301803591506001600160401b0382111561366f57600080fd5b6020019150600581901b3603821315612f8757600080fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126136b457600080fd5b8301803591506001600160401b038211156136ce57600080fd5b602001915036819003821315612f8757600080fd5b80356136ee81612f08565b6001600160a01b03168252602090810135910152565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61373781866136e3565b836040820152608060608201526000613754608083018486613704565b9695505050505050565b604080825283519082018190526000906020906060840190828701845b828110156137a05781516001600160a01b03168452928401929084019060010161377b565b50505083810382850152845180825282820190600581901b8301840187850160005b8381101561381f57601f19808785030186528251805180865260005b818110156137f9578281018b01518782018c01528a016137de565b5060008682018b015296890196601f0190911690930187019250908601906001016137c2565b50909998505050505050505050565b61383881856136e3565b60606040820152600061384f606083018486613704565b95945050505050565b8183526000602080850194508260005b8581101561389657813561387b81612f08565b6001600160a01b031687529582019590820190600101613868565b509495945050505050565b6001600160a01b03851681526001600160e01b0319841660208201526060604082018190526000906137549083018486613858565b6000808335601e198436030181126138ed57600080fd5b83016020810192503590506001600160401b0381111561390c57600080fd5b8060051b3603821315612f8757600080fd5b6000808335601e1984360301811261393557600080fd5b83016020810192503590506001600160401b0381111561395457600080fd5b803603821315612f8757600080fd5b6000823560fe1983360301811261397957600080fd5b90910192915050565b81835260006020808501808196508560051b810191508460005b87811015613a6e5782840389526139b38288613963565b61010081356139c181612f08565b6001600160a01b031686526139d7828801612f20565b6001600160a01b03168787015260408281013590870152606080830135908701526080808301359087015260a0613a0f818401612f20565b6001600160a01b03169087015260c0613a29838201612f20565b6001600160a01b03169087015260e0613a448382018461391e565b93508282890152613a588389018583613704565b9c89019c9750505092860192505060010161399c565b5091979650505050505050565b6000823560be1983360301811261397957600080fd5b81835260006001600160fb1b03831115613aaa57600080fd5b8260051b80836020870137939093016020019392505050565b602081526000613ad383846138d6565b60406020850152613ae8606085018284613982565b915050613af86020850185613a7b565b838203601f190160408501528035613b0f81612f08565b6001600160a01b039081168352602082013590613b2b82612f08565b166020830152613b3e60408201826138d6565b60c06040850152613b5360c085018284613858565b915050613b6360608301836138d6565b8483036060860152613b76838284613a91565b92505050613b8760808301836138d6565b8483036080860152613b9a838284613a91565b92505050613bab60a083018361391e565b925083820360a0850152613bc0828483613704565b979650505050505050565b6000823560be1983360301811261363457600080fd5b613beb81866136e3565b6001600160a01b03841660408201526080606082018190526000906137549083018486613704565b602081526000610f67602083018486613858565b80358015158114612f2b57600080fd5b803560038110613c4657600080fd5b82526020810135613c5681612f08565b6001600160a01b03166020929092019190915250565b6000823561013e1983360301811261397957600080fd5b6000610140823584526020830135602085015260408301356040850152613cac60608401612f20565b6001600160a01b0316606085015260808381013590850152613cd060a08401612f20565b6001600160a01b031660a0850152613ceb60c08401846138d6565b8260c0870152613cfe8387018284613a91565b92505050613d0f60e08401846138d6565b85830360e0870152613d22838284613858565b610100868101359088015261012095860135959096019490945250929392505050565b6001600160a01b038481168252600090613d6260208401866136e3565b608060608401528335613d7481612f08565b811660808401526020840135613d8981612f08565b1660a0830152613d9b60408401613c27565b151560c0830152613db260e0830160608501613c37565b613dbe60a08401613c27565b1515610120830152613dd360c0840184613c6c565b610100610140840152613dea610180840182613c83565b9050613df960e085018561391e565b848303607f1901610160860152613e11838284613704565b98975050505050505050565b602081526000613e2d8384613a7b565b604060208401528035613e3f81612f08565b6001600160a01b039081166060850152602082013590613e5e82612f08565b166080840152613e7160408201826138d6565b60c060a0860152613e8761012086018284613858565b915050606082013560c0850152613ea160808301836138d6565b605f19808785030160e0880152613eb9848385613a91565b9350613ec860a086018661391e565b9550925080878503016101008801525050613ee4828483613704565b92505050613ef560208501856138d6565b848303601f19016040860152613754838284613982565b608081526000613f2060808301888a613858565b8281036020840152613f33818789613a91565b6001600160a01b0395909516604084015250506001600160e01b031991909116606090910152949350505050565b602081526000610f6760208301848661398256fe5b8dc100c818a2d82ad26ea9a99b72b4d5c96a4067ed40cb71a16acda082b97aa2646970667358221220e8132e4a6c224b28178dd4dc854d4643585100b18d0ed79254bee1189640ec8364736f6c63430008130033000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c990000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d00000000000000000000000034f895a2b90e60721a046a7cbf330ca74070968c00000000000000000000000004448ed523730142b1eaf647123d9029e8da74fa00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d17698

Deployed Bytecode

0x6080604052600436106101665760003560e01c80636a7295f7116100d1578063c0df2c001161008a578063e0974da711610064578063e0974da7146104a2578063ee360f24146104c2578063ee972cea146104f6578063f61456f51461051657600080fd5b8063c0df2c001461041a578063c45a01551461044e578063d9fa226f1461048257600080fd5b80636a7295f71461033f5780636e6164101461035f578063759cb23414610372578063b3fb68d514610392578063b53c86d2146103b2578063bc6b74ab146103e657600080fd5b806341c801581161012357806341c80158146102785780634380e666146102985780634be3dde5146102cc5780636277c7d6146102ec57806369dbeadf1461030c5780636a6793ba1461031f57600080fd5b806302b570031461016b5780630de11c741461018d5780632af3fa1b146101ad5780633f56bfb5146101fd5780633faa6e30146102105780633fb53a0d14610244575b600080fd5b34801561017757600080fd5b5061018b610186366004612eba565b610536565b005b34801561019957600080fd5b5061018b6101a8366004612f8e565b6105a3565b3480156101b957600080fd5b506101e17f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d81565b6040516001600160a01b03909116815260200160405180910390f35b61018b61020b366004613018565b6107da565b34801561021c57600080fd5b506101e17f00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b81565b34801561025057600080fd5b506101e17f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b81565b34801561028457600080fd5b5061018b610293366004613095565b610843565b3480156102a457600080fd5b506101e17f00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d1769881565b3480156102d857600080fd5b5061018b6102e736600461316f565b610a88565b3480156102f857600080fd5b5061018b6103073660046131cd565b610b4b565b61018b61031a366004613223565b610bb8565b34801561032b57600080fd5b5061018b61033a36600461316f565b610c73565b34801561034b57600080fd5b5061018b61035a3660046132cd565b610d05565b61018b61036d366004613301565b610d5e565b34801561037e57600080fd5b506101e161038d366004613369565b610e09565b34801561039e57600080fd5b506101e16103ad36600461338d565b610ec7565b3480156103be57600080fd5b506101e17f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c9981565b3480156103f257600080fd5b506101e17f000000000000000000000000b4c31b0f0b76b351395d4acc94a54dd4e6fba1e881565b34801561042657600080fd5b506101e17f00000000000000000000000004448ed523730142b1eaf647123d9029e8da74fa81565b34801561045a57600080fd5b506101e17f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d56716881565b34801561048e57600080fd5b5061018b61049d3660046133ce565b610f6f565b3480156104ae57600080fd5b5061018b6104bd366004613498565b611007565b3480156104ce57600080fd5b506101e17f00000000000000000000000034f895a2b90e60721a046a7cbf330ca74070968c81565b34801561050257600080fd5b5061018b61051136600461350c565b611080565b34801561052257600080fd5b5061018b61053136600461359a565b6112bf565b600061054133610e09565b905061054e818484611374565b6020830180359061055f9085613369565b6001600160a01b0316826001600160a01b03167fe9c66e9e1d796f55a0a4ff881f3c8040b01b7ce5f10ef67228ee2d5d3fe61c2a60405160405180910390a4505050565b60405163429b62e560e01b81526001600160a01b03808616600483015285916000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063429b62e590602401602060405180830381865afa15801561060e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063291906135d2565b6001600160a01b03160361065957604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c591906135d2565b6001600160a01b0316146106ec5760405163c19f17a960e01b815260040160405180910390fd5b60408051606081019091526001600160a01b0386811682527f00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d17698169063f1cf41829060208082019061073f90890189613369565b6001600160a01b031681526020888101359101526040516001600160e01b031960e084901b16815261077491906004016135ef565b600060405180830381600087803b15801561078e57600080fd5b505af11580156107a2573d6000803e3d6000fd5b505050506107d3858585857f6b277b6f647b7a0d8000e4fc1460639f589d3e1262b3f1a2f378cce0a5da40bb611623565b5050505050565b60006107e7338484610ec7565b90506107f38186611bca565b6107fe818686611ec8565b6020850180359061080f9087613369565b6001600160a01b0316826001600160a01b0316600080516020613f7683398151915260405160405180910390a45050505050565b60405163429b62e560e01b81526001600160a01b03808a16600483015289916000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063429b62e590602401602060405180830381865afa1580156108ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d291906135d2565b6001600160a01b0316036108f957604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610941573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096591906135d2565b6001600160a01b03161461098c5760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d176986001600160a01b031663459e268460405180606001604052808c6001600160a01b031681526020018b60000160208101906109e89190613369565b6001600160a01b031681526020018b602001358152506040518263ffffffff1660e01b8152600401610a1a91906135ef565b600060405180830381600087803b158015610a3457600080fd5b505af1158015610a48573d6000803e3d6000fd5b50505050610a7d89898989898989897f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612078565b505050505050505050565b6000610a9333610e09565b9050600080610aa5602087018761361e565b610ab390602081019061363e565b905011610ac1576000610ae3565b7fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b9050610af38287878787866120b0565b60208601803590610b049088613369565b6001600160a01b0316836001600160a01b03167fe9c66e9e1d796f55a0a4ff881f3c8040b01b7ce5f10ef67228ee2d5d3fe61c2a60405160405180910390a4505050505050565b6000610b5633610e09565b9050610b638184846124be565b60208301803590610b749085613369565b6001600160a01b0316826001600160a01b03167f37da49704c95bce31298d9d965163d5953283973279e35728e6666bd9abe1e7a60405160405180910390a4505050565b6000610bc5338484610ec7565b9050600080610bd760808a018a61361e565b610be1908061363e565b905011610bef576000610c11565b7fab273376f9efdd920b41b30b3f02b3dee877874951e3c14bf87bc60060efebcc5b9050610c2082898888856127e7565b610c2b828989611ec8565b60208801803590610c3c908a613369565b6001600160a01b0316836001600160a01b0316600080516020613f7683398151915260405160405180910390a45050505050505050565b6000610c7e33610e09565b9050610cae81868686867fe400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa3612c5c565b60208501803590610cbf9087613369565b6001600160a01b0316826001600160a01b03167f37da49704c95bce31298d9d965163d5953283973279e35728e6666bd9abe1e7a60405160405180910390a45050505050565b6000610d1033610e09565b9050610d1c8183611bca565b60208201803590610d2d9084613369565b6001600160a01b0316826001600160a01b0316600080516020613f7683398151915260405160405180910390a45050565b6000610d6933610e09565b9050600080610d7b608087018761361e565b610d85908061363e565b905011610d93576000610db5565b7fab273376f9efdd920b41b30b3f02b3dee877874951e3c14bf87bc60060efebcc5b9050610dc482868686856127e7565b60208501803590610dd59087613369565b6001600160a01b0316836001600160a01b0316600080516020613f7683398151915260405160405180910390a45050505050565b6040516312cfc9b560e31b81526001600160a01b03828116600483015260009182917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063967e4da890602401602060405180830381865afa158015610e74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9891906135d2565b90506001600160a01b038116610ec157604051633098a45560e01b815260040160405180910390fd5b92915050565b60405163de0d95ed60e01b81526001600160a01b0384811660048301528381166024830152604482018390526000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d5671689091169063de0d95ed906064016020604051808303816000875af1158015610f43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6791906135d2565b949350505050565b6000610f7a33610e09565b9050610fad81898989898989897fe400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa3612078565b60208801803590610fbe908a613369565b6001600160a01b0316826001600160a01b03167fb87a6e19b5097564ab5587b8f33a8c71a8521d60e54d580717be695d4f47535c60405160405180910390a45050505050505050565b600061101233610e09565b905061101f8185856124be565b61102a818584611374565b6020840180359061103b9086613369565b6001600160a01b0316826001600160a01b03167fb87a6e19b5097564ab5587b8f33a8c71a8521d60e54d580717be695d4f47535c60405160405180910390a450505050565b60405163429b62e560e01b81526001600160a01b03808716600483015286916000917f000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168169063429b62e590602401602060405180830381865afa1580156110eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110f91906135d2565b6001600160a01b03160361113657604051633098a45560e01b815260040160405180910390fd5b336001600160a01b0316816001600160a01b03166319d40b086040518163ffffffff1660e01b8152600401602060405180830381865afa15801561117e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a291906135d2565b6001600160a01b0316146111c95760405163c19f17a960e01b815260040160405180910390fd5b7f00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d176986001600160a01b031663bca9ca736040518060600160405280896001600160a01b031681526020018860000160208101906112259190613369565b6001600160a01b0316815260200188602001358152506040518263ffffffff1660e01b815260040161125791906135ef565b600060405180830381600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506112b786868686867f139f6e665188bd3327a590d2d1c9d8d09b55289c07e19fef103ceab100ea0979612c5c565b505050505050565b60006112ca33610e09565b90506112f9818585857f1d5b8de553017a3bd388578aeece0183b79c5ca87ec64628b3f76b39487f0231611623565b61130960c0850160a08601613369565b6001600160a01b031661131f6020860186613369565b60408051602080890135825260c0890135908201526001600160a01b03928316928516917f052db0f97f7329c6cb05c89ccab89a2ad3acd05ac8d5678a6c1d46c309afbad1910160405180910390a450505050565b6040805160028082526060820183526000926020830190803683375050604080516002808252606082019092529293506000929150602082015b60608152602001906001900390816113ae57905050905060006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae6114036020880188613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146b91906135d2565b9050808360008151811061148157611481613687565b6001600160a01b0390921660209283029190910182015285908501356114aa604087018761369d565b6040516024016114bd949392919061372d565b60408051601f198184030181529190526020810180516001600160e01b0316620dc4f960e91b179052825183906000906114f9576114f9613687565b60200260200101819052507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b8360018151811061153857611538613687565b6001600160a01b0390921660209283029190910182015261155b90850185613369565b6040516001600160a01b03909116602482015260440160408051601f198184030181529190526020810180516001600160e01b0316630dba98cb60e11b1790528251839060019081106115b0576115b0613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038716906363fb0b96906115e9908690869060040161375e565b600060405180830381600087803b15801561160357600080fd5b505af1158015611617573d6000803e3d6000fd5b50505050505050505050565b60408051600580825260c082019092526000916020820160a080368337505060408051600580825260c082019092529293506000929150602082015b606081526020019060019003908161165f57905050905060006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae6116b460208a018a613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156116f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171c91906135d2565b9050808360008151811061173257611732613687565b6001600160a01b039092166020928302919091019091015286611758604082018261369d565b60405160240161176a9392919061382e565b60408051601f198184030181529190526020810180516001600160e01b0316638bddf18760e01b179052825183906000906117a7576117a7613687565b60200260200101819052507f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d836001815181106117e6576117e6613687565b6001600160a01b03909216602092830291909101909101527f000000000000000000000000b4c31b0f0b76b351395d4acc94a54dd4e6fba1e88461182d60608a018a61363e565b60405160240161184094939291906138a1565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b17905282518390600190811061187f5761187f613687565b60200260200101819052507f00000000000000000000000034f895a2b90e60721a046a7cbf330ca74070968c836002815181106118be576118be613687565b6001600160a01b03909216602092830291909101909101526118e3608088018861361e565b6040516024016118f39190613ac3565b60408051601f198184030181529190526020810180516001600160e01b0316635bdcfb0d60e01b17905282518390600290811061193257611932613687565b602090810291909101015260006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae61197e60c08b0160a08c01613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e691906135d2565b905080846003815181106119fc576119fc613687565b6001600160a01b039092166020928302919091019091015260a08801611a2560808a018a61361e565b611a33906020810190613bcb565b611a44906040810190602001613369565b611a5160e08b018b61369d565b604051602401611a649493929190613be1565b60408051601f198184030181529190526020810180516001600160e01b0316636ec4f1e960e11b179052835184906003908110611aa357611aa3613687565b60200260200101819052507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b84600481518110611ae257611ae2613687565b60200260200101906001600160a01b031690816001600160a01b0316815250508686604051602401611b15929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b179052835184906004908110611b5457611b54613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038a16906363fb0b9690611b8d908790879060040161375e565b600060405180830381600087803b158015611ba757600080fd5b505af1158015611bbb573d6000803e3d6000fd5b50505050505050505050505050565b6040805160028082526060820183526000926020830190803683375050604080516002808252606082019092529293506000929150602082015b6060815260200190600190039081611c045790505090507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b82600081518110611c4f57611c4f613687565b6001600160a01b0390921660209283029190910190910152611c776060840160408501613369565b6040516001600160a01b039182166024820152606085013560448201527f000000000000000000000000b4c31b0f0b76b351395d4acc94a54dd4e6fba1e890911660648201526000608482015260a40160408051601f198184030181529190526020810180516001600160e01b031663054eeefb60e21b17905281518290600090611d0457611d04613687565b60200260200101819052507f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c996001600160a01b031663c79aeaae846000016000016020810190611d549190613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbc91906135d2565b82600181518110611dcf57611dcf613687565b6001600160a01b039092166020928302919091019091015282611df86060820160408301613369565b611e05608086018661369d565b604051602401611e189493929190613be1565b60408051601f198184030181529190526020810180516001600160e01b0316636ec4f1e960e11b179052815182906001908110611e5757611e57613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038516906363fb0b9690611e90908590859060040161375e565b600060405180830381600087803b158015611eaa57600080fd5b505af1158015611ebe573d6000803e3d6000fd5b5050505050505050565b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081611f025790505090507f00000000000000000000000004448ed523730142b1eaf647123d9029e8da74fa82600081518110611f4d57611f4d613687565b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000004448ed523730142b1eaf647123d9029e8da74fa6001600160a01b031663028bba217f00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d176988686604051602401611fd193929190613d45565b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050508160008151811061201157612011613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038616906363fb0b969061204a908590859060040161375e565b600060405180830381600087803b15801561206457600080fd5b505af1158015610a7d573d6000803e3d6000fd5b612086898989898986612c5c565b610a7d89898686867fdfa64d371f38074894860654f13f7558a46a9b052e65fd158280c8dd2f07af645b60408051600480825260a0820190925260009160208201608080368337505060408051600480825260a082019092529293506000929150602082015b60608152602001906001900390816120ec57905050905060006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae61214160208b018b613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121a991906135d2565b905080836000815181106121bf576121bf613687565b6001600160a01b0390921660209283029190910182015288906121e49089018961361e565b6121ee9080613bcb565b606001356121fc898061369d565b60405160240161220f949392919061372d565b60408051601f198184030181529190526020810180516001600160e01b0316620dc4f960e91b1790528251839060009061224b5761224b613687565b60200260200101819052507f00000000000000000000000034f895a2b90e60721a046a7cbf330ca74070968c8360018151811061228a5761228a613687565b6001600160a01b039092166020928302919091018201526122ad9088018861361e565b6040516024016122bd9190613e1d565b60408051601f198184030181529190526020810180516001600160e01b031663f3defcd560e01b1790528251839060019081106122fc576122fc613687565b60200260200101819052507f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d8360028151811061233b5761233b613687565b6001600160a01b03909216602092830291909101909101527f000000000000000000000000b4c31b0f0b76b351395d4acc94a54dd4e6fba1e88461238260408a018a61363e565b60405160240161239594939291906138a1565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b1790528251839060029081106123d4576123d4613687565b60200260200101819052507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b8360038151811061241357612413613687565b60200260200101906001600160a01b031690816001600160a01b0316815250508585604051602401612446929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b17905282518390600390811061248557612485613687565b60209081029190910101526040516331fd85cb60e11b81526001600160a01b038a16906363fb0b9690611b8d908690869060040161375e565b60408051600380825260808201909252600091602082016060803683375050604080516003808252608082019092529293506000929150602082015b60608152602001906001900390816124fa57905050905060006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae61254f6020880188613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b791906135d2565b905080836000815181106125cd576125cd613687565b6001600160a01b0390921660209283029190910182015285906125f29086018661369d565b6040516024016126049392919061382e565b60408051601f198184030181529190526020810180516001600160e01b0316638bddf18760e01b1790528251839060009061264157612641613687565b60200260200101819052507f00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d8360018151811061268057612680613687565b6001600160a01b03909216602092830291909101909101527f000000000000000000000000b4c31b0f0b76b351395d4acc94a54dd4e6fba1e87fe400534da780c9d64ef8b5f03c074ff47537b6a4aa2a3e5d5455cb37b5406aa36126e4868061363e565b6040516024016126f794939291906138a1565b60408051601f198184030181529190526020810180516001600160e01b031663dcc3284160e01b17905282518390600190811061273657612736613687565b60200260200101819052507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b8360028151811061277557612775613687565b6001600160a01b0390921660209283029190910190910152612797848061363e565b6040516024016127a8929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b1790528251839060029081106115b0576115b0613687565b60408051600480825260a0820190925260009160208201608080368337505060408051600480825260a082019092529293506000929150602082015b60608152602001906001900390816128235790505090507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b8260008151811061286e5761286e613687565b6001600160a01b0390921660209283029190910190910152612893604087018761363e565b6128a0606089018961363e565b7f000000000000000000000000b4c31b0f0b76b351395d4acc94a54dd4e6fba1e8876040516024016128d796959493929190613f0c565b60408051601f198184030181529190526020810180516001600160e01b03166312f5760360e01b1790528151829060009061291457612914613687565b60200260200101819052507f00000000000000000000000034f895a2b90e60721a046a7cbf330ca74070968c8260018151811061295357612953613687565b6001600160a01b0390921660209283029190910190910152612978608087018761361e565b6040516024016129889190613ac3565b60408051601f198184030181529190526020810180516001600160e01b0316635bdcfb0d60e01b1790528151829060019081106129c7576129c7613687565b60200260200101819052507f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c996001600160a01b031663c79aeaae876000016000016020810190612a179190613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612a5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7f91906135d2565b82600281518110612a9257612a92613687565b6001600160a01b039092166020928302919091019091015285612ab8608082018261361e565b612ac6906020810190613bcb565b612ad7906040810190602001613369565b612ae460a089018961369d565b604051602401612af79493929190613be1565b60408051601f198184030181529190526020810180516001600160e01b0316636ec4f1e960e11b179052815182906002908110612b3657612b36613687565b60200260200101819052507f0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b82600381518110612b7557612b75613687565b60200260200101906001600160a01b031690816001600160a01b0316815250508484604051602401612ba8929190613c13565b60408051601f198184030181529190526020810180516001600160e01b031663d354641160e01b179052815182906003908110612be757612be7613687565b6020026020010181905250866001600160a01b03166363fb0b963484846040518463ffffffff1660e01b8152600401612c2192919061375e565b6000604051808303818588803b158015612c3a57600080fd5b505af1158015612c4e573d6000803e3d6000fd5b505050505050505050505050565b60408051600480825260a0820190925260009160208201608080368337505060408051600480825260a082019092529293506000929150602082015b6060815260200190600190039081612c9857905050905060006001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c991663c79aeaae612ced60208b018b613369565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015612d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d5591906135d2565b90508083600081518110612d6b57612d6b613687565b6001600160a01b039092166020928302919091018201528890612d909089018961369d565b604051602401612da29392919061382e565b60408051601f198184030181529190526020810180516001600160e01b0316638bddf18760e01b17905282518390600090612ddf57612ddf613687565b60200260200101819052507f00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b83600181518110612e1e57612e1e613687565b6001600160a01b0390921660209283029190910190910152612e40878061363e565b604051602401612e51929190613f61565b60408051601f198184030181529190526020810180516001600160e01b03166321e9d05b60e01b1790528251839060019081106122fc576122fc613687565b600060408284031215612ea257600080fd5b50919050565b600060608284031215612ea257600080fd5b60008060608385031215612ecd57600080fd5b612ed78484612e90565b915060408301356001600160401b03811115612ef257600080fd5b612efe85828601612ea8565b9150509250929050565b6001600160a01b0381168114612f1d57600080fd5b50565b8035612f2b81612f08565b919050565b60006101008284031215612ea257600080fd5b60008083601f840112612f5557600080fd5b5081356001600160401b03811115612f6c57600080fd5b6020830191508360208260051b8501011115612f8757600080fd5b9250929050565b60008060008060608587031215612fa457600080fd5b8435612faf81612f08565b935060208501356001600160401b0380821115612fcb57600080fd5b612fd788838901612f30565b94506040870135915080821115612fed57600080fd5b50612ffa87828801612f43565b95989497509550505050565b600060a08284031215612ea257600080fd5b6000806000806080858703121561302e57600080fd5b84356001600160401b038082111561304557600080fd5b61305188838901613006565b9550602087013591508082111561306757600080fd5b5061307487828801612f30565b935050604085013561308581612f08565b9396929550929360600135925050565b60008060008060008060008060e0898b0312156130b157600080fd5b6130ba89612f20565b97506130c98a60208b01612e90565b965060608901356001600160401b03808211156130e557600080fd5b6130f18c838d01612ea8565b975060808b013591508082111561310757600080fd5b6131138c838d01612f43565b909750955060a08b013591508082111561312c57600080fd5b6131388c838d01612ea8565b945060c08b013591508082111561314e57600080fd5b5061315b8b828c01612f43565b999c989b5096995094979396929594505050565b6000806000806080858703121561318557600080fd5b61318f8686612e90565b935060408501356001600160401b03808211156131ab57600080fd5b6131b788838901612ea8565b94506060870135915080821115612fed57600080fd5b600080606083850312156131e057600080fd5b6131ea8484612e90565b915060408301356001600160401b0381111561320557600080fd5b612efe85828601612e90565b600060c08284031215612ea257600080fd5b60008060008060008060a0878903121561323c57600080fd5b86356001600160401b038082111561325357600080fd5b61325f8a838b01613211565b9750602089013591508082111561327557600080fd5b6132818a838b01612f30565b9650604089013591508082111561329757600080fd5b506132a489828a01612f43565b90955093505060608701356132b881612f08565b80925050608087013590509295509295509295565b6000602082840312156132df57600080fd5b81356001600160401b038111156132f557600080fd5b610f6784828501613006565b60008060006040848603121561331657600080fd5b83356001600160401b038082111561332d57600080fd5b61333987838801613211565b9450602086013591508082111561334f57600080fd5b5061335c86828701612f43565b9497909650939450505050565b60006020828403121561337b57600080fd5b813561338681612f08565b9392505050565b6000806000606084860312156133a257600080fd5b83356133ad81612f08565b925060208401356133bd81612f08565b929592945050506040919091013590565b600080600080600080600060c0888a0312156133e957600080fd5b6133f38989612e90565b965060408801356001600160401b038082111561340f57600080fd5b61341b8b838c01612ea8565b975060608a013591508082111561343157600080fd5b61343d8b838c01612f43565b909750955060808a013591508082111561345657600080fd5b6134628b838c01612ea8565b945060a08a013591508082111561347857600080fd5b506134858a828b01612f43565b989b979a50959850939692959293505050565b6000806000608084860312156134ad57600080fd5b6134b78585612e90565b925060408401356001600160401b03808211156134d357600080fd5b6134df87838801612e90565b935060608601359150808211156134f557600080fd5b5061350286828701612ea8565b9150509250925092565b600080600080600060a0868803121561352457600080fd5b853561352f81612f08565b945061353e8760208801612e90565b935060608601356001600160401b038082111561355a57600080fd5b61356689838a01612ea8565b9450608088013591508082111561357c57600080fd5b5061358988828901612f43565b969995985093965092949392505050565b6000806000604084860312156135af57600080fd5b83356001600160401b03808211156135c657600080fd5b61333987838801612f30565b6000602082840312156135e457600080fd5b815161338681612f08565b81516001600160a01b039081168252602080840151909116908201526040918201519181019190915260600190565b60008235603e1983360301811261363457600080fd5b9190910192915050565b6000808335601e1984360301811261365557600080fd5b8301803591506001600160401b0382111561366f57600080fd5b6020019150600581901b3603821315612f8757600080fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126136b457600080fd5b8301803591506001600160401b038211156136ce57600080fd5b602001915036819003821315612f8757600080fd5b80356136ee81612f08565b6001600160a01b03168252602090810135910152565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61373781866136e3565b836040820152608060608201526000613754608083018486613704565b9695505050505050565b604080825283519082018190526000906020906060840190828701845b828110156137a05781516001600160a01b03168452928401929084019060010161377b565b50505083810382850152845180825282820190600581901b8301840187850160005b8381101561381f57601f19808785030186528251805180865260005b818110156137f9578281018b01518782018c01528a016137de565b5060008682018b015296890196601f0190911690930187019250908601906001016137c2565b50909998505050505050505050565b61383881856136e3565b60606040820152600061384f606083018486613704565b95945050505050565b8183526000602080850194508260005b8581101561389657813561387b81612f08565b6001600160a01b031687529582019590820190600101613868565b509495945050505050565b6001600160a01b03851681526001600160e01b0319841660208201526060604082018190526000906137549083018486613858565b6000808335601e198436030181126138ed57600080fd5b83016020810192503590506001600160401b0381111561390c57600080fd5b8060051b3603821315612f8757600080fd5b6000808335601e1984360301811261393557600080fd5b83016020810192503590506001600160401b0381111561395457600080fd5b803603821315612f8757600080fd5b6000823560fe1983360301811261397957600080fd5b90910192915050565b81835260006020808501808196508560051b810191508460005b87811015613a6e5782840389526139b38288613963565b61010081356139c181612f08565b6001600160a01b031686526139d7828801612f20565b6001600160a01b03168787015260408281013590870152606080830135908701526080808301359087015260a0613a0f818401612f20565b6001600160a01b03169087015260c0613a29838201612f20565b6001600160a01b03169087015260e0613a448382018461391e565b93508282890152613a588389018583613704565b9c89019c9750505092860192505060010161399c565b5091979650505050505050565b6000823560be1983360301811261397957600080fd5b81835260006001600160fb1b03831115613aaa57600080fd5b8260051b80836020870137939093016020019392505050565b602081526000613ad383846138d6565b60406020850152613ae8606085018284613982565b915050613af86020850185613a7b565b838203601f190160408501528035613b0f81612f08565b6001600160a01b039081168352602082013590613b2b82612f08565b166020830152613b3e60408201826138d6565b60c06040850152613b5360c085018284613858565b915050613b6360608301836138d6565b8483036060860152613b76838284613a91565b92505050613b8760808301836138d6565b8483036080860152613b9a838284613a91565b92505050613bab60a083018361391e565b925083820360a0850152613bc0828483613704565b979650505050505050565b6000823560be1983360301811261363457600080fd5b613beb81866136e3565b6001600160a01b03841660408201526080606082018190526000906137549083018486613704565b602081526000610f67602083018486613858565b80358015158114612f2b57600080fd5b803560038110613c4657600080fd5b82526020810135613c5681612f08565b6001600160a01b03166020929092019190915250565b6000823561013e1983360301811261397957600080fd5b6000610140823584526020830135602085015260408301356040850152613cac60608401612f20565b6001600160a01b0316606085015260808381013590850152613cd060a08401612f20565b6001600160a01b031660a0850152613ceb60c08401846138d6565b8260c0870152613cfe8387018284613a91565b92505050613d0f60e08401846138d6565b85830360e0870152613d22838284613858565b610100868101359088015261012095860135959096019490945250929392505050565b6001600160a01b038481168252600090613d6260208401866136e3565b608060608401528335613d7481612f08565b811660808401526020840135613d8981612f08565b1660a0830152613d9b60408401613c27565b151560c0830152613db260e0830160608501613c37565b613dbe60a08401613c27565b1515610120830152613dd360c0840184613c6c565b610100610140840152613dea610180840182613c83565b9050613df960e085018561391e565b848303607f1901610160860152613e11838284613704565b98975050505050505050565b602081526000613e2d8384613a7b565b604060208401528035613e3f81612f08565b6001600160a01b039081166060850152602082013590613e5e82612f08565b166080840152613e7160408201826138d6565b60c060a0860152613e8761012086018284613858565b915050606082013560c0850152613ea160808301836138d6565b605f19808785030160e0880152613eb9848385613a91565b9350613ec860a086018661391e565b9550925080878503016101008801525050613ee4828483613704565b92505050613ef560208501856138d6565b848303601f19016040860152613754838284613982565b608081526000613f2060808301888a613858565b8281036020840152613f33818789613a91565b6001600160a01b0395909516604084015250506001600160e01b031991909116606090910152949350505050565b602081526000610f6760208301848661398256fe5b8dc100c818a2d82ad26ea9a99b72b4d5c96a4067ed40cb71a16acda082b97aa2646970667358221220e8132e4a6c224b28178dd4dc854d4643585100b18d0ed79254bee1189640ec8364736f6c63430008130033

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

000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c990000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d00000000000000000000000034f895a2b90e60721a046a7cbf330ca74070968c00000000000000000000000004448ed523730142b1eaf647123d9029e8da74fa00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d17698

-----Decoded View---------------
Arg [0] : factory (address): 0x233D9067677dCf1a161954D45B4C965B9d567168
Arg [1] : connectorRegistry (address): 0xc6013E57a0811C7111A8fB07ACd2E248D9489C99
Arg [2] : libraries (tuple):
Arg [1] : transferLib (address): 0x0626Bd067fF557AE86Ee5c7CE44281aDbf10298B
Arg [2] : swapLib (address): 0x23eb5CE64769b969b58f008154d396957A7aDE3b
Arg [3] : feesLib (address): 0x46292986Df2FEE3a048Dd6753918e62e93806C2d
Arg [4] : zapLib (address): 0x34f895A2b90e60721A046a7cbf330cA74070968C
Arg [5] : positionSettingsLib (address): 0x04448ED523730142B1EAf647123d9029E8dA74Fa

Arg [3] : _positionSettingsRegistry (address): 0x60d3345C2D2FD62DBED55cf2178BDcff69d17698

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000233d9067677dcf1a161954d45b4c965b9d567168
Arg [1] : 000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99
Arg [2] : 0000000000000000000000000626bd067ff557ae86ee5c7ce44281adbf10298b
Arg [3] : 00000000000000000000000023eb5ce64769b969b58f008154d396957a7ade3b
Arg [4] : 00000000000000000000000046292986df2fee3a048dd6753918e62e93806c2d
Arg [5] : 00000000000000000000000034f895a2b90e60721a046a7cbf330ca74070968c
Arg [6] : 00000000000000000000000004448ed523730142b1eaf647123d9029e8da74fa
Arg [7] : 00000000000000000000000060d3345c2d2fd62dbed55cf2178bdcff69d17698


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
0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8
Loading...
Loading
Loading...
Loading

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.