Contract 0x38a50ebB6b299361D4492D488F95e13bE0A6b693 5

 
Txn Hash Method
Block
From
To
Value
0x3779d6c4f533baafd3863422d72314f632933ef46e117fb9894a494821445dd20x6080604045610132023-09-28 14:29:33154 days 9 hrs ago0x8559027bac39638438ddb32d713f0b12ef66ea7b IN  Create: MultiCollateralOnOffRamp0 ETH0.0067130248461
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MultiCollateralOnOffRamp

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 27 : MultiCollateralOnOffRamp.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// external
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

// internal
import "../utils/proxy/solidity-0.8.0/ProxyReentrancyGuard.sol";
import "../utils/proxy/solidity-0.8.0/ProxyOwned.sol";
import "../utils/proxy/solidity-0.8.0/ProxyPausable.sol";

import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IQuoter.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "../utils/libraries/UniswapMath.sol";

// interfaces
import "../interfaces/ICurveSUSD.sol";
import "../interfaces/IPriceFeed.sol";
import "../interfaces/IPositionalMarketManagerTruncated.sol";

interface WethLike {
    function deposit() external payable;

    function withdraw(uint256) external;
}

/// @title MultiCollateralOnOffRamp to use different collateral than default
contract MultiCollateralOnOffRamp is Initializable, ProxyOwned, ProxyPausable, ProxyReentrancyGuard {
    using SafeERC20Upgradeable for IERC20Upgradeable;

    uint private constant ONE = 1e18;
    uint private constant COLLATERAL_TRANSFORMER_MULTIPLIER = 1e12;

    IERC20Upgradeable public sUSD;

    mapping(address => bool) public collateralSupported;

    mapping(address => bool) public ammsSupported;

    ISwapRouter public swapRouter;

    IPriceFeed public priceFeed;

    address public WETH9;
    address public usdc;
    address public usdt;
    address public dai;

    bool public curveOnrampEnabled;

    uint public maxAllowedPegSlippagePercentage;

    ICurveSUSD public curveSUSD;

    mapping(address => bytes) public pathPerCollateral;

    mapping(address => bytes32) public priceFeedKeyPerCollateral;

    IPositionalMarketManagerTruncated public manager;

    mapping(address => bytes) public pathPerCollateralOfframp;

    mapping(address => uint) public maxAllowedPegSlippagePercentagePerCollateral;

    receive() external payable {}

    function initialize(address _owner, IERC20Upgradeable _sUSD) external initializer {
        setOwner(_owner);
        initNonReentrant();
        sUSD = _sUSD;
    }

    /// @notice use the collateral and collateralAmount to buy sUSD
    /// @return convertedAmount The amount of sUSD received.
    function onramp(address collateral, uint collateralAmount)
        external
        nonReentrant
        notPaused
        returns (uint convertedAmount)
    {
        require(collateralSupported[collateral], "Unsupported collateral");
        require(ammsSupported[msg.sender], "Unsupported caller");

        IERC20Upgradeable(collateral).safeTransferFrom(msg.sender, address(this), collateralAmount);

        //TODO: on Release set a path for WETH
        if (curveOnrampEnabled && (collateral == usdc || collateral == dai || collateral == usdt)) {
            // for stable coins use Curve
            convertedAmount = _swapViaCurve(collateral, collateralAmount);
        } else {
            // use a path over WETH pools for other ammsSupported collaterals (OP, ARB)
            convertedAmount = _swapExactInput(collateralAmount, collateral);
        }
        sUSD.safeTransfer(msg.sender, convertedAmount);

        emit Onramped(collateral, collateralAmount);
    }

    /// @notice use native eth as a collateral to buy sUSD
    /// @return convertedAmount The amount of sUSD received.
    function onrampWithEth(uint amount) external payable nonReentrant notPaused returns (uint convertedAmount) {
        require(collateralSupported[address(WETH9)], "Unsupported collateral");
        require(ammsSupported[msg.sender], "Unsupported caller");
        require(msg.value > 0 && amount > 0, "Can not exchange 0 ETH");
        require(msg.value >= amount, "Amount ETH has to be larger than specified amount");

        uint balanceBefore = IERC20Upgradeable(WETH9).balanceOf(address(this));
        WethLike(WETH9).deposit{value: amount}();

        uint balanceDiff = IERC20Upgradeable(WETH9).balanceOf(address(this)) - balanceBefore;
        require(balanceDiff == amount, "Not enough WETH received");

        convertedAmount = _swapExactInput(amount, WETH9);

        sUSD.safeTransfer(msg.sender, convertedAmount);

        emit OnrampedEth(amount);
    }

    /// @notice offramp the amount of sUSD into the target collateral
    /// @return convertedAmount The amount of sUSD to offramp.
    function offramp(address collateral, uint amount) external nonReentrant notPaused returns (uint convertedAmount) {
        require(collateralSupported[collateral], "Unsupported collateral");
        require(ammsSupported[msg.sender], "Unsupported caller");
        sUSD.safeTransferFrom(msg.sender, address(this), amount);

        if (curveOnrampEnabled && (collateral == usdc || collateral == dai || collateral == usdt)) {
            // for stable coins use Curve
            convertedAmount = _swapViaCurveOfframp(collateral, amount);
        } else {
            // for other use defined path
            convertedAmount = _swapExactInputOfframp(amount, collateral);
        }
        IERC20Upgradeable(collateral).safeTransfer(msg.sender, convertedAmount);

        emit Offramped(collateral, amount);
    }

    function offrampIntoEth(uint amount) external nonReentrant notPaused returns (uint convertedAmount) {
        require(ammsSupported[msg.sender], "Unsupported caller");

        sUSD.safeTransferFrom(msg.sender, address(this), amount);

        convertedAmount = _swapExactInputOfframp(amount, WETH9);

        WethLike(WETH9).withdraw(convertedAmount);

        bool sent = payable(msg.sender).send(convertedAmount);
        require(sent, "Failed to send Ether");

        emit OfframpedEth(amount);
    }

    ///////////////////////Curve related code///////////////////
    function _swapViaCurve(address collateral, uint collateralQuote) internal returns (uint256 amountOut) {
        int128 curveIndex = _mapCollateralToCurveIndex(collateral);
        require(curveIndex > 0 && curveOnrampEnabled, "unsupported collateral");

        amountOut = curveSUSD.exchange_underlying(
            curveIndex,
            0,
            collateralQuote,
            getMinimumReceived(collateral, collateralQuote) // the minimum received is predefined
        );

        // ensure the amount received is within allowed range per maxAllowedPegSlippagePercentage
        require(amountOut <= getMaximumReceived(collateral, collateralQuote), "Amount above max allowed peg slippage");
    }

    function _swapViaCurveOfframp(address collateral, uint amount) internal returns (uint256 amountOut) {
        int128 curveIndex = _mapCollateralToCurveIndex(collateral);
        require(curveIndex > 0 && curveOnrampEnabled, "unsupported collateral");

        sUSD.approve(address(curveSUSD), amount);

        amountOut = curveSUSD.exchange_underlying(
            0,
            curveIndex,
            amount,
            getMinimumReceivedOfframp(collateral, amount) // the minimum received is predefined
        );

        // ensure the amount received is within allowed range per maxAllowedPegSlippagePercentage
        require(amountOut <= getMaximumReceivedOfframp(collateral, amount), "Amount above max allowed peg slippage");
    }

    ///////////////////////UNISWAP related code///////////////////

    /// @notice _swapExactInput swaps a fixed amount of tokenIn for a maximum possible amount of tokenOut
    /// @param amountIn The exact amount of tokenIn that will be swapped for tokenOut.
    /// @param tokenIn Address of first token
    /// @return amountOut The amount of tokenOut received.
    function _swapExactInput(uint256 amountIn, address tokenIn) internal returns (uint256 amountOut) {
        IERC20Upgradeable(tokenIn).approve(address(swapRouter), amountIn);

        bytes memory pathToUse = pathPerCollateral[tokenIn];
        if (pathToUse.length == 0) {
            uint24 fee = 3000;
            pathToUse = abi.encodePacked(address(tokenIn), fee, WETH9, fee, address(sUSD));
        }

        // Multiple pool swaps are encoded through bytes called a `path`. A path is a sequence of token addresses and poolFees that define the pools used in the swaps.
        ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
            path: pathToUse,
            recipient: address(this),
            deadline: block.timestamp + 15,
            amountIn: amountIn,
            amountOutMinimum: getMinimumReceived(tokenIn, amountIn)
        });

        // The call to `exactInput` executes the swap.
        amountOut = swapRouter.exactInput(params);

        // ensure the amount received is withing allowed range per maxAllowedPegSlippagePercentage
        require(amountOut <= getMaximumReceived(tokenIn, amountIn), "Amount above max allowed peg slippage");
    }

    function _swapExactInputOfframp(uint256 amountIn, address tokenOut) internal returns (uint256 amountOut) {
        sUSD.approve(address(swapRouter), amountIn);

        bytes memory pathToUse = pathPerCollateralOfframp[tokenOut];
        if (pathToUse.length == 0) {
            uint24 fee = 3000;
            pathToUse = abi.encodePacked(address(sUSD), fee, WETH9, fee, address(tokenOut));
        }

        // Multiple pool swaps are encoded through bytes called a `path`. A path is a sequence of token addresses and poolFees that define the pools used in the swaps.
        ISwapRouter.ExactInputParams memory params = ISwapRouter.ExactInputParams({
            path: pathToUse,
            recipient: address(this),
            deadline: block.timestamp + 15,
            amountIn: amountIn,
            amountOutMinimum: getMinimumReceivedOfframp(tokenOut, amountIn)
        });

        // The call to `exactInput` executes the swap.
        amountOut = swapRouter.exactInput(params);

        // ensure the amount received is withing allowed range per maxAllowedPegSlippagePercentage
        require(amountOut <= getMaximumReceivedOfframp(tokenOut, amountIn), "Amount above max allowed peg slippage");
    }

    function _mapCollateralToCurveIndex(address collateral) internal view returns (int128) {
        if (collateral == dai) {
            return 1;
        }
        if (collateral == usdc) {
            return 2;
        }
        if (collateral == usdt) {
            return 3;
        }
        return 0;
    }

    /////////// read methods

    /// @notice return the guaranteed payout for the given collateral and amount
    function getMinimumReceived(address collateral, uint amount) public view returns (uint minReceived) {
        if (_mapCollateralToCurveIndex(collateral) > 0) {
            uint transformedCollateralForPegCheck = collateral == usdc || collateral == usdt
                ? amount * (COLLATERAL_TRANSFORMER_MULTIPLIER)
                : amount;
            minReceived =
                (transformedCollateralForPegCheck * (ONE - _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) /
                ONE;
        } else {
            uint currentCollateralPrice = priceFeed.rateForCurrency(priceFeedKeyPerCollateral[collateral]);
            minReceived =
                (((amount * currentCollateralPrice) / ONE) *
                    (ONE - _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) /
                ONE;
        }
        if (address(manager) != address(0)) {
            minReceived = manager.transformCollateral(minReceived);
        }
    }

    // @notice return the minimum needed of collateral to receive amount of sUSD
    function getMinimumNeeded(address collateral, uint amount) public view returns (uint minNeeded) {
        if (address(manager) != address(0)) {
            amount = manager.reverseTransformCollateral(amount);
        }
        if (_mapCollateralToCurveIndex(collateral) > 0) {
            minNeeded = (amount * (ONE + _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) / ONE;
            if (collateral == usdc || collateral == usdt) {
                minNeeded = minNeeded / COLLATERAL_TRANSFORMER_MULTIPLIER;
            }
        } else {
            uint currentCollateralPrice = priceFeed.rateForCurrency(priceFeedKeyPerCollateral[collateral]);
            minNeeded =
                (((amount * ONE) / currentCollateralPrice) *
                    (ONE + _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) /
                ONE;
        }
    }

    /// @notice return the guaranteed largest payout for the given collateral and amount
    function getMaximumReceived(address collateral, uint amount) public view returns (uint maxReceived) {
        if (_mapCollateralToCurveIndex(collateral) > 0) {
            uint transformedCollateralForPegCheck = collateral == usdc || collateral == usdt
                ? amount * (COLLATERAL_TRANSFORMER_MULTIPLIER)
                : amount;
            maxReceived =
                (transformedCollateralForPegCheck * (ONE + _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) /
                ONE;
        } else {
            uint currentCollateralPrice = priceFeed.rateForCurrency(priceFeedKeyPerCollateral[collateral]);
            maxReceived =
                (((amount * currentCollateralPrice) / ONE) *
                    (ONE + _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) /
                ONE;
        }
        if (address(manager) != address(0)) {
            maxReceived = manager.transformCollateral(maxReceived);
        }
    }

    /// @notice return the minimum received amount in collateral for sUSD amount
    function getMinimumReceivedOfframp(address collateral, uint amount) public view returns (uint minReceivedOfframp) {
        if (address(manager) != address(0)) {
            amount = manager.reverseTransformCollateral(amount);
        }
        if (_mapCollateralToCurveIndex(collateral) > 0) {
            minReceivedOfframp = (amount * (ONE - _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) / ONE;
            if (collateral == usdc || collateral == usdt) {
                minReceivedOfframp = minReceivedOfframp / COLLATERAL_TRANSFORMER_MULTIPLIER;
            }
        } else {
            uint currentCollateralPrice = priceFeed.rateForCurrency(priceFeedKeyPerCollateral[collateral]);
            minReceivedOfframp =
                (((amount * ONE) / currentCollateralPrice) *
                    (ONE - _getMaxAllowedPegSlippagePercentageForCollateral(collateral))) /
                ONE;
        }
    }

    /// @notice return the maximum received amount in collateral for sUSD amount
    function getMaximumReceivedOfframp(address collateral, uint amount) public view returns (uint maxReceivedOfframp) {
        maxReceivedOfframp = getMinimumNeeded(collateral, amount);
    }

    /// @notice utility method to pack best path
    function getEncodedPacked(
        address inToken,
        uint24 feeIn,
        address proxy,
        uint24 feeOut,
        address target
    ) external view returns (bytes memory encoded) {
        if (proxy != address(0)) {
            encoded = abi.encodePacked(inToken, feeIn, proxy, feeOut, target);
        } else {
            encoded = abi.encodePacked(inToken, feeOut, target);
        }
    }

    function _getMaxAllowedPegSlippagePercentageForCollateral(address collateral) internal view returns (uint) {
        return
            maxAllowedPegSlippagePercentagePerCollateral[collateral] > 0
                ? maxAllowedPegSlippagePercentagePerCollateral[collateral]
                : maxAllowedPegSlippagePercentage;
    }

    //////////////// setters

    /// @notice setSupportedCollateral which can be used for onramp
    function setSupportedCollateral(address collateral, bool supported) external onlyOwner {
        require(collateral != address(0), "Can not set a zero address!");
        collateralSupported[collateral] = supported;
        emit SetSupportedCollateral(collateral, supported);
    }

    /// @notice setSupportedAMM which can call the onramp method
    function setSupportedAMM(address amm, bool supported) external onlyOwner {
        require(amm != address(0), "Can not set a zero address!");
        ammsSupported[amm] = supported;
        emit SetSupportedAMM(amm, supported);
    }

    /// @notice setWETH
    function setWETH(address _weth) external onlyOwner {
        require(_weth != address(0), "Can not set a zero address!");
        WETH9 = _weth;
        emit SetWETH(_weth);
    }

    /// @notice setUSD
    function setSUSD(address _usd) external onlyOwner {
        require(_usd != address(0), "Can not set a zero address!");
        sUSD = IERC20Upgradeable(_usd);
        emit SetSUSD(_usd);
    }

    /// @notice setSwapRouter
    function setSwapRouter(address _router) external onlyOwner {
        require(_router != address(0), "Can not set a zero address!");
        swapRouter = ISwapRouter(_router);
        emit SetSwapRouter(_router);
    }

    /// @notice setPriceFeed
    function setPriceFeed(address _priceFeed) external onlyOwner {
        require(_priceFeed != address(0), "Can not set a zero address!");
        priceFeed = IPriceFeed(_priceFeed);
        emit SetPriceFeed(_priceFeed);
    }

    /// @notice map a key to an asset for price feed
    function setPriceFeedKeyPerAsset(bytes32 key, address asset) external onlyOwner {
        require(asset != address(0), "Can not set a zero address!");
        priceFeedKeyPerCollateral[asset] = key;
        emit SetPriceFeedKeyPerAsset(key, asset);
    }

    /// @notice map a path for a given collateral
    function setPathPerCollateral(
        address asset,
        bytes calldata path,
        bool doReset
    ) external onlyOwner {
        require(asset != address(0), "Can not set a zero address!");
        if (doReset) {
            bytes memory resetVar;
            pathPerCollateral[asset] = resetVar;
        } else {
            pathPerCollateral[asset] = path;
        }
        emit SetPathPerCollateral(asset, path, doReset);
    }

    /// @notice map a path for a given collateral offramp
    function setPathPerCollateralOfframp(
        address asset,
        bytes calldata path,
        bool doReset
    ) external onlyOwner {
        require(asset != address(0), "Can not set a zero address!");
        if (doReset) {
            bytes memory resetVar;
            pathPerCollateralOfframp[asset] = resetVar;
        } else {
            pathPerCollateralOfframp[asset] = path;
        }
        emit SetPathPerCollateralOfframp(asset, path, doReset);
    }

    /// @notice set max slippage for a given collateral
    function setMaxAllowedPegSlippagePercentagePerCollateral(address collateral, uint _maxAllowedSlippagePerCollateral)
        external
        onlyOwner
    {
        require(collateral != address(0), "Can not set a zero address!");
        require(_maxAllowedSlippagePerCollateral <= maxAllowedPegSlippagePercentage, "Can not set higher than default");
        maxAllowedPegSlippagePercentagePerCollateral[collateral] = _maxAllowedSlippagePerCollateral;
        emit SetMaxAllowedPegSlippagePercentagePerCollateral(collateral, _maxAllowedSlippagePerCollateral);
    }

    /// @notice set max default slippage
    function setMaxAllowedPegSlippagePercentage(uint _maxAllowedSlippage) external onlyOwner {
        require(_maxAllowedSlippage <= 2 * 1e16, "Can not set higher than 2%");
        maxAllowedPegSlippagePercentage = _maxAllowedSlippage;
        emit SetMaxAllowedPegSlippagePercentage(_maxAllowedSlippage);
    }

    /// @notice set manager to use collateral transformations as needed
    function setManager(address _manager) external onlyOwner {
        require(_manager != address(0), "Can not set a zero address!");
        manager = IPositionalMarketManagerTruncated(_manager);
        emit ManagerChanged(_manager);
    }

    /// @notice Updates contract parametars
    /// @param _curveSUSD curve sUSD pool exchanger contract
    /// @param _dai DAI address
    /// @param _usdc USDC address
    /// @param _usdt USDT addresss
    /// @param _curveOnrampEnabled whether AMM supports curve onramp
    /// @param _maxAllowedPegSlippagePercentage maximum discount AMM accepts for sUSD purchases
    function setCurveSUSD(
        address _curveSUSD,
        address _dai,
        address _usdc,
        address _usdt,
        bool _curveOnrampEnabled,
        uint _maxAllowedPegSlippagePercentage
    ) external onlyOwner {
        require(_curveSUSD != address(0), "Can not set a zero address!");
        curveSUSD = ICurveSUSD(_curveSUSD);
        dai = _dai;
        usdc = _usdc;
        usdt = _usdt;
        IERC20Upgradeable(dai).approve(_curveSUSD, type(uint256).max);
        IERC20Upgradeable(usdc).approve(_curveSUSD, type(uint256).max);
        IERC20Upgradeable(usdt).approve(_curveSUSD, type(uint256).max);
        curveOnrampEnabled = _curveOnrampEnabled;
        maxAllowedPegSlippagePercentage = _maxAllowedPegSlippagePercentage;
        emit CurveSUSDSet(_curveSUSD, _dai, _usdc, _usdt, _curveOnrampEnabled, _maxAllowedPegSlippagePercentage);
    }

    ////////////////events
    event CurveSUSDSet(
        address _curveSUSD,
        address _dai,
        address _usdc,
        address _usdt,
        bool _curveOnrampEnabled,
        uint _maxAllowedPegSlippagePercentage
    );
    event SetPriceFeedKeyPerAsset(bytes32 key, address asset);
    event SetPriceFeed(address _priceFeed);
    event SetSwapRouter(address _router);
    event SetSUSD(address _usd);
    event SetWETH(address _weth);
    event SetSupportedAMM(address amm, bool supported);
    event SetSupportedCollateral(address collateral, bool supported);
    event Onramped(address collateral, uint amount);
    event OnrampedEth(uint amount);
    event Offramped(address collateral, uint amount);
    event OfframpedEth(uint amount);
    event ManagerChanged(address manager);
    event SetPathPerCollateral(address asset, bytes path, bool doReset);
    event SetPathPerCollateralOfframp(address asset, bytes path, bool doReset);
    event SetMaxAllowedPegSlippagePercentagePerCollateral(address collateral, uint _maxAllowedSlippagePerCollateral);
    event SetMaxAllowedPegSlippagePercentage(uint _maxAllowedSlippage);
}

File 2 of 27 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 3 of 27 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
    uint256[49] private __gap;
}

File 4 of 27 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.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 a proxied contract can't have 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.
 *
 * 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 initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 5 of 27 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMathUpgradeable {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 6 of 27 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 7 of 27 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
    uint256[49] private __gap;
}

File 8 of 27 : ProxyReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the `nonReentrant` modifier
 * available, which can be aplied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 */
contract ProxyReentrancyGuard {
    /// @dev counter to allow mutex lock with only one SSTORE operation
    uint256 private _guardCounter;
    bool private _initialized;

    function initNonReentrant() public {
        require(!_initialized, "Already initialized");
        _initialized = true;
        _guardCounter = 1;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _guardCounter += 1;
        uint256 localCounter = _guardCounter;
        _;
        require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
    }
}

File 9 of 27 : ProxyOwned.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// Clone of syntetix contract without constructor
contract ProxyOwned {
    address public owner;
    address public nominatedOwner;
    bool private _initialized;
    bool private _transferredAtInit;

    function setOwner(address _owner) public {
        require(_owner != address(0), "Owner address cannot be 0");
        require(!_initialized, "Already initialized, use nominateNewOwner");
        _initialized = true;
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    function transferOwnershipAtInit(address proxyAddress) external onlyOwner {
        require(proxyAddress != address(0), "Invalid address");
        require(!_transferredAtInit, "Already transferred");
        owner = proxyAddress;
        _transferredAtInit = true;
        emit OwnerChanged(owner, proxyAddress);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}

File 10 of 27 : ProxyPausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// Inheritance
import "./ProxyOwned.sol";

// Clone of syntetix contract without constructor

contract ProxyPausable is ProxyOwned {
    uint public lastPauseTime;
    bool public paused;

    

    /**
     * @notice Change the paused state of the contract
     * @dev Only the contract owner may call this.
     */
    function setPaused(bool _paused) external onlyOwner {
        // Ensure we're actually changing the state before we do anything
        if (_paused == paused) {
            return;
        }

        // Set our paused state.
        paused = _paused;

        // If applicable, set the last pause time.
        if (paused) {
            lastPauseTime = block.timestamp;
        }

        // Let everyone know that our pause state has changed.
        emit PauseChanged(paused);
    }

    event PauseChanged(bool isPaused);

    modifier notPaused {
        require(!paused, "This action cannot be performed while the contract is paused");
        _;
    }
}

File 11 of 27 : ISwapRouter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 12 of 27 : IQuoter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

/// @title Quoter Interface
/// @notice Supports quoting the calculated amounts from exact input or exact output swaps
/// @dev These functions are not marked view because they rely on calling non-view functions and reverting
/// to compute the result. They are also not gas efficient and should not be called on-chain.
interface IQuoter {
    /// @notice Returns the amount out received for a given exact input swap without executing the swap
    /// @param path The path of the swap, i.e. each token pair and the pool fee
    /// @param amountIn The amount of the first token to swap
    /// @return amountOut The amount of the last token that would be received
    function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);

    /// @notice Returns the amount out received for a given exact input but for a swap of a single pool
    /// @param tokenIn The token being swapped in
    /// @param tokenOut The token being swapped out
    /// @param fee The fee of the token pool to consider for the pair
    /// @param amountIn The desired input amount
    /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
    /// @return amountOut The amount of `tokenOut` that would be received
    function quoteExactInputSingle(
        address tokenIn,
        address tokenOut,
        uint24 fee,
        uint256 amountIn,
        uint160 sqrtPriceLimitX96
    ) external returns (uint256 amountOut);

    /// @notice Returns the amount in required for a given exact output swap without executing the swap
    /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order
    /// @param amountOut The amount of the last token to receive
    /// @return amountIn The amount of first token required to be paid
    function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);

    /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool
    /// @param tokenIn The token being swapped in
    /// @param tokenOut The token being swapped out
    /// @param fee The fee of the token pool to consider for the pair
    /// @param amountOut The desired output amount
    /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
    /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`
    function quoteExactOutputSingle(
        address tokenIn,
        address tokenOut,
        uint24 fee,
        uint256 amountOut,
        uint160 sqrtPriceLimitX96
    ) external returns (uint256 amountIn);
}

File 13 of 27 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './pool/IUniswapV3PoolImmutables.sol';
import './pool/IUniswapV3PoolState.sol';
import './pool/IUniswapV3PoolDerivedState.sol';
import './pool/IUniswapV3PoolActions.sol';
import './pool/IUniswapV3PoolOwnerActions.sol';
import './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{

}

File 14 of 27 : IUniswapV3Factory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title The interface for the Uniswap V3 Factory
/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees
interface IUniswapV3Factory {
    /// @notice Emitted when the owner of the factory is changed
    /// @param oldOwner The owner before the owner was changed
    /// @param newOwner The owner after the owner was changed
    event OwnerChanged(address indexed oldOwner, address indexed newOwner);

    /// @notice Emitted when a pool is created
    /// @param token0 The first token of the pool by address sort order
    /// @param token1 The second token of the pool by address sort order
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks
    /// @param pool The address of the created pool
    event PoolCreated(
        address indexed token0,
        address indexed token1,
        uint24 indexed fee,
        int24 tickSpacing,
        address pool
    );

    /// @notice Emitted when a new fee amount is enabled for pool creation via the factory
    /// @param fee The enabled fee, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee
    event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);

    /// @notice Returns the current owner of the factory
    /// @dev Can be changed by the current owner via setOwner
    /// @return The address of the factory owner
    function owner() external view returns (address);

    /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled
    /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context
    /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee
    /// @return The tick spacing
    function feeAmountTickSpacing(uint24 fee) external view returns (int24);

    /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
    /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
    /// @param tokenA The contract address of either token0 or token1
    /// @param tokenB The contract address of the other token
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @return pool The pool address
    function getPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external view returns (address pool);

    /// @notice Creates a pool for the given two tokens and fee
    /// @param tokenA One of the two tokens in the desired pool
    /// @param tokenB The other of the two tokens in the desired pool
    /// @param fee The desired fee for the pool
    /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved
    /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments
    /// are invalid.
    /// @return pool The address of the newly created pool
    function createPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external returns (address pool);

    /// @notice Updates the owner of the factory
    /// @dev Must be called by the current owner
    /// @param _owner The new owner of the factory
    function setOwner(address _owner) external;

    /// @notice Enables a fee amount with the given tickSpacing
    /// @dev Fee amounts may never be removed once enabled
    /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)
    /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount
    function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
}

File 15 of 27 : UniswapMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.0;

/// @title Math library for computing sqrt prices from ticks and vice versa; Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision;
/// Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits

library UniswapMath {
    uint256 internal constant Q192 = 0x1000000000000000000000000000000000000000000000000;
    uint256 internal constant Q96 = 0x1000000000000000000000000;

    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        // 512-bit multiply [prod1 prod0] = a * b
        // Compute the product mod 2**256 and mod 2**256 - 1
        // then use the Chinese Remainder Theorem to reconstruct
        // the 512 bit result. The result is stored in two 256
        // variables such that product = prod1 * 2**256 + prod0
        uint256 prod0; // Least significant 256 bits of the product
        uint256 prod1; // Most significant 256 bits of the product
        assembly {
            let mm := mulmod(a, b, not(0))
            prod0 := mul(a, b)
            prod1 := sub(sub(mm, prod0), lt(mm, prod0))
        }

        // Handle non-overflow cases, 256 by 256 division
        if (prod1 == 0) {
            require(denominator > 0);
            assembly {
                result := div(prod0, denominator)
            }
            return result;
        }

        // Make sure the result is less than 2**256.
        // Also prevents denominator == 0
        require(denominator > prod1);

        ///////////////////////////////////////////////
        // 512 by 256 division.
        ///////////////////////////////////////////////

        // Make division exact by subtracting the remainder from [prod1 prod0]
        // Compute remainder using mulmod
        uint256 remainder;
        assembly {
            remainder := mulmod(a, b, denominator)
        }
        // Subtract 256 bit number from 512 bit number
        assembly {
            prod1 := sub(prod1, gt(remainder, prod0))
            prod0 := sub(prod0, remainder)
        }

        // Factor powers of two out of denominator
        // Compute largest power of two divisor of denominator.
        // Always >= 1.
        uint256 twos = denominator & (~denominator + 1);
        // Divide denominator by power of two
        assembly {
            denominator := div(denominator, twos)
        }

        // Divide [prod1 prod0] by the factors of two
        assembly {
            prod0 := div(prod0, twos)
        }
        // Shift in bits from prod1 into prod0. For this we need
        // to flip `twos` such that it is 2**256 / twos.
        // If twos is zero, then it becomes one
        assembly {
            twos := add(div(sub(0, twos), twos), 1)
        }
        prod0 |= prod1 * twos;

        // Invert denominator mod 2**256
        // Now that denominator is an odd number, it has an inverse
        // modulo 2**256 such that denominator * inv = 1 mod 2**256.
        // Compute the inverse by starting with a seed that is correct
        // correct for four bits. That is, denominator * inv = 1 mod 2**4
        uint256 inv = (3 * denominator) ^ 2;
        // Now use Newton-Raphson iteration to improve the precision.
        // Thanks to Hensel's lifting lemma, this also works in modular
        // arithmetic, doubling the correct bits in each step.
        inv *= 2 - denominator * inv; // inverse mod 2**8
        inv *= 2 - denominator * inv; // inverse mod 2**16
        inv *= 2 - denominator * inv; // inverse mod 2**32
        inv *= 2 - denominator * inv; // inverse mod 2**64
        inv *= 2 - denominator * inv; // inverse mod 2**128
        inv *= 2 - denominator * inv; // inverse mod 2**256

        // Because the division is now exact we can divide by multiplying
        // with the modular inverse of denominator. This will give us the
        // correct result modulo 2**256. Since the precoditions guarantee
        // that the outcome is less than 2**256, this is the final result.
        // We don't need to compute the high bits of the result and prod1
        // is no longer required.
        result = prod0 * inv;
        return result;
    }

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
        require(absTick <= uint256(int256(MAX_TICK)), 'T');

        uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
        if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
        if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
        if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
        if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
        if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
        if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
        if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
        if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
        if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
        if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
        if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
        if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
        if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
        if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
        if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
        if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
        if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
        if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
        if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

        if (tick > 0) ratio = type(uint256).max / ratio;

        // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
        // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
        // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
        sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
        // second inequality must be < because the price can never reach the price at the max tick
        require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
        uint256 ratio = uint256(sqrtPriceX96) << 32;

        uint256 r = ratio;
        uint256 msb = 0;

        assembly {
            let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(5, gt(r, 0xFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(4, gt(r, 0xFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(3, gt(r, 0xFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(2, gt(r, 0xF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(1, gt(r, 0x3))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := gt(r, 0x1)
            msb := or(msb, f)
        }

        if (msb >= 128) r = ratio >> (msb - 127);
        else r = ratio << (127 - msb);

        int256 log_2 = (int256(msb) - 128) << 64;

        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(63, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(62, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(61, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(60, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(59, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(58, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(57, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(56, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(55, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(54, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(53, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(52, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(51, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(50, f))
        }

        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

        int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
        int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

        tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
    }
}

File 16 of 27 : ICurveSUSD.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.16;

interface ICurveSUSD {
    function exchange_underlying(
        int128 i,
        int128 j,
        uint256 _dx,
        uint256 _min_dy
    ) external returns (uint256);

    function get_dy_underlying(
        int128 i,
        int128 j,
        uint256 _dx
    ) external view returns (uint256);

    //    @notice Perform an exchange between two underlying coins
    //    @param i Index value for the underlying coin to send
    //    @param j Index valie of the underlying coin to receive
    //    @param _dx Amount of `i` being exchanged
    //    @param _min_dy Minimum amount of `j` to receive
    //    @param _receiver Address that receives `j`
    //    @return Actual amount of `j` received

    // indexes:
    // 0 = sUSD 18 dec 0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9
    // 1= DAI 18 dec 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1
    // 2= USDC 6 dec 0x7F5c764cBc14f9669B88837ca1490cCa17c31607
    // 3= USDT 6 dec 0x94b008aA00579c1307B0EF2c499aD98a8ce58e58
}

File 17 of 27 : IPriceFeed.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.5.16;

interface IPriceFeed {
    // Structs
    struct RateAndUpdatedTime {
        uint216 rate;
        uint40 time;
    }

    // Mutative functions
    function addAggregator(bytes32 currencyKey, address aggregatorAddress) external;

    function removeAggregator(bytes32 currencyKey) external;

    // Views

    function rateForCurrency(bytes32 currencyKey) external view returns (uint);

    function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time);

    function getRates() external view returns (uint[] memory);

    function getCurrencies() external view returns (bytes32[] memory);
}

File 18 of 27 : IPositionalMarketManagerTruncated.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IPositionalMarketManagerTruncated {
    function transformCollateral(uint value) external view returns (uint);

    function reverseTransformCollateral(uint value) external view returns (uint);
}

File 19 of 27 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 20 of 27 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 21 of 27 : IUniswapV3SwapCallback.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

File 22 of 27 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 23 of 27 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 24 of 27 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 25 of 27 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 26 of 27 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 27 of 27 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_curveSUSD","type":"address"},{"indexed":false,"internalType":"address","name":"_dai","type":"address"},{"indexed":false,"internalType":"address","name":"_usdc","type":"address"},{"indexed":false,"internalType":"address","name":"_usdt","type":"address"},{"indexed":false,"internalType":"bool","name":"_curveOnrampEnabled","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_maxAllowedPegSlippagePercentage","type":"uint256"}],"name":"CurveSUSDSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"manager","type":"address"}],"name":"ManagerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Offramped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OfframpedEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Onramped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"OnrampedEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_maxAllowedSlippage","type":"uint256"}],"name":"SetMaxAllowedPegSlippagePercentage","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"_maxAllowedSlippagePerCollateral","type":"uint256"}],"name":"SetMaxAllowedPegSlippagePercentagePerCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"bytes","name":"path","type":"bytes"},{"indexed":false,"internalType":"bool","name":"doReset","type":"bool"}],"name":"SetPathPerCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"bytes","name":"path","type":"bytes"},{"indexed":false,"internalType":"bool","name":"doReset","type":"bool"}],"name":"SetPathPerCollateralOfframp","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_priceFeed","type":"address"}],"name":"SetPriceFeed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"SetPriceFeedKeyPerAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_usd","type":"address"}],"name":"SetSUSD","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"amm","type":"address"},{"indexed":false,"internalType":"bool","name":"supported","type":"bool"}],"name":"SetSupportedAMM","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"collateral","type":"address"},{"indexed":false,"internalType":"bool","name":"supported","type":"bool"}],"name":"SetSupportedCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_router","type":"address"}],"name":"SetSwapRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_weth","type":"address"}],"name":"SetWETH","type":"event"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ammsSupported","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collateralSupported","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curveOnrampEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curveSUSD","outputs":[{"internalType":"contract ICurveSUSD","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dai","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"inToken","type":"address"},{"internalType":"uint24","name":"feeIn","type":"uint24"},{"internalType":"address","name":"proxy","type":"address"},{"internalType":"uint24","name":"feeOut","type":"uint24"},{"internalType":"address","name":"target","type":"address"}],"name":"getEncodedPacked","outputs":[{"internalType":"bytes","name":"encoded","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getMaximumReceived","outputs":[{"internalType":"uint256","name":"maxReceived","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getMaximumReceivedOfframp","outputs":[{"internalType":"uint256","name":"maxReceivedOfframp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getMinimumNeeded","outputs":[{"internalType":"uint256","name":"minNeeded","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getMinimumReceived","outputs":[{"internalType":"uint256","name":"minReceived","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getMinimumReceivedOfframp","outputs":[{"internalType":"uint256","name":"minReceivedOfframp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initNonReentrant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IERC20Upgradeable","name":"_sUSD","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"contract IPositionalMarketManagerTruncated","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAllowedPegSlippagePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxAllowedPegSlippagePercentagePerCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"offramp","outputs":[{"internalType":"uint256","name":"convertedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"offrampIntoEth","outputs":[{"internalType":"uint256","name":"convertedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"collateralAmount","type":"uint256"}],"name":"onramp","outputs":[{"internalType":"uint256","name":"convertedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"onrampWithEth","outputs":[{"internalType":"uint256","name":"convertedAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pathPerCollateral","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pathPerCollateralOfframp","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeed","outputs":[{"internalType":"contract IPriceFeed","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priceFeedKeyPerCollateral","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sUSD","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_curveSUSD","type":"address"},{"internalType":"address","name":"_dai","type":"address"},{"internalType":"address","name":"_usdc","type":"address"},{"internalType":"address","name":"_usdt","type":"address"},{"internalType":"bool","name":"_curveOnrampEnabled","type":"bool"},{"internalType":"uint256","name":"_maxAllowedPegSlippagePercentage","type":"uint256"}],"name":"setCurveSUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxAllowedSlippage","type":"uint256"}],"name":"setMaxAllowedPegSlippagePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"_maxAllowedSlippagePerCollateral","type":"uint256"}],"name":"setMaxAllowedPegSlippagePercentagePerCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bool","name":"doReset","type":"bool"}],"name":"setPathPerCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"bool","name":"doReset","type":"bool"}],"name":"setPathPerCollateralOfframp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_priceFeed","type":"address"}],"name":"setPriceFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"address","name":"asset","type":"address"}],"name":"setPriceFeedKeyPerAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_usd","type":"address"}],"name":"setSUSD","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"amm","type":"address"},{"internalType":"bool","name":"supported","type":"bool"}],"name":"setSupportedAMM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"bool","name":"supported","type":"bool"}],"name":"setSupportedCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setSwapRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"name":"setWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapRouter","outputs":[{"internalType":"contract ISwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50613d27806100206000396000f3fe6080604052600436106102e85760003560e01c80635c975abb11610190578063b45e98d9116100dc578063cb4ba52411610095578063da6070251161006f578063da60702514610932578063ebc7977214610952578063f4b9fa7514610967578063f5866a461461098757600080fd5b8063cb4ba524146108d2578063d0ebdbe7146108f2578063d3c4297c1461091257600080fd5b8063b45e98d914610802578063b98b63f814610822578063c31c9c0714610852578063c3b83f5f14610872578063c42f4c8b14610892578063c4ebcb54146108b257600080fd5b80638826e5de1161014957806391b4ded91161012357806391b4ded9146107875780639324cac71461079d578063953caf51146107c2578063a5bf660d146107e257600080fd5b80638826e5de146107215780638b3ac44c146107415780638da5cb5b1461076157600080fd5b80635c975abb14610658578063724e78da14610672578063741bef1a1461069257806379ba5097146106b25780637d904d3a146106c757806382e76c36146106f457600080fd5b80632f48ab7d1161024f578063481c6a75116102085780634c932368116101e25780634c932368146105d857806353a47bb7146105f85780635b769f3c146106185780635c5189bb1461063857600080fd5b8063481c6a7514610578578063485cc955146105985780634aa4a4fc146105b857600080fd5b80632f48ab7d146104a057806338053078146104d85780633e413bee146104f85780634127365714610518578063420a038c14610538578063477bf5a51461055857600080fd5b80631fbb38e8116102a15780631fbb38e8146103c957806321ef44c6146103fa5780632213af251461041a57806322bdb38c1461043a5780632909f51a1461045a5780632ab8de381461047057600080fd5b80630d9393cf146102f45780631321b85d1461032757806313af40351461033a5780631627540c1461035c57806316c38b3c1461037c578063178b8ac81461039c57600080fd5b366102ef57005b600080fd5b34801561030057600080fd5b5061031461030f36600461385e565b6109a7565b6040519081526020015b60405180910390f35b6103146103353660046138e5565b610bc1565b34801561034657600080fd5b5061035a610355366004613666565b610f86565b005b34801561036857600080fd5b5061035a610377366004613666565b6110c1565b34801561038857600080fd5b5061035a610397366004613889565b611117565b3480156103a857600080fd5b506103bc6103b73660046137f2565b61118d565b60405161031e9190613a12565b3480156103d557600080fd5b50600d546103ea90600160a01b900460ff1681565b604051901515815260200161031e565b34801561040657600080fd5b5061035a610415366004613666565b611225565b34801561042657600080fd5b506103bc610435366004613666565b6112a9565b34801561044657600080fd5b506103bc610455366004613666565b611343565b34801561046657600080fd5b50610314600e5481565b34801561047c57600080fd5b506103ea61048b366004613666565b60066020526000908152604090205460ff1681565b3480156104ac57600080fd5b50600c546104c0906001600160a01b031681565b6040516001600160a01b03909116815260200161031e565b3480156104e457600080fd5b5061035a6104f3366004613732565b61135c565b34801561050457600080fd5b50600b546104c0906001600160a01b031681565b34801561052457600080fd5b5061035a610533366004613666565b611429565b34801561054457600080fd5b5061031461055336600461385e565b6114a5565b34801561056457600080fd5b5061035a6105733660046138c1565b6116c2565b34801561058457600080fd5b506012546104c0906001600160a01b031681565b3480156105a457600080fd5b5061035a6105b33660046137c5565b61174b565b3480156105c457600080fd5b50600a546104c0906001600160a01b031681565b3480156105e457600080fd5b506103146105f336600461385e565b611837565b34801561060457600080fd5b506001546104c0906001600160a01b031681565b34801561062457600080fd5b5061035a610633366004613666565b6119e8565b34801561064457600080fd5b5061035a6106533660046138e5565b611a64565b34801561066457600080fd5b506003546103ea9060ff1681565b34801561067e57600080fd5b5061035a61068d366004613666565b611af8565b34801561069e57600080fd5b506009546104c0906001600160a01b031681565b3480156106be57600080fd5b5061035a611b74565b3480156106d357600080fd5b506103146106e2366004613666565b60146020526000908152604090205481565b34801561070057600080fd5b5061031461070f366004613666565b60116020526000908152604090205481565b34801561072d57600080fd5b5061031461073c36600461385e565b611c71565b34801561074d57600080fd5b5061031461075c36600461385e565b611df4565b34801561076d57600080fd5b506000546104c0906201000090046001600160a01b031681565b34801561079357600080fd5b5061031460025481565b3480156107a957600080fd5b506005546104c09061010090046001600160a01b031681565b3480156107ce57600080fd5b5061035a6107dd3660046136fa565b611f75565b3480156107ee57600080fd5b50600f546104c0906001600160a01b031681565b34801561080e57600080fd5b5061031461081d3660046138e5565b611fff565b34801561082e57600080fd5b506103ea61083d366004613666565b60076020526000908152604090205460ff1681565b34801561085e57600080fd5b506008546104c0906001600160a01b031681565b34801561087e57600080fd5b5061035a61088d366004613666565b6121ba565b34801561089e57600080fd5b506103146108ad36600461385e565b6122d3565b3480156108be57600080fd5b5061035a6108cd366004613732565b6122df565b3480156108de57600080fd5b506103146108ed36600461385e565b61239e565b3480156108fe57600080fd5b5061035a61090d366004613666565b6124d6565b34801561091e57600080fd5b5061035a61092d366004613682565b612552565b34801561093e57600080fd5b5061035a61094d3660046136fa565b6127de565b34801561095e57600080fd5b5061035a612868565b34801561097357600080fd5b50600d546104c0906001600160a01b031681565b34801561099357600080fd5b5061035a6109a236600461385e565b6128c6565b6012546000906001600160a01b031615610a3a57601254604051630bfec24d60e11b8152600481018490526001600160a01b03909116906317fd849a9060240160206040518083038186803b1580156109ff57600080fd5b505afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3791906138fd565b91505b6000610a4584612993565b600f0b1315610ace57670de0b6b3a7640000610a60846129f8565b610a7290670de0b6b3a7640000613c40565b610a7c9084613c21565b610a869190613c01565b600b549091506001600160a01b0384811691161480610ab25750600c546001600160a01b038481169116145b15610ac957610ac664e8d4a5100082613c01565b90505b610bbb565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b158015610b2857600080fd5b505afa158015610b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6091906138fd565b9050670de0b6b3a7640000610b74856129f8565b610b8690670de0b6b3a7640000613c40565b82610b99670de0b6b3a764000087613c21565b610ba39190613c01565b610bad9190613c21565b610bb79190613c01565b9150505b92915050565b6000600160046000828254610bd69190613be9565b909155505060045460035460ff1615610c0a5760405162461bcd60e51b8152600401610c0190613ac6565b60405180910390fd5b600a546001600160a01b031660009081526006602052604090205460ff16610c445760405162461bcd60e51b8152600401610c0190613a25565b3360009081526007602052604090205460ff16610c735760405162461bcd60e51b8152600401610c0190613a9a565b600034118015610c835750600083115b610cc85760405162461bcd60e51b8152602060048201526016602482015275086c2dc40dcdee840caf0c6d0c2dcceca4060408aa8960531b6044820152606401610c01565b82341015610d325760405162461bcd60e51b815260206004820152603160248201527f416d6f756e74204554482068617320746f206265206c6172676572207468616e604482015270081cdc1958da599a595908185b5bdd5b9d607a1b6064820152608401610c01565b600a546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610d7657600080fd5b505afa158015610d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dae91906138fd565b9050600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e0057600080fd5b505af1158015610e14573d6000803e3d6000fd5b5050600a546040516370a0823160e01b8152306004820152600094508593506001600160a01b0390911691506370a082319060240160206040518083038186803b158015610e6157600080fd5b505afa158015610e75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9991906138fd565b610ea39190613c40565b9050848114610ef45760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f756768205745544820726563656976656400000000000000006044820152606401610c01565b600a54610f0b9086906001600160a01b0316612a39565b600554909450610f2a9061010090046001600160a01b03163386612ca6565b6040518581527f1d21653337ffd9933b1202c6f3c39cd605ff6743734277eb4e927881358330ca9060200160405180910390a150506004548114610f805760405162461bcd60e51b8152600401610c0190613b23565b50919050565b6001600160a01b038116610fdc5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f742062652030000000000000006044820152606401610c01565b600154600160a01b900460ff16156110485760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610c01565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b6110c9612cfc565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020016110b6565b61111f612cfc565b60035460ff16151581151514156111335750565b6003805460ff191682151590811790915560ff161561115157426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec5906020016110b6565b50565b60606001600160a01b038416156111cd5785858585856040516020016111b7959493929190613941565b604051602081830303815290604052905061121c565b6040516bffffffffffffffffffffffff19606088811b821660208401526001600160e81b031960e887901b16603484015284901b166037820152604b0160405160208183030381529060405290505b95945050505050565b61122d612cfc565b6001600160a01b0381166112535760405162461bcd60e51b8152600401610c0190613b5a565b60058054610100600160a81b0319166101006001600160a01b038416908102919091179091556040519081527f74a8764fc8d62d2d844c8c54426bd94ad034e0e92abdf5280ff75e2cbd678fb6906020016110b6565b601360205260009081526040902080546112c290613c83565b80601f01602080910402602001604051908101604052809291908181526020018280546112ee90613c83565b801561133b5780601f106113105761010080835404028352916020019161133b565b820191906000526020600020905b81548152906001019060200180831161131e57829003601f168201915b505050505081565b601060205260009081526040902080546112c290613c83565b611364612cfc565b6001600160a01b03841661138a5760405162461bcd60e51b8152600401610c0190613b5a565b80156113c1576001600160a01b03841660009081526010602052604090206060805190916113ba91608090613541565b50506113e6565b6001600160a01b03841660009081526010602052604090206113e49084846135c5565b505b7fd3b7ee92d897f8cd1e3f97fea5e9af64ae3e6dbb89aec16c39e922958af0e4ef8484848460405161141b94939291906139af565b60405180910390a150505050565b611431612cfc565b6001600160a01b0381166114575760405162461bcd60e51b8152600401610c0190613b5a565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fd2d21ca3f6860b1fb0c8a54f761f0cd731cdc2e66db8d850c25eabbbbab0411e906020016110b6565b6000806114b184612993565b600f0b131561154157600b546000906001600160a01b03858116911614806114e65750600c546001600160a01b038581169116145b6114f057826114ff565b6114ff64e8d4a5100084613c21565b9050670de0b6b3a7640000611513856129f8565b61152590670de0b6b3a7640000613be9565b61152f9083613c21565b6115399190613c01565b91505061162e565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b15801561159b57600080fd5b505afa1580156115af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d391906138fd565b9050670de0b6b3a76400006115e7856129f8565b6115f990670de0b6b3a7640000613be9565b670de0b6b3a764000061160c8487613c21565b6116169190613c01565b6116209190613c21565b61162a9190613c01565b9150505b6012546001600160a01b031615610bbb5760125460405163edc892e160e01b8152600481018390526001600160a01b039091169063edc892e19060240160206040518083038186803b15801561168357600080fd5b505afa158015611697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bb91906138fd565b9392505050565b6116ca612cfc565b6001600160a01b0381166116f05760405162461bcd60e51b8152600401610c0190613b5a565b6001600160a01b0381166000818152601160209081526040918290208590558151858152908101929092527f8ca223f1e27a56a1e9f08d9b3c59f60de0598f93413be07e2580ef1a84e4818c91015b60405180910390a15050565b600054610100900460ff166117665760005460ff161561176a565b303b155b6117cd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c01565b600054610100900460ff161580156117ef576000805461ffff19166101011790555b6117f883610f86565b611800612868565b60058054610100600160a81b0319166101006001600160a01b038516021790558015611832576000805461ff00191690555b505050565b600060016004600082825461184c9190613be9565b909155505060045460035460ff16156118775760405162461bcd60e51b8152600401610c0190613ac6565b6001600160a01b03841660009081526006602052604090205460ff166118af5760405162461bcd60e51b8152600401610c0190613a25565b3360009081526007602052604090205460ff166118de5760405162461bcd60e51b8152600401610c0190613a9a565b6005546118fb9061010090046001600160a01b0316333086612d76565b600d54600160a01b900460ff1680156119505750600b546001600160a01b03858116911614806119385750600d546001600160a01b038581169116145b806119505750600c546001600160a01b038581169116145b156119665761195f8484612db4565b9150611973565b6119708385612f84565b91505b6119876001600160a01b0385163384612ca6565b7f959784334a6c68fffefe45835ca75cf1ce27c5fe9f0e424f81fefcd7663622d384846040516119b89291906139f9565b60405180910390a160045481146119e15760405162461bcd60e51b8152600401610c0190613b23565b5092915050565b6119f0612cfc565b6001600160a01b038116611a165760405162461bcd60e51b8152600401610c0190613b5a565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe390bcec6614d6b1f8ae47a4d9d46531ce328e3d293ecd6ddd015cb01eff0300906020016110b6565b611a6c612cfc565b66470de4df820000811115611ac35760405162461bcd60e51b815260206004820152601a60248201527f43616e206e6f742073657420686967686572207468616e2032250000000000006044820152606401610c01565b600e8190556040518181527f32266df6c6a587ffa9b674c3cba38c095d95f15cf737e81c544f426c92705170906020016110b6565b611b00612cfc565b6001600160a01b038116611b265760405162461bcd60e51b8152600401610c0190613b5a565b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527ff724a45d041687842411f2b977ef22ab8f43c8f1104f4592b42a00f9b34a643d906020016110b6565b6001546001600160a01b03163314611bec5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610c01565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b6012546000906001600160a01b031615611d0457601254604051630bfec24d60e11b8152600481018490526001600160a01b03909116906317fd849a9060240160206040518083038186803b158015611cc957600080fd5b505afa158015611cdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0191906138fd565b91505b6000611d0f84612993565b600f0b1315611d3c57670de0b6b3a7640000611d2a846129f8565b610a7290670de0b6b3a7640000613be9565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b158015611d9657600080fd5b505afa158015611daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dce91906138fd565b9050670de0b6b3a7640000611de2856129f8565b610b8690670de0b6b3a7640000613be9565b6000600160046000828254611e099190613be9565b909155505060045460035460ff1615611e345760405162461bcd60e51b8152600401610c0190613ac6565b6001600160a01b03841660009081526006602052604090205460ff16611e6c5760405162461bcd60e51b8152600401610c0190613a25565b3360009081526007602052604090205460ff16611e9b5760405162461bcd60e51b8152600401610c0190613a9a565b611eb06001600160a01b038516333086612d76565b600d54600160a01b900460ff168015611f055750600b546001600160a01b0385811691161480611eed5750600d546001600160a01b038581169116145b80611f055750600c546001600160a01b038581169116145b15611f1b57611f1484846131d4565b9150611f28565b611f258385612a39565b91505b600554611f449061010090046001600160a01b03163384612ca6565b7f5853647b869c89b776cea981783043fb2c8d9f0f16d6596c592fe9c46d18bcf484846040516119b89291906139f9565b611f7d612cfc565b6001600160a01b038216611fa35760405162461bcd60e51b8152600401610c0190613b5a565b6001600160a01b038216600081815260076020908152604091829020805460ff19168515159081179091558251938452908301527f38c2fbcd5e86222b26aadd09cdf191ada1a02ecd24c0bad919cce414e83bce86910161173f565b60006001600460008282546120149190613be9565b909155505060045460035460ff161561203f5760405162461bcd60e51b8152600401610c0190613ac6565b3360009081526007602052604090205460ff1661206e5760405162461bcd60e51b8152600401610c0190613a9a565b60055461208b9061010090046001600160a01b0316333086612d76565b600a546120a29084906001600160a01b0316612f84565b600a54604051632e1a7d4d60e01b8152600481018390529193506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156120e957600080fd5b505af11580156120fd573d6000803e3d6000fd5b50506040516000925033915084156108fc0290859084818181858888f193505050509050806121655760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610c01565b6040518481527f06c33e95d844c66a239d77c9dde1638cf061853d0fb9b77624ba3930ea5e13409060200160405180910390a1506004548114610f805760405162461bcd60e51b8152600401610c0190613b23565b6121c2612cfc565b6001600160a01b03811661220a5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610c01565b600154600160a81b900460ff161561225a5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610c01565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91016110b6565b60006116bb8383611c71565b6122e7612cfc565b6001600160a01b03841661230d5760405162461bcd60e51b8152600401610c0190613b5a565b8015612344576001600160a01b038416600090815260136020526040902060608051909161233d91608090613541565b5050612369565b6001600160a01b03841660009081526013602052604090206123679084846135c5565b505b7fb3e563b89bf0a11edbcc16ff8d93058a89d8b9b250963ec2092cba251db7e80e8484848460405161141b94939291906139af565b6000806123aa84612993565b600f0b131561241e57600b546000906001600160a01b03858116911614806123df5750600c546001600160a01b038581169116145b6123e957826123f8565b6123f864e8d4a5100084613c21565b9050670de0b6b3a764000061240c856129f8565b61152590670de0b6b3a7640000613c40565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b15801561247857600080fd5b505afa15801561248c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b091906138fd565b9050670de0b6b3a76400006124c4856129f8565b6115f990670de0b6b3a7640000613c40565b6124de612cfc565b6001600160a01b0381166125045760405162461bcd60e51b8152600401610c0190613b5a565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f198db6e425fb8aafd1823c6ca50be2d51e5764571a5ae0f0f21c6812e45def0b906020016110b6565b61255a612cfc565b6001600160a01b0386166125805760405162461bcd60e51b8152600401610c0190613b5a565b600f80546001600160a01b038089166001600160a01b031992831617909255600d80548884169083168117909155600b8054888516908416179055600c80549387169390921692909217905560405163095ea7b360e01b815263095ea7b3906125f1908990600019906004016139f9565b602060405180830381600087803b15801561260b57600080fd5b505af115801561261f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061264391906138a5565b50600b5460405163095ea7b360e01b81526001600160a01b039091169063095ea7b390612678908990600019906004016139f9565b602060405180830381600087803b15801561269257600080fd5b505af11580156126a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ca91906138a5565b50600c5460405163095ea7b360e01b81526001600160a01b039091169063095ea7b3906126ff908990600019906004016139f9565b602060405180830381600087803b15801561271957600080fd5b505af115801561272d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275191906138a5565b50600d8054831515600160a01b810260ff60a01b1990921691909117909155600e829055604080516001600160a01b03898116825288811660208301528781168284015286166060820152608081019290925260a08201839052517fa4db60d8d97ea35442f00dd184c71f951541462f55930f217cd83ae236ec74ab9181900360c00190a1505050505050565b6127e6612cfc565b6001600160a01b03821661280c5760405162461bcd60e51b8152600401610c0190613b5a565b6001600160a01b038216600081815260066020908152604091829020805460ff19168515159081179091558251938452908301527f5224b67e466b1ae7b3e4397bec3663e69813fca9262c30a6c7594b92badaf041910161173f565b60055460ff16156128b15760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610c01565b6005805460ff19166001908117909155600455565b6128ce612cfc565b6001600160a01b0382166128f45760405162461bcd60e51b8152600401610c0190613b5a565b600e548111156129465760405162461bcd60e51b815260206004820152601f60248201527f43616e206e6f742073657420686967686572207468616e2064656661756c74006044820152606401610c01565b6001600160a01b03821660009081526014602052604090819020829055517fbecbc03040bc790a255d073a8a8b65af77277f1f0d20ae79890613a98e5508729061173f90849084906139f9565b600d546000906001600160a01b03838116911614156129b457506001919050565b600b546001600160a01b03838116911614156129d257506002919050565b600c546001600160a01b03838116911614156129f057506003919050565b506000919050565b6001600160a01b038116600090815260146020526040812054612a1d57600e54610bbb565b506001600160a01b031660009081526014602052604090205490565b60085460405163095ea7b360e01b81526000916001600160a01b038085169263095ea7b392612a6e92169087906004016139f9565b602060405180830381600087803b158015612a8857600080fd5b505af1158015612a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac091906138a5565b506001600160a01b03821660009081526010602052604081208054612ae490613c83565b80601f0160208091040260200160405190810160405280929190818152602001828054612b1090613c83565b8015612b5d5780601f10612b3257610100808354040283529160200191612b5d565b820191906000526020600020905b815481529060010190602001808311612b4057829003601f168201915b50505050509050805160001415612bb657600a54600554604051610bb892612ba392879285926001600160a01b0390811692849261010090910490911690602001613941565b6040516020818303038152906040529150505b6040805160a0810182528281523060208201526000918101612bd942600f613be9565b8152602001868152602001612bee868861239e565b905260085460405163c04b8d5960e01b81529192506001600160a01b03169063c04b8d5990612c21908490600401613b91565b602060405180830381600087803b158015612c3b57600080fd5b505af1158015612c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c7391906138fd565b9250612c7f84866114a5565b831115612c9e5760405162461bcd60e51b8152600401610c0190613a55565b505092915050565b6118328363a9059cbb60e01b8484604051602401612cc59291906139f9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526132f7565b6000546201000090046001600160a01b03163314612d745760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610c01565b565b6040516001600160a01b0380851660248301528316604482015260648101829052612dae9085906323b872dd60e01b90608401612cc5565b50505050565b600080612dc084612993565b9050600081600f0b138015612dde5750600d54600160a01b900460ff165b612e235760405162461bcd60e51b81526020600482015260166024820152751d5b9cdd5c1c1bdc9d19590818dbdb1b185d195c985b60521b6044820152606401610c01565b600554600f5460405163095ea7b360e01b81526001600160a01b0361010090930483169263095ea7b392612e5e9291169087906004016139f9565b602060405180830381600087803b158015612e7857600080fd5b505af1158015612e8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eb091906138a5565b50600f546001600160a01b031663a6417ed660008386612ed089826109a7565b6040516001600160e01b031960e087901b168152600f94850b60048201529290930b602483015260448201526064810191909152608401602060405180830381600087803b158015612f2157600080fd5b505af1158015612f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f5991906138fd565b9150612f6584846122d3565b8211156119e15760405162461bcd60e51b8152600401610c0190613a55565b60055460085460405163095ea7b360e01b815260009261010090046001600160a01b039081169263095ea7b392612fc3929091169087906004016139f9565b602060405180830381600087803b158015612fdd57600080fd5b505af1158015612ff1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301591906138a5565b506001600160a01b0382166000908152601360205260408120805461303990613c83565b80601f016020809104026020016040519081016040528092919081815260200182805461306590613c83565b80156130b25780601f10613087576101008083540402835291602001916130b2565b820191906000526020600020905b81548152906001019060200180831161309557829003601f168201915b5050505050905080516000141561310b57600554600a54604051610bb8926130f8926001600160a01b036101009092048216928592919091169082908990602001613941565b6040516020818303038152906040529150505b6040805160a081018252828152306020820152600091810161312e42600f613be9565b815260200186815260200161314386886109a7565b905260085460405163c04b8d5960e01b81529192506001600160a01b03169063c04b8d5990613176908490600401613b91565b602060405180830381600087803b15801561319057600080fd5b505af11580156131a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131c891906138fd565b9250612c7f84866122d3565b6000806131e084612993565b9050600081600f0b1380156131fe5750600d54600160a01b900460ff165b6132435760405162461bcd60e51b81526020600482015260166024820152751d5b9cdd5c1c1bdc9d19590818dbdb1b185d195c985b60521b6044820152606401610c01565b600f546001600160a01b031663a6417ed682600086613262898261239e565b6040516001600160e01b031960e087901b168152600f94850b60048201529290930b602483015260448201526064810191909152608401602060405180830381600087803b1580156132b357600080fd5b505af11580156132c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132eb91906138fd565b9150612f6584846114a5565b600061334c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133c99092919063ffffffff16565b805190915015611832578080602001905181019061336a91906138a5565b6118325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c01565b60606133d884846000856133e0565b949350505050565b6060824710156134415760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c01565b843b61348f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c01565b600080866001600160a01b031685876040516134ab9190613993565b60006040518083038185875af1925050503d80600081146134e8576040519150601f19603f3d011682016040523d82523d6000602084013e6134ed565b606091505b50915091506134fd828286613508565b979650505050505050565b606083156135175750816116bb565b8251156135275782518084602001fd5b8160405162461bcd60e51b8152600401610c019190613a12565b82805461354d90613c83565b90600052602060002090601f01602090048101928261356f57600085556135b5565b82601f1061358857805160ff19168380011785556135b5565b828001600101855582156135b5579182015b828111156135b557825182559160200191906001019061359a565b506135c1929150613639565b5090565b8280546135d190613c83565b90600052602060002090601f0160209004810192826135f357600085556135b5565b82601f1061360c5782800160ff198235161785556135b5565b828001600101855582156135b5579182015b828111156135b557823582559160200191906001019061361e565b5b808211156135c1576000815560010161363a565b803562ffffff8116811461366157600080fd5b919050565b600060208284031215613677578081fd5b81356116bb81613cce565b60008060008060008060c0878903121561369a578182fd5b86356136a581613cce565b955060208701356136b581613cce565b945060408701356136c581613cce565b935060608701356136d581613cce565b925060808701356136e581613ce3565b8092505060a087013590509295509295509295565b6000806040838503121561370c578182fd5b823561371781613cce565b9150602083013561372781613ce3565b809150509250929050565b60008060008060608587031215613747578384fd5b843561375281613cce565b9350602085013567ffffffffffffffff8082111561376e578485fd5b818701915087601f830112613781578485fd5b81358181111561378f578586fd5b8860208285010111156137a0578586fd5b60208301955080945050505060408501356137ba81613ce3565b939692955090935050565b600080604083850312156137d7578182fd5b82356137e281613cce565b9150602083013561372781613cce565b600080600080600060a08688031215613809578081fd5b853561381481613cce565b94506138226020870161364e565b9350604086013561383281613cce565b92506138406060870161364e565b9150608086013561385081613cce565b809150509295509295909350565b60008060408385031215613870578182fd5b823561387b81613cce565b946020939093013593505050565b60006020828403121561389a578081fd5b81356116bb81613ce3565b6000602082840312156138b6578081fd5b81516116bb81613ce3565b600080604083850312156138d3578182fd5b82359150602083013561372781613cce565b6000602082840312156138f6578081fd5b5035919050565b60006020828403121561390e578081fd5b5051919050565b6000815180845261392d816020860160208601613c57565b601f01601f19169290920160200192915050565b6bffffffffffffffffffffffff19606096871b811682526001600160e81b031960e896871b8116601484015294871b811660178301529290941b909216602b840152921b909116602e82015260420190565b600082516139a5818460208701613c57565b9190910192915050565b6001600160a01b038516815260606020820181905281018390528284608083013760008184016080908101919091529115156040820152601f909201601f19169091010192915050565b6001600160a01b03929092168252602082015260400190565b6020815260006116bb6020830184613915565b602080825260169082015275155b9cdd5c1c1bdc9d19590818dbdb1b185d195c985b60521b604082015260600190565b60208082526025908201527f416d6f756e742061626f7665206d617820616c6c6f7765642070656720736c69604082015264707061676560d81b606082015260800190565b6020808252601290820152712ab739bab83837b93a32b21031b0b63632b960711b604082015260600190565b6020808252603c908201527f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642060408201527f7768696c652074686520636f6e74726163742069732070617573656400000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601b908201527f43616e206e6f74207365742061207a65726f2061646472657373210000000000604082015260600190565b602081526000825160a06020840152613bad60c0840182613915565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60008219821115613bfc57613bfc613cb8565b500190565b600082613c1c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615613c3b57613c3b613cb8565b500290565b600082821015613c5257613c52613cb8565b500390565b60005b83811015613c72578181015183820152602001613c5a565b83811115612dae5750506000910152565b600181811c90821680613c9757607f821691505b60208210811415610f8057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461118a57600080fd5b801515811461118a57600080fdfea2646970667358221220ee358eb30686d1732d39441843462979ff8218151d995c9365180ef7a85ddc8064736f6c63430008040033

Deployed Bytecode

0x6080604052600436106102e85760003560e01c80635c975abb11610190578063b45e98d9116100dc578063cb4ba52411610095578063da6070251161006f578063da60702514610932578063ebc7977214610952578063f4b9fa7514610967578063f5866a461461098757600080fd5b8063cb4ba524146108d2578063d0ebdbe7146108f2578063d3c4297c1461091257600080fd5b8063b45e98d914610802578063b98b63f814610822578063c31c9c0714610852578063c3b83f5f14610872578063c42f4c8b14610892578063c4ebcb54146108b257600080fd5b80638826e5de1161014957806391b4ded91161012357806391b4ded9146107875780639324cac71461079d578063953caf51146107c2578063a5bf660d146107e257600080fd5b80638826e5de146107215780638b3ac44c146107415780638da5cb5b1461076157600080fd5b80635c975abb14610658578063724e78da14610672578063741bef1a1461069257806379ba5097146106b25780637d904d3a146106c757806382e76c36146106f457600080fd5b80632f48ab7d1161024f578063481c6a75116102085780634c932368116101e25780634c932368146105d857806353a47bb7146105f85780635b769f3c146106185780635c5189bb1461063857600080fd5b8063481c6a7514610578578063485cc955146105985780634aa4a4fc146105b857600080fd5b80632f48ab7d146104a057806338053078146104d85780633e413bee146104f85780634127365714610518578063420a038c14610538578063477bf5a51461055857600080fd5b80631fbb38e8116102a15780631fbb38e8146103c957806321ef44c6146103fa5780632213af251461041a57806322bdb38c1461043a5780632909f51a1461045a5780632ab8de381461047057600080fd5b80630d9393cf146102f45780631321b85d1461032757806313af40351461033a5780631627540c1461035c57806316c38b3c1461037c578063178b8ac81461039c57600080fd5b366102ef57005b600080fd5b34801561030057600080fd5b5061031461030f36600461385e565b6109a7565b6040519081526020015b60405180910390f35b6103146103353660046138e5565b610bc1565b34801561034657600080fd5b5061035a610355366004613666565b610f86565b005b34801561036857600080fd5b5061035a610377366004613666565b6110c1565b34801561038857600080fd5b5061035a610397366004613889565b611117565b3480156103a857600080fd5b506103bc6103b73660046137f2565b61118d565b60405161031e9190613a12565b3480156103d557600080fd5b50600d546103ea90600160a01b900460ff1681565b604051901515815260200161031e565b34801561040657600080fd5b5061035a610415366004613666565b611225565b34801561042657600080fd5b506103bc610435366004613666565b6112a9565b34801561044657600080fd5b506103bc610455366004613666565b611343565b34801561046657600080fd5b50610314600e5481565b34801561047c57600080fd5b506103ea61048b366004613666565b60066020526000908152604090205460ff1681565b3480156104ac57600080fd5b50600c546104c0906001600160a01b031681565b6040516001600160a01b03909116815260200161031e565b3480156104e457600080fd5b5061035a6104f3366004613732565b61135c565b34801561050457600080fd5b50600b546104c0906001600160a01b031681565b34801561052457600080fd5b5061035a610533366004613666565b611429565b34801561054457600080fd5b5061031461055336600461385e565b6114a5565b34801561056457600080fd5b5061035a6105733660046138c1565b6116c2565b34801561058457600080fd5b506012546104c0906001600160a01b031681565b3480156105a457600080fd5b5061035a6105b33660046137c5565b61174b565b3480156105c457600080fd5b50600a546104c0906001600160a01b031681565b3480156105e457600080fd5b506103146105f336600461385e565b611837565b34801561060457600080fd5b506001546104c0906001600160a01b031681565b34801561062457600080fd5b5061035a610633366004613666565b6119e8565b34801561064457600080fd5b5061035a6106533660046138e5565b611a64565b34801561066457600080fd5b506003546103ea9060ff1681565b34801561067e57600080fd5b5061035a61068d366004613666565b611af8565b34801561069e57600080fd5b506009546104c0906001600160a01b031681565b3480156106be57600080fd5b5061035a611b74565b3480156106d357600080fd5b506103146106e2366004613666565b60146020526000908152604090205481565b34801561070057600080fd5b5061031461070f366004613666565b60116020526000908152604090205481565b34801561072d57600080fd5b5061031461073c36600461385e565b611c71565b34801561074d57600080fd5b5061031461075c36600461385e565b611df4565b34801561076d57600080fd5b506000546104c0906201000090046001600160a01b031681565b34801561079357600080fd5b5061031460025481565b3480156107a957600080fd5b506005546104c09061010090046001600160a01b031681565b3480156107ce57600080fd5b5061035a6107dd3660046136fa565b611f75565b3480156107ee57600080fd5b50600f546104c0906001600160a01b031681565b34801561080e57600080fd5b5061031461081d3660046138e5565b611fff565b34801561082e57600080fd5b506103ea61083d366004613666565b60076020526000908152604090205460ff1681565b34801561085e57600080fd5b506008546104c0906001600160a01b031681565b34801561087e57600080fd5b5061035a61088d366004613666565b6121ba565b34801561089e57600080fd5b506103146108ad36600461385e565b6122d3565b3480156108be57600080fd5b5061035a6108cd366004613732565b6122df565b3480156108de57600080fd5b506103146108ed36600461385e565b61239e565b3480156108fe57600080fd5b5061035a61090d366004613666565b6124d6565b34801561091e57600080fd5b5061035a61092d366004613682565b612552565b34801561093e57600080fd5b5061035a61094d3660046136fa565b6127de565b34801561095e57600080fd5b5061035a612868565b34801561097357600080fd5b50600d546104c0906001600160a01b031681565b34801561099357600080fd5b5061035a6109a236600461385e565b6128c6565b6012546000906001600160a01b031615610a3a57601254604051630bfec24d60e11b8152600481018490526001600160a01b03909116906317fd849a9060240160206040518083038186803b1580156109ff57600080fd5b505afa158015610a13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3791906138fd565b91505b6000610a4584612993565b600f0b1315610ace57670de0b6b3a7640000610a60846129f8565b610a7290670de0b6b3a7640000613c40565b610a7c9084613c21565b610a869190613c01565b600b549091506001600160a01b0384811691161480610ab25750600c546001600160a01b038481169116145b15610ac957610ac664e8d4a5100082613c01565b90505b610bbb565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b158015610b2857600080fd5b505afa158015610b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6091906138fd565b9050670de0b6b3a7640000610b74856129f8565b610b8690670de0b6b3a7640000613c40565b82610b99670de0b6b3a764000087613c21565b610ba39190613c01565b610bad9190613c21565b610bb79190613c01565b9150505b92915050565b6000600160046000828254610bd69190613be9565b909155505060045460035460ff1615610c0a5760405162461bcd60e51b8152600401610c0190613ac6565b60405180910390fd5b600a546001600160a01b031660009081526006602052604090205460ff16610c445760405162461bcd60e51b8152600401610c0190613a25565b3360009081526007602052604090205460ff16610c735760405162461bcd60e51b8152600401610c0190613a9a565b600034118015610c835750600083115b610cc85760405162461bcd60e51b8152602060048201526016602482015275086c2dc40dcdee840caf0c6d0c2dcceca4060408aa8960531b6044820152606401610c01565b82341015610d325760405162461bcd60e51b815260206004820152603160248201527f416d6f756e74204554482068617320746f206265206c6172676572207468616e604482015270081cdc1958da599a595908185b5bdd5b9d607a1b6064820152608401610c01565b600a546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610d7657600080fd5b505afa158015610d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dae91906138fd565b9050600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e0057600080fd5b505af1158015610e14573d6000803e3d6000fd5b5050600a546040516370a0823160e01b8152306004820152600094508593506001600160a01b0390911691506370a082319060240160206040518083038186803b158015610e6157600080fd5b505afa158015610e75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9991906138fd565b610ea39190613c40565b9050848114610ef45760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f756768205745544820726563656976656400000000000000006044820152606401610c01565b600a54610f0b9086906001600160a01b0316612a39565b600554909450610f2a9061010090046001600160a01b03163386612ca6565b6040518581527f1d21653337ffd9933b1202c6f3c39cd605ff6743734277eb4e927881358330ca9060200160405180910390a150506004548114610f805760405162461bcd60e51b8152600401610c0190613b23565b50919050565b6001600160a01b038116610fdc5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f742062652030000000000000006044820152606401610c01565b600154600160a01b900460ff16156110485760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b6064820152608401610c01565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b6110c9612cfc565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020016110b6565b61111f612cfc565b60035460ff16151581151514156111335750565b6003805460ff191682151590811790915560ff161561115157426002555b60035460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec5906020016110b6565b50565b60606001600160a01b038416156111cd5785858585856040516020016111b7959493929190613941565b604051602081830303815290604052905061121c565b6040516bffffffffffffffffffffffff19606088811b821660208401526001600160e81b031960e887901b16603484015284901b166037820152604b0160405160208183030381529060405290505b95945050505050565b61122d612cfc565b6001600160a01b0381166112535760405162461bcd60e51b8152600401610c0190613b5a565b60058054610100600160a81b0319166101006001600160a01b038416908102919091179091556040519081527f74a8764fc8d62d2d844c8c54426bd94ad034e0e92abdf5280ff75e2cbd678fb6906020016110b6565b601360205260009081526040902080546112c290613c83565b80601f01602080910402602001604051908101604052809291908181526020018280546112ee90613c83565b801561133b5780601f106113105761010080835404028352916020019161133b565b820191906000526020600020905b81548152906001019060200180831161131e57829003601f168201915b505050505081565b601060205260009081526040902080546112c290613c83565b611364612cfc565b6001600160a01b03841661138a5760405162461bcd60e51b8152600401610c0190613b5a565b80156113c1576001600160a01b03841660009081526010602052604090206060805190916113ba91608090613541565b50506113e6565b6001600160a01b03841660009081526010602052604090206113e49084846135c5565b505b7fd3b7ee92d897f8cd1e3f97fea5e9af64ae3e6dbb89aec16c39e922958af0e4ef8484848460405161141b94939291906139af565b60405180910390a150505050565b611431612cfc565b6001600160a01b0381166114575760405162461bcd60e51b8152600401610c0190613b5a565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fd2d21ca3f6860b1fb0c8a54f761f0cd731cdc2e66db8d850c25eabbbbab0411e906020016110b6565b6000806114b184612993565b600f0b131561154157600b546000906001600160a01b03858116911614806114e65750600c546001600160a01b038581169116145b6114f057826114ff565b6114ff64e8d4a5100084613c21565b9050670de0b6b3a7640000611513856129f8565b61152590670de0b6b3a7640000613be9565b61152f9083613c21565b6115399190613c01565b91505061162e565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b15801561159b57600080fd5b505afa1580156115af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d391906138fd565b9050670de0b6b3a76400006115e7856129f8565b6115f990670de0b6b3a7640000613be9565b670de0b6b3a764000061160c8487613c21565b6116169190613c01565b6116209190613c21565b61162a9190613c01565b9150505b6012546001600160a01b031615610bbb5760125460405163edc892e160e01b8152600481018390526001600160a01b039091169063edc892e19060240160206040518083038186803b15801561168357600080fd5b505afa158015611697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116bb91906138fd565b9392505050565b6116ca612cfc565b6001600160a01b0381166116f05760405162461bcd60e51b8152600401610c0190613b5a565b6001600160a01b0381166000818152601160209081526040918290208590558151858152908101929092527f8ca223f1e27a56a1e9f08d9b3c59f60de0598f93413be07e2580ef1a84e4818c91015b60405180910390a15050565b600054610100900460ff166117665760005460ff161561176a565b303b155b6117cd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c01565b600054610100900460ff161580156117ef576000805461ffff19166101011790555b6117f883610f86565b611800612868565b60058054610100600160a81b0319166101006001600160a01b038516021790558015611832576000805461ff00191690555b505050565b600060016004600082825461184c9190613be9565b909155505060045460035460ff16156118775760405162461bcd60e51b8152600401610c0190613ac6565b6001600160a01b03841660009081526006602052604090205460ff166118af5760405162461bcd60e51b8152600401610c0190613a25565b3360009081526007602052604090205460ff166118de5760405162461bcd60e51b8152600401610c0190613a9a565b6005546118fb9061010090046001600160a01b0316333086612d76565b600d54600160a01b900460ff1680156119505750600b546001600160a01b03858116911614806119385750600d546001600160a01b038581169116145b806119505750600c546001600160a01b038581169116145b156119665761195f8484612db4565b9150611973565b6119708385612f84565b91505b6119876001600160a01b0385163384612ca6565b7f959784334a6c68fffefe45835ca75cf1ce27c5fe9f0e424f81fefcd7663622d384846040516119b89291906139f9565b60405180910390a160045481146119e15760405162461bcd60e51b8152600401610c0190613b23565b5092915050565b6119f0612cfc565b6001600160a01b038116611a165760405162461bcd60e51b8152600401610c0190613b5a565b600a80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe390bcec6614d6b1f8ae47a4d9d46531ce328e3d293ecd6ddd015cb01eff0300906020016110b6565b611a6c612cfc565b66470de4df820000811115611ac35760405162461bcd60e51b815260206004820152601a60248201527f43616e206e6f742073657420686967686572207468616e2032250000000000006044820152606401610c01565b600e8190556040518181527f32266df6c6a587ffa9b674c3cba38c095d95f15cf737e81c544f426c92705170906020016110b6565b611b00612cfc565b6001600160a01b038116611b265760405162461bcd60e51b8152600401610c0190613b5a565b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527ff724a45d041687842411f2b977ef22ab8f43c8f1104f4592b42a00f9b34a643d906020016110b6565b6001546001600160a01b03163314611bec5760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b6064820152608401610c01565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b6012546000906001600160a01b031615611d0457601254604051630bfec24d60e11b8152600481018490526001600160a01b03909116906317fd849a9060240160206040518083038186803b158015611cc957600080fd5b505afa158015611cdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0191906138fd565b91505b6000611d0f84612993565b600f0b1315611d3c57670de0b6b3a7640000611d2a846129f8565b610a7290670de0b6b3a7640000613be9565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b158015611d9657600080fd5b505afa158015611daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dce91906138fd565b9050670de0b6b3a7640000611de2856129f8565b610b8690670de0b6b3a7640000613be9565b6000600160046000828254611e099190613be9565b909155505060045460035460ff1615611e345760405162461bcd60e51b8152600401610c0190613ac6565b6001600160a01b03841660009081526006602052604090205460ff16611e6c5760405162461bcd60e51b8152600401610c0190613a25565b3360009081526007602052604090205460ff16611e9b5760405162461bcd60e51b8152600401610c0190613a9a565b611eb06001600160a01b038516333086612d76565b600d54600160a01b900460ff168015611f055750600b546001600160a01b0385811691161480611eed5750600d546001600160a01b038581169116145b80611f055750600c546001600160a01b038581169116145b15611f1b57611f1484846131d4565b9150611f28565b611f258385612a39565b91505b600554611f449061010090046001600160a01b03163384612ca6565b7f5853647b869c89b776cea981783043fb2c8d9f0f16d6596c592fe9c46d18bcf484846040516119b89291906139f9565b611f7d612cfc565b6001600160a01b038216611fa35760405162461bcd60e51b8152600401610c0190613b5a565b6001600160a01b038216600081815260076020908152604091829020805460ff19168515159081179091558251938452908301527f38c2fbcd5e86222b26aadd09cdf191ada1a02ecd24c0bad919cce414e83bce86910161173f565b60006001600460008282546120149190613be9565b909155505060045460035460ff161561203f5760405162461bcd60e51b8152600401610c0190613ac6565b3360009081526007602052604090205460ff1661206e5760405162461bcd60e51b8152600401610c0190613a9a565b60055461208b9061010090046001600160a01b0316333086612d76565b600a546120a29084906001600160a01b0316612f84565b600a54604051632e1a7d4d60e01b8152600481018390529193506001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156120e957600080fd5b505af11580156120fd573d6000803e3d6000fd5b50506040516000925033915084156108fc0290859084818181858888f193505050509050806121655760405162461bcd60e51b81526020600482015260146024820152732330b4b632b2103a379039b2b7321022ba3432b960611b6044820152606401610c01565b6040518481527f06c33e95d844c66a239d77c9dde1638cf061853d0fb9b77624ba3930ea5e13409060200160405180910390a1506004548114610f805760405162461bcd60e51b8152600401610c0190613b23565b6121c2612cfc565b6001600160a01b03811661220a5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610c01565b600154600160a81b900460ff161561225a5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b6044820152606401610c01565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91016110b6565b60006116bb8383611c71565b6122e7612cfc565b6001600160a01b03841661230d5760405162461bcd60e51b8152600401610c0190613b5a565b8015612344576001600160a01b038416600090815260136020526040902060608051909161233d91608090613541565b5050612369565b6001600160a01b03841660009081526013602052604090206123679084846135c5565b505b7fb3e563b89bf0a11edbcc16ff8d93058a89d8b9b250963ec2092cba251db7e80e8484848460405161141b94939291906139af565b6000806123aa84612993565b600f0b131561241e57600b546000906001600160a01b03858116911614806123df5750600c546001600160a01b038581169116145b6123e957826123f8565b6123f864e8d4a5100084613c21565b9050670de0b6b3a764000061240c856129f8565b61152590670de0b6b3a7640000613c40565b6009546001600160a01b038481166000908152601160205260408082205490516315905ec160e31b815260048101919091529092919091169063ac82f6089060240160206040518083038186803b15801561247857600080fd5b505afa15801561248c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b091906138fd565b9050670de0b6b3a76400006124c4856129f8565b6115f990670de0b6b3a7640000613c40565b6124de612cfc565b6001600160a01b0381166125045760405162461bcd60e51b8152600401610c0190613b5a565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f198db6e425fb8aafd1823c6ca50be2d51e5764571a5ae0f0f21c6812e45def0b906020016110b6565b61255a612cfc565b6001600160a01b0386166125805760405162461bcd60e51b8152600401610c0190613b5a565b600f80546001600160a01b038089166001600160a01b031992831617909255600d80548884169083168117909155600b8054888516908416179055600c80549387169390921692909217905560405163095ea7b360e01b815263095ea7b3906125f1908990600019906004016139f9565b602060405180830381600087803b15801561260b57600080fd5b505af115801561261f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061264391906138a5565b50600b5460405163095ea7b360e01b81526001600160a01b039091169063095ea7b390612678908990600019906004016139f9565b602060405180830381600087803b15801561269257600080fd5b505af11580156126a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ca91906138a5565b50600c5460405163095ea7b360e01b81526001600160a01b039091169063095ea7b3906126ff908990600019906004016139f9565b602060405180830381600087803b15801561271957600080fd5b505af115801561272d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275191906138a5565b50600d8054831515600160a01b810260ff60a01b1990921691909117909155600e829055604080516001600160a01b03898116825288811660208301528781168284015286166060820152608081019290925260a08201839052517fa4db60d8d97ea35442f00dd184c71f951541462f55930f217cd83ae236ec74ab9181900360c00190a1505050505050565b6127e6612cfc565b6001600160a01b03821661280c5760405162461bcd60e51b8152600401610c0190613b5a565b6001600160a01b038216600081815260066020908152604091829020805460ff19168515159081179091558251938452908301527f5224b67e466b1ae7b3e4397bec3663e69813fca9262c30a6c7594b92badaf041910161173f565b60055460ff16156128b15760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610c01565b6005805460ff19166001908117909155600455565b6128ce612cfc565b6001600160a01b0382166128f45760405162461bcd60e51b8152600401610c0190613b5a565b600e548111156129465760405162461bcd60e51b815260206004820152601f60248201527f43616e206e6f742073657420686967686572207468616e2064656661756c74006044820152606401610c01565b6001600160a01b03821660009081526014602052604090819020829055517fbecbc03040bc790a255d073a8a8b65af77277f1f0d20ae79890613a98e5508729061173f90849084906139f9565b600d546000906001600160a01b03838116911614156129b457506001919050565b600b546001600160a01b03838116911614156129d257506002919050565b600c546001600160a01b03838116911614156129f057506003919050565b506000919050565b6001600160a01b038116600090815260146020526040812054612a1d57600e54610bbb565b506001600160a01b031660009081526014602052604090205490565b60085460405163095ea7b360e01b81526000916001600160a01b038085169263095ea7b392612a6e92169087906004016139f9565b602060405180830381600087803b158015612a8857600080fd5b505af1158015612a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac091906138a5565b506001600160a01b03821660009081526010602052604081208054612ae490613c83565b80601f0160208091040260200160405190810160405280929190818152602001828054612b1090613c83565b8015612b5d5780601f10612b3257610100808354040283529160200191612b5d565b820191906000526020600020905b815481529060010190602001808311612b4057829003601f168201915b50505050509050805160001415612bb657600a54600554604051610bb892612ba392879285926001600160a01b0390811692849261010090910490911690602001613941565b6040516020818303038152906040529150505b6040805160a0810182528281523060208201526000918101612bd942600f613be9565b8152602001868152602001612bee868861239e565b905260085460405163c04b8d5960e01b81529192506001600160a01b03169063c04b8d5990612c21908490600401613b91565b602060405180830381600087803b158015612c3b57600080fd5b505af1158015612c4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c7391906138fd565b9250612c7f84866114a5565b831115612c9e5760405162461bcd60e51b8152600401610c0190613a55565b505092915050565b6118328363a9059cbb60e01b8484604051602401612cc59291906139f9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526132f7565b6000546201000090046001600160a01b03163314612d745760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b6064820152608401610c01565b565b6040516001600160a01b0380851660248301528316604482015260648101829052612dae9085906323b872dd60e01b90608401612cc5565b50505050565b600080612dc084612993565b9050600081600f0b138015612dde5750600d54600160a01b900460ff165b612e235760405162461bcd60e51b81526020600482015260166024820152751d5b9cdd5c1c1bdc9d19590818dbdb1b185d195c985b60521b6044820152606401610c01565b600554600f5460405163095ea7b360e01b81526001600160a01b0361010090930483169263095ea7b392612e5e9291169087906004016139f9565b602060405180830381600087803b158015612e7857600080fd5b505af1158015612e8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eb091906138a5565b50600f546001600160a01b031663a6417ed660008386612ed089826109a7565b6040516001600160e01b031960e087901b168152600f94850b60048201529290930b602483015260448201526064810191909152608401602060405180830381600087803b158015612f2157600080fd5b505af1158015612f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f5991906138fd565b9150612f6584846122d3565b8211156119e15760405162461bcd60e51b8152600401610c0190613a55565b60055460085460405163095ea7b360e01b815260009261010090046001600160a01b039081169263095ea7b392612fc3929091169087906004016139f9565b602060405180830381600087803b158015612fdd57600080fd5b505af1158015612ff1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301591906138a5565b506001600160a01b0382166000908152601360205260408120805461303990613c83565b80601f016020809104026020016040519081016040528092919081815260200182805461306590613c83565b80156130b25780601f10613087576101008083540402835291602001916130b2565b820191906000526020600020905b81548152906001019060200180831161309557829003601f168201915b5050505050905080516000141561310b57600554600a54604051610bb8926130f8926001600160a01b036101009092048216928592919091169082908990602001613941565b6040516020818303038152906040529150505b6040805160a081018252828152306020820152600091810161312e42600f613be9565b815260200186815260200161314386886109a7565b905260085460405163c04b8d5960e01b81529192506001600160a01b03169063c04b8d5990613176908490600401613b91565b602060405180830381600087803b15801561319057600080fd5b505af11580156131a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131c891906138fd565b9250612c7f84866122d3565b6000806131e084612993565b9050600081600f0b1380156131fe5750600d54600160a01b900460ff165b6132435760405162461bcd60e51b81526020600482015260166024820152751d5b9cdd5c1c1bdc9d19590818dbdb1b185d195c985b60521b6044820152606401610c01565b600f546001600160a01b031663a6417ed682600086613262898261239e565b6040516001600160e01b031960e087901b168152600f94850b60048201529290930b602483015260448201526064810191909152608401602060405180830381600087803b1580156132b357600080fd5b505af11580156132c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132eb91906138fd565b9150612f6584846114a5565b600061334c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133c99092919063ffffffff16565b805190915015611832578080602001905181019061336a91906138a5565b6118325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c01565b60606133d884846000856133e0565b949350505050565b6060824710156134415760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c01565b843b61348f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c01565b600080866001600160a01b031685876040516134ab9190613993565b60006040518083038185875af1925050503d80600081146134e8576040519150601f19603f3d011682016040523d82523d6000602084013e6134ed565b606091505b50915091506134fd828286613508565b979650505050505050565b606083156135175750816116bb565b8251156135275782518084602001fd5b8160405162461bcd60e51b8152600401610c019190613a12565b82805461354d90613c83565b90600052602060002090601f01602090048101928261356f57600085556135b5565b82601f1061358857805160ff19168380011785556135b5565b828001600101855582156135b5579182015b828111156135b557825182559160200191906001019061359a565b506135c1929150613639565b5090565b8280546135d190613c83565b90600052602060002090601f0160209004810192826135f357600085556135b5565b82601f1061360c5782800160ff198235161785556135b5565b828001600101855582156135b5579182015b828111156135b557823582559160200191906001019061361e565b5b808211156135c1576000815560010161363a565b803562ffffff8116811461366157600080fd5b919050565b600060208284031215613677578081fd5b81356116bb81613cce565b60008060008060008060c0878903121561369a578182fd5b86356136a581613cce565b955060208701356136b581613cce565b945060408701356136c581613cce565b935060608701356136d581613cce565b925060808701356136e581613ce3565b8092505060a087013590509295509295509295565b6000806040838503121561370c578182fd5b823561371781613cce565b9150602083013561372781613ce3565b809150509250929050565b60008060008060608587031215613747578384fd5b843561375281613cce565b9350602085013567ffffffffffffffff8082111561376e578485fd5b818701915087601f830112613781578485fd5b81358181111561378f578586fd5b8860208285010111156137a0578586fd5b60208301955080945050505060408501356137ba81613ce3565b939692955090935050565b600080604083850312156137d7578182fd5b82356137e281613cce565b9150602083013561372781613cce565b600080600080600060a08688031215613809578081fd5b853561381481613cce565b94506138226020870161364e565b9350604086013561383281613cce565b92506138406060870161364e565b9150608086013561385081613cce565b809150509295509295909350565b60008060408385031215613870578182fd5b823561387b81613cce565b946020939093013593505050565b60006020828403121561389a578081fd5b81356116bb81613ce3565b6000602082840312156138b6578081fd5b81516116bb81613ce3565b600080604083850312156138d3578182fd5b82359150602083013561372781613cce565b6000602082840312156138f6578081fd5b5035919050565b60006020828403121561390e578081fd5b5051919050565b6000815180845261392d816020860160208601613c57565b601f01601f19169290920160200192915050565b6bffffffffffffffffffffffff19606096871b811682526001600160e81b031960e896871b8116601484015294871b811660178301529290941b909216602b840152921b909116602e82015260420190565b600082516139a5818460208701613c57565b9190910192915050565b6001600160a01b038516815260606020820181905281018390528284608083013760008184016080908101919091529115156040820152601f909201601f19169091010192915050565b6001600160a01b03929092168252602082015260400190565b6020815260006116bb6020830184613915565b602080825260169082015275155b9cdd5c1c1bdc9d19590818dbdb1b185d195c985b60521b604082015260600190565b60208082526025908201527f416d6f756e742061626f7665206d617820616c6c6f7765642070656720736c69604082015264707061676560d81b606082015260800190565b6020808252601290820152712ab739bab83837b93a32b21031b0b63632b960711b604082015260600190565b6020808252603c908201527f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642060408201527f7768696c652074686520636f6e74726163742069732070617573656400000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601b908201527f43616e206e6f74207365742061207a65726f2061646472657373210000000000604082015260600190565b602081526000825160a06020840152613bad60c0840182613915565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60008219821115613bfc57613bfc613cb8565b500190565b600082613c1c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615613c3b57613c3b613cb8565b500290565b600082821015613c5257613c52613cb8565b500390565b60005b83811015613c72578181015183820152602001613c5a565b83811115612dae5750506000910152565b600181811c90821680613c9757607f821691505b60208210811415610f8057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461118a57600080fd5b801515811461118a57600080fdfea2646970667358221220ee358eb30686d1732d39441843462979ff8218151d995c9365180ef7a85ddc8064736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.