{"file_path":"contracts/Misc_AMOs/UniV3LiquidityAMO.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\npragma experimental ABIEncoderV2;\n\n// ====================================================================\n// |     ______                   _______                             |\n// |    / _____________ __  __   / ____(_____  ____ _____  ________   |\n// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \\/ __ `/ __ \\/ ___/ _ \\  |\n// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |\n// | /_/   /_/   \\__,_/_/|_|  /_/   /_/_/ /_/\\__,_/_/ /_/\\___/\\___/   |\n// |                                                                  |\n// ====================================================================\n// ============================= UniV3LiquidityAMO =============================\n// ====================================================================\n// Creates Uni v3 positions between Frax and other stablecoins/assets\n// Earns money on swap fees\n\n// Frax Finance: https://github.com/FraxFinance\n\n// Primary Author(s)\n// Jason Huan: https://github.com/jasonhuan\n\n// Reviewer(s) / Contributor(s)\n// Sam Kazemian: https://github.com/samkazemian\n// Travis Moore: https://github.com/FortisFortuna\n\nimport \"../Frax/Frax.sol\";\nimport \"../FXS/FXS.sol\";\nimport \"../Frax/Pools/FraxPool.sol\";\nimport \"../Math/Math.sol\";\nimport \"../Math/SafeMath.sol\";\nimport \"../ERC20/ERC20.sol\";\nimport '../Uniswap/TransferHelper.sol';\nimport \"../Staking/Owned.sol\";\n\nimport \"../Uniswap_V3/IUniswapV3Factory.sol\";\nimport \"../Uniswap_V3/libraries/TickMath.sol\";\nimport \"../Uniswap_V3/libraries/LiquidityAmounts.sol\";\nimport \"../Uniswap_V3/periphery/interfaces/INonfungiblePositionManager.sol\";\nimport \"../Uniswap_V3/IUniswapV3Pool.sol\";\nimport \"../Uniswap_V3/ISwapRouter.sol\";\n\ncontract UniV3LiquidityAMO is Owned {\n    using SafeMath for uint256;\n\n    /* ========== STATE VARIABLES ========== */\n\n    // Details about the AMO's uniswap positions\n    struct Position {\n        uint256 token_id;\n        address collateral_address;\n        uint128 liquidity; // the liquidity of the position\n        int24 tickLower; // the tick range of the position\n        int24 tickUpper;\n        uint24 fee_tier;\n    }\n\n    // Array of all Uni v3 NFT positions held by the AMO\n    Position[] public positions_array;\n\n    // List of all collaterals\n    address[] public collateral_addresses;\n    mapping(address => bool) public allowed_collaterals; // Mapping is also used for faster verification\n\n    // Map token_id to Position\n    mapping(uint256 => Position) public positions_mapping;\n\n    // Core\n    FRAXStablecoin private FRAX;\n    FRAXShares private FXS;\n    FraxPool private pool;\n    ERC20 private pool_collateral_token;\n    address public pool_collateral_address;\n    uint256 public missing_decimals;\n    address public pool_address;\n    address public timelock_address;\n    address public custodian_address;\n\n    // Uniswap v3\n    IUniswapV3Factory public univ3_factory;\n    INonfungiblePositionManager public univ3_positions;\n    ISwapRouter public univ3_router;\n\n    // Price constants\n    uint256 private constant PRICE_PRECISION = 1e6;\n\n    // Max amount of FRAX this contract can mint\n    int256 public mint_cap = int256(5000000e18);\n    \n    // Tracks collateral\n    uint256 public borrowed_collat_historical;\n    uint256 public returned_collat_historical;\n\n    // Max amount of collateral the contract can borrow from the FraxPool\n    uint256 public collat_borrow_cap = uint256(5000000e6);\n\n    // Minimum collateral ratio needed for new FRAX minting\n    uint256 public min_cr = 820000;\n\n    // Amount the contract borrowed\n    int256 public minted_sum_historical = 0;\n    int256 public burned_sum_historical = 0;\n\n    /* ========== CONSTRUCTOR ========== */\n    \n    constructor(\n        address _creator_address,\n        address _custodian_address,\n        address _frax_contract_address,\n        address _fxs_contract_address,\n        address _timelock_address,\n        address _pool_address,\n        address _pool_collateral_address,\n        address _univ3_factory_address,\n        address _univ3_positions_address,\n        address _univ3_router_address\n    ) Owned(_creator_address) {\n        FRAX = FRAXStablecoin(_frax_contract_address);\n        FXS = FRAXShares(_fxs_contract_address);\n        pool_address = _pool_address;\n        pool = FraxPool(_pool_address);\n        pool_collateral_address = _pool_collateral_address;\n        pool_collateral_token = ERC20(_pool_collateral_address);\n        missing_decimals = uint256(18).sub(pool_collateral_token.decimals());\n        timelock_address = _timelock_address;\n        custodian_address = _custodian_address;\n\n        collateral_addresses.push(_pool_collateral_address);\n        allowed_collaterals[_pool_collateral_address] = true;\n\n        univ3_factory = IUniswapV3Factory(_univ3_factory_address);\n        univ3_positions = INonfungiblePositionManager(_univ3_positions_address);\n        univ3_router = ISwapRouter(_univ3_router_address);\n    }\n\n    /* ========== MODIFIERS ========== */\n\n    modifier onlyByOwnerOrGovernance() {\n        require(msg.sender == timelock_address || msg.sender == owner, \"Not owner or timelock\");\n        _;\n    }\n\n    modifier onlyByOwnerOrGovernanceOrCustodian() {\n        require(msg.sender == timelock_address || msg.sender == owner || msg.sender == custodian_address, \"Not owner, timelock, or custodian\");\n        _;\n    }\n\n    /* ========== VIEWS ========== */\n\n    function showAllocations() public view returns (uint256[4] memory allocations) {\n        // All numbers given are in FRAX unless otherwise stated\n\n        // Unallocated FRAX\n        allocations[0] = FRAX.balanceOf(address(this));\n\n        // Unallocated Collateral Dollar Value (E18)\n        allocations[1] = freeColDolVal();\n        \n        // Sum of Uni v3 Positions liquidity, if it was all in FRAX\n        allocations[2] = TotalLiquidityFrax(); \n\n        // Total Value\n        allocations[3] = allocations[0].add(allocations[1]).add(allocations[2]);\n    }\n\n    // E18 Collateral dollar value\n    function freeColDolVal() public view returns (uint256) {\n        uint256 value_tally_e18 = 0;\n        for (uint i = 0; i < collateral_addresses.length; i++){ \n            ERC20 thisCollateral = ERC20(collateral_addresses[i]);\n            uint256 missing_decs = uint256(18).sub(thisCollateral.decimals());\n            uint256 col_bal_e18 = thisCollateral.balanceOf(address(this)).mul(10 ** missing_decs);\n            value_tally_e18 = value_tally_e18.add(col_bal_e18);\n        }\n        return value_tally_e18;\n    }\n\n    // Needed for the Frax contract to function \n    function collatDollarBalance() external view returns (uint256) {\n        uint256 collat_portion = showAllocations()[1];\n        uint256 frax_portion = (showAllocations()[0]).add(showAllocations()[2]);\n\n        // Assumes worst case scenario if FRAX slips out of range. \n        // Otherwise, it would only be half that is multiplied by the CR\n        frax_portion = frax_portion.mul(FRAX.global_collateral_ratio()).div(PRICE_PRECISION);\n        return (collat_portion).add(frax_portion);\n    }\n\n    function allCollateralAddresses() external view returns (address[] memory) {\n        return collateral_addresses;\n    }\n\n    function TotalLiquidityFrax() public view returns (uint256) {\n        uint256 frax_tally = 0;\n        Position memory thisPosition;\n        for (uint256 i = 0; i < positions_array.length; i++) {\n            thisPosition = positions_array[i];\n            uint128 this_liq = thisPosition.liquidity;\n            if (this_liq > 0){\n                uint160 sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(thisPosition.tickLower);\n                uint160 sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(thisPosition.tickUpper);\n                if (thisPosition.collateral_address > 0x853d955aCEf822Db058eb8505911ED77F175b99e){ // if address(FRAX) < collateral_address, then FRAX is token0\n                    frax_tally = frax_tally.add(LiquidityAmounts.getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, this_liq));\n                }\n                else {\n                    frax_tally = frax_tally.add(LiquidityAmounts.getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, this_liq));\n                }\n            }\n        }\n\n        // Return the sum of all the positions' balances of FRAX, if the price fell off the range towards that side\n        return frax_tally;\n    }\n\n    // In collateral\n    function collateralBalance() public view returns (uint256) {\n        if (borrowed_collat_historical >= returned_collat_historical) return borrowed_collat_historical.sub(returned_collat_historical);\n        else return 0;\n    }\n\n    // In FRAX, can be negative\n    function mintedBalance() public view returns (int256) {\n        return minted_sum_historical - burned_sum_historical;\n    }\n\n    // In FRAX, can be negative\n    function accumulatedProfit() public view returns (int256) {\n        return int256(showAllocations()[0]) - mintedBalance();\n    }\n\n    // Only counts non-withdrawn positions\n    function numPositions() public view returns (uint256) {\n        return positions_array.length;\n    }\n    \n\n    /* ========== RESTRICTED FUNCTIONS, BUT CUSTODIAN CAN CALL ========== */\n\n    // Burn unneeded or excess FRAX\n    function burnFRAX(uint256 amount) external onlyByOwnerOrGovernanceOrCustodian {\n        burned_sum_historical += int256(amount);\n        FRAX.burn(amount);\n    }\n\n    // Burn unneeded or excess FXS\n    function burnFXS(uint256 amount) external onlyByOwnerOrGovernanceOrCustodian {\n        FXS.approve(address(this), amount);\n        FXS.pool_burn_from(address(this), amount);\n    }\n\n    // Give USDC profits back\n    function giveCollatBack(uint256 amount) external onlyByOwnerOrGovernanceOrCustodian {\n        returned_collat_historical = returned_collat_historical.add(amount);\n        TransferHelper.safeTransfer(address(pool_collateral_token), address(pool), amount);\n    }\n\n    // Iterate through all positions and collect fees accumulated\n    function collectFees() external onlyByOwnerOrGovernanceOrCustodian {\n        for (uint i = 0; i < positions_array.length; i++){ \n            Position memory current_position = positions_array[i];\n            INonfungiblePositionManager.CollectParams memory collect_params = INonfungiblePositionManager.CollectParams(\n                current_position.token_id,\n                custodian_address,\n                type(uint128).max,\n                type(uint128).max\n            );\n\n            // Send to custodian address\n            univ3_positions.collect(collect_params);\n        }\n    }\n\n\n    /* ---------------------------------------------------- */\n    /* ---------------------- Uni v3 ---------------------- */\n    /* ---------------------------------------------------- */\n\n    function approveTarget(address _target, address _token, uint256 _amount, bool use_safe_approve) public onlyByOwnerOrGovernance {\n        if (use_safe_approve) {\n            // safeApprove needed for USDT and others for the first approval\n            TransferHelper.safeApprove(_token, _target, _amount);\n        }\n        else {\n            ERC20(_token).approve(_target, _amount);\n        }\n    }\n\n    // Mint NFT using collateral / FRAX already held\n    // If suboptimal liquidity taken, withdraw() and try again\n    function mint(address _collat_addr, uint256 _amountCollateral, uint256 _amountFrax, uint24 _fee_tier, int24 _tickLower, int24 _tickUpper) public onlyByOwnerOrGovernance returns (uint256, uint128) {\n        // Will revert if pool doesn't exist yet\n\n        INonfungiblePositionManager.MintParams memory mint_params;\n        if(_collat_addr < address(FRAX)){\n            mint_params = INonfungiblePositionManager.MintParams(\n                _collat_addr,\n                address(FRAX),\n                _fee_tier,\n                _tickLower,\n                _tickUpper,\n                _amountCollateral,\n                _amountFrax,\n                0,\n                0,\n                address(this),\n                2105300114 // Expiration: a long time from now\n            );\n        } else {\n            mint_params = INonfungiblePositionManager.MintParams(\n                address(FRAX),\n                _collat_addr,\n                _fee_tier,\n                _tickLower,\n                _tickUpper,\n                _amountFrax,\n                _amountCollateral,\n                0,\n                0,\n                address(this),\n                2105300114 // Expiration: a long time from now\n            );\n        }\n\n        // Approvals\n        TransferHelper.safeApprove(_collat_addr, address(univ3_positions), _amountCollateral);\n        TransferHelper.safeApprove(address(FRAX), address(univ3_positions), _amountFrax);\n\n        // Leave off amount0 and amount1 due to stack limit\n        (uint256 token_id, uint128 liquidity, , ) = univ3_positions.mint(mint_params);\n        \n        // store new NFT in mapping and array\n        Position memory new_position = Position(token_id, _collat_addr, liquidity, _tickLower, _tickUpper, _fee_tier);\n        positions_mapping[token_id] = new_position;\n        positions_array.push(new_position);\n\n        return (token_id, liquidity);\n    }\n\n    // Remove liquidity\n    // Example fract_to_rem_e6 = 500000 = 50% removal. 1000000 = 100% removal\n    function withdraw(uint256 _token_id) public onlyByOwnerOrGovernance returns (uint256, uint256) {\n        Position memory current_position = positions_mapping[_token_id];\n\n        INonfungiblePositionManager.DecreaseLiquidityParams memory decrease_params = INonfungiblePositionManager.DecreaseLiquidityParams(\n            _token_id,\n            current_position.liquidity,\n            0,\n            0,\n            2105300114 // Expiration: a long time from now\n        );\n\n        univ3_positions.decreaseLiquidity(decrease_params);\n\n        (uint256 amount0, uint256 amount1) = univ3_positions.collect(INonfungiblePositionManager.CollectParams(\n            _token_id,\n            address(this),\n            type(uint128).max,\n            type(uint128).max\n        ));\n\n        // Burn the empty NFT\n        // univ3_positions.burn(_token_id);\n\n        // Delete from the mapping\n        delete positions_mapping[_token_id];\n\n        // Swap withdrawn position with last element and delete to avoid leaving a hole\n        for (uint i = 0; i < positions_array.length; i++){ \n            if(positions_array[i].token_id == _token_id){\n                positions_array[i] = positions_array[positions_array.length - 1];\n                positions_array.pop();\n            }\n        }\n\n        return (amount0, amount1);\n    }\n\n    \n    // Swap tokenA into tokenB using univ3_router.ExactInputSingle()\n    // Uni V3 only\n    function swap(address _tokenA, address _tokenB, uint24 _fee_tier, uint256 _amountAtoB, uint256 _amountOutMinimum, uint160 _sqrtPriceLimitX96) public onlyByOwnerOrGovernance returns (uint256) {\n        ISwapRouter.ExactInputSingleParams memory swap_params = ISwapRouter.ExactInputSingleParams(\n            _tokenA,\n            _tokenB,\n            _fee_tier,\n            address(this),\n            2105300114, // Expiration: a long time from now\n            _amountAtoB,\n            _amountOutMinimum,\n            _sqrtPriceLimitX96\n        );\n\n        // Approval\n        TransferHelper.safeApprove(_tokenA, address(univ3_router), _amountAtoB);\n\n        uint256 amountOut = univ3_router.exactInputSingle(swap_params);\n        return amountOut;\n    }\n\n\n    /* ========== OWNER / GOVERNANCE FUNCTIONS ONLY ========== */\n    // Only owner or timelock can call, to limit risk \n\n    // This contract is essentially marked as a 'pool' so it can call OnlyPools functions like pool_mint and pool_burn_from\n    // on the main FRAX contract\n    function mintFRAXForInvestments(uint256 frax_amount) public onlyByOwnerOrGovernance {\n        int256 frax_amt_i256 = int256(frax_amount);\n\n        // Make sure you aren't minting more than the mint cap\n        require((mintedBalance() + frax_amt_i256) <= mint_cap, \"Mint cap reached\");\n        minted_sum_historical = minted_sum_historical + frax_amt_i256;\n\n        // Make sure the current CR isn't already too low\n        require (FRAX.global_collateral_ratio() > min_cr, \"Collateral ratio is already too low\");\n\n        // Make sure the FRAX minting wouldn't push the CR down too much\n        // This is also a sanity check for the int256 math\n        uint256 current_collateral_E18 = FRAX.globalCollateralValue();\n        uint256 cur_frax_supply = FRAX.totalSupply();\n        uint256 new_frax_supply = cur_frax_supply.add(frax_amount);\n        uint256 new_cr = (current_collateral_E18.mul(PRICE_PRECISION)).div(new_frax_supply);\n        require (new_cr > min_cr, \"Minting would cause collateral ratio to be too low\");\n\n        // Mint the frax \n        FRAX.pool_mint(address(this), frax_amount);\n    }\n\n    // It mints FRAX from nothing, and redeems it on the target pool for collateral and FXS\n    // The burn can be called separately later on\n    function mintRedeemPart1(uint256 frax_amount) external onlyByOwnerOrGovernance {\n        //require(allow_yearn || allow_aave || allow_compound, 'All strategies are currently off');\n        uint256 redeem_amount_E6 = (frax_amount.mul(uint256(1e6).sub(pool.redemption_fee()))).div(1e6).div(10 ** missing_decimals);\n        uint256 expected_collat_amount = redeem_amount_E6.mul(FRAX.global_collateral_ratio()).div(1e6);\n        expected_collat_amount = expected_collat_amount.mul(1e6).div(pool.getCollateralPrice());\n\n        require(collateralBalance().add(expected_collat_amount) <= collat_borrow_cap, \"Borrow cap\");\n        borrowed_collat_historical = borrowed_collat_historical.add(expected_collat_amount);\n\n        // Mint the frax \n        FRAX.pool_mint(address(this), frax_amount);\n\n        // Redeem the frax\n        FRAX.approve(address(pool), frax_amount);\n        pool.redeemFractionalFRAX(frax_amount, 0, 0);\n    }\n\n    function mintRedeemPart2() external onlyByOwnerOrGovernance {\n        pool.collectRedemption();\n    }\n\n    // Adds collateral addresses supported. Needed to make sure collatDollarBalance is correct\n    function addCollateral(address collat_addr) public onlyByOwnerOrGovernance {\n        require(collat_addr != address(0), \"Zero address detected\");\n        require(collat_addr != address(FRAX), \"FRAX is not collateral\");\n\n        require(allowed_collaterals[collat_addr] == false, \"Address already exists\");\n        allowed_collaterals[collat_addr] = true; \n        collateral_addresses.push(collat_addr);\n    }\n\n    function setCustodian(address _custodian_address) external onlyByOwnerOrGovernance {\n        require(_custodian_address != address(0), \"Custodian address cannot be 0\");        \n        custodian_address = _custodian_address;\n    }\n\n    function setTimelock(address new_timelock) external onlyByOwnerOrGovernance {\n        require(new_timelock != address(0), \"Timelock address cannot be 0\");\n        timelock_address = new_timelock;\n    }\n\n    function setSafetyParams(uint256 _min_cr, uint256 _mint_cap, uint256 _collat_borrow_cap) external onlyByOwnerOrGovernance {\n        min_cr = _min_cr;\n        mint_cap = int256(_mint_cap);\n        collat_borrow_cap = _collat_borrow_cap;\n    }\n\n    function setPool(address _pool_address, address _pool_collateral_address, uint256 _missing_decimals) external onlyByOwnerOrGovernance {\n        pool_address = _pool_address;\n        pool = FraxPool(_pool_address);\n        pool_collateral_token = ERC20(_pool_collateral_address);\n        pool_collateral_address = _pool_collateral_address;\n        missing_decimals = _missing_decimals;\n    }\n\n    function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyByOwnerOrGovernance {\n        // Can only be triggered by owner or governance, not custodian\n        // Tokens are sent to the custodian, as a sort of safeguard\n        TransferHelper.safeTransfer(tokenAddress, custodian_address, tokenAmount);\n        \n        emit RecoveredERC20(tokenAddress, tokenAmount);\n    }\n\n    function recoverERC721(address tokenAddress, uint256 token_id) external onlyByOwnerOrGovernance {        \n        // Only the owner address can ever receive the recovery withdrawal\n        // INonfungiblePositionManager inherits IERC721 so the latter does not need to be imported\n        INonfungiblePositionManager(tokenAddress).safeTransferFrom( address(this), custodian_address, token_id);\n        emit RecoveredERC721(tokenAddress, token_id);\n    }\n\n\n    /* ========== EVENTS ========== */\n\n    event RecoveredERC20(address token, uint256 amount);\n    event RecoveredERC721(address token, uint256 id);\n\n}","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106103365760003560e01c80637bdfc32a116101b2578063b497d8ca116100f9578063d72da8dc116100a2578063dc6663c71161007c578063dc6663c7146107ef578063e06b421b1461080f578063e97d85a514610822578063f0d2d5a81461082b57600080fd5b8063d72da8dc146107c1578063d989f747146107d4578063d99e4d67146107e757600080fd5b8063c8796572116100d3578063c879657214610778578063c98c05b714610780578063cfb13e651461078857600080fd5b8063b497d8ca1461073c578063bdacb3031461075c578063c221c32a1461076f57600080fd5b80638980f11f1161015b5780638f8e1ed2116101355780638f8e1ed214610722578063a7100f211461072b578063ad7b68fe1461073457600080fd5b80638980f11f146106dc5780638c79d138146106ef5780638da5cb5b1461070257600080fd5b80637e34026e1161018c5780637e34026e14610694578063819d4cc6146106a95780638292fd84146106bc57600080fd5b80637bdfc32a146106595780637ccc0078146106615780637ce6112b1461067457600080fd5b806337508b06116102815780634755abbb1161022a5780635e71823b116102045780635e71823b14610531578063722f7a9f14610539578063748e37f41461064957806379ba50971461065157600080fd5b80634755abbb146104de5780634bb4a730146104fe57806353a47bb71461051157600080fd5b8063403f37311161025b578063403f3731146104ae57806341401da9146104c1578063467b96e0146104d657600080fd5b806337508b061461045f578063377a18c7146104925780633ed4e55c146104a557600080fd5b806323fbd1c7116102e357806332b82dbb116102bd57806332b82dbb1461042357806336082ac01461044357806336d5a76d1461044c57600080fd5b806323fbd1c7146103df57806329988e2c146103f25780632e1a7d4d146103fb57600080fd5b80631627540c116103145780631627540c1461037f57806317284c94146103925780631baf16821461039a57600080fd5b806302825d111461033b57806303a76bff1461035057806314af33801461036c575b600080fd5b61034e610349366004614e9c565b61083e565b005b61035960185481565b6040519081526020015b60405180910390f35b61034e61037a366004614e9c565b610a67565b61034e61038d366004614cd3565b610b8f565b610359610caf565b600f546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610363565b61034e6103ed366004614e9c565b610db3565b61035960175481565b61040e610409366004614e9c565b610f0c565b60408051928352602083019190915201610363565b600a546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61035960165481565b61034e61045a366004614e9c565b611641565b61048261046d366004614cd3565b60046020526000908152604090205460ff1681565b6040519015158152602001610363565b61034e6104a0366004614e9c565b611b7c565b610359600b5481565b61034e6104bc366004614cd3565b612072565b6104c96121d9565b6040516103639190614fa8565b610359612248565b600c546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b6103ba61050c366004614e9c565b61242d565b6001546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b600254610359565b6105e5610547366004614e9c565b600560205260009081526040902080546001820154600292830154919273ffffffffffffffffffffffffffffffffffffffff909116916fffffffffffffffffffffffffffffffff8116917001000000000000000000000000000000008204810b91730100000000000000000000000000000000000000810490910b90760100000000000000000000000000000000000000000000900462ffffff1686565b6040805196875273ffffffffffffffffffffffffffffffffffffffff90951660208701526fffffffffffffffffffffffffffffffff90931693850193909352600290810b60608501529190910b608083015262ffffff1660a082015260c001610363565b610359612464565b61034e612486565b61034e6125d1565b61034e61066f366004614d5c565b6126f8565b600e546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61069c61280e565b6040516103639190615002565b61034e6106b7366004614dee565b6128f3565b6011546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61034e6106ea366004614dee565b612a7d565b61034e6106fd366004614d9c565b612b91565b6000546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61035960125481565b61035960135481565b610359612cf2565b6010546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61034e61076a366004614cd3565b612d04565b61035960145481565b61034e612e6b565b610359613154565b61079b610796366004614e19565b613176565b604080519283526fffffffffffffffffffffffffffffffff909116602083015201610363565b61034e6107cf366004614f40565b613766565b6105e56107e2366004614e9c565b613817565b6103596138c5565b600d546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61035961081d366004614cef565b613aca565b61035960155481565b61034e610839366004614cd3565b613cec565b600d5473ffffffffffffffffffffffffffffffffffffffff1633148061087b575060005473ffffffffffffffffffffffffffffffffffffffff1633145b8061089d5750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b61092e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6007546040517f095ea7b30000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff9091169063095ea7b390604401602060405180830381600087803b1580156109a057600080fd5b505af11580156109b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d89190614e80565b506007546040517fa8a778ae0000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff9091169063a8a778ae906044015b600060405180830381600087803b158015610a4c57600080fd5b505af1158015610a60573d6000803e3d6000fd5b5050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480610aa4575060005473ffffffffffffffffffffffffffffffffffffffff1633145b80610ac65750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b610b52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b601454610b5f9082614015565b601455600954600854610b8c9173ffffffffffffffffffffffffffffffffffffffff90811691168361408e565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e00000000000000000000000000000000006064820152608401610925565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229060200160405180910390a150565b600080610cba61280e565b6020015190506000610ce7610ccd61280e565b60400151610cd961280e565b60005b602002015190614015565b9050610da0620f4240610d9a600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632eb9771b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5b57600080fd5b505afa158015610d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d939190614eb4565b84906141f7565b906142ac565b9050610dac8282614015565b9250505090565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480610df0575060005473ffffffffffffffffffffffffffffffffffffffff1633145b80610e125750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b610e9e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b8060186000828254610eb0919061516f565b90915550506006546040517f42966c680000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906342966c6890602401610a32565b600d54600090819073ffffffffffffffffffffffffffffffffffffffff16331480610f4e575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610fb4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b6000838152600560209081526040808320815160c08101835281548152600182015473ffffffffffffffffffffffffffffffffffffffff908116828601526002928301546fffffffffffffffffffffffffffffffff8082168487019081527001000000000000000000000000000000008304860b860b860b6060808701919091527301000000000000000000000000000000000000008404870b870b90960b60808087019190915276010000000000000000000000000000000000000000000090930462ffffff1660a080870191909152875190810188528c815290518216978101978852808701898152958101988952637d7c549292810192835260105496517f0c49ccbe0000000000000000000000000000000000000000000000000000000081528151600482015297519091166024880152935160448701529551606486015294516084850152939092911690630c49ccbe9060a4016040805180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115e9190614f1d565b50506010546040805160808101825287815230602082019081526fffffffffffffffffffffffffffffffff8284018181526060840182815294517ffc6f786500000000000000000000000000000000000000000000000000000000815293516004850152915173ffffffffffffffffffffffffffffffffffffffff9081166024850152915181166044840152925190921660648201526000928392169063fc6f7865906084016040805180830381600087803b15801561121d57600080fd5b505af1158015611231573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112559190614f1d565b60008981526005602052604081208181556001810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560020180547fffffffffffffff0000000000000000000000000000000000000000000000000016905591935091505b600254811015611634578760028281548110611304577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060030201600001541415611622576002805461132c9060019061541c565b81548110611363577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060030201600282815481106113ab577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120825460039092020190815560018083015490820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790556002918201805491830180547fffffffffffffffffffffffffffffffff0000000000000000000000000000000081166fffffffffffffffffffffffffffffffff9094169384178255825470010000000000000000000000000000000090819004860b860b62ffffff9081169091027fffffffffffffffffffffffffff0000000000000000000000000000000000000090921690941717808255825473010000000000000000000000000000000000000090819004860b860b8516027fffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffff8216811783559254760100000000000000000000000000000000000000000000908190049094169093027fffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffff90931692909217179055805480611596577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008281526020812060037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909301928302019081556001810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560020180547fffffffffffffff0000000000000000000000000000000000000000000000000016905590555b8061162c8161545f565b9150506112bf565b5090945092505050915091565b600d5473ffffffffffffffffffffffffffffffffffffffff1633148061167e575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6116e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b60006117b6600b54600a6116f89190615270565b610d9a620f4240610d9a6117af600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb73999f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561176d57600080fd5b505afa158015611781573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a59190614eb4565b620f424090613fca565b87906141f7565b9050600061186b620f4240610d9a600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632eb9771b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182c57600080fd5b505afa158015611840573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118649190614eb4565b85906141f7565b905061191d600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f7683bbc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118d857600080fd5b505afa1580156118ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119109190614eb4565b610d9a83620f42406141f7565b90506015546119348261192e613154565b90614015565b111561199c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f426f72726f7720636170000000000000000000000000000000000000000000006044820152606401610925565b6013546119a99082614015565b6013556006546040517fb4f56b260000000000000000000000000000000000000000000000000000000081523060048201526024810185905273ffffffffffffffffffffffffffffffffffffffff9091169063b4f56b2690604401600060405180830381600087803b158015611a1e57600080fd5b505af1158015611a32573d6000803e3d6000fd5b50506006546008546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018890529116925063095ea7b39150604401602060405180830381600087803b158015611aac57600080fd5b505af1158015611ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae49190614e80565b506008546040517f7e108af900000000000000000000000000000000000000000000000000000000815260048101859052600060248201819052604482015273ffffffffffffffffffffffffffffffffffffffff90911690637e108af990606401600060405180830381600087803b158015611b5f57600080fd5b505af1158015611b73573d6000803e3d6000fd5b50505050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480611bb9575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611c1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b601254819081611c2d612cf2565b611c37919061516f565b1315611c9f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4d696e74206361702072656163686564000000000000000000000000000000006044820152606401610925565b80601754611cad919061516f565b601755601654600654604080517f2eb9771b000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff90921691632eb9771b91600480820192602092909190829003018186803b158015611d1e57600080fd5b505afa158015611d32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d569190614eb4565b11611de3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f436f6c6c61746572616c20726174696f20697320616c726561647920746f6f2060448201527f6c6f7700000000000000000000000000000000000000000000000000000000006064820152608401610925565b600654604080517fd2d97b06000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163d2d97b06916004808301926020929190829003018186803b158015611e4e57600080fd5b505afa158015611e62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e869190614eb4565b90506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ef257600080fd5b505afa158015611f06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2a9190614eb4565b90506000611f388286614015565b90506000611f4d82610d9a86620f42406141f7565b90506016548111611fe0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4d696e74696e6720776f756c6420636175736520636f6c6c61746572616c207260448201527f6174696f20746f20626520746f6f206c6f7700000000000000000000000000006064820152608401610925565b6006546040517fb4f56b260000000000000000000000000000000000000000000000000000000081523060048201526024810188905273ffffffffffffffffffffffffffffffffffffffff9091169063b4f56b2690604401600060405180830381600087803b15801561205257600080fd5b505af1158015612066573d6000803e3d6000fd5b50505050505050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff163314806120af575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612115576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff8116612192576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437573746f6469616e20616464726573732063616e6e6f7420626520300000006044820152606401610925565b600e80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060600380548060200260200160405190810160405280929190818152602001828054801561223e57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311612213575b5050505050905090565b600080805b60035481101561242757600060038281548110612293577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600061234e8273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561230b57600080fd5b505afa15801561231f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123439190614f6b565b60129060ff16613fca565b9050600061240361236083600a615270565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b1580156123c557600080fd5b505afa1580156123d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fd9190614eb4565b906141f7565b905061240f8582614015565b9450505050808061241f9061545f565b91505061224d565b50919050565b6003818154811061243d57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b600061246e612cf2565b61247661280e565b516124819190615373565b905090565b60015473ffffffffffffffffffffffffffffffffffffffff16331461252d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e65727368697000000000000000000000006064820152608401610925565b6000546001546040805173ffffffffffffffffffffffffffffffffffffffff93841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b600d5473ffffffffffffffffffffffffffffffffffffffff1633148061260e575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166312ace5a26040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156126de57600080fd5b505af11580156126f2573d6000803e3d6000fd5b50505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612735575060005473ffffffffffffffffffffffffffffffffffffffff1633145b61279b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600c805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216811790925560088054821690921790915560098054939094169281168317909355600a8054909316909117909155600b55565b612816614c8b565b6006546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b15801561287f57600080fd5b505afa158015612893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b79190614eb4565b81526128c1612248565b60208201526128ce6138c5565b6040820181905260208201516128eb919061192e90846000610cdc565b606082015290565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612930575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600e546040517f42842e0e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101839052908316906342842e0e90606401600060405180830381600087803b158015612a1057600080fd5b505af1158015612a24573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff86168152602081018590527f57519b6a0997d7d44511836bcee0a36871aa79d445816f6c464abb0cd9d3f3e893500190505b60405180910390a15050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612aba575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612b20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600e54612b4590839073ffffffffffffffffffffffffffffffffffffffff168361408e565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f55350610fe57096d8c0ffa30beede987326bccfcb0b4415804164d0dd50ce8b19101612a71565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612bce575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612c34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b8015612c4a57612c458385846142ee565b6126f2565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301526024820184905284169063095ea7b390604401602060405180830381600087803b158015612cba57600080fd5b505af1158015612cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a609190614e80565b60006018546017546124819190615373565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612d41575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612da7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff8116612e24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f54696d656c6f636b20616464726573732063616e6e6f742062652030000000006044820152606401610925565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612ea8575060005473ffffffffffffffffffffffffffffffffffffffff1633145b80612eca5750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b612f56576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b60005b600254811015610b8c57600060028281548110612f9f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160c08101825260039390930290910180548352600181015473ffffffffffffffffffffffffffffffffffffffff908116848601526002918201546fffffffffffffffffffffffffffffffff808216868601527001000000000000000000000000000000008204840b840b840b6060808801919091527301000000000000000000000000000000000000008304850b850b90940b60808088019190915276010000000000000000000000000000000000000000000090920462ffffff1660a08701528451918201855285518252600e54831696820196875281850181815293820181815260105495517ffc6f786500000000000000000000000000000000000000000000000000000000815283516004820152975184166024890152935181166044880152925190921660648601529294509291169063fc6f7865906084016040805180830381600087803b15801561310557600080fd5b505af1158015613119573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061313d9190614f1d565b50505050808061314c9061545f565b915050612f59565b6000601454601354106131705760145460135461248191613fca565b50600090565b600d54600090819073ffffffffffffffffffffffffffffffffffffffff163314806131b8575060005473ffffffffffffffffffffffffffffffffffffffff1633145b61321e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081019190915260065473ffffffffffffffffffffffffffffffffffffffff908116908a16101561331d5750604080516101608101825273ffffffffffffffffffffffffffffffffffffffff808b16825260065416602082015262ffffff871691810191909152600285810b606083015284900b608082015260a0810188905260c08101879052600060e0820181905261010082015230610120820152637d7c549261014082015261339c565b50604080516101608101825260065473ffffffffffffffffffffffffffffffffffffffff90811682528a16602082015262ffffff871691810191909152600285810b606083015284900b608082015260a0810187905260c08101889052600060e0820181905261010082015230610120820152637d7c54926101408201525b6010546133c1908a9073ffffffffffffffffffffffffffffffffffffffff168a6142ee565b6006546010546133eb9173ffffffffffffffffffffffffffffffffffffffff9081169116896142ee565b6010546040517f88316456000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff90911690638831645690613446908690600401615084565b608060405180830381600087803b15801561346057600080fd5b505af1158015613474573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134989190614ecc565b50509150915060006040518060c001604052808481526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001836fffffffffffffffffffffffffffffffff1681526020018960020b81526020018860020b81526020018a62ffffff16815250905080600560008581526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060608201518160020160106101000a81548162ffffff021916908360020b62ffffff16021790555060808201518160020160136101000a81548162ffffff021916908360020b62ffffff16021790555060a08201518160020160166101000a81548162ffffff021916908362ffffff16021790555090505060028190806001815401808255809150506001900390600052602060002090600302016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060608201518160020160106101000a81548162ffffff021916908360020b62ffffff16021790555060808201518160020160136101000a81548162ffffff021916908360020b62ffffff16021790555060a08201518160020160166101000a81548162ffffff021916908362ffffff160217905550505082829550955050505050965096945050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff163314806137a3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b613809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b601692909255601255601555565b6002818154811061382757600080fd5b600091825260209091206003909102018054600182015460029283015491935073ffffffffffffffffffffffffffffffffffffffff16916fffffffffffffffffffffffffffffffff8216917001000000000000000000000000000000008104820b917301000000000000000000000000000000000000008204900b90760100000000000000000000000000000000000000000000900462ffffff1686565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101829052819060005b600254811015613ac2576002818154811061393f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160c08101825260039390930290910180548352600181015473ffffffffffffffffffffffffffffffffffffffff16938301939093526002928301546fffffffffffffffffffffffffffffffff81169183018290527001000000000000000000000000000000008104840b840b840b60608401527301000000000000000000000000000000000000008104840b840b90930b608083015276010000000000000000000000000000000000000000000090920462ffffff1660a082015292508015613aaf576000613a208460600151614457565b90506000613a318560800151614457565b905073853d955acef822db058eb8505911ed77f175b99e73ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161115613a9b57613a94613a8d8383866148f1565b8790614015565b9550613aac565b613aa9613a8d8383866149b8565b95505b50505b5080613aba8161545f565b9150506138fb565b509092915050565b600d5460009073ffffffffffffffffffffffffffffffffffffffff16331480613b0a575060005473ffffffffffffffffffffffffffffffffffffffff1633145b613b70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b604080516101008101825273ffffffffffffffffffffffffffffffffffffffff808a168252888116602083015262ffffff881692820192909252306060820152637d7c5492608082015260a0810186905260c0810185905283821660e08201526011549091613be2918a9116876142ee565b601154604080517f414bf389000000000000000000000000000000000000000000000000000000008152835173ffffffffffffffffffffffffffffffffffffffff90811660048301526020850151811660248301529184015162ffffff1660448201526060840151821660648201526080840151608482015260a084015160a482015260c084015160c482015260e0840151821660e4820152600092919091169063414bf3899061010401602060405180830381600087803b158015613ca757600080fd5b505af1158015613cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cdf9190614eb4565b9998505050505050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480613d29575060005473ffffffffffffffffffffffffffffffffffffffff1633145b613d8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff8116613e0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5a65726f206164647265737320646574656374656400000000000000000000006044820152606401610925565b60065473ffffffffffffffffffffffffffffffffffffffff82811691161415613e91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f46524158206973206e6f7420636f6c6c61746572616c000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090205460ff1615613f21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4164647265737320616c726561647920657869737473000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff16600081815260046020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091556003805491820181559091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169091179055565b600061400c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614a3b565b90505b92915050565b60008061402283856151e3565b90508381101561400c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610925565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916141259190614f8c565b6000604051808303816000865af19150503d8060008114614162576040519150601f19603f3d011682016040523d82523d6000602084013e614167565b606091505b50915091508180156141915750805115806141915750808060200190518101906141919190614e80565b610a60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610925565b6000826142065750600061400f565b60006142128385615336565b90508261421f85836151fb565b1461400c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f77000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b600061400c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614a8f565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916143859190614f8c565b6000604051808303816000865af19150503d80600081146143c2576040519150601f19603f3d011682016040523d82523d6000602084013e6143c7565b606091505b50915091508180156143f15750805115806143f15750808060200190518101906143f19190614e80565b610a60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c454400006044820152606401610925565b60008060008360020b1261446e578260020b61447b565b8260020b61447b906154e9565b90506144a67ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff276186154ac565b60020b811315614512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f54000000000000000000000000000000000000000000000000000000000000006044820152606401610925565b60006001821661453357700100000000000000000000000000000000614545565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561458457608061457f826ffff97272373d413259a46990580e213a615336565b901c90505b60048216156145ae5760806145a9826ffff2e50f5f656932ef12357cf3c7fdcc615336565b901c90505b60088216156145d85760806145d3826fffe5caca7e10e4e61c3624eaa0941cd0615336565b901c90505b60108216156146025760806145fd826fffcb9843d60f6159c9db58835c926644615336565b901c90505b602082161561462c576080614627826fff973b41fa98c081472e6896dfb254c0615336565b901c90505b6040821615614656576080614651826fff2ea16466c96a3843ec78b326b52861615336565b901c90505b608082161561468057608061467b826ffe5dee046a99a2a811c461f1969c3053615336565b901c90505b6101008216156146ab5760806146a6826ffcbe86c7900a88aedcffc83b479aa3a4615336565b901c90505b6102008216156146d65760806146d1826ff987a7253ac413176f2b074cf7815e54615336565b901c90505b6104008216156147015760806146fc826ff3392b0822b70005940c7a398e4b70f3615336565b901c90505b61080082161561472c576080614727826fe7159475a2c29b7443b29c7fa6e889d9615336565b901c90505b611000821615614757576080614752826fd097f3bdfd2022b8845ad8f792aa5825615336565b901c90505b61200082161561478257608061477d826fa9f746462d870fdf8a65dc1f90e061e5615336565b901c90505b6140008216156147ad5760806147a8826f70d869a156d2a1b890bb3df62baf32f7615336565b901c90505b6180008216156147d85760806147d3826f31be135f97d08fd981231505542fcfa6615336565b901c90505b620100008216156148045760806147ff826f09aa508b5b7a84e1c677de54f3e99bc9615336565b901c90505b6202000082161561482f57608061482a826e5d6af8dedb81196699c329225ee604615336565b901c90505b62040000821615614859576080614854826d2216e584f5fa1ea926041bedfe98615336565b901c90505b6208000082161561488157608061487c826b048a170391f7dc42444e8fa2615336565b901c90505b60008460020b13156148ba576148b7817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6151fb565b90505b6148c964010000000082615498565b156148d55760016148d8565b60005b6148e99060ff16602083901c6151e3565b949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16111561492b579192915b73ffffffffffffffffffffffffffffffffffffffff84166149a47bffffffffffffffffffffffffffffffff000000000000000000000000606085901b1661497287876153e7565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16614ad7565b6149ae91906151fb565b90505b9392505050565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1611156149f2579192915b6149ae6fffffffffffffffffffffffffffffffff8316614a1286866153e7565b73ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000614ad7565b60008184841115614a79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109259190615033565b506000614a86848661541c565b95945050505050565b60008183614aca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109259190615033565b506000614a8684866151fb565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098587029250828110838203039150508060001415614b2f5760008411614b2457600080fd5b5082900490506149b1565b808411614b3b57600080fd5b600084868809808403938111909203919050600085614b7a817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61541c565b614b859060016151e3565b16958690049593849004936000819003046001019050614ba58184615336565b909317926000614bb6876003615336565b6002189050614bc58188615336565b614bd090600261541c565b614bda9082615336565b9050614be68188615336565b614bf190600261541c565b614bfb9082615336565b9050614c078188615336565b614c1290600261541c565b614c1c9082615336565b9050614c288188615336565b614c3390600261541c565b614c3d9082615336565b9050614c498188615336565b614c5490600261541c565b614c5e9082615336565b9050614c6a8188615336565b614c7590600261541c565b614c7f9082615336565b9050613cdf8186615336565b60405180608001604052806004906020820280368337509192915050565b8035600281900b8114614cbb57600080fd5b919050565b803562ffffff81168114614cbb57600080fd5b600060208284031215614ce4578081fd5b813561400c8161557d565b60008060008060008060c08789031215614d07578182fd5b8635614d128161557d565b95506020870135614d228161557d565b9450614d3060408801614cc0565b9350606087013592506080870135915060a0870135614d4e8161557d565b809150509295509295509295565b600080600060608486031215614d70578283fd5b8335614d7b8161557d565b92506020840135614d8b8161557d565b929592945050506040919091013590565b60008060008060808587031215614db1578384fd5b8435614dbc8161557d565b93506020850135614dcc8161557d565b9250604085013591506060850135614de38161559f565b939692955090935050565b60008060408385031215614e00578182fd5b8235614e0b8161557d565b946020939093013593505050565b60008060008060008060c08789031215614e31578182fd5b8635614e3c8161557d565b95506020870135945060408701359350614e5860608801614cc0565b9250614e6660808801614ca9565b9150614e7460a08801614ca9565b90509295509295509295565b600060208284031215614e91578081fd5b815161400c8161559f565b600060208284031215614ead578081fd5b5035919050565b600060208284031215614ec5578081fd5b5051919050565b60008060008060808587031215614ee1578384fd5b8451935060208501516fffffffffffffffffffffffffffffffff81168114614f07578384fd5b6040860151606090960151949790965092505050565b60008060408385031215614f2f578182fd5b505080516020909101519092909150565b600080600060608486031215614f54578081fd5b505081359360208301359350604090920135919050565b600060208284031215614f7c578081fd5b815160ff8116811461400c578182fd5b60008251614f9e818460208701615433565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b81811015614ff657835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101614fc4565b50909695505050505050565b60808101818360005b600481101561502a57815183526020928301929091019060010161500b565b50505092915050565b6020815260008251806020840152615052816040850160208701615433565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b815173ffffffffffffffffffffffffffffffffffffffff168152610160810160208301516150ca602084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060408301516150e1604084018262ffffff169052565b5060608301516150f6606084018260020b9052565b50608083015161510b608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008084015181840152506101208084015161515e8285018273ffffffffffffffffffffffffffffffffffffffff169052565b505061014092830151919092015290565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038413811516156151a9576151a961551f565b827f80000000000000000000000000000000000000000000000000000000000000000384128116156151dd576151dd61551f565b50500190565b600082198211156151f6576151f661551f565b500190565b60008261520a5761520a61554e565b500490565b600181815b8085111561526857817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561524e5761524e61551f565b8085161561525b57918102915b93841c9390800290615214565b509250929050565b600061400c83836000826152865750600161400f565b816152935750600061400f565b81600181146152a957600281146152b3576152cf565b600191505061400f565b60ff8411156152c4576152c461551f565b50506001821b61400f565b5060208310610133831016604e8410600b84101617156152f2575081810a61400f565b6152fc838361520f565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561532e5761532e61551f565b029392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561536e5761536e61551f565b500290565b6000808312837f8000000000000000000000000000000000000000000000000000000000000000018312811516156153ad576153ad61551f565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0183138116156153e1576153e161551f565b50500390565b600073ffffffffffffffffffffffffffffffffffffffff838116908316818110156154145761541461551f565b039392505050565b60008282101561542e5761542e61551f565b500390565b60005b8381101561544e578181015183820152602001615436565b838111156126f25750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156154915761549161551f565b5060010190565b6000826154a7576154a761554e565b500690565b60008160020b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000008114156154e2576154e261551f565b9003919050565b60007f800000000000000000000000000000000000000000000000000000000000000082141561551b5761551b61551f565b0390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610b8c57600080fd5b8015158114610b8c57600080fdfea2646970667358221220e17be7bd828d49ffb4ba6e76bead5b058d923ddc15f845b4c6febf1e8d1fcaee64736f6c63430008040033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"istanbul","libraries":{},"metadata":{"bytecodeHash":"ipfs","useLiteralContent":true},"optimizer":{"enabled":true,"runs":100000},"remappings":[]},"optimization_runs":100000,"sourcify_repo_url":null,"decoded_constructor_args":[["0x234D953a9404Bf9DbC3b526271d440cD2870bCd2",{"internalType":"address","name":"_creator_address","type":"address"}],["0x5180db0237291A6449DdA9ed33aD90a38787621c",{"internalType":"address","name":"_custodian_address","type":"address"}],["0x853d955aCEf822Db058eb8505911ED77F175b99e",{"internalType":"address","name":"_frax_contract_address","type":"address"}],["0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",{"internalType":"address","name":"_fxs_contract_address","type":"address"}],["0x8412ebf45bAC1B340BbE8F318b928C466c4E39CA",{"internalType":"address","name":"_timelock_address","type":"address"}],["0x1864Ca3d47AaB98Ee78D11fc9DCC5E7bADdA1c0d",{"internalType":"address","name":"_pool_address","type":"address"}],["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",{"internalType":"address","name":"_pool_collateral_address","type":"address"}],["0x1F98431c8aD98523631AE4a59f267346ea31F984",{"internalType":"address","name":"_univ3_factory_address","type":"address"}],["0xC36442b4a4522E871399CD717aBDD847Ab11FE88",{"internalType":"address","name":"_univ3_positions_address","type":"address"}],["0xE592427A0AEce92De3Edee1F18E0157C05861564",{"internalType":"address","name":"_univ3_router_address","type":"address"}]],"compiler_version":"0.8.4+commit.c7e474f2","is_verified_via_verifier_alliance":true,"verified_at":"2026-02-06T20:03:12.720173Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x60806040526a0422ca8b0a00a42500000060125565048c27395000601555620c8320601655600060175560006018553480156200003b57600080fd5b5060405162005ace38038062005ace8339810160408190526200005e9162000370565b896001600160a01b038116620000bb5760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b03831690811782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a150600680546001600160a01b03808b166001600160a01b031992831617909255600780548a8416908316179055600c805488841690831681179091556008805483169091179055600a80549287169282168317905560098054909116821790556040805163313ce56760e01b8152905162000202929163313ce567916004828101926020929190829003018186803b158015620001ae57600080fd5b505afa158015620001c3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001e991906200043e565b60ff166012620002c360201b62003fca1790919060201c565b600b55600d80546001600160a01b03199081166001600160a01b0398891617909155600e805482169a88169a909a179099556003805460018181019092557fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180548b169588169586179055600094855260046020526040909420805460ff1916909417909355600f80548916928616929092179091556010805488169185169190911790556011805490961692169190911790935550620004db92505050565b60006200030d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506200031460201b60201c565b9392505050565b600081848411156200033b5760405162461bcd60e51b8152600401620000b2919062000461565b5060006200034a8486620004b7565b95945050505050565b80516001600160a01b03811681146200036b57600080fd5b919050565b6000806000806000806000806000806101408b8d03121562000390578586fd5b6200039b8b62000353565b9950620003ab60208c0162000353565b9850620003bb60408c0162000353565b9750620003cb60608c0162000353565b9650620003db60808c0162000353565b9550620003eb60a08c0162000353565b9450620003fb60c08c0162000353565b93506200040b60e08c0162000353565b92506200041c6101008c0162000353565b91506200042d6101208c0162000353565b90509295989b9194979a5092959850565b60006020828403121562000450578081fd5b815160ff811681146200030d578182fd5b6000602080835283518082850152825b818110156200048f5785810183015185820160400152820162000471565b81811115620004a15783604083870101525b50601f01601f1916929092016040019392505050565b600082821015620004d657634e487b7160e01b81526011600452602481fd5b500390565b6155e380620004eb6000396000f3fe608060405234801561001057600080fd5b50600436106103365760003560e01c80637bdfc32a116101b2578063b497d8ca116100f9578063d72da8dc116100a2578063dc6663c71161007c578063dc6663c7146107ef578063e06b421b1461080f578063e97d85a514610822578063f0d2d5a81461082b57600080fd5b8063d72da8dc146107c1578063d989f747146107d4578063d99e4d67146107e757600080fd5b8063c8796572116100d3578063c879657214610778578063c98c05b714610780578063cfb13e651461078857600080fd5b8063b497d8ca1461073c578063bdacb3031461075c578063c221c32a1461076f57600080fd5b80638980f11f1161015b5780638f8e1ed2116101355780638f8e1ed214610722578063a7100f211461072b578063ad7b68fe1461073457600080fd5b80638980f11f146106dc5780638c79d138146106ef5780638da5cb5b1461070257600080fd5b80637e34026e1161018c5780637e34026e14610694578063819d4cc6146106a95780638292fd84146106bc57600080fd5b80637bdfc32a146106595780637ccc0078146106615780637ce6112b1461067457600080fd5b806337508b06116102815780634755abbb1161022a5780635e71823b116102045780635e71823b14610531578063722f7a9f14610539578063748e37f41461064957806379ba50971461065157600080fd5b80634755abbb146104de5780634bb4a730146104fe57806353a47bb71461051157600080fd5b8063403f37311161025b578063403f3731146104ae57806341401da9146104c1578063467b96e0146104d657600080fd5b806337508b061461045f578063377a18c7146104925780633ed4e55c146104a557600080fd5b806323fbd1c7116102e357806332b82dbb116102bd57806332b82dbb1461042357806336082ac01461044357806336d5a76d1461044c57600080fd5b806323fbd1c7146103df57806329988e2c146103f25780632e1a7d4d146103fb57600080fd5b80631627540c116103145780631627540c1461037f57806317284c94146103925780631baf16821461039a57600080fd5b806302825d111461033b57806303a76bff1461035057806314af33801461036c575b600080fd5b61034e610349366004614e9c565b61083e565b005b61035960185481565b6040519081526020015b60405180910390f35b61034e61037a366004614e9c565b610a67565b61034e61038d366004614cd3565b610b8f565b610359610caf565b600f546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610363565b61034e6103ed366004614e9c565b610db3565b61035960175481565b61040e610409366004614e9c565b610f0c565b60408051928352602083019190915201610363565b600a546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61035960165481565b61034e61045a366004614e9c565b611641565b61048261046d366004614cd3565b60046020526000908152604090205460ff1681565b6040519015158152602001610363565b61034e6104a0366004614e9c565b611b7c565b610359600b5481565b61034e6104bc366004614cd3565b612072565b6104c96121d9565b6040516103639190614fa8565b610359612248565b600c546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b6103ba61050c366004614e9c565b61242d565b6001546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b600254610359565b6105e5610547366004614e9c565b600560205260009081526040902080546001820154600292830154919273ffffffffffffffffffffffffffffffffffffffff909116916fffffffffffffffffffffffffffffffff8116917001000000000000000000000000000000008204810b91730100000000000000000000000000000000000000810490910b90760100000000000000000000000000000000000000000000900462ffffff1686565b6040805196875273ffffffffffffffffffffffffffffffffffffffff90951660208701526fffffffffffffffffffffffffffffffff90931693850193909352600290810b60608501529190910b608083015262ffffff1660a082015260c001610363565b610359612464565b61034e612486565b61034e6125d1565b61034e61066f366004614d5c565b6126f8565b600e546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61069c61280e565b6040516103639190615002565b61034e6106b7366004614dee565b6128f3565b6011546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61034e6106ea366004614dee565b612a7d565b61034e6106fd366004614d9c565b612b91565b6000546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61035960125481565b61035960135481565b610359612cf2565b6010546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61034e61076a366004614cd3565b612d04565b61035960145481565b61034e612e6b565b610359613154565b61079b610796366004614e19565b613176565b604080519283526fffffffffffffffffffffffffffffffff909116602083015201610363565b61034e6107cf366004614f40565b613766565b6105e56107e2366004614e9c565b613817565b6103596138c5565b600d546103ba9073ffffffffffffffffffffffffffffffffffffffff1681565b61035961081d366004614cef565b613aca565b61035960155481565b61034e610839366004614cd3565b613cec565b600d5473ffffffffffffffffffffffffffffffffffffffff1633148061087b575060005473ffffffffffffffffffffffffffffffffffffffff1633145b8061089d5750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b61092e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e0000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6007546040517f095ea7b30000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff9091169063095ea7b390604401602060405180830381600087803b1580156109a057600080fd5b505af11580156109b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d89190614e80565b506007546040517fa8a778ae0000000000000000000000000000000000000000000000000000000081523060048201526024810183905273ffffffffffffffffffffffffffffffffffffffff9091169063a8a778ae906044015b600060405180830381600087803b158015610a4c57600080fd5b505af1158015610a60573d6000803e3d6000fd5b5050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480610aa4575060005473ffffffffffffffffffffffffffffffffffffffff1633145b80610ac65750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b610b52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b601454610b5f9082614015565b601455600954600854610b8c9173ffffffffffffffffffffffffffffffffffffffff90811691168361408e565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e00000000000000000000000000000000006064820152608401610925565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229060200160405180910390a150565b600080610cba61280e565b6020015190506000610ce7610ccd61280e565b60400151610cd961280e565b60005b602002015190614015565b9050610da0620f4240610d9a600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632eb9771b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5b57600080fd5b505afa158015610d6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d939190614eb4565b84906141f7565b906142ac565b9050610dac8282614015565b9250505090565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480610df0575060005473ffffffffffffffffffffffffffffffffffffffff1633145b80610e125750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b610e9e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b8060186000828254610eb0919061516f565b90915550506006546040517f42966c680000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906342966c6890602401610a32565b600d54600090819073ffffffffffffffffffffffffffffffffffffffff16331480610f4e575060005473ffffffffffffffffffffffffffffffffffffffff1633145b610fb4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b6000838152600560209081526040808320815160c08101835281548152600182015473ffffffffffffffffffffffffffffffffffffffff908116828601526002928301546fffffffffffffffffffffffffffffffff8082168487019081527001000000000000000000000000000000008304860b860b860b6060808701919091527301000000000000000000000000000000000000008404870b870b90960b60808087019190915276010000000000000000000000000000000000000000000090930462ffffff1660a080870191909152875190810188528c815290518216978101978852808701898152958101988952637d7c549292810192835260105496517f0c49ccbe0000000000000000000000000000000000000000000000000000000081528151600482015297519091166024880152935160448701529551606486015294516084850152939092911690630c49ccbe9060a4016040805180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115e9190614f1d565b50506010546040805160808101825287815230602082019081526fffffffffffffffffffffffffffffffff8284018181526060840182815294517ffc6f786500000000000000000000000000000000000000000000000000000000815293516004850152915173ffffffffffffffffffffffffffffffffffffffff9081166024850152915181166044840152925190921660648201526000928392169063fc6f7865906084016040805180830381600087803b15801561121d57600080fd5b505af1158015611231573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112559190614f1d565b60008981526005602052604081208181556001810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560020180547fffffffffffffff0000000000000000000000000000000000000000000000000016905591935091505b600254811015611634578760028281548110611304577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060030201600001541415611622576002805461132c9060019061541c565b81548110611363577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060030201600282815481106113ab577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120825460039092020190815560018083015490820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790556002918201805491830180547fffffffffffffffffffffffffffffffff0000000000000000000000000000000081166fffffffffffffffffffffffffffffffff9094169384178255825470010000000000000000000000000000000090819004860b860b62ffffff9081169091027fffffffffffffffffffffffffff0000000000000000000000000000000000000090921690941717808255825473010000000000000000000000000000000000000090819004860b860b8516027fffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffff8216811783559254760100000000000000000000000000000000000000000000908190049094169093027fffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffff000000000000ffffffffffffffffffffffffffffffffffffff90931692909217179055805480611596577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008281526020812060037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909301928302019081556001810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560020180547fffffffffffffff0000000000000000000000000000000000000000000000000016905590555b8061162c8161545f565b9150506112bf565b5090945092505050915091565b600d5473ffffffffffffffffffffffffffffffffffffffff1633148061167e575060005473ffffffffffffffffffffffffffffffffffffffff1633145b6116e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b60006117b6600b54600a6116f89190615270565b610d9a620f4240610d9a6117af600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb73999f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561176d57600080fd5b505afa158015611781573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a59190614eb4565b620f424090613fca565b87906141f7565b9050600061186b620f4240610d9a600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632eb9771b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561182c57600080fd5b505afa158015611840573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118649190614eb4565b85906141f7565b905061191d600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f7683bbc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156118d857600080fd5b505afa1580156118ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119109190614eb4565b610d9a83620f42406141f7565b90506015546119348261192e613154565b90614015565b111561199c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f426f72726f7720636170000000000000000000000000000000000000000000006044820152606401610925565b6013546119a99082614015565b6013556006546040517fb4f56b260000000000000000000000000000000000000000000000000000000081523060048201526024810185905273ffffffffffffffffffffffffffffffffffffffff9091169063b4f56b2690604401600060405180830381600087803b158015611a1e57600080fd5b505af1158015611a32573d6000803e3d6000fd5b50506006546008546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9182166004820152602481018890529116925063095ea7b39150604401602060405180830381600087803b158015611aac57600080fd5b505af1158015611ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae49190614e80565b506008546040517f7e108af900000000000000000000000000000000000000000000000000000000815260048101859052600060248201819052604482015273ffffffffffffffffffffffffffffffffffffffff90911690637e108af990606401600060405180830381600087803b158015611b5f57600080fd5b505af1158015611b73573d6000803e3d6000fd5b50505050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480611bb9575060005473ffffffffffffffffffffffffffffffffffffffff1633145b611c1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b601254819081611c2d612cf2565b611c37919061516f565b1315611c9f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4d696e74206361702072656163686564000000000000000000000000000000006044820152606401610925565b80601754611cad919061516f565b601755601654600654604080517f2eb9771b000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff90921691632eb9771b91600480820192602092909190829003018186803b158015611d1e57600080fd5b505afa158015611d32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d569190614eb4565b11611de3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f436f6c6c61746572616c20726174696f20697320616c726561647920746f6f2060448201527f6c6f7700000000000000000000000000000000000000000000000000000000006064820152608401610925565b600654604080517fd2d97b06000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163d2d97b06916004808301926020929190829003018186803b158015611e4e57600080fd5b505afa158015611e62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e869190614eb4565b90506000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ef257600080fd5b505afa158015611f06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2a9190614eb4565b90506000611f388286614015565b90506000611f4d82610d9a86620f42406141f7565b90506016548111611fe0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4d696e74696e6720776f756c6420636175736520636f6c6c61746572616c207260448201527f6174696f20746f20626520746f6f206c6f7700000000000000000000000000006064820152608401610925565b6006546040517fb4f56b260000000000000000000000000000000000000000000000000000000081523060048201526024810188905273ffffffffffffffffffffffffffffffffffffffff9091169063b4f56b2690604401600060405180830381600087803b15801561205257600080fd5b505af1158015612066573d6000803e3d6000fd5b50505050505050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff163314806120af575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612115576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff8116612192576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437573746f6469616e20616464726573732063616e6e6f7420626520300000006044820152606401610925565b600e80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060600380548060200260200160405190810160405280929190818152602001828054801561223e57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311612213575b5050505050905090565b600080805b60035481101561242757600060038281548110612293577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600061234e8273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561230b57600080fd5b505afa15801561231f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123439190614f6b565b60129060ff16613fca565b9050600061240361236083600a615270565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b1580156123c557600080fd5b505afa1580156123d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fd9190614eb4565b906141f7565b905061240f8582614015565b9450505050808061241f9061545f565b91505061224d565b50919050565b6003818154811061243d57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b600061246e612cf2565b61247661280e565b516124819190615373565b905090565b60015473ffffffffffffffffffffffffffffffffffffffff16331461252d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e65727368697000000000000000000000006064820152608401610925565b6000546001546040805173ffffffffffffffffffffffffffffffffffffffff93841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b600d5473ffffffffffffffffffffffffffffffffffffffff1633148061260e575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612674576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166312ace5a26040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156126de57600080fd5b505af11580156126f2573d6000803e3d6000fd5b50505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612735575060005473ffffffffffffffffffffffffffffffffffffffff1633145b61279b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600c805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216811790925560088054821690921790915560098054939094169281168317909355600a8054909316909117909155600b55565b612816614c8b565b6006546040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b15801561287f57600080fd5b505afa158015612893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b79190614eb4565b81526128c1612248565b60208201526128ce6138c5565b6040820181905260208201516128eb919061192e90846000610cdc565b606082015290565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612930575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600e546040517f42842e0e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101839052908316906342842e0e90606401600060405180830381600087803b158015612a1057600080fd5b505af1158015612a24573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff86168152602081018590527f57519b6a0997d7d44511836bcee0a36871aa79d445816f6c464abb0cd9d3f3e893500190505b60405180910390a15050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612aba575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612b20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b600e54612b4590839073ffffffffffffffffffffffffffffffffffffffff168361408e565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f55350610fe57096d8c0ffa30beede987326bccfcb0b4415804164d0dd50ce8b19101612a71565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612bce575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612c34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b8015612c4a57612c458385846142ee565b6126f2565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301526024820184905284169063095ea7b390604401602060405180830381600087803b158015612cba57600080fd5b505af1158015612cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a609190614e80565b60006018546017546124819190615373565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612d41575060005473ffffffffffffffffffffffffffffffffffffffff1633145b612da7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff8116612e24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f54696d656c6f636b20616464726573732063616e6e6f742062652030000000006044820152606401610925565b600d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480612ea8575060005473ffffffffffffffffffffffffffffffffffffffff1633145b80612eca5750600e5473ffffffffffffffffffffffffffffffffffffffff1633145b612f56576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4e6f74206f776e65722c2074696d656c6f636b2c206f7220637573746f64696160448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b60005b600254811015610b8c57600060028281548110612f9f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160c08101825260039390930290910180548352600181015473ffffffffffffffffffffffffffffffffffffffff908116848601526002918201546fffffffffffffffffffffffffffffffff808216868601527001000000000000000000000000000000008204840b840b840b6060808801919091527301000000000000000000000000000000000000008304850b850b90940b60808088019190915276010000000000000000000000000000000000000000000090920462ffffff1660a08701528451918201855285518252600e54831696820196875281850181815293820181815260105495517ffc6f786500000000000000000000000000000000000000000000000000000000815283516004820152975184166024890152935181166044880152925190921660648601529294509291169063fc6f7865906084016040805180830381600087803b15801561310557600080fd5b505af1158015613119573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061313d9190614f1d565b50505050808061314c9061545f565b915050612f59565b6000601454601354106131705760145460135461248191613fca565b50600090565b600d54600090819073ffffffffffffffffffffffffffffffffffffffff163314806131b8575060005473ffffffffffffffffffffffffffffffffffffffff1633145b61321e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081019190915260065473ffffffffffffffffffffffffffffffffffffffff908116908a16101561331d5750604080516101608101825273ffffffffffffffffffffffffffffffffffffffff808b16825260065416602082015262ffffff871691810191909152600285810b606083015284900b608082015260a0810188905260c08101879052600060e0820181905261010082015230610120820152637d7c549261014082015261339c565b50604080516101608101825260065473ffffffffffffffffffffffffffffffffffffffff90811682528a16602082015262ffffff871691810191909152600285810b606083015284900b608082015260a0810187905260c08101889052600060e0820181905261010082015230610120820152637d7c54926101408201525b6010546133c1908a9073ffffffffffffffffffffffffffffffffffffffff168a6142ee565b6006546010546133eb9173ffffffffffffffffffffffffffffffffffffffff9081169116896142ee565b6010546040517f88316456000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff90911690638831645690613446908690600401615084565b608060405180830381600087803b15801561346057600080fd5b505af1158015613474573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134989190614ecc565b50509150915060006040518060c001604052808481526020018d73ffffffffffffffffffffffffffffffffffffffff168152602001836fffffffffffffffffffffffffffffffff1681526020018960020b81526020018860020b81526020018a62ffffff16815250905080600560008581526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060608201518160020160106101000a81548162ffffff021916908360020b62ffffff16021790555060808201518160020160136101000a81548162ffffff021916908360020b62ffffff16021790555060a08201518160020160166101000a81548162ffffff021916908362ffffff16021790555090505060028190806001815401808255809150506001900390600052602060002090600302016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060608201518160020160106101000a81548162ffffff021916908360020b62ffffff16021790555060808201518160020160136101000a81548162ffffff021916908360020b62ffffff16021790555060a08201518160020160166101000a81548162ffffff021916908362ffffff160217905550505082829550955050505050965096945050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff163314806137a3575060005473ffffffffffffffffffffffffffffffffffffffff1633145b613809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b601692909255601255601555565b6002818154811061382757600080fd5b600091825260209091206003909102018054600182015460029283015491935073ffffffffffffffffffffffffffffffffffffffff16916fffffffffffffffffffffffffffffffff8216917001000000000000000000000000000000008104820b917301000000000000000000000000000000000000008204900b90760100000000000000000000000000000000000000000000900462ffffff1686565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101829052819060005b600254811015613ac2576002818154811061393f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160c08101825260039390930290910180548352600181015473ffffffffffffffffffffffffffffffffffffffff16938301939093526002928301546fffffffffffffffffffffffffffffffff81169183018290527001000000000000000000000000000000008104840b840b840b60608401527301000000000000000000000000000000000000008104840b840b90930b608083015276010000000000000000000000000000000000000000000090920462ffffff1660a082015292508015613aaf576000613a208460600151614457565b90506000613a318560800151614457565b905073853d955acef822db058eb8505911ed77f175b99e73ffffffffffffffffffffffffffffffffffffffff16856020015173ffffffffffffffffffffffffffffffffffffffff161115613a9b57613a94613a8d8383866148f1565b8790614015565b9550613aac565b613aa9613a8d8383866149b8565b95505b50505b5080613aba8161545f565b9150506138fb565b509092915050565b600d5460009073ffffffffffffffffffffffffffffffffffffffff16331480613b0a575060005473ffffffffffffffffffffffffffffffffffffffff1633145b613b70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b604080516101008101825273ffffffffffffffffffffffffffffffffffffffff808a168252888116602083015262ffffff881692820192909252306060820152637d7c5492608082015260a0810186905260c0810185905283821660e08201526011549091613be2918a9116876142ee565b601154604080517f414bf389000000000000000000000000000000000000000000000000000000008152835173ffffffffffffffffffffffffffffffffffffffff90811660048301526020850151811660248301529184015162ffffff1660448201526060840151821660648201526080840151608482015260a084015160a482015260c084015160c482015260e0840151821660e4820152600092919091169063414bf3899061010401602060405180830381600087803b158015613ca757600080fd5b505af1158015613cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cdf9190614eb4565b9998505050505050505050565b600d5473ffffffffffffffffffffffffffffffffffffffff16331480613d29575060005473ffffffffffffffffffffffffffffffffffffffff1633145b613d8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f74206f776e6572206f722074696d656c6f636b00000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff8116613e0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5a65726f206164647265737320646574656374656400000000000000000000006044820152606401610925565b60065473ffffffffffffffffffffffffffffffffffffffff82811691161415613e91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f46524158206973206e6f7420636f6c6c61746572616c000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090205460ff1615613f21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4164647265737320616c726561647920657869737473000000000000000000006044820152606401610925565b73ffffffffffffffffffffffffffffffffffffffff16600081815260046020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091556003805491820181559091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169091179055565b600061400c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614a3b565b90505b92915050565b60008061402283856151e3565b90508381101561400c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610925565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905291516000928392908716916141259190614f8c565b6000604051808303816000865af19150503d8060008114614162576040519150601f19603f3d011682016040523d82523d6000602084013e614167565b606091505b50915091508180156141915750805115806141915750808060200190518101906141919190614e80565b610a60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610925565b6000826142065750600061400f565b60006142128385615336565b90508261421f85836151fb565b1461400c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60448201527f77000000000000000000000000000000000000000000000000000000000000006064820152608401610925565b600061400c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614a8f565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905291516000928392908716916143859190614f8c565b6000604051808303816000865af19150503d80600081146143c2576040519150601f19603f3d011682016040523d82523d6000602084013e6143c7565b606091505b50915091508180156143f15750805115806143f15750808060200190518101906143f19190614e80565b610a60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c454400006044820152606401610925565b60008060008360020b1261446e578260020b61447b565b8260020b61447b906154e9565b90506144a67ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff276186154ac565b60020b811315614512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f54000000000000000000000000000000000000000000000000000000000000006044820152606401610925565b60006001821661453357700100000000000000000000000000000000614545565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561458457608061457f826ffff97272373d413259a46990580e213a615336565b901c90505b60048216156145ae5760806145a9826ffff2e50f5f656932ef12357cf3c7fdcc615336565b901c90505b60088216156145d85760806145d3826fffe5caca7e10e4e61c3624eaa0941cd0615336565b901c90505b60108216156146025760806145fd826fffcb9843d60f6159c9db58835c926644615336565b901c90505b602082161561462c576080614627826fff973b41fa98c081472e6896dfb254c0615336565b901c90505b6040821615614656576080614651826fff2ea16466c96a3843ec78b326b52861615336565b901c90505b608082161561468057608061467b826ffe5dee046a99a2a811c461f1969c3053615336565b901c90505b6101008216156146ab5760806146a6826ffcbe86c7900a88aedcffc83b479aa3a4615336565b901c90505b6102008216156146d65760806146d1826ff987a7253ac413176f2b074cf7815e54615336565b901c90505b6104008216156147015760806146fc826ff3392b0822b70005940c7a398e4b70f3615336565b901c90505b61080082161561472c576080614727826fe7159475a2c29b7443b29c7fa6e889d9615336565b901c90505b611000821615614757576080614752826fd097f3bdfd2022b8845ad8f792aa5825615336565b901c90505b61200082161561478257608061477d826fa9f746462d870fdf8a65dc1f90e061e5615336565b901c90505b6140008216156147ad5760806147a8826f70d869a156d2a1b890bb3df62baf32f7615336565b901c90505b6180008216156147d85760806147d3826f31be135f97d08fd981231505542fcfa6615336565b901c90505b620100008216156148045760806147ff826f09aa508b5b7a84e1c677de54f3e99bc9615336565b901c90505b6202000082161561482f57608061482a826e5d6af8dedb81196699c329225ee604615336565b901c90505b62040000821615614859576080614854826d2216e584f5fa1ea926041bedfe98615336565b901c90505b6208000082161561488157608061487c826b048a170391f7dc42444e8fa2615336565b901c90505b60008460020b13156148ba576148b7817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6151fb565b90505b6148c964010000000082615498565b156148d55760016148d8565b60005b6148e99060ff16602083901c6151e3565b949350505050565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16111561492b579192915b73ffffffffffffffffffffffffffffffffffffffff84166149a47bffffffffffffffffffffffffffffffff000000000000000000000000606085901b1661497287876153e7565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16614ad7565b6149ae91906151fb565b90505b9392505050565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1611156149f2579192915b6149ae6fffffffffffffffffffffffffffffffff8316614a1286866153e7565b73ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000614ad7565b60008184841115614a79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109259190615033565b506000614a86848661541c565b95945050505050565b60008183614aca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109259190615033565b506000614a8684866151fb565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098587029250828110838203039150508060001415614b2f5760008411614b2457600080fd5b5082900490506149b1565b808411614b3b57600080fd5b600084868809808403938111909203919050600085614b7a817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61541c565b614b859060016151e3565b16958690049593849004936000819003046001019050614ba58184615336565b909317926000614bb6876003615336565b6002189050614bc58188615336565b614bd090600261541c565b614bda9082615336565b9050614be68188615336565b614bf190600261541c565b614bfb9082615336565b9050614c078188615336565b614c1290600261541c565b614c1c9082615336565b9050614c288188615336565b614c3390600261541c565b614c3d9082615336565b9050614c498188615336565b614c5490600261541c565b614c5e9082615336565b9050614c6a8188615336565b614c7590600261541c565b614c7f9082615336565b9050613cdf8186615336565b60405180608001604052806004906020820280368337509192915050565b8035600281900b8114614cbb57600080fd5b919050565b803562ffffff81168114614cbb57600080fd5b600060208284031215614ce4578081fd5b813561400c8161557d565b60008060008060008060c08789031215614d07578182fd5b8635614d128161557d565b95506020870135614d228161557d565b9450614d3060408801614cc0565b9350606087013592506080870135915060a0870135614d4e8161557d565b809150509295509295509295565b600080600060608486031215614d70578283fd5b8335614d7b8161557d565b92506020840135614d8b8161557d565b929592945050506040919091013590565b60008060008060808587031215614db1578384fd5b8435614dbc8161557d565b93506020850135614dcc8161557d565b9250604085013591506060850135614de38161559f565b939692955090935050565b60008060408385031215614e00578182fd5b8235614e0b8161557d565b946020939093013593505050565b60008060008060008060c08789031215614e31578182fd5b8635614e3c8161557d565b95506020870135945060408701359350614e5860608801614cc0565b9250614e6660808801614ca9565b9150614e7460a08801614ca9565b90509295509295509295565b600060208284031215614e91578081fd5b815161400c8161559f565b600060208284031215614ead578081fd5b5035919050565b600060208284031215614ec5578081fd5b5051919050565b60008060008060808587031215614ee1578384fd5b8451935060208501516fffffffffffffffffffffffffffffffff81168114614f07578384fd5b6040860151606090960151949790965092505050565b60008060408385031215614f2f578182fd5b505080516020909101519092909150565b600080600060608486031215614f54578081fd5b505081359360208301359350604090920135919050565b600060208284031215614f7c578081fd5b815160ff8116811461400c578182fd5b60008251614f9e818460208701615433565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b81811015614ff657835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101614fc4565b50909695505050505050565b60808101818360005b600481101561502a57815183526020928301929091019060010161500b565b50505092915050565b6020815260008251806020840152615052816040850160208701615433565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b815173ffffffffffffffffffffffffffffffffffffffff168152610160810160208301516150ca602084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060408301516150e1604084018262ffffff169052565b5060608301516150f6606084018260020b9052565b50608083015161510b608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e08301526101008084015181840152506101208084015161515e8285018273ffffffffffffffffffffffffffffffffffffffff169052565b505061014092830151919092015290565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038413811516156151a9576151a961551f565b827f80000000000000000000000000000000000000000000000000000000000000000384128116156151dd576151dd61551f565b50500190565b600082198211156151f6576151f661551f565b500190565b60008261520a5761520a61554e565b500490565b600181815b8085111561526857817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561524e5761524e61551f565b8085161561525b57918102915b93841c9390800290615214565b509250929050565b600061400c83836000826152865750600161400f565b816152935750600061400f565b81600181146152a957600281146152b3576152cf565b600191505061400f565b60ff8411156152c4576152c461551f565b50506001821b61400f565b5060208310610133831016604e8410600b84101617156152f2575081810a61400f565b6152fc838361520f565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561532e5761532e61551f565b029392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561536e5761536e61551f565b500290565b6000808312837f8000000000000000000000000000000000000000000000000000000000000000018312811516156153ad576153ad61551f565b837f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0183138116156153e1576153e161551f565b50500390565b600073ffffffffffffffffffffffffffffffffffffffff838116908316818110156154145761541461551f565b039392505050565b60008282101561542e5761542e61551f565b500390565b60005b8381101561544e578181015183820152602001615436565b838111156126f25750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156154915761549161551f565b5060010190565b6000826154a7576154a761554e565b500690565b60008160020b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000008114156154e2576154e261551f565b9003919050565b60007f800000000000000000000000000000000000000000000000000000000000000082141561551b5761551b61551f565b0390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610b8c57600080fd5b8015158114610b8c57600080fdfea2646970667358221220e17be7bd828d49ffb4ba6e76bead5b058d923ddc15f845b4c6febf1e8d1fcaee64736f6c63430008040033000000000000000000000000234d953a9404bf9dbc3b526271d440cd2870bcd20000000000000000000000005180db0237291a6449dda9ed33ad90a38787621c000000000000000000000000853d955acef822db058eb8505911ed77f175b99e0000000000000000000000003432b6a60d23ca0dfca7761b7ab56459d9c964d00000000000000000000000008412ebf45bac1b340bbe8f318b928c466c4e39ca0000000000000000000000001864ca3d47aab98ee78d11fc9dcc5e7badda1c0d000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564","name":"UniV3LiquidityAMO","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"istanbul","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"contracts/Math/FixedPoint.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport './Babylonian.sol';\n\n// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))\nlibrary FixedPoint {\n    // range: [0, 2**112 - 1]\n    // resolution: 1 / 2**112\n    struct uq112x112 {\n        uint224 _x;\n    }\n\n    // range: [0, 2**144 - 1]\n    // resolution: 1 / 2**112\n    struct uq144x112 {\n        uint _x;\n    }\n\n    uint8 private constant RESOLUTION = 112;\n    uint private constant Q112 = uint(1) << RESOLUTION;\n    uint private constant Q224 = Q112 << RESOLUTION;\n\n    // encode a uint112 as a UQ112x112\n    function encode(uint112 x) internal pure returns (uq112x112 memory) {\n        return uq112x112(uint224(x) << RESOLUTION);\n    }\n\n    // encodes a uint144 as a UQ144x112\n    function encode144(uint144 x) internal pure returns (uq144x112 memory) {\n        return uq144x112(uint256(x) << RESOLUTION);\n    }\n\n    // divide a UQ112x112 by a uint112, returning a UQ112x112\n    function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {\n        require(x != 0, 'FixedPoint: DIV_BY_ZERO');\n        return uq112x112(self._x / uint224(x));\n    }\n\n    // multiply a UQ112x112 by a uint, returning a UQ144x112\n    // reverts on overflow\n    function mul(uq112x112 memory self, uint y) internal pure returns (uq144x112 memory) {\n        uint z;\n        require(y == 0 || (z = uint(self._x) * y) / y == uint(self._x), \"FixedPoint: MULTIPLICATION_OVERFLOW\");\n        return uq144x112(z);\n    }\n\n    // returns a UQ112x112 which represents the ratio of the numerator to the denominator\n    // equivalent to encode(numerator).div(denominator)\n    function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {\n        require(denominator > 0, \"FixedPoint: DIV_BY_ZERO\");\n        return uq112x112((uint224(numerator) << RESOLUTION) / denominator);\n    }\n\n    // decode a UQ112x112 into a uint112 by truncating after the radix point\n    function decode(uq112x112 memory self) internal pure returns (uint112) {\n        return uint112(self._x >> RESOLUTION);\n    }\n\n    // decode a UQ144x112 into a uint144 by truncating after the radix point\n    function decode144(uq144x112 memory self) internal pure returns (uint144) {\n        return uint144(self._x >> RESOLUTION);\n    }\n\n    // take the reciprocal of a UQ112x112\n    function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {\n        require(self._x != 0, 'FixedPoint: ZERO_RECIPROCAL');\n        return uq112x112(uint224(Q224 / self._x));\n    }\n\n    // square root of a UQ112x112\n    function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {\n        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));\n    }\n}"},{"file_path":"contracts/Staking/Owned.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n// https://docs.synthetix.io/contracts/Owned\ncontract Owned {\n    address public owner;\n    address public nominatedOwner;\n\n    constructor (address _owner) public {\n        require(_owner != address(0), \"Owner address cannot be 0\");\n        owner = _owner;\n        emit OwnerChanged(address(0), _owner);\n    }\n\n    function nominateNewOwner(address _owner) external onlyOwner {\n        nominatedOwner = _owner;\n        emit OwnerNominated(_owner);\n    }\n\n    function acceptOwnership() external {\n        require(msg.sender == nominatedOwner, \"You must be nominated before you can accept ownership\");\n        emit OwnerChanged(owner, nominatedOwner);\n        owner = nominatedOwner;\n        nominatedOwner = address(0);\n    }\n\n    modifier onlyOwner {\n        require(msg.sender == owner, \"Only the contract owner may perform this action\");\n        _;\n    }\n\n    event OwnerNominated(address newOwner);\n    event OwnerChanged(address oldOwner, address newOwner);\n}"},{"file_path":"contracts/ERC20/ERC20Custom.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport \"../Common/Context.sol\";\nimport \"./IERC20.sol\";\nimport \"../Math/SafeMath.sol\";\nimport \"../Utils/Address.sol\";\n\n// Due to compiling issues, _name, _symbol, and _decimals were removed\n\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20Mintable}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Custom is Context, IERC20 {\n    using SafeMath for uint256;\n\n    mapping (address => uint256) internal _balances;\n\n    mapping (address => mapping (address => uint256)) internal _allowances;\n\n    uint256 private _totalSupply;\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `recipient` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n        _transfer(_msgSender(), recipient, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.approve(address spender, uint256 amount)\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        _approve(_msgSender(), spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20};\n     *\n     * Requirements:\n     * - `sender` and `recipient` cannot be the zero address.\n     * - `sender` must have a balance of at least `amount`.\n     * - the caller must have allowance for `sender`'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n        _transfer(sender, recipient, amount);\n        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n        return true;\n    }\n\n    /**\n     * @dev Moves tokens `amount` from `sender` to `recipient`.\n     *\n     * This is internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `sender` cannot be the zero address.\n     * - `recipient` cannot be the zero address.\n     * - `sender` must have a balance of at least `amount`.\n     */\n    function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n        require(sender != address(0), \"ERC20: transfer from the zero address\");\n        require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(sender, recipient, amount);\n\n        _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n        _balances[recipient] = _balances[recipient].add(amount);\n        emit Transfer(sender, recipient, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements\n     *\n     * - `to` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply = _totalSupply.add(amount);\n        _balances[account] = _balances[account].add(amount);\n        emit Transfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from the caller.\n     *\n     * See {ERC20-_burn}.\n     */\n    function burn(uint256 amount) public virtual {\n        _burn(_msgSender(), amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n     * allowance.\n     *\n     * See {ERC20-_burn} and {ERC20-allowance}.\n     *\n     * Requirements:\n     *\n     * - the caller must have allowance for `accounts`'s tokens of at least\n     * `amount`.\n     */\n    function burnFrom(address account, uint256 amount) public virtual {\n        uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, \"ERC20: burn amount exceeds allowance\");\n\n        _approve(account, _msgSender(), decreasedAllowance);\n        _burn(account, amount);\n    }\n\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n        _totalSupply = _totalSupply.sub(amount);\n        emit Transfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.\n     *\n     * This is internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`.`amount` is then deducted\n     * from the caller's allowance.\n     *\n     * See {_burn} and {_approve}.\n     */\n    function _burnFrom(address account, uint256 amount) internal virtual {\n        _burn(account, amount);\n        _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, \"ERC20: burn amount exceeds allowance\"));\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of `from`'s tokens\n     * will be to transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of `from`'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:using-hooks.adoc[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\n}"},{"file_path":"contracts/Uniswap/Interfaces/IUniswapV2Pair.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\ninterface IUniswapV2Pair {\n    event Approval(address indexed owner, address indexed spender, uint value);\n    event Transfer(address indexed from, address indexed to, uint value);\n\n    function name() external pure returns (string memory);\n    function symbol() external pure returns (string memory);\n    function decimals() external pure returns (uint8);\n    function totalSupply() external view returns (uint);\n    function balanceOf(address owner) external view returns (uint);\n    function allowance(address owner, address spender) external view returns (uint);\n\n    function approve(address spender, uint value) external returns (bool);\n    function transfer(address to, uint value) external returns (bool);\n    function transferFrom(address from, address to, uint value) external returns (bool);\n\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n    function PERMIT_TYPEHASH() external pure returns (bytes32);\n    function nonces(address owner) external view returns (uint);\n\n    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n\n    event Mint(address indexed sender, uint amount0, uint amount1);\n    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\n    event Swap(\n        address indexed sender,\n        uint amount0In,\n        uint amount1In,\n        uint amount0Out,\n        uint amount1Out,\n        address indexed to\n    );\n    event Sync(uint112 reserve0, uint112 reserve1);\n\n    function MINIMUM_LIQUIDITY() external pure returns (uint);\n    function factory() external view returns (address);\n    function token0() external view returns (address);\n    function token1() external view returns (address);\n    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n    function price0CumulativeLast() external view returns (uint);\n    function price1CumulativeLast() external view returns (uint);\n    function kLast() external view returns (uint);\n\n    function mint(address to) external returns (uint liquidity);\n    function burn(address to) external returns (uint amount0, uint amount1);\n    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\n    function skim(address to) external;\n    function sync() external;\n\n    function initialize(address, address) external;\n\n\n\n\n\n\n\n\n\n\n\n\n    \n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Enumerable is IERC721 {\n    /**\n     * @dev Returns the total amount of tokens stored by the contract.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n     */\n    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);\n\n    /**\n     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n     * Use along with {totalSupply} to enumerate all tokens.\n     */\n    function tokenByIndex(uint256 index) external view returns (uint256);\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n    /**\n     * @dev Returns the token collection name.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the token collection symbol.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n     */\n    function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n"},{"file_path":"contracts/Uniswap_V3/periphery/interfaces/IERC721Permit.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\n\n/// @title ERC721 with permit\n/// @notice Extension to ERC721 that includes a permit function for signature based approvals\ninterface IERC721Permit is IERC721 {\n    /// @notice The permit typehash used in the permit signature\n    /// @return The typehash for the permit\n    function PERMIT_TYPEHASH() external pure returns (bytes32);\n\n    /// @notice The domain separator used in the permit signature\n    /// @return The domain seperator used in encoding of permit signature\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n    /// @notice Approve of a specific token ID for spending by spender via signature\n    /// @param spender The account that is being approved\n    /// @param tokenId The ID of the token that is being approved for spending\n    /// @param deadline The deadline timestamp by which the call must be mined for the approve to work\n    /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`\n    /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`\n    /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`\n    function permit(\n        address spender,\n        uint256 tokenId,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external payable;\n}"},{"file_path":"contracts/Math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a >= b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow, so we distribute\n        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);\n    }\n\n    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)\n    function sqrt(uint y) internal pure returns (uint z) {\n        if (y > 3) {\n            z = y;\n            uint x = y / 2 + 1;\n            while (x < z) {\n                z = x;\n                x = (y / x + x) / 2;\n            }\n        } else if (y != 0) {\n            z = 1;\n        }\n    }\n}"},{"file_path":"contracts/Uniswap_V3/IUniswapV3Pool.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n    IUniswapV3PoolImmutables,\n    IUniswapV3PoolState,\n    IUniswapV3PoolDerivedState,\n    IUniswapV3PoolActions,\n    IUniswapV3PoolOwnerActions,\n    IUniswapV3PoolEvents\n{\n\n}"},{"file_path":"contracts/Uniswap_V3/periphery/interfaces/IPeripheryPayments.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\n\n/// @title Periphery Payments\n/// @notice Functions to ease deposits and withdrawals of ETH\ninterface IPeripheryPayments {\n    /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH.\n    /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.\n    /// @param amountMinimum The minimum amount of WETH9 to unwrap\n    /// @param recipient The address receiving ETH\n    function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;\n\n    /// @notice Refunds any ETH balance held by this contract to the `msg.sender`\n    /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps\n    /// that use ether for the input amount\n    function refundETH() external payable;\n\n    /// @notice Transfers the full amount of a token held by this contract to recipient\n    /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users\n    /// @param token The contract address of the token which will be transferred to `recipient`\n    /// @param amountMinimum The minimum amount of token required for a transfer\n    /// @param recipient The destination address of the token\n    function sweepToken(\n        address token,\n        uint256 amountMinimum,\n        address recipient\n    ) external payable;\n}"},{"file_path":"contracts/Uniswap_V3/periphery/interfaces/INonfungiblePositionManager.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';\nimport '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';\n\nimport './IPoolInitializer.sol';\nimport './IERC721Permit.sol';\nimport './IPeripheryPayments.sol';\nimport './IPeripheryImmutableState.sol';\nimport '../libraries/PoolAddress.sol';\n\n/// @title Non-fungible token for positions\n/// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred\n/// and authorized.\ninterface INonfungiblePositionManager is\n    IPoolInitializer,\n    IPeripheryPayments,\n    IPeripheryImmutableState,\n    IERC721Metadata,\n    IERC721Enumerable,\n    IERC721Permit\n{\n    /// @notice Emitted when liquidity is increased for a position NFT\n    /// @dev Also emitted when a token is minted\n    /// @param tokenId The ID of the token for which liquidity was increased\n    /// @param liquidity The amount by which liquidity for the NFT position was increased\n    /// @param amount0 The amount of token0 that was paid for the increase in liquidity\n    /// @param amount1 The amount of token1 that was paid for the increase in liquidity\n    event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n    /// @notice Emitted when liquidity is decreased for a position NFT\n    /// @param tokenId The ID of the token for which liquidity was decreased\n    /// @param liquidity The amount by which liquidity for the NFT position was decreased\n    /// @param amount0 The amount of token0 that was accounted for the decrease in liquidity\n    /// @param amount1 The amount of token1 that was accounted for the decrease in liquidity\n    event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);\n    /// @notice Emitted when tokens are collected for a position NFT\n    /// @dev The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior\n    /// @param tokenId The ID of the token for which underlying tokens were collected\n    /// @param recipient The address of the account that received the collected tokens\n    /// @param amount0 The amount of token0 owed to the position that was collected\n    /// @param amount1 The amount of token1 owed to the position that was collected\n    event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1);\n\n    /// @notice Returns the position information associated with a given token ID.\n    /// @dev Throws if the token ID is not valid.\n    /// @param tokenId The ID of the token that represents the position\n    /// @return nonce The nonce for permits\n    /// @return operator The address that is approved for spending\n    /// @return token0 The address of the token0 for a specific pool\n    /// @return token1 The address of the token1 for a specific pool\n    /// @return fee The fee associated with the pool\n    /// @return tickLower The lower end of the tick range for the position\n    /// @return tickUpper The higher end of the tick range for the position\n    /// @return liquidity The liquidity of the position\n    /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position\n    /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position\n    /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation\n    /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation\n    function positions(uint256 tokenId)\n        external\n        view\n        returns (\n            uint96 nonce,\n            address operator,\n            address token0,\n            address token1,\n            uint24 fee,\n            int24 tickLower,\n            int24 tickUpper,\n            uint128 liquidity,\n            uint256 feeGrowthInside0LastX128,\n            uint256 feeGrowthInside1LastX128,\n            uint128 tokensOwed0,\n            uint128 tokensOwed1\n        );\n\n    struct MintParams {\n        address token0;\n        address token1;\n        uint24 fee;\n        int24 tickLower;\n        int24 tickUpper;\n        uint256 amount0Desired;\n        uint256 amount1Desired;\n        uint256 amount0Min;\n        uint256 amount1Min;\n        address recipient;\n        uint256 deadline;\n    }\n\n    /// @notice Creates a new position wrapped in a NFT\n    /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized\n    /// a method does not exist, i.e. the pool is assumed to be initialized.\n    /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata\n    /// @return tokenId The ID of the token that represents the minted position\n    /// @return liquidity The amount of liquidity for this position\n    /// @return amount0 The amount of token0\n    /// @return amount1 The amount of token1\n    function mint(MintParams calldata params)\n        external\n        payable\n        returns (\n            uint256 tokenId,\n            uint128 liquidity,\n            uint256 amount0,\n            uint256 amount1\n        );\n\n    struct IncreaseLiquidityParams {\n        uint256 tokenId;\n        uint256 amount0Desired;\n        uint256 amount1Desired;\n        uint256 amount0Min;\n        uint256 amount1Min;\n        uint256 deadline;\n    }\n\n    /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`\n    /// @param params tokenId The ID of the token for which liquidity is being increased,\n    /// amount0Desired The desired amount of token0 to be spent,\n    /// amount1Desired The desired amount of token1 to be spent,\n    /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check,\n    /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check,\n    /// deadline The time by which the transaction must be included to effect the change\n    /// @return liquidity The new liquidity amount as a result of the increase\n    /// @return amount0 The amount of token0 to acheive resulting liquidity\n    /// @return amount1 The amount of token1 to acheive resulting liquidity\n    function increaseLiquidity(IncreaseLiquidityParams calldata params)\n        external\n        payable\n        returns (\n            uint128 liquidity,\n            uint256 amount0,\n            uint256 amount1\n        );\n\n    struct DecreaseLiquidityParams {\n        uint256 tokenId;\n        uint128 liquidity;\n        uint256 amount0Min;\n        uint256 amount1Min;\n        uint256 deadline;\n    }\n\n    /// @notice Decreases the amount of liquidity in a position and accounts it to the position\n    /// @param params tokenId The ID of the token for which liquidity is being decreased,\n    /// amount The amount by which liquidity will be decreased,\n    /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,\n    /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,\n    /// deadline The time by which the transaction must be included to effect the change\n    /// @return amount0 The amount of token0 accounted to the position's tokens owed\n    /// @return amount1 The amount of token1 accounted to the position's tokens owed\n    function decreaseLiquidity(DecreaseLiquidityParams calldata params)\n        external\n        payable\n        returns (uint256 amount0, uint256 amount1);\n\n    struct CollectParams {\n        uint256 tokenId;\n        address recipient;\n        uint128 amount0Max;\n        uint128 amount1Max;\n    }\n\n    /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient\n    /// @param params tokenId The ID of the NFT for which tokens are being collected,\n    /// recipient The account that should receive the tokens,\n    /// amount0Max The maximum amount of token0 to collect,\n    /// amount1Max The maximum amount of token1 to collect\n    /// @return amount0 The amount of fees collected in token0\n    /// @return amount1 The amount of fees collected in token1\n    function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);\n\n    /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens\n    /// must be collected first.\n    /// @param tokenId The ID of the token that is being burned\n    function burn(uint256 tokenId) external payable;\n}"},{"file_path":"contracts/Oracle/UniswapPairOracle.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport '../Uniswap/Interfaces/IUniswapV2Factory.sol';\nimport '../Uniswap/Interfaces/IUniswapV2Pair.sol';\nimport '../Math/FixedPoint.sol';\n\nimport '../Uniswap/UniswapV2OracleLibrary.sol';\nimport '../Uniswap/UniswapV2Library.sol';\nimport \"../Staking/Owned.sol\";\n\n// Fixed window oracle that recomputes the average price for the entire period once every period\n// Note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period\ncontract UniswapPairOracle is Owned {\n    using FixedPoint for *;\n    \n    address timelock_address;\n\n    uint public PERIOD = 3600; // 1 hour TWAP (time-weighted average price)\n    uint public CONSULT_LENIENCY = 120; // Used for being able to consult past the period end\n    bool public ALLOW_STALE_CONSULTS = false; // If false, consult() will fail if the TWAP is stale\n\n    IUniswapV2Pair public immutable pair;\n    address public immutable token0;\n    address public immutable token1;\n\n    uint    public price0CumulativeLast;\n    uint    public price1CumulativeLast;\n    uint32  public blockTimestampLast;\n    FixedPoint.uq112x112 public price0Average;\n    FixedPoint.uq112x112 public price1Average;\n\n    modifier onlyByOwnGov() {\n        require(msg.sender == owner || msg.sender == timelock_address, \"You are not an owner or the governance timelock\");\n        _;\n    }\n\n    constructor (address factory, address tokenA, address tokenB, address _owner_address, address _timelock_address) public Owned(_owner_address) {\n        IUniswapV2Pair _pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, tokenA, tokenB));\n        pair = _pair;\n        token0 = _pair.token0();\n        token1 = _pair.token1();\n        price0CumulativeLast = _pair.price0CumulativeLast(); // Fetch the current accumulated price value (1 / 0)\n        price1CumulativeLast = _pair.price1CumulativeLast(); // Fetch the current accumulated price value (0 / 1)\n        uint112 reserve0;\n        uint112 reserve1;\n        (reserve0, reserve1, blockTimestampLast) = _pair.getReserves();\n        require(reserve0 != 0 && reserve1 != 0, 'UniswapPairOracle: NO_RESERVES'); // Ensure that there's liquidity in the pair\n\n        timelock_address = _timelock_address;\n    }\n\n    function setTimelock(address _timelock_address) external onlyByOwnGov {\n        timelock_address = _timelock_address;\n    }\n\n    function setPeriod(uint _period) external onlyByOwnGov {\n        PERIOD = _period;\n    }\n\n    function setConsultLeniency(uint _consult_leniency) external onlyByOwnGov {\n        CONSULT_LENIENCY = _consult_leniency;\n    }\n\n    function setAllowStaleConsults(bool _allow_stale_consults) external onlyByOwnGov {\n        ALLOW_STALE_CONSULTS = _allow_stale_consults;\n    }\n\n    // Check if update() can be called instead of wasting gas calling it\n    function canUpdate() public view returns (bool) {\n        uint32 blockTimestamp = UniswapV2OracleLibrary.currentBlockTimestamp();\n        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // Overflow is desired\n        return (timeElapsed >= PERIOD);\n    }\n\n    function update() external {\n        (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) =\n            UniswapV2OracleLibrary.currentCumulativePrices(address(pair));\n        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // Overflow is desired\n\n        // Ensure that at least one full period has passed since the last update\n        require(timeElapsed >= PERIOD, 'UniswapPairOracle: PERIOD_NOT_ELAPSED');\n\n        // Overflow is desired, casting never truncates\n        // Cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed\n        price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed));\n        price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed));\n\n        price0CumulativeLast = price0Cumulative;\n        price1CumulativeLast = price1Cumulative;\n        blockTimestampLast = blockTimestamp;\n    }\n\n    // Note this will always return 0 before update has been called successfully for the first time.\n    function consult(address token, uint amountIn) external view returns (uint amountOut) {\n        uint32 blockTimestamp = UniswapV2OracleLibrary.currentBlockTimestamp();\n        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // Overflow is desired\n\n        // Ensure that the price is not stale\n        require((timeElapsed < (PERIOD + CONSULT_LENIENCY)) || ALLOW_STALE_CONSULTS, 'UniswapPairOracle: PRICE_IS_STALE_NEED_TO_CALL_UPDATE');\n\n        if (token == token0) {\n            amountOut = price0Average.mul(amountIn).decode144();\n        } else {\n            require(token == token1, 'UniswapPairOracle: INVALID_TOKEN');\n            amountOut = price1Average.mul(amountIn).decode144();\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC721/IERC721.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 tokenId\n    ) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the caller.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool _approved) external;\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 tokenId,\n        bytes calldata data\n    ) external;\n}\n"},{"file_path":"contracts/Frax/Pools/FraxPool.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n// ====================================================================\n// |     ______                   _______                             |\n// |    / _____________ __  __   / ____(_____  ____ _____  ________   |\n// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \\/ __ `/ __ \\/ ___/ _ \\  |\n// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |\n// | /_/   /_/   \\__,_/_/|_|  /_/   /_/_/ /_/\\__,_/_/ /_/\\___/\\___/   |\n// |                                                                  |\n// ====================================================================\n// ============================= FraxPool =============================\n// ====================================================================\n// Frax Finance: https://github.com/FraxFinance\n\n// Primary Author(s)\n// Travis Moore: https://github.com/FortisFortuna\n// Jason Huan: https://github.com/jasonhuan\n// Sam Kazemian: https://github.com/samkazemian\n\n// Reviewer(s) / Contributor(s)\n// Sam Sun: https://github.com/samczsun\n\nimport \"../../Math/SafeMath.sol\";\nimport '../../Uniswap/TransferHelper.sol';\nimport \"../../Staking/Owned.sol\";\nimport \"../../FXS/FXS.sol\";\nimport \"../../Frax/Frax.sol\";\nimport \"../../ERC20/ERC20.sol\";\nimport \"../../Oracle/UniswapPairOracle.sol\";\nimport \"../../Governance/AccessControl.sol\";\nimport \"./FraxPoolLibrary.sol\";\n\ncontract FraxPool is AccessControl, Owned {\n    using SafeMath for uint256;\n\n    /* ========== STATE VARIABLES ========== */\n\n    ERC20 private collateral_token;\n    address private collateral_address;\n\n    address private frax_contract_address;\n    address private fxs_contract_address;\n    address private timelock_address;\n    FRAXShares private FXS;\n    FRAXStablecoin private FRAX;\n\n    UniswapPairOracle private collatEthOracle;\n    address public collat_eth_oracle_address;\n    address private weth_address;\n\n    uint256 public minting_fee;\n    uint256 public redemption_fee;\n    uint256 public buyback_fee;\n    uint256 public recollat_fee;\n\n    mapping (address => uint256) public redeemFXSBalances;\n    mapping (address => uint256) public redeemCollateralBalances;\n    uint256 public unclaimedPoolCollateral;\n    uint256 public unclaimedPoolFXS;\n    mapping (address => uint256) public lastRedeemed;\n\n    // Constants for various precisions\n    uint256 private constant PRICE_PRECISION = 1e6;\n    uint256 private constant COLLATERAL_RATIO_PRECISION = 1e6;\n    uint256 private constant COLLATERAL_RATIO_MAX = 1e6;\n\n    // Number of decimals needed to get to 18\n    uint256 private immutable missing_decimals;\n    \n    // Pool_ceiling is the total units of collateral that a pool contract can hold\n    uint256 public pool_ceiling = 0;\n\n    // Stores price of the collateral, if price is paused\n    uint256 public pausedPrice = 0;\n\n    // Bonus rate on FXS minted during recollateralizeFRAX(); 6 decimals of precision, set to 0.75% on genesis\n    uint256 public bonus_rate = 7500;\n\n    // Number of blocks to wait before being able to collectRedemption()\n    uint256 public redemption_delay = 1;\n\n    // AccessControl Roles\n    bytes32 private constant MINT_PAUSER = keccak256(\"MINT_PAUSER\");\n    bytes32 private constant REDEEM_PAUSER = keccak256(\"REDEEM_PAUSER\");\n    bytes32 private constant BUYBACK_PAUSER = keccak256(\"BUYBACK_PAUSER\");\n    bytes32 private constant RECOLLATERALIZE_PAUSER = keccak256(\"RECOLLATERALIZE_PAUSER\");\n    bytes32 private constant COLLATERAL_PRICE_PAUSER = keccak256(\"COLLATERAL_PRICE_PAUSER\");\n    \n    // AccessControl state variables\n    bool public mintPaused = false;\n    bool public redeemPaused = false;\n    bool public recollateralizePaused = false;\n    bool public buyBackPaused = false;\n    bool public collateralPricePaused = false;\n\n    /* ========== MODIFIERS ========== */\n\n    modifier onlyByOwnGov() {\n        require(msg.sender == timelock_address || msg.sender == owner, \"Not owner or timelock\");\n        _;\n    }\n\n    modifier notRedeemPaused() {\n        require(redeemPaused == false, \"Redeeming is paused\");\n        _;\n    }\n\n    modifier notMintPaused() {\n        require(mintPaused == false, \"Minting is paused\");\n        _;\n    }\n \n    /* ========== CONSTRUCTOR ========== */\n    \n    constructor (\n        address _frax_contract_address,\n        address _fxs_contract_address,\n        address _collateral_address,\n        address _creator_address,\n        address _timelock_address,\n        uint256 _pool_ceiling\n    ) public Owned(_creator_address){\n        require(\n            (_frax_contract_address != address(0))\n            && (_fxs_contract_address != address(0))\n            && (_collateral_address != address(0))\n            && (_creator_address != address(0))\n            && (_timelock_address != address(0))\n        , \"Zero address detected\"); \n        FRAX = FRAXStablecoin(_frax_contract_address);\n        FXS = FRAXShares(_fxs_contract_address);\n        frax_contract_address = _frax_contract_address;\n        fxs_contract_address = _fxs_contract_address;\n        collateral_address = _collateral_address;\n        timelock_address = _timelock_address;\n        collateral_token = ERC20(_collateral_address);\n        pool_ceiling = _pool_ceiling;\n        missing_decimals = uint(18).sub(collateral_token.decimals());\n\n        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n        grantRole(MINT_PAUSER, timelock_address);\n        grantRole(REDEEM_PAUSER, timelock_address);\n        grantRole(RECOLLATERALIZE_PAUSER, timelock_address);\n        grantRole(BUYBACK_PAUSER, timelock_address);\n        grantRole(COLLATERAL_PRICE_PAUSER, timelock_address);\n    }\n\n    /* ========== VIEWS ========== */\n\n    // Returns dollar value of collateral held in this Frax pool\n    function collatDollarBalance() public view returns (uint256) {\n        if(collateralPricePaused == true){\n            return (collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral)).mul(10 ** missing_decimals).mul(pausedPrice).div(PRICE_PRECISION);\n        } else {\n            uint256 eth_usd_price = FRAX.eth_usd_price();\n            uint256 eth_collat_price = collatEthOracle.consult(weth_address, (PRICE_PRECISION * (10 ** missing_decimals)));\n\n            uint256 collat_usd_price = eth_usd_price.mul(PRICE_PRECISION).div(eth_collat_price);\n            return (collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral)).mul(10 ** missing_decimals).mul(collat_usd_price).div(PRICE_PRECISION); //.mul(getCollateralPrice()).div(1e6);    \n        }\n    }\n\n    // Returns the value of excess collateral held in this Frax pool, compared to what is needed to maintain the global collateral ratio\n    function availableExcessCollatDV() public view returns (uint256) {\n        uint256 total_supply = FRAX.totalSupply();\n        uint256 global_collateral_ratio = FRAX.global_collateral_ratio();\n        uint256 global_collat_value = FRAX.globalCollateralValue();\n\n        if (global_collateral_ratio > COLLATERAL_RATIO_PRECISION) global_collateral_ratio = COLLATERAL_RATIO_PRECISION; // Handles an overcollateralized contract with CR > 1\n        uint256 required_collat_dollar_value_d18 = (total_supply.mul(global_collateral_ratio)).div(COLLATERAL_RATIO_PRECISION); // Calculates collateral needed to back each 1 FRAX with $1 of collateral at current collat ratio\n        if (global_collat_value > required_collat_dollar_value_d18) return global_collat_value.sub(required_collat_dollar_value_d18);\n        else return 0;\n    }\n\n    /* ========== PUBLIC FUNCTIONS ========== */\n    \n    // Returns the price of the pool collateral in USD\n    function getCollateralPrice() public view returns (uint256) {\n        if(collateralPricePaused == true){\n            return pausedPrice;\n        } else {\n            uint256 eth_usd_price = FRAX.eth_usd_price();\n            return eth_usd_price.mul(PRICE_PRECISION).div(collatEthOracle.consult(weth_address, PRICE_PRECISION * (10 ** missing_decimals)));\n        }\n    }\n\n    function setCollatETHOracle(address _collateral_weth_oracle_address, address _weth_address) external onlyByOwnGov {\n        collat_eth_oracle_address = _collateral_weth_oracle_address;\n        collatEthOracle = UniswapPairOracle(_collateral_weth_oracle_address);\n        weth_address = _weth_address;\n    }\n\n    // We separate out the 1t1, fractional and algorithmic minting functions for gas efficiency \n    function mint1t1FRAX(uint256 collateral_amount, uint256 FRAX_out_min) external notMintPaused {\n        uint256 collateral_amount_d18 = collateral_amount * (10 ** missing_decimals);\n\n        require(FRAX.global_collateral_ratio() >= COLLATERAL_RATIO_MAX, \"Collateral ratio must be >= 1\");\n        require((collateral_token.balanceOf(address(this))).sub(unclaimedPoolCollateral).add(collateral_amount) <= pool_ceiling, \"[Pool's Closed]: Ceiling reached\");\n        \n        (uint256 frax_amount_d18) = FraxPoolLibrary.calcMint1t1FRAX(\n            getCollateralPrice(),\n            collateral_amount_d18\n        ); //1 FRAX for each $1 worth of collateral\n\n        frax_amount_d18 = (frax_amount_d18.mul(uint(1e6).sub(minting_fee))).div(1e6); //remove precision at the end\n        require(FRAX_out_min <= frax_amount_d18, \"Slippage limit reached\");\n\n        TransferHelper.safeTransferFrom(address(collateral_token), msg.sender, address(this), collateral_amount);\n        FRAX.pool_mint(msg.sender, frax_amount_d18);\n    }\n\n    // 0% collateral-backed\n    function mintAlgorithmicFRAX(uint256 fxs_amount_d18, uint256 FRAX_out_min) external notMintPaused {\n        uint256 fxs_price = FRAX.fxs_price();\n        require(FRAX.global_collateral_ratio() == 0, \"Collateral ratio must be 0\");\n        \n        (uint256 frax_amount_d18) = FraxPoolLibrary.calcMintAlgorithmicFRAX(\n            fxs_price, // X FXS / 1 USD\n            fxs_amount_d18\n        );\n\n        frax_amount_d18 = (frax_amount_d18.mul(uint(1e6).sub(minting_fee))).div(1e6);\n        require(FRAX_out_min <= frax_amount_d18, \"Slippage limit reached\");\n\n        FXS.pool_burn_from(msg.sender, fxs_amount_d18);\n        FRAX.pool_mint(msg.sender, frax_amount_d18);\n    }\n\n    // Will fail if fully collateralized or fully algorithmic\n    // > 0% and < 100% collateral-backed\n    function mintFractionalFRAX(uint256 collateral_amount, uint256 fxs_amount, uint256 FRAX_out_min) external notMintPaused {\n        uint256 fxs_price = FRAX.fxs_price();\n        uint256 global_collateral_ratio = FRAX.global_collateral_ratio();\n\n        require(global_collateral_ratio < COLLATERAL_RATIO_MAX && global_collateral_ratio > 0, \"Collateral ratio needs to be between .000001 and .999999\");\n        require(collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral).add(collateral_amount) <= pool_ceiling, \"Pool ceiling reached, no more FRAX can be minted with this collateral\");\n\n        uint256 collateral_amount_d18 = collateral_amount * (10 ** missing_decimals);\n        FraxPoolLibrary.MintFF_Params memory input_params = FraxPoolLibrary.MintFF_Params(\n            fxs_price,\n            getCollateralPrice(),\n            fxs_amount,\n            collateral_amount_d18,\n            global_collateral_ratio\n        );\n\n        (uint256 mint_amount, uint256 fxs_needed) = FraxPoolLibrary.calcMintFractionalFRAX(input_params);\n\n        mint_amount = (mint_amount.mul(uint(1e6).sub(minting_fee))).div(1e6);\n        require(FRAX_out_min <= mint_amount, \"Slippage limit reached\");\n        require(fxs_needed <= fxs_amount, \"Not enough FXS inputted\");\n\n        FXS.pool_burn_from(msg.sender, fxs_needed);\n        TransferHelper.safeTransferFrom(address(collateral_token), msg.sender, address(this), collateral_amount);\n        FRAX.pool_mint(msg.sender, mint_amount);\n    }\n\n    // Redeem collateral. 100% collateral-backed\n    function redeem1t1FRAX(uint256 FRAX_amount, uint256 COLLATERAL_out_min) external notRedeemPaused {\n        require(FRAX.global_collateral_ratio() == COLLATERAL_RATIO_MAX, \"Collateral ratio must be == 1\");\n\n        // Need to adjust for decimals of collateral\n        uint256 FRAX_amount_precision = FRAX_amount.div(10 ** missing_decimals);\n        (uint256 collateral_needed) = FraxPoolLibrary.calcRedeem1t1FRAX(\n            getCollateralPrice(),\n            FRAX_amount_precision\n        );\n\n        collateral_needed = (collateral_needed.mul(uint(1e6).sub(redemption_fee))).div(1e6);\n        require(collateral_needed <= collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral), \"Not enough collateral in pool\");\n        require(COLLATERAL_out_min <= collateral_needed, \"Slippage limit reached\");\n\n        redeemCollateralBalances[msg.sender] = redeemCollateralBalances[msg.sender].add(collateral_needed);\n        unclaimedPoolCollateral = unclaimedPoolCollateral.add(collateral_needed);\n        lastRedeemed[msg.sender] = block.number;\n        \n        // Move all external functions to the end\n        FRAX.pool_burn_from(msg.sender, FRAX_amount);\n    }\n\n    // Will fail if fully collateralized or algorithmic\n    // Redeem FRAX for collateral and FXS. > 0% and < 100% collateral-backed\n    function redeemFractionalFRAX(uint256 FRAX_amount, uint256 FXS_out_min, uint256 COLLATERAL_out_min) external notRedeemPaused {\n        uint256 fxs_price = FRAX.fxs_price();\n        uint256 global_collateral_ratio = FRAX.global_collateral_ratio();\n\n        require(global_collateral_ratio < COLLATERAL_RATIO_MAX && global_collateral_ratio > 0, \"Collateral ratio needs to be between .000001 and .999999\");\n        uint256 col_price_usd = getCollateralPrice();\n\n        uint256 FRAX_amount_post_fee = (FRAX_amount.mul(uint(1e6).sub(redemption_fee))).div(PRICE_PRECISION);\n\n        uint256 fxs_dollar_value_d18 = FRAX_amount_post_fee.sub(FRAX_amount_post_fee.mul(global_collateral_ratio).div(PRICE_PRECISION));\n        uint256 fxs_amount = fxs_dollar_value_d18.mul(PRICE_PRECISION).div(fxs_price);\n\n        // Need to adjust for decimals of collateral\n        uint256 FRAX_amount_precision = FRAX_amount_post_fee.div(10 ** missing_decimals);\n        uint256 collateral_dollar_value = FRAX_amount_precision.mul(global_collateral_ratio).div(PRICE_PRECISION);\n        uint256 collateral_amount = collateral_dollar_value.mul(PRICE_PRECISION).div(col_price_usd);\n\n\n        require(collateral_amount <= collateral_token.balanceOf(address(this)).sub(unclaimedPoolCollateral), \"Not enough collateral in pool\");\n        require(COLLATERAL_out_min <= collateral_amount, \"Slippage limit reached [collateral]\");\n        require(FXS_out_min <= fxs_amount, \"Slippage limit reached [FXS]\");\n\n        redeemCollateralBalances[msg.sender] = redeemCollateralBalances[msg.sender].add(collateral_amount);\n        unclaimedPoolCollateral = unclaimedPoolCollateral.add(collateral_amount);\n\n        redeemFXSBalances[msg.sender] = redeemFXSBalances[msg.sender].add(fxs_amount);\n        unclaimedPoolFXS = unclaimedPoolFXS.add(fxs_amount);\n\n        lastRedeemed[msg.sender] = block.number;\n        \n        // Move all external functions to the end\n        FRAX.pool_burn_from(msg.sender, FRAX_amount);\n        FXS.pool_mint(address(this), fxs_amount);\n    }\n\n    // Redeem FRAX for FXS. 0% collateral-backed\n    function redeemAlgorithmicFRAX(uint256 FRAX_amount, uint256 FXS_out_min) external notRedeemPaused {\n        uint256 fxs_price = FRAX.fxs_price();\n        uint256 global_collateral_ratio = FRAX.global_collateral_ratio();\n\n        require(global_collateral_ratio == 0, \"Collateral ratio must be 0\"); \n        uint256 fxs_dollar_value_d18 = FRAX_amount;\n\n        fxs_dollar_value_d18 = (fxs_dollar_value_d18.mul(uint(1e6).sub(redemption_fee))).div(PRICE_PRECISION); //apply fees\n\n        uint256 fxs_amount = fxs_dollar_value_d18.mul(PRICE_PRECISION).div(fxs_price);\n        \n        redeemFXSBalances[msg.sender] = redeemFXSBalances[msg.sender].add(fxs_amount);\n        unclaimedPoolFXS = unclaimedPoolFXS.add(fxs_amount);\n        \n        lastRedeemed[msg.sender] = block.number;\n        \n        require(FXS_out_min <= fxs_amount, \"Slippage limit reached\");\n        // Move all external functions to the end\n        FRAX.pool_burn_from(msg.sender, FRAX_amount);\n        FXS.pool_mint(address(this), fxs_amount);\n    }\n\n    // After a redemption happens, transfer the newly minted FXS and owed collateral from this pool\n    // contract to the user. Redemption is split into two functions to prevent flash loans from being able\n    // to take out FRAX/collateral from the system, use an AMM to trade the new price, and then mint back into the system.\n    function collectRedemption() external {\n        require((lastRedeemed[msg.sender].add(redemption_delay)) <= block.number, \"Must wait for redemption_delay blocks before collecting redemption\");\n        bool sendFXS = false;\n        bool sendCollateral = false;\n        uint FXSAmount = 0;\n        uint CollateralAmount = 0;\n\n        // Use Checks-Effects-Interactions pattern\n        if(redeemFXSBalances[msg.sender] > 0){\n            FXSAmount = redeemFXSBalances[msg.sender];\n            redeemFXSBalances[msg.sender] = 0;\n            unclaimedPoolFXS = unclaimedPoolFXS.sub(FXSAmount);\n\n            sendFXS = true;\n        }\n        \n        if(redeemCollateralBalances[msg.sender] > 0){\n            CollateralAmount = redeemCollateralBalances[msg.sender];\n            redeemCollateralBalances[msg.sender] = 0;\n            unclaimedPoolCollateral = unclaimedPoolCollateral.sub(CollateralAmount);\n\n            sendCollateral = true;\n        }\n\n        if(sendFXS){\n            TransferHelper.safeTransfer(address(FXS), msg.sender, FXSAmount);\n        }\n        if(sendCollateral){\n            TransferHelper.safeTransfer(address(collateral_token), msg.sender, CollateralAmount);\n        }\n    }\n\n\n    // When the protocol is recollateralizing, we need to give a discount of FXS to hit the new CR target\n    // Thus, if the target collateral ratio is higher than the actual value of collateral, minters get FXS for adding collateral\n    // This function simply rewards anyone that sends collateral to a pool with the same amount of FXS + the bonus rate\n    // Anyone can call this function to recollateralize the protocol and take the extra FXS value from the bonus rate as an arb opportunity\n    function recollateralizeFRAX(uint256 collateral_amount, uint256 FXS_out_min) external {\n        require(recollateralizePaused == false, \"Recollateralize is paused\");\n        uint256 collateral_amount_d18 = collateral_amount * (10 ** missing_decimals);\n        uint256 fxs_price = FRAX.fxs_price();\n        uint256 frax_total_supply = FRAX.totalSupply();\n        uint256 global_collateral_ratio = FRAX.global_collateral_ratio();\n        uint256 global_collat_value = FRAX.globalCollateralValue();\n\n        (uint256 collateral_units, uint256 amount_to_recollat) = FraxPoolLibrary.calcRecollateralizeFRAXInner(\n            collateral_amount_d18,\n            getCollateralPrice(),\n            global_collat_value,\n            frax_total_supply,\n            global_collateral_ratio\n        ); \n\n        uint256 collateral_units_precision = collateral_units.div(10 ** missing_decimals);\n\n        uint256 fxs_paid_back = amount_to_recollat.mul(uint(1e6).add(bonus_rate).sub(recollat_fee)).div(fxs_price);\n\n        require(FXS_out_min <= fxs_paid_back, \"Slippage limit reached\");\n        TransferHelper.safeTransferFrom(address(collateral_token), msg.sender, address(this), collateral_units_precision);\n        FXS.pool_mint(msg.sender, fxs_paid_back);\n        \n    }\n\n    // Function can be called by an FXS holder to have the protocol buy back FXS with excess collateral value from a desired collateral pool\n    // This can also happen if the collateral ratio > 1\n    function buyBackFXS(uint256 FXS_amount, uint256 COLLATERAL_out_min) external {\n        require(buyBackPaused == false, \"Buyback is paused\");\n        uint256 fxs_price = FRAX.fxs_price();\n    \n        FraxPoolLibrary.BuybackFXS_Params memory input_params = FraxPoolLibrary.BuybackFXS_Params(\n            availableExcessCollatDV(),\n            fxs_price,\n            getCollateralPrice(),\n            FXS_amount\n        );\n\n        (uint256 collateral_equivalent_d18) = (FraxPoolLibrary.calcBuyBackFXS(input_params)).mul(uint(1e6).sub(buyback_fee)).div(1e6);\n        uint256 collateral_precision = collateral_equivalent_d18.div(10 ** missing_decimals);\n\n        require(COLLATERAL_out_min <= collateral_precision, \"Slippage limit reached\");\n        // Give the sender their desired collateral and burn the FXS\n        FXS.pool_burn_from(msg.sender, FXS_amount);\n        TransferHelper.safeTransfer(address(collateral_token), msg.sender, collateral_precision);\n    }\n\n    /* ========== RESTRICTED FUNCTIONS ========== */\n\n    function toggleMinting() external {\n        require(hasRole(MINT_PAUSER, msg.sender));\n        mintPaused = !mintPaused;\n\n        emit MintingToggled(mintPaused);\n    }\n\n    function toggleRedeeming() external {\n        require(hasRole(REDEEM_PAUSER, msg.sender));\n        redeemPaused = !redeemPaused;\n\n        emit RedeemingToggled(redeemPaused);\n    }\n\n    function toggleRecollateralize() external {\n        require(hasRole(RECOLLATERALIZE_PAUSER, msg.sender));\n        recollateralizePaused = !recollateralizePaused;\n\n        emit RecollateralizeToggled(recollateralizePaused);\n    }\n    \n    function toggleBuyBack() external {\n        require(hasRole(BUYBACK_PAUSER, msg.sender));\n        buyBackPaused = !buyBackPaused;\n\n        emit BuybackToggled(buyBackPaused);\n    }\n\n    function toggleCollateralPrice(uint256 _new_price) external {\n        require(hasRole(COLLATERAL_PRICE_PAUSER, msg.sender));\n        // If pausing, set paused price; else if unpausing, clear pausedPrice\n        if(collateralPricePaused == false){\n            pausedPrice = _new_price;\n        } else {\n            pausedPrice = 0;\n        }\n        collateralPricePaused = !collateralPricePaused;\n\n        emit CollateralPriceToggled(collateralPricePaused);\n    }\n\n    // Combined into one function due to 24KiB contract memory limit\n    function setPoolParameters(uint256 new_ceiling, uint256 new_bonus_rate, uint256 new_redemption_delay, uint256 new_mint_fee, uint256 new_redeem_fee, uint256 new_buyback_fee, uint256 new_recollat_fee) external onlyByOwnGov {\n        pool_ceiling = new_ceiling;\n        bonus_rate = new_bonus_rate;\n        redemption_delay = new_redemption_delay;\n        minting_fee = new_mint_fee;\n        redemption_fee = new_redeem_fee;\n        buyback_fee = new_buyback_fee;\n        recollat_fee = new_recollat_fee;\n\n        emit PoolParametersSet(new_ceiling, new_bonus_rate, new_redemption_delay, new_mint_fee, new_redeem_fee, new_buyback_fee, new_recollat_fee);\n    }\n\n    function setTimelock(address new_timelock) external onlyByOwnGov {\n        timelock_address = new_timelock;\n\n        emit TimelockSet(new_timelock);\n    }\n\n    /* ========== EVENTS ========== */\n\n    event PoolParametersSet(uint256 new_ceiling, uint256 new_bonus_rate, uint256 new_redemption_delay, uint256 new_mint_fee, uint256 new_redeem_fee, uint256 new_buyback_fee, uint256 new_recollat_fee);\n    event TimelockSet(address new_timelock);\n    event MintingToggled(bool toggled);\n    event RedeemingToggled(bool toggled);\n    event RecollateralizeToggled(bool toggled);\n    event BuybackToggled(bool toggled);\n    event CollateralPriceToggled(bool toggled);\n\n}"},{"file_path":"contracts/Uniswap/UniswapV2Library.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport './Interfaces/IUniswapV2Pair.sol';\nimport './Interfaces/IUniswapV2Factory.sol';\n\nimport \"../Math/SafeMath.sol\";\n\nlibrary UniswapV2Library {\n    using SafeMath for uint;\n\n    // returns sorted token addresses, used to handle return values from pairs sorted in this order\n    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\n        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');\n        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\n        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');\n    }\n\n    // Less efficient than the CREATE2 method below\n    function pairFor(address factory, address tokenA, address tokenB) internal view returns (address pair) {\n        (address token0, address token1) = sortTokens(tokenA, tokenB);\n        pair = IUniswapV2Factory(factory).getPair(token0, token1);\n    }\n\n    // calculates the CREATE2 address for a pair without making any external calls\n    function pairForCreate2(address factory, address tokenA, address tokenB) internal pure returns (address pair) {\n        (address token0, address token1) = sortTokens(tokenA, tokenB);\n        pair = address(uint160(bytes20(keccak256(abi.encodePacked(\n                hex'ff',\n                factory,\n                keccak256(abi.encodePacked(token0, token1)),\n                hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash\n            ))))); // this matches the CREATE2 in UniswapV2Factory.createPair\n    }\n\n    // fetches and sorts the reserves for a pair\n    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {\n        (address token0,) = sortTokens(tokenA, tokenB);\n        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\n        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\n    }\n\n    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\n    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {\n        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');\n        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n        amountB = amountA.mul(reserveB) / reserveA;\n    }\n\n    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\n    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {\n        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');\n        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n        uint amountInWithFee = amountIn.mul(997);\n        uint numerator = amountInWithFee.mul(reserveOut);\n        uint denominator = reserveIn.mul(1000).add(amountInWithFee);\n        amountOut = numerator / denominator;\n    }\n\n    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\n    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {\n        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');\n        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');\n        uint numerator = reserveIn.mul(amountOut).mul(1000);\n        uint denominator = reserveOut.sub(amountOut).mul(997);\n        amountIn = (numerator / denominator).add(1);\n    }\n\n    // performs chained getAmountOut calculations on any number of pairs\n    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {\n        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');\n        amounts = new uint[](path.length);\n        amounts[0] = amountIn;\n        for (uint i = 0; i < path.length - 1; i++) {\n            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);\n            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);\n        }\n    }\n\n    // performs chained getAmountIn calculations on any number of pairs\n    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {\n        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');\n        amounts = new uint[](path.length);\n        amounts[amounts.length - 1] = amountOut;\n        for (uint i = path.length - 1; i > 0; i--) {\n            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);\n            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);\n        }\n    }\n}"},{"file_path":"contracts/Uniswap_V3/periphery/interfaces/IPoolInitializer.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\n/// @title Creates and initializes V3 Pools\n/// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that\n/// require the pool to exist.\ninterface IPoolInitializer {\n    /// @notice Creates a new pool if it does not exist, then initializes if not initialized\n    /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool\n    /// @param token0 The contract address of token0 of the pool\n    /// @param token1 The contract address of token1 of the pool\n    /// @param fee The fee amount of the v3 pool for the specified token pair\n    /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value\n    /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary\n    function createAndInitializePoolIfNecessary(\n        address token0,\n        address token1,\n        uint24 fee,\n        uint160 sqrtPriceX96\n    ) external payable returns (address pool);\n}"},{"file_path":"contracts/Uniswap_V3/libraries/LiquidityAmounts.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './FixedPoint96.sol';\n\n/// @title Liquidity amount functions\n/// @notice Provides functions for computing liquidity amounts from token amounts and prices\nlibrary LiquidityAmounts {\n    /// @notice Downcasts uint256 to uint128\n    /// @param x The uint258 to be downcasted\n    /// @return y The passed value, downcasted to uint128\n    function toUint128(uint256 x) private pure returns (uint128 y) {\n        require((y = uint128(x)) == x);\n    }\n\n    /// @notice Computes the amount of liquidity received for a given amount of token0 and price range\n    /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower))\n    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n    /// @param amount0 The amount0 being sent in\n    /// @return liquidity The amount of returned liquidity\n    function getLiquidityForAmount0(\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint256 amount0\n    ) internal pure returns (uint128 liquidity) {\n        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n        uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);\n        return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));\n    }\n\n    /// @notice Computes the amount of liquidity received for a given amount of token1 and price range\n    /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)).\n    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n    /// @param amount1 The amount1 being sent in\n    /// @return liquidity The amount of returned liquidity\n    function getLiquidityForAmount1(\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint256 amount1\n    ) internal pure returns (uint128 liquidity) {\n        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n        return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));\n    }\n\n    /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current\n    /// pool prices and the prices at the tick boundaries\n    /// @param sqrtRatioX96 A sqrt price representing the current pool prices\n    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n    /// @param amount0 The amount of token0 being sent in\n    /// @param amount1 The amount of token1 being sent in\n    /// @return liquidity The maximum amount of liquidity received\n    function getLiquidityForAmounts(\n        uint160 sqrtRatioX96,\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint256 amount0,\n        uint256 amount1\n    ) internal pure returns (uint128 liquidity) {\n        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n        if (sqrtRatioX96 <= sqrtRatioAX96) {\n            liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);\n        } else if (sqrtRatioX96 < sqrtRatioBX96) {\n            uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);\n            uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);\n\n            liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;\n        } else {\n            liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);\n        }\n    }\n\n    /// @notice Computes the amount of token0 for a given amount of liquidity and a price range\n    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n    /// @param liquidity The liquidity being valued\n    /// @return amount0 The amount of token0\n    function getAmount0ForLiquidity(\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint128 liquidity\n    ) internal pure returns (uint256 amount0) {\n        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n        return\n            FullMath.mulDiv(\n                uint256(liquidity) << FixedPoint96.RESOLUTION,\n                sqrtRatioBX96 - sqrtRatioAX96,\n                sqrtRatioBX96\n            ) / sqrtRatioAX96;\n    }\n\n    /// @notice Computes the amount of token1 for a given amount of liquidity and a price range\n    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n    /// @param liquidity The liquidity being valued\n    /// @return amount1 The amount of token1\n    function getAmount1ForLiquidity(\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint128 liquidity\n    ) internal pure returns (uint256 amount1) {\n        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n        return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n    }\n\n    /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current\n    /// pool prices and the prices at the tick boundaries\n    /// @param sqrtRatioX96 A sqrt price representing the current pool prices\n    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary\n    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary\n    /// @param liquidity The liquidity being valued\n    /// @return amount0 The amount of token0\n    /// @return amount1 The amount of token1\n    function getAmountsForLiquidity(\n        uint160 sqrtRatioX96,\n        uint160 sqrtRatioAX96,\n        uint160 sqrtRatioBX96,\n        uint128 liquidity\n    ) internal pure returns (uint256 amount0, uint256 amount1) {\n        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n        if (sqrtRatioX96 <= sqrtRatioAX96) {\n            amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n        } else if (sqrtRatioX96 < sqrtRatioBX96) {\n            amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);\n            amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);\n        } else {\n            amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);\n        }\n    }\n}"},{"file_path":"contracts/Frax/Frax.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n// ====================================================================\n// |     ______                   _______                             |\n// |    / _____________ __  __   / ____(_____  ____ _____  ________   |\n// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \\/ __ `/ __ \\/ ___/ _ \\  |\n// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |\n// | /_/   /_/   \\__,_/_/|_|  /_/   /_/_/ /_/\\__,_/_/ /_/\\___/\\___/   |\n// |                                                                  |\n// ====================================================================\n// ======================= FRAXStablecoin (FRAX) ======================\n// ====================================================================\n// Frax Finance: https://github.com/FraxFinance\n\n// Primary Author(s)\n// Travis Moore: https://github.com/FortisFortuna\n// Jason Huan: https://github.com/jasonhuan\n// Sam Kazemian: https://github.com/samkazemian\n\n// Reviewer(s) / Contributor(s)\n// Sam Sun: https://github.com/samczsun\n\nimport \"../Common/Context.sol\";\nimport \"../ERC20/IERC20.sol\";\nimport \"../ERC20/ERC20Custom.sol\";\nimport \"../ERC20/ERC20.sol\";\nimport \"../Math/SafeMath.sol\";\nimport \"../Staking/Owned.sol\";\nimport \"../FXS/FXS.sol\";\nimport \"./Pools/FraxPool.sol\";\nimport \"../Oracle/UniswapPairOracle.sol\";\nimport \"../Oracle/ChainlinkETHUSDPriceConsumer.sol\";\nimport \"../Governance/AccessControl.sol\";\n\ncontract FRAXStablecoin is ERC20Custom, AccessControl, Owned {\n    using SafeMath for uint256;\n\n    /* ========== STATE VARIABLES ========== */\n    enum PriceChoice { FRAX, FXS }\n    ChainlinkETHUSDPriceConsumer private eth_usd_pricer;\n    uint8 private eth_usd_pricer_decimals;\n    UniswapPairOracle private fraxEthOracle;\n    UniswapPairOracle private fxsEthOracle;\n    string public symbol;\n    string public name;\n    uint8 public constant decimals = 18;\n    address public creator_address;\n    address public timelock_address; // Governance timelock address\n    address public controller_address; // Controller contract to dynamically adjust system parameters automatically\n    address public fxs_address;\n    address public frax_eth_oracle_address;\n    address public fxs_eth_oracle_address;\n    address public weth_address;\n    address public eth_usd_consumer_address;\n    uint256 public constant genesis_supply = 2000000e18; // 2M FRAX (only for testing, genesis supply will be 5k on Mainnet). This is to help with establishing the Uniswap pools, as they need liquidity\n\n    // The addresses in this array are added by the oracle and these contracts are able to mint frax\n    address[] public frax_pools_array;\n\n    // Mapping is also used for faster verification\n    mapping(address => bool) public frax_pools; \n\n    // Constants for various precisions\n    uint256 private constant PRICE_PRECISION = 1e6;\n    \n    uint256 public global_collateral_ratio; // 6 decimals of precision, e.g. 924102 = 0.924102\n    uint256 public redemption_fee; // 6 decimals of precision, divide by 1000000 in calculations for fee\n    uint256 public minting_fee; // 6 decimals of precision, divide by 1000000 in calculations for fee\n    uint256 public frax_step; // Amount to change the collateralization ratio by upon refreshCollateralRatio()\n    uint256 public refresh_cooldown; // Seconds to wait before being able to run refreshCollateralRatio() again\n    uint256 public price_target; // The price of FRAX at which the collateral ratio will respond to; this value is only used for the collateral ratio mechanism and not for minting and redeeming which are hardcoded at $1\n    uint256 public price_band; // The bound above and below the price target at which the refreshCollateralRatio() will not change the collateral ratio\n\n    address public DEFAULT_ADMIN_ADDRESS;\n    bytes32 public constant COLLATERAL_RATIO_PAUSER = keccak256(\"COLLATERAL_RATIO_PAUSER\");\n    bool public collateral_ratio_paused = false;\n\n    /* ========== MODIFIERS ========== */\n\n    modifier onlyCollateralRatioPauser() {\n        require(hasRole(COLLATERAL_RATIO_PAUSER, msg.sender));\n        _;\n    }\n\n    modifier onlyPools() {\n       require(frax_pools[msg.sender] == true, \"Only frax pools can call this function\");\n        _;\n    } \n    \n    modifier onlyByOwnerGovernanceOrController() {\n        require(msg.sender == owner || msg.sender == timelock_address || msg.sender == controller_address, \"Not the owner, controller, or the governance timelock\");\n        _;\n    }\n\n    modifier onlyByOwnerGovernanceOrPool() {\n        require(\n            msg.sender == owner \n            || msg.sender == timelock_address \n            || frax_pools[msg.sender] == true, \n            \"Not the owner, the governance timelock, or a pool\");\n        _;\n    }\n\n    /* ========== CONSTRUCTOR ========== */\n\n    constructor (\n        string memory _name,\n        string memory _symbol,\n        address _creator_address,\n        address _timelock_address\n    ) public Owned(_creator_address){\n        require(_timelock_address != address(0), \"Zero address detected\"); \n        name = _name;\n        symbol = _symbol;\n        creator_address = _creator_address;\n        timelock_address = _timelock_address;\n        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n        DEFAULT_ADMIN_ADDRESS = _msgSender();\n        _mint(creator_address, genesis_supply);\n        grantRole(COLLATERAL_RATIO_PAUSER, creator_address);\n        grantRole(COLLATERAL_RATIO_PAUSER, timelock_address);\n        frax_step = 2500; // 6 decimals of precision, equal to 0.25%\n        global_collateral_ratio = 1000000; // Frax system starts off fully collateralized (6 decimals of precision)\n        refresh_cooldown = 3600; // Refresh cooldown period is set to 1 hour (3600 seconds) at genesis\n        price_target = 1000000; // Collateral ratio will adjust according to the $1 price target at genesis\n        price_band = 5000; // Collateral ratio will not adjust if between $0.995 and $1.005 at genesis\n    }\n\n    /* ========== VIEWS ========== */\n\n    // Choice = 'FRAX' or 'FXS' for now\n    function oracle_price(PriceChoice choice) internal view returns (uint256) {\n        // Get the ETH / USD price first, and cut it down to 1e6 precision\n        uint256 __eth_usd_price = uint256(eth_usd_pricer.getLatestPrice()).mul(PRICE_PRECISION).div(uint256(10) ** eth_usd_pricer_decimals);\n        uint256 price_vs_eth = 0;\n\n        if (choice == PriceChoice.FRAX) {\n            price_vs_eth = uint256(fraxEthOracle.consult(weth_address, PRICE_PRECISION)); // How much FRAX if you put in PRICE_PRECISION WETH\n        }\n        else if (choice == PriceChoice.FXS) {\n            price_vs_eth = uint256(fxsEthOracle.consult(weth_address, PRICE_PRECISION)); // How much FXS if you put in PRICE_PRECISION WETH\n        }\n        else revert(\"INVALID PRICE CHOICE. Needs to be either 0 (FRAX) or 1 (FXS)\");\n\n        // Will be in 1e6 format\n        return __eth_usd_price.mul(PRICE_PRECISION).div(price_vs_eth);\n    }\n\n    // Returns X FRAX = 1 USD\n    function frax_price() public view returns (uint256) {\n        return oracle_price(PriceChoice.FRAX);\n    }\n\n    // Returns X FXS = 1 USD\n    function fxs_price()  public view returns (uint256) {\n        return oracle_price(PriceChoice.FXS);\n    }\n\n    function eth_usd_price() public view returns (uint256) {\n        return uint256(eth_usd_pricer.getLatestPrice()).mul(PRICE_PRECISION).div(uint256(10) ** eth_usd_pricer_decimals);\n    }\n\n    // This is needed to avoid costly repeat calls to different getter functions\n    // It is cheaper gas-wise to just dump everything and only use some of the info\n    function frax_info() public view returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256) {\n        return (\n            oracle_price(PriceChoice.FRAX), // frax_price()\n            oracle_price(PriceChoice.FXS), // fxs_price()\n            totalSupply(), // totalSupply()\n            global_collateral_ratio, // global_collateral_ratio()\n            globalCollateralValue(), // globalCollateralValue\n            minting_fee, // minting_fee()\n            redemption_fee, // redemption_fee()\n            uint256(eth_usd_pricer.getLatestPrice()).mul(PRICE_PRECISION).div(uint256(10) ** eth_usd_pricer_decimals) //eth_usd_price\n        );\n    }\n\n    // Iterate through all frax pools and calculate all value of collateral in all pools globally \n    function globalCollateralValue() public view returns (uint256) {\n        uint256 total_collateral_value_d18 = 0; \n\n        for (uint i = 0; i < frax_pools_array.length; i++){ \n            // Exclude null addresses\n            if (frax_pools_array[i] != address(0)){\n                total_collateral_value_d18 = total_collateral_value_d18.add(FraxPool(frax_pools_array[i]).collatDollarBalance());\n            }\n\n        }\n        return total_collateral_value_d18;\n    }\n\n    /* ========== PUBLIC FUNCTIONS ========== */\n    \n    // There needs to be a time interval that this can be called. Otherwise it can be called multiple times per expansion.\n    uint256 public last_call_time; // Last time the refreshCollateralRatio function was called\n    function refreshCollateralRatio() public {\n        require(collateral_ratio_paused == false, \"Collateral Ratio has been paused\");\n        uint256 frax_price_cur = frax_price();\n        require(block.timestamp - last_call_time >= refresh_cooldown, \"Must wait for the refresh cooldown since last refresh\");\n\n        // Step increments are 0.25% (upon genesis, changable by setFraxStep()) \n        \n        if (frax_price_cur > price_target.add(price_band)) { //decrease collateral ratio\n            if(global_collateral_ratio <= frax_step){ //if within a step of 0, go to 0\n                global_collateral_ratio = 0;\n            } else {\n                global_collateral_ratio = global_collateral_ratio.sub(frax_step);\n            }\n        } else if (frax_price_cur < price_target.sub(price_band)) { //increase collateral ratio\n            if(global_collateral_ratio.add(frax_step) >= 1000000){\n                global_collateral_ratio = 1000000; // cap collateral ratio at 1.000000\n            } else {\n                global_collateral_ratio = global_collateral_ratio.add(frax_step);\n            }\n        }\n\n        last_call_time = block.timestamp; // Set the time of the last expansion\n\n        emit CollateralRatioRefreshed(global_collateral_ratio);\n    }\n\n    /* ========== RESTRICTED FUNCTIONS ========== */\n\n    // Used by pools when user redeems\n    function pool_burn_from(address b_address, uint256 b_amount) public onlyPools {\n        super._burnFrom(b_address, b_amount);\n        emit FRAXBurned(b_address, msg.sender, b_amount);\n    }\n\n    // This function is what other frax pools will call to mint new FRAX \n    function pool_mint(address m_address, uint256 m_amount) public onlyPools {\n        super._mint(m_address, m_amount);\n        emit FRAXMinted(msg.sender, m_address, m_amount);\n    }\n\n    // Adds collateral addresses supported, such as tether and busd, must be ERC20 \n    function addPool(address pool_address) public onlyByOwnerGovernanceOrController {\n        require(pool_address != address(0), \"Zero address detected\");\n\n        require(frax_pools[pool_address] == false, \"Address already exists\");\n        frax_pools[pool_address] = true; \n        frax_pools_array.push(pool_address);\n\n        emit PoolAdded(pool_address);\n    }\n\n    // Remove a pool \n    function removePool(address pool_address) public onlyByOwnerGovernanceOrController {\n        require(pool_address != address(0), \"Zero address detected\");\n        require(frax_pools[pool_address] == true, \"Address nonexistant\");\n        \n        // Delete from the mapping\n        delete frax_pools[pool_address];\n\n        // 'Delete' from the array by setting the address to 0x0\n        for (uint i = 0; i < frax_pools_array.length; i++){ \n            if (frax_pools_array[i] == pool_address) {\n                frax_pools_array[i] = address(0); // This will leave a null in the array and keep the indices the same\n                break;\n            }\n        }\n\n        emit PoolRemoved(pool_address);\n    }\n\n    function setRedemptionFee(uint256 red_fee) public onlyByOwnerGovernanceOrController {\n        redemption_fee = red_fee;\n\n        emit RedemptionFeeSet(red_fee);\n    }\n\n    function setMintingFee(uint256 min_fee) public onlyByOwnerGovernanceOrController {\n        minting_fee = min_fee;\n\n        emit MintingFeeSet(min_fee);\n    }  \n\n    function setFraxStep(uint256 _new_step) public onlyByOwnerGovernanceOrController {\n        frax_step = _new_step;\n\n        emit FraxStepSet(_new_step);\n    }  \n\n    function setPriceTarget (uint256 _new_price_target) public onlyByOwnerGovernanceOrController {\n        price_target = _new_price_target;\n\n        emit PriceTargetSet(_new_price_target);\n    }\n\n    function setRefreshCooldown(uint256 _new_cooldown) public onlyByOwnerGovernanceOrController {\n    \trefresh_cooldown = _new_cooldown;\n\n        emit RefreshCooldownSet(_new_cooldown);\n    }\n\n    function setFXSAddress(address _fxs_address) public onlyByOwnerGovernanceOrController {\n        require(_fxs_address != address(0), \"Zero address detected\");\n\n        fxs_address = _fxs_address;\n\n        emit FXSAddressSet(_fxs_address);\n    }\n\n    function setETHUSDOracle(address _eth_usd_consumer_address) public onlyByOwnerGovernanceOrController {\n        require(_eth_usd_consumer_address != address(0), \"Zero address detected\");\n\n        eth_usd_consumer_address = _eth_usd_consumer_address;\n        eth_usd_pricer = ChainlinkETHUSDPriceConsumer(eth_usd_consumer_address);\n        eth_usd_pricer_decimals = eth_usd_pricer.getDecimals();\n\n        emit ETHUSDOracleSet(_eth_usd_consumer_address);\n    }\n\n    function setTimelock(address new_timelock) external onlyByOwnerGovernanceOrController {\n        require(new_timelock != address(0), \"Zero address detected\");\n\n        timelock_address = new_timelock;\n\n        emit TimelockSet(new_timelock);\n    }\n\n    function setController(address _controller_address) external onlyByOwnerGovernanceOrController {\n        require(_controller_address != address(0), \"Zero address detected\");\n\n        controller_address = _controller_address;\n\n        emit ControllerSet(_controller_address);\n    }\n\n    function setPriceBand(uint256 _price_band) external onlyByOwnerGovernanceOrController {\n        price_band = _price_band;\n\n        emit PriceBandSet(_price_band);\n    }\n\n    // Sets the FRAX_ETH Uniswap oracle address \n    function setFRAXEthOracle(address _frax_oracle_addr, address _weth_address) public onlyByOwnerGovernanceOrController {\n        require((_frax_oracle_addr != address(0)) && (_weth_address != address(0)), \"Zero address detected\");\n        frax_eth_oracle_address = _frax_oracle_addr;\n        fraxEthOracle = UniswapPairOracle(_frax_oracle_addr); \n        weth_address = _weth_address;\n\n        emit FRAXETHOracleSet(_frax_oracle_addr, _weth_address);\n    }\n\n    // Sets the FXS_ETH Uniswap oracle address \n    function setFXSEthOracle(address _fxs_oracle_addr, address _weth_address) public onlyByOwnerGovernanceOrController {\n        require((_fxs_oracle_addr != address(0)) && (_weth_address != address(0)), \"Zero address detected\");\n\n        fxs_eth_oracle_address = _fxs_oracle_addr;\n        fxsEthOracle = UniswapPairOracle(_fxs_oracle_addr);\n        weth_address = _weth_address;\n\n        emit FXSEthOracleSet(_fxs_oracle_addr, _weth_address);\n    }\n\n    function toggleCollateralRatio() public onlyCollateralRatioPauser {\n        collateral_ratio_paused = !collateral_ratio_paused;\n\n        emit CollateralRatioToggled(collateral_ratio_paused);\n    }\n\n    /* ========== EVENTS ========== */\n\n    // Track FRAX burned\n    event FRAXBurned(address indexed from, address indexed to, uint256 amount);\n\n    // Track FRAX minted\n    event FRAXMinted(address indexed from, address indexed to, uint256 amount);\n\n    event CollateralRatioRefreshed(uint256 global_collateral_ratio);\n    event PoolAdded(address pool_address);\n    event PoolRemoved(address pool_address);\n    event RedemptionFeeSet(uint256 red_fee);\n    event MintingFeeSet(uint256 min_fee);\n    event FraxStepSet(uint256 new_step);\n    event PriceTargetSet(uint256 new_price_target);\n    event RefreshCooldownSet(uint256 new_cooldown);\n    event FXSAddressSet(address _fxs_address);\n    event ETHUSDOracleSet(address eth_usd_consumer_address);\n    event TimelockSet(address new_timelock);\n    event ControllerSet(address controller_address);\n    event PriceBandSet(uint256 price_band);\n    event FRAXETHOracleSet(address frax_oracle_addr, address weth_address);\n    event FXSEthOracleSet(address fxs_oracle_addr, address weth_address);\n    event CollateralRatioToggled(bool collateral_ratio_paused);\n}\n"},{"file_path":"contracts/Uniswap_V3/libraries/TickMath.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n    int24 internal constant MIN_TICK = -887272;\n    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n    int24 internal constant MAX_TICK = -MIN_TICK;\n\n    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n    uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n    /// @notice Calculates sqrt(1.0001^tick) * 2^96\n    /// @dev Throws if |tick| > max tick\n    /// @param tick The input tick for the above formula\n    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n    /// at the given tick\n    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n        uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n        require(int256(absTick) <= int256(MAX_TICK), 'T');\n\n        uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n        if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n        if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n        if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n        if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n        if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n        if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n        if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n        if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n        if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n        if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n        if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n        if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n        if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n        if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n        if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n        if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n        if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n        if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n        if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n        if (tick > 0) ratio = type(uint256).max / ratio;\n\n        // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n        // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n        // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n        sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n    }\n\n    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n    /// ever return.\n    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n    function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n        // second inequality must be < because the price can never reach the price at the max tick\n        require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n        uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n        uint256 r = ratio;\n        uint256 msb = 0;\n\n        assembly {\n            let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n            msb := or(msb, f)\n            r := shr(f, r)\n        }\n        assembly {\n            let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n            msb := or(msb, f)\n            r := shr(f, r)\n        }\n        assembly {\n            let f := shl(5, gt(r, 0xFFFFFFFF))\n            msb := or(msb, f)\n            r := shr(f, r)\n        }\n        assembly {\n            let f := shl(4, gt(r, 0xFFFF))\n            msb := or(msb, f)\n            r := shr(f, r)\n        }\n        assembly {\n            let f := shl(3, gt(r, 0xFF))\n            msb := or(msb, f)\n            r := shr(f, r)\n        }\n        assembly {\n            let f := shl(2, gt(r, 0xF))\n            msb := or(msb, f)\n            r := shr(f, r)\n        }\n        assembly {\n            let f := shl(1, gt(r, 0x3))\n            msb := or(msb, f)\n            r := shr(f, r)\n        }\n        assembly {\n            let f := gt(r, 0x1)\n            msb := or(msb, f)\n        }\n\n        if (msb >= 128) r = ratio >> (msb - 127);\n        else r = ratio << (127 - msb);\n\n        int256 log_2 = (int256(msb) - 128) << 64;\n\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(63, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(62, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(61, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(60, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(59, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(58, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(57, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(56, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(55, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(54, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(53, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(52, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(51, f))\n            r := shr(f, r)\n        }\n        assembly {\n            r := shr(127, mul(r, r))\n            let f := shr(128, r)\n            log_2 := or(log_2, shl(50, f))\n        }\n\n        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n        int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n        int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n        tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n    }\n}"},{"file_path":"contracts/Math/SafeMath.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\n * checks.\n *\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\n * in bugs, because programmers usually assume that an overflow raises an\n * error, which is the standard behavior in high level programming languages.\n * `SafeMath` restores this intuition by reverting the transaction when an\n * operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n */\nlibrary SafeMath {\n    /**\n     * @dev Returns the addition of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `+` operator.\n     *\n     * Requirements:\n     * - Addition cannot overflow.\n     */\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a, \"SafeMath: addition overflow\");\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting on\n     * overflow (when the result is negative).\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     * - Subtraction cannot overflow.\n     */\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return sub(a, b, \"SafeMath: subtraction overflow\");\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n     * overflow (when the result is negative).\n     *\n     * Counterpart to Solidity's `-` operator.\n     *\n     * Requirements:\n     * - Subtraction cannot overflow.\n     *\n     * _Available since v2.4.0._\n     */\n    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b <= a, errorMessage);\n        uint256 c = a - b;\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, reverting on\n     * overflow.\n     *\n     * Counterpart to Solidity's `*` operator.\n     *\n     * Requirements:\n     * - Multiplication cannot overflow.\n     */\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n        // benefit is lost if 'b' is also tested.\n        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n        if (a == 0) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: multiplication overflow\");\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers. Reverts on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity's `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     * - The divisor cannot be zero.\n     */\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(a, b, \"SafeMath: division by zero\");\n    }\n\n    /**\n     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\n     * division by zero. The result is rounded towards zero.\n     *\n     * Counterpart to Solidity's `/` operator. Note: this function uses a\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\n     * uses an invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     * - The divisor cannot be zero.\n     *\n     * _Available since v2.4.0._\n     */\n    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        // Solidity only automatically asserts when dividing by 0\n        require(b > 0, errorMessage);\n        uint256 c = a / b;\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n        return c;\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * Reverts when dividing by zero.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     * - The divisor cannot be zero.\n     */\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mod(a, b, \"SafeMath: modulo by zero\");\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n     * Reverts with custom message when dividing by zero.\n     *\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\n     * invalid opcode to revert (consuming all remaining gas).\n     *\n     * Requirements:\n     * - The divisor cannot be zero.\n     *\n     * _Available since v2.4.0._\n     */\n    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n        require(b != 0, errorMessage);\n        return a % b;\n    }\n}"},{"file_path":"contracts/Uniswap_V3/IUniswapV3Factory.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n    /// @notice Emitted when the owner of the factory is changed\n    /// @param oldOwner The owner before the owner was changed\n    /// @param newOwner The owner after the owner was changed\n    event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n    /// @notice Emitted when a pool is created\n    /// @param token0 The first token of the pool by address sort order\n    /// @param token1 The second token of the pool by address sort order\n    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n    /// @param tickSpacing The minimum number of ticks between initialized ticks\n    /// @param pool The address of the created pool\n    event PoolCreated(\n        address indexed token0,\n        address indexed token1,\n        uint24 indexed fee,\n        int24 tickSpacing,\n        address pool\n    );\n\n    /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n    /// @param fee The enabled fee, denominated in hundredths of a bip\n    /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n    event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n    /// @notice Returns the current owner of the factory\n    /// @dev Can be changed by the current owner via setOwner\n    /// @return The address of the factory owner\n    function owner() external view returns (address);\n\n    /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n    /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n    /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n    /// @return The tick spacing\n    function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n    /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n    /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n    /// @param tokenA The contract address of either token0 or token1\n    /// @param tokenB The contract address of the other token\n    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n    /// @return pool The pool address\n    function getPool(\n        address tokenA,\n        address tokenB,\n        uint24 fee\n    ) external view returns (address pool);\n\n    /// @notice Creates a pool for the given two tokens and fee\n    /// @param tokenA One of the two tokens in the desired pool\n    /// @param tokenB The other of the two tokens in the desired pool\n    /// @param fee The desired fee for the pool\n    /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n    /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n    /// are invalid.\n    /// @return pool The address of the newly created pool\n    function createPool(\n        address tokenA,\n        address tokenB,\n        uint24 fee\n    ) external returns (address pool);\n\n    /// @notice Updates the owner of the factory\n    /// @dev Must be called by the current owner\n    /// @param _owner The new owner of the factory\n    function setOwner(address _owner) external;\n\n    /// @notice Enables a fee amount with the given tickSpacing\n    /// @dev Fee amounts may never be removed once enabled\n    /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n    /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n    function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}"},{"file_path":"@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n    /// @dev In the implementation you must pay the pool tokens owed for the swap.\n    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata data\n    ) external;\n}\n"},{"file_path":"contracts/Math/Babylonian.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\n// computes square roots using the babylonian method\n// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method\nlibrary Babylonian {\n    function sqrt(uint y) internal pure returns (uint z) {\n        if (y > 3) {\n            z = y;\n            uint x = y / 2 + 1;\n            while (x < z) {\n                z = x;\n                x = (y / x + x) / 2;\n            }\n        } else if (y != 0) {\n            z = 1;\n        }\n        // else z = 0\n    }\n}"},{"file_path":"contracts/Uniswap_V3/periphery/libraries/PoolAddress.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee\nlibrary PoolAddress {\n    bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;\n\n    /// @notice The identifying key of the pool\n    struct PoolKey {\n        address token0;\n        address token1;\n        uint24 fee;\n    }\n\n    /// @notice Returns PoolKey: the ordered tokens with the matched fee levels\n    /// @param tokenA The first token of a pool, unsorted\n    /// @param tokenB The second token of a pool, unsorted\n    /// @param fee The fee level of the pool\n    /// @return Poolkey The pool details with ordered token0 and token1 assignments\n    function getPoolKey(\n        address tokenA,\n        address tokenB,\n        uint24 fee\n    ) internal pure returns (PoolKey memory) {\n        if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);\n        return PoolKey({token0: tokenA, token1: tokenB, fee: fee});\n    }\n\n    /// @notice Deterministically computes the pool address given the factory and PoolKey\n    /// @param factory The Uniswap V3 factory contract address\n    /// @param key The PoolKey\n    /// @return pool The contract address of the V3 pool\n    function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) {\n        require(key.token0 < key.token1);\n        pool = address(uint160(\n            uint256(\n                keccak256(\n                    abi.encodePacked(\n                        hex'ff',\n                        factory,\n                        keccak256(abi.encode(key.token0, key.token1, key.fee)),\n                        POOL_INIT_CODE_HASH\n                    )\n                )\n            )\n        ));\n    }\n}"},{"file_path":"contracts/FXS/FXS.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n// ====================================================================\n// |     ______                   _______                             |\n// |    / _____________ __  __   / ____(_____  ____ _____  ________   |\n// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \\/ __ `/ __ \\/ ___/ _ \\  |\n// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |\n// | /_/   /_/   \\__,_/_/|_|  /_/   /_/_/ /_/\\__,_/_/ /_/\\___/\\___/   |\n// |                                                                  |\n// ====================================================================\n// ========================= FRAXShares (FXS) =========================\n// ====================================================================\n// Frax Finance: https://github.com/FraxFinance\n\n// Primary Author(s)\n// Travis Moore: https://github.com/FortisFortuna\n// Jason Huan: https://github.com/jasonhuan\n// Sam Kazemian: https://github.com/samkazemian\n\n// Reviewer(s) / Contributor(s)\n// Sam Sun: https://github.com/samczsun\n\nimport \"../Common/Context.sol\";\nimport \"../ERC20/ERC20Custom.sol\";\nimport \"../ERC20/IERC20.sol\";\nimport \"../Frax/Frax.sol\";\nimport \"../Staking/Owned.sol\";\nimport \"../Math/SafeMath.sol\";\nimport \"../Governance/AccessControl.sol\";\n\ncontract FRAXShares is ERC20Custom, AccessControl, Owned {\n    using SafeMath for uint256;\n\n    /* ========== STATE VARIABLES ========== */\n\n    string public symbol;\n    string public name;\n    uint8 public constant decimals = 18;\n    address public FRAXStablecoinAdd;\n    \n    uint256 public constant genesis_supply = 100000000e18; // 100M is printed upon genesis\n\n    address public oracle_address;\n    address public timelock_address; // Governance timelock address\n    FRAXStablecoin private FRAX;\n\n    bool public trackingVotes = true; // Tracking votes (only change if need to disable votes)\n\n    // A checkpoint for marking number of votes from a given block\n    struct Checkpoint {\n        uint32 fromBlock;\n        uint96 votes;\n    }\n\n    // A record of votes checkpoints for each account, by index\n    mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;\n\n    // The number of checkpoints for each account\n    mapping (address => uint32) public numCheckpoints;\n\n    /* ========== MODIFIERS ========== */\n\n    modifier onlyPools() {\n       require(FRAX.frax_pools(msg.sender) == true, \"Only frax pools can mint new FRAX\");\n        _;\n    } \n    \n    modifier onlyByOwnGov() {\n        require(msg.sender == owner || msg.sender == timelock_address, \"You are not an owner or the governance timelock\");\n        _;\n    }\n\n    /* ========== CONSTRUCTOR ========== */\n\n    constructor (\n        string memory _name,\n        string memory _symbol, \n        address _oracle_address,\n        address _creator_address,\n        address _timelock_address\n    ) public Owned(_creator_address){\n        require((_oracle_address != address(0)) && (_timelock_address != address(0)), \"Zero address detected\"); \n        name = _name;\n        symbol = _symbol;\n        oracle_address = _oracle_address;\n        timelock_address = _timelock_address;\n        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n        _mint(_creator_address, genesis_supply);\n\n        // Do a checkpoint for the owner\n        _writeCheckpoint(_creator_address, 0, 0, uint96(genesis_supply));\n    }\n\n    /* ========== RESTRICTED FUNCTIONS ========== */\n\n    function setOracle(address new_oracle) external onlyByOwnGov {\n        require(new_oracle != address(0), \"Zero address detected\");\n\n        oracle_address = new_oracle;\n    }\n\n    function setTimelock(address new_timelock) external onlyByOwnGov {\n        require(new_timelock != address(0), \"Timelock address cannot be 0\");\n        timelock_address = new_timelock;\n    }\n    \n    function setFRAXAddress(address frax_contract_address) external onlyByOwnGov {\n        require(frax_contract_address != address(0), \"Zero address detected\");\n\n        FRAX = FRAXStablecoin(frax_contract_address);\n\n        emit FRAXAddressSet(frax_contract_address);\n    }\n    \n    function mint(address to, uint256 amount) public onlyPools {\n        _mint(to, amount);\n    }\n    \n    // This function is what other frax pools will call to mint new FXS (similar to the FRAX mint) \n    function pool_mint(address m_address, uint256 m_amount) external onlyPools {        \n        if(trackingVotes){\n            uint32 srcRepNum = numCheckpoints[address(this)];\n            uint96 srcRepOld = srcRepNum > 0 ? checkpoints[address(this)][srcRepNum - 1].votes : 0;\n            uint96 srcRepNew = add96(srcRepOld, uint96(m_amount), \"pool_mint new votes overflows\");\n            _writeCheckpoint(address(this), srcRepNum, srcRepOld, srcRepNew); // mint new votes\n            trackVotes(address(this), m_address, uint96(m_amount));\n        }\n\n        super._mint(m_address, m_amount);\n        emit FXSMinted(address(this), m_address, m_amount);\n    }\n\n    // This function is what other frax pools will call to burn FXS \n    function pool_burn_from(address b_address, uint256 b_amount) external onlyPools {\n        if(trackingVotes){\n            trackVotes(b_address, address(this), uint96(b_amount));\n            uint32 srcRepNum = numCheckpoints[address(this)];\n            uint96 srcRepOld = srcRepNum > 0 ? checkpoints[address(this)][srcRepNum - 1].votes : 0;\n            uint96 srcRepNew = sub96(srcRepOld, uint96(b_amount), \"pool_burn_from new votes underflows\");\n            _writeCheckpoint(address(this), srcRepNum, srcRepOld, srcRepNew); // burn votes\n        }\n\n        super._burnFrom(b_address, b_amount);\n        emit FXSBurned(b_address, address(this), b_amount);\n    }\n\n    function toggleVotes() external onlyByOwnGov {\n        trackingVotes = !trackingVotes;\n    }\n\n    /* ========== OVERRIDDEN PUBLIC FUNCTIONS ========== */\n\n    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n        if(trackingVotes){\n            // Transfer votes\n            trackVotes(_msgSender(), recipient, uint96(amount));\n        }\n\n        _transfer(_msgSender(), recipient, amount);\n        return true;\n    }\n\n    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n        if(trackingVotes){\n            // Transfer votes\n            trackVotes(sender, recipient, uint96(amount));\n        }\n\n        _transfer(sender, recipient, amount);\n        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n\n        return true;\n    }\n\n    /* ========== PUBLIC FUNCTIONS ========== */\n\n    /**\n     * @notice Gets the current votes balance for `account`\n     * @param account The address to get votes balance\n     * @return The number of current votes for `account`\n     */\n    function getCurrentVotes(address account) external view returns (uint96) {\n        uint32 nCheckpoints = numCheckpoints[account];\n        return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;\n    }\n\n    /**\n     * @notice Determine the prior number of votes for an account as of a block number\n     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.\n     * @param account The address of the account to check\n     * @param blockNumber The block number to get the vote balance at\n     * @return The number of votes the account had as of the given block\n     */\n    function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {\n        require(blockNumber < block.number, \"FXS::getPriorVotes: not yet determined\");\n\n        uint32 nCheckpoints = numCheckpoints[account];\n        if (nCheckpoints == 0) {\n            return 0;\n        }\n\n        // First check most recent balance\n        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {\n            return checkpoints[account][nCheckpoints - 1].votes;\n        }\n\n        // Next check implicit zero balance\n        if (checkpoints[account][0].fromBlock > blockNumber) {\n            return 0;\n        }\n\n        uint32 lower = 0;\n        uint32 upper = nCheckpoints - 1;\n        while (upper > lower) {\n            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow\n            Checkpoint memory cp = checkpoints[account][center];\n            if (cp.fromBlock == blockNumber) {\n                return cp.votes;\n            } else if (cp.fromBlock < blockNumber) {\n                lower = center;\n            } else {\n                upper = center - 1;\n            }\n        }\n        return checkpoints[account][lower].votes;\n    }\n\n    /* ========== INTERNAL FUNCTIONS ========== */\n\n    // From compound's _moveDelegates\n    // Keep track of votes. \"Delegates\" is a misnomer here\n    function trackVotes(address srcRep, address dstRep, uint96 amount) internal {\n        if (srcRep != dstRep && amount > 0) {\n            if (srcRep != address(0)) {\n                uint32 srcRepNum = numCheckpoints[srcRep];\n                uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;\n                uint96 srcRepNew = sub96(srcRepOld, amount, \"FXS::_moveVotes: vote amount underflows\");\n                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);\n            }\n\n            if (dstRep != address(0)) {\n                uint32 dstRepNum = numCheckpoints[dstRep];\n                uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;\n                uint96 dstRepNew = add96(dstRepOld, amount, \"FXS::_moveVotes: vote amount overflows\");\n                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);\n            }\n        }\n    }\n\n    function _writeCheckpoint(address voter, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {\n      uint32 blockNumber = safe32(block.number, \"FXS::_writeCheckpoint: block number exceeds 32 bits\");\n\n      if (nCheckpoints > 0 && checkpoints[voter][nCheckpoints - 1].fromBlock == blockNumber) {\n          checkpoints[voter][nCheckpoints - 1].votes = newVotes;\n      } else {\n          checkpoints[voter][nCheckpoints] = Checkpoint(blockNumber, newVotes);\n          numCheckpoints[voter] = nCheckpoints + 1;\n      }\n\n      emit VoterVotesChanged(voter, oldVotes, newVotes);\n    }\n\n    function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {\n        require(n < 2**32, errorMessage);\n        return uint32(n);\n    }\n\n    function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {\n        require(n < 2**96, errorMessage);\n        return uint96(n);\n    }\n\n    function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n        uint96 c = a + b;\n        require(c >= a, errorMessage);\n        return c;\n    }\n\n    function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {\n        require(b <= a, errorMessage);\n        return a - b;\n    }\n\n    /* ========== EVENTS ========== */\n    \n    /// @notice An event thats emitted when a voters account's vote balance changes\n    event VoterVotesChanged(address indexed voter, uint previousBalance, uint newBalance);\n\n    // Track FXS burned\n    event FXSBurned(address indexed from, address indexed to, uint256 amount);\n\n    // Track FXS minted\n    event FXSMinted(address indexed from, address indexed to, uint256 amount);\n\n    event FRAXAddressSet(address addr);\n}\n"},{"file_path":"contracts/Uniswap_V3/libraries/FixedPoint96.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n    uint8 internal constant RESOLUTION = 96;\n    uint256 internal constant Q96 = 0x1000000000000000000000000;\n}"},{"file_path":"contracts/Uniswap_V3/pool/IUniswapV3PoolOwnerActions.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n    /// @notice Set the denominator of the protocol's % share of the fees\n    /// @param feeProtocol0 new protocol fee for token0 of the pool\n    /// @param feeProtocol1 new protocol fee for token1 of the pool\n    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n    /// @notice Collect the protocol fee accrued to the pool\n    /// @param recipient The address to which collected protocol fees should be sent\n    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n    /// @return amount0 The protocol fee collected in token0\n    /// @return amount1 The protocol fee collected in token1\n    function collectProtocol(\n        address recipient,\n        uint128 amount0Requested,\n        uint128 amount1Requested\n    ) external returns (uint128 amount0, uint128 amount1);\n}\n"},{"file_path":"contracts/Uniswap_V3/pool/IUniswapV3PoolState.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n    /// when accessed externally.\n    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n    /// boundary.\n    /// observationIndex The index of the last oracle observation that was written,\n    /// observationCardinality The current maximum number of observations stored in the pool,\n    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n    /// feeProtocol The protocol fee for both tokens of the pool.\n    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n    /// 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.\n    /// unlocked Whether the pool is currently locked to reentrancy\n    function slot0()\n        external\n        view\n        returns (\n            uint160 sqrtPriceX96,\n            int24 tick,\n            uint16 observationIndex,\n            uint16 observationCardinality,\n            uint16 observationCardinalityNext,\n            uint8 feeProtocol,\n            bool unlocked\n        );\n\n    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n    /// @dev This value can overflow the uint256\n    function feeGrowthGlobal0X128() external view returns (uint256);\n\n    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n    /// @dev This value can overflow the uint256\n    function feeGrowthGlobal1X128() external view returns (uint256);\n\n    /// @notice The amounts of token0 and token1 that are owed to the protocol\n    /// @dev Protocol fees will never exceed uint128 max in either token\n    function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n    /// @notice The currently in range liquidity available to the pool\n    /// @dev This value has no relationship to the total liquidity across all ticks\n    function liquidity() external view returns (uint128);\n\n    /// @notice Look up information about a specific tick in the pool\n    /// @param tick The tick to look up\n    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n    /// tick upper,\n    /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n    /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n    /// a specific position.\n    function ticks(int24 tick)\n        external\n        view\n        returns (\n            uint128 liquidityGross,\n            int128 liquidityNet,\n            uint256 feeGrowthOutside0X128,\n            uint256 feeGrowthOutside1X128,\n            int56 tickCumulativeOutside,\n            uint160 secondsPerLiquidityOutsideX128,\n            uint32 secondsOutside,\n            bool initialized\n        );\n\n    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n    function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n    /// @notice Returns the information about a position by the position's key\n    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n    /// @return _liquidity The amount of liquidity in the position,\n    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n    function positions(bytes32 key)\n        external\n        view\n        returns (\n            uint128 _liquidity,\n            uint256 feeGrowthInside0LastX128,\n            uint256 feeGrowthInside1LastX128,\n            uint128 tokensOwed0,\n            uint128 tokensOwed1\n        );\n\n    /// @notice Returns data about a specific observation index\n    /// @param index The element of the observations array to fetch\n    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n    /// ago, rather than at a specific index in the array.\n    /// @return blockTimestamp The timestamp of the observation,\n    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n    /// Returns initialized whether the observation has been initialized and the values are safe to use\n    function observations(uint256 index)\n        external\n        view\n        returns (\n            uint32 blockTimestamp,\n            int56 tickCumulative,\n            uint160 secondsPerLiquidityCumulativeX128,\n            bool initialized\n        );\n}\n"},{"file_path":"contracts/Utils/Address.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11 <0.9.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize, which returns 0 for contracts in\n        // construction, since the code is only stored at the end of the\n        // constructor execution.\n\n        uint256 size;\n        // solhint-disable-next-line no-inline-assembly\n        assembly { size := extcodesize(account) }\n        return size > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n        (bool success, ) = recipient.call{ value: amount }(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain`call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n      return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.call{ value: value }(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n        require(isContract(target), \"Address: delegate call to non-contract\");\n\n        // solhint-disable-next-line avoid-low-level-calls\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return _verifyCallResult(success, returndata, errorMessage);\n    }\n\n    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n\n                // solhint-disable-next-line no-inline-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}"},{"file_path":"contracts/Oracle/ChainlinkETHUSDPriceConsumer.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport \"./AggregatorV3Interface.sol\";\n\ncontract ChainlinkETHUSDPriceConsumer {\n\n    AggregatorV3Interface internal priceFeed;\n\n\n    constructor () public {\n        priceFeed = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);\n    }\n\n    /**\n     * Returns the latest price\n     */\n    function getLatestPrice() public view returns (int) {\n        (\n            , \n            int price,\n            ,\n            ,\n            \n        ) = priceFeed.latestRoundData();\n        return price;\n    }\n\n    function getDecimals() public view returns (uint8) {\n        return priceFeed.decimals();\n    }\n}"},{"file_path":"contracts/Uniswap/Interfaces/IUniswapV2Factory.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\ninterface IUniswapV2Factory {\n    event PairCreated(address indexed token0, address indexed token1, address pair, uint);\n\n    function feeTo() external view returns (address);\n    function feeToSetter() external view returns (address);\n\n    function getPair(address tokenA, address tokenB) external view returns (address pair);\n    function allPairs(uint) external view returns (address pair);\n    function allPairsLength() external view returns (uint);\n\n    function createPair(address tokenA, address tokenB) external returns (address pair);\n\n    function setFeeTo(address) external;\n    function setFeeToSetter(address) external;\n}\n"},{"file_path":"contracts/Uniswap_V3/pool/IUniswapV3PoolDerivedState.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n    /// you must call it with secondsAgos = [3600, 0].\n    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n    /// timestamp\n    function observe(uint32[] calldata secondsAgos)\n        external\n        view\n        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n    /// snapshot is taken and the second snapshot is taken.\n    /// @param tickLower The lower tick of the range\n    /// @param tickUpper The upper tick of the range\n    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n    /// @return secondsInside The snapshot of seconds per liquidity for the range\n    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n        external\n        view\n        returns (\n            int56 tickCumulativeInside,\n            uint160 secondsPerLiquidityInsideX128,\n            uint32 secondsInside\n        );\n}\n"},{"file_path":"contracts/Oracle/AggregatorV3Interface.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.0;\n\ninterface AggregatorV3Interface {\n\n  function decimals() external view returns (uint8);\n  function description() external view returns (string memory);\n  function version() external view returns (uint256);\n\n  // getRoundData and latestRoundData should both raise \"No data present\"\n  // if they do not have data to report, instead of returning unset values\n  // which could be misinterpreted as actual reported values.\n  function getRoundData(uint80 _roundId)\n    external\n    view\n    returns (\n      uint80 roundId,\n      int256 answer,\n      uint256 startedAt,\n      uint256 updatedAt,\n      uint80 answeredInRound\n    );\n  function latestRoundData()\n    external\n    view\n    returns (\n      uint80 roundId,\n      int256 answer,\n      uint256 startedAt,\n      uint256 updatedAt,\n      uint80 answeredInRound\n    );\n\n}"},{"file_path":"contracts/Governance/AccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.11;\n\nimport \"../Utils/EnumerableSet.sol\";\nimport \"../Utils/Address.sol\";\nimport \"../Common/Context.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context {\n    using EnumerableSet for EnumerableSet.AddressSet;\n    using Address for address;\n\n    struct RoleData {\n        EnumerableSet.AddressSet members;\n        bytes32 adminRole;\n    }\n\n    mapping (bytes32 => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; //bytes32(uint256(0x4B437D01b575618140442A4975db38850e3f8f5f) << 96);\n\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view returns (bool) {\n        return _roles[role].members.contains(account);\n    }\n\n    /**\n     * @dev Returns the number of accounts that have `role`. Can be used\n     * together with {getRoleMember} to enumerate all bearers of a role.\n     */\n    function getRoleMemberCount(bytes32 role) public view returns (uint256) {\n        return _roles[role].members.length();\n    }\n\n    /**\n     * @dev Returns one of the accounts that have `role`. `index` must be a\n     * value between 0 and {getRoleMemberCount}, non-inclusive.\n     *\n     * Role bearers are not sorted in any particular way, and their ordering may\n     * change at any point.\n     *\n     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n     * you perform all queries on the same block. See the following\n     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n     * for more information.\n     */\n    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {\n        return _roles[role].members.at(index);\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) public virtual {\n        require(hasRole(_roles[role].adminRole, _msgSender()), \"AccessControl: sender must be an admin to grant\");\n\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) public virtual {\n        require(hasRole(_roles[role].adminRole, _msgSender()), \"AccessControl: sender must be an admin to revoke\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) public virtual {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event. Note that unlike {grantRole}, this function doesn't perform any\n     * checks on the calling account.\n     *\n     * [WARNING]\n     * ====\n     * This function should only be called from the constructor when setting\n     * up the initial roles for the system.\n     *\n     * Using this function in any other way is effectively circumventing the admin\n     * system imposed by {AccessControl}.\n     * ====\n     */\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);\n        _roles[role].adminRole = adminRole;\n    }\n\n    function _grantRole(bytes32 role, address account) private {\n        if (_roles[role].members.add(account)) {\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    function _revokeRole(bytes32 role, address account) private {\n        if (_roles[role].members.remove(account)) {\n            emit RoleRevoked(role, account, _msgSender());\n        }\n    }\n}\n"},{"file_path":"contracts/Frax/Pools/FraxPoolLibrary.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\nimport \"../../Math/SafeMath.sol\";\n\n\n\nlibrary FraxPoolLibrary {\n    using SafeMath for uint256;\n\n    // Constants for various precisions\n    uint256 private constant PRICE_PRECISION = 1e6;\n\n    // ================ Structs ================\n    // Needed to lower stack size\n    struct MintFF_Params {\n        uint256 fxs_price_usd; \n        uint256 col_price_usd;\n        uint256 fxs_amount;\n        uint256 collateral_amount;\n        uint256 col_ratio;\n    }\n\n    struct BuybackFXS_Params {\n        uint256 excess_collateral_dollar_value_d18;\n        uint256 fxs_price_usd;\n        uint256 col_price_usd;\n        uint256 FXS_amount;\n    }\n\n    // ================ Functions ================\n\n    function calcMint1t1FRAX(uint256 col_price, uint256 collateral_amount_d18) public pure returns (uint256) {\n        return (collateral_amount_d18.mul(col_price)).div(1e6);\n    }\n\n    function calcMintAlgorithmicFRAX(uint256 fxs_price_usd, uint256 fxs_amount_d18) public pure returns (uint256) {\n        return fxs_amount_d18.mul(fxs_price_usd).div(1e6);\n    }\n\n    // Must be internal because of the struct\n    function calcMintFractionalFRAX(MintFF_Params memory params) internal pure returns (uint256, uint256) {\n        // Since solidity truncates division, every division operation must be the last operation in the equation to ensure minimum error\n        // The contract must check the proper ratio was sent to mint FRAX. We do this by seeing the minimum mintable FRAX based on each amount \n        uint256 fxs_dollar_value_d18;\n        uint256 c_dollar_value_d18;\n        \n        // Scoping for stack concerns\n        {    \n            // USD amounts of the collateral and the FXS\n            fxs_dollar_value_d18 = params.fxs_amount.mul(params.fxs_price_usd).div(1e6);\n            c_dollar_value_d18 = params.collateral_amount.mul(params.col_price_usd).div(1e6);\n\n        }\n        uint calculated_fxs_dollar_value_d18 = \n                    (c_dollar_value_d18.mul(1e6).div(params.col_ratio))\n                    .sub(c_dollar_value_d18);\n\n        uint calculated_fxs_needed = calculated_fxs_dollar_value_d18.mul(1e6).div(params.fxs_price_usd);\n\n        return (\n            c_dollar_value_d18.add(calculated_fxs_dollar_value_d18),\n            calculated_fxs_needed\n        );\n    }\n\n    function calcRedeem1t1FRAX(uint256 col_price_usd, uint256 FRAX_amount) public pure returns (uint256) {\n        return FRAX_amount.mul(1e6).div(col_price_usd);\n    }\n\n    // Must be internal because of the struct\n    function calcBuyBackFXS(BuybackFXS_Params memory params) internal pure returns (uint256) {\n        // If the total collateral value is higher than the amount required at the current collateral ratio then buy back up to the possible FXS with the desired collateral\n        require(params.excess_collateral_dollar_value_d18 > 0, \"No excess collateral to buy back!\");\n\n        // Make sure not to take more than is available\n        uint256 fxs_dollar_value_d18 = params.FXS_amount.mul(params.fxs_price_usd).div(1e6);\n        require(fxs_dollar_value_d18 <= params.excess_collateral_dollar_value_d18, \"You are trying to buy back more than the excess!\");\n\n        // Get the equivalent amount of collateral based on the market value of FXS provided \n        uint256 collateral_equivalent_d18 = fxs_dollar_value_d18.mul(1e6).div(params.col_price_usd);\n        //collateral_equivalent_d18 = collateral_equivalent_d18.sub((collateral_equivalent_d18.mul(params.buyback_fee)).div(1e6));\n\n        return (\n            collateral_equivalent_d18\n        );\n\n    }\n\n\n    // Returns value of collateral that must increase to reach recollateralization target (if 0 means no recollateralization)\n    function recollateralizeAmount(uint256 total_supply, uint256 global_collateral_ratio, uint256 global_collat_value) public pure returns (uint256) {\n        uint256 target_collat_value = total_supply.mul(global_collateral_ratio).div(1e6); // We want 18 decimals of precision so divide by 1e6; total_supply is 1e18 and global_collateral_ratio is 1e6\n        // Subtract the current value of collateral from the target value needed, if higher than 0 then system needs to recollateralize\n        return target_collat_value.sub(global_collat_value); // If recollateralization is not needed, throws a subtraction underflow\n        // return(recollateralization_left);\n    }\n\n    function calcRecollateralizeFRAXInner(\n        uint256 collateral_amount, \n        uint256 col_price,\n        uint256 global_collat_value,\n        uint256 frax_total_supply,\n        uint256 global_collateral_ratio\n    ) public pure returns (uint256, uint256) {\n        uint256 collat_value_attempted = collateral_amount.mul(col_price).div(1e6);\n        uint256 effective_collateral_ratio = global_collat_value.mul(1e6).div(frax_total_supply); //returns it in 1e6\n        uint256 recollat_possible = (global_collateral_ratio.mul(frax_total_supply).sub(frax_total_supply.mul(effective_collateral_ratio))).div(1e6);\n\n        uint256 amount_to_recollat;\n        if(collat_value_attempted <= recollat_possible){\n            amount_to_recollat = collat_value_attempted;\n        } else {\n            amount_to_recollat = recollat_possible;\n        }\n\n        return (amount_to_recollat.mul(1e6).div(col_price), amount_to_recollat);\n\n    }\n\n}"},{"file_path":"contracts/Uniswap_V3/libraries/FullMath.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n    /// @param a The multiplicand\n    /// @param b The multiplier\n    /// @param denominator The divisor\n    /// @return result The 256-bit result\n    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n    function mulDiv(\n        uint256 a,\n        uint256 b,\n        uint256 denominator\n    ) internal pure returns (uint256 result) {\n        // 512-bit multiply [prod1 prod0] = a * b\n        // Compute the product mod 2**256 and mod 2**256 - 1\n        // then use the Chinese Remainder Theorem to reconstruct\n        // the 512 bit result. The result is stored in two 256\n        // variables such that product = prod1 * 2**256 + prod0\n        uint256 prod0; // Least significant 256 bits of the product\n        uint256 prod1; // Most significant 256 bits of the product\n        assembly {\n            let mm := mulmod(a, b, not(0))\n            prod0 := mul(a, b)\n            prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n        }\n\n        // Handle non-overflow cases, 256 by 256 division\n        if (prod1 == 0) {\n            require(denominator > 0);\n            assembly {\n                result := div(prod0, denominator)\n            }\n            return result;\n        }\n\n        // Make sure the result is less than 2**256.\n        // Also prevents denominator == 0\n        require(denominator > prod1);\n\n        ///////////////////////////////////////////////\n        // 512 by 256 division.\n        ///////////////////////////////////////////////\n\n        // Make division exact by subtracting the remainder from [prod1 prod0]\n        // Compute remainder using mulmod\n        uint256 remainder;\n        assembly {\n            remainder := mulmod(a, b, denominator)\n        }\n        // Subtract 256 bit number from 512 bit number\n        assembly {\n            prod1 := sub(prod1, gt(remainder, prod0))\n            prod0 := sub(prod0, remainder)\n        }\n\n        // Factor powers of two out of denominator\n        // Compute largest power of two divisor of denominator.\n        // Always >= 1.\n        uint256 twos = (type(uint256).max - denominator + 1) & denominator;\n        // Divide denominator by power of two\n        assembly {\n            denominator := div(denominator, twos)\n        }\n\n        // Divide [prod1 prod0] by the factors of two\n        assembly {\n            prod0 := div(prod0, twos)\n        }\n        // Shift in bits from prod1 into prod0. For this we need\n        // to flip `twos` such that it is 2**256 / twos.\n        // If twos is zero, then it becomes one\n        assembly {\n            twos := add(div(sub(0, twos), twos), 1)\n        }\n        prod0 |= prod1 * twos;\n\n        // Invert denominator mod 2**256\n        // Now that denominator is an odd number, it has an inverse\n        // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n        // Compute the inverse by starting with a seed that is correct\n        // correct for four bits. That is, denominator * inv = 1 mod 2**4\n        uint256 inv = (3 * denominator) ^ 2;\n        // Now use Newton-Raphson iteration to improve the precision.\n        // Thanks to Hensel's lifting lemma, this also works in modular\n        // arithmetic, doubling the correct bits in each step.\n        inv *= 2 - denominator * inv; // inverse mod 2**8\n        inv *= 2 - denominator * inv; // inverse mod 2**16\n        inv *= 2 - denominator * inv; // inverse mod 2**32\n        inv *= 2 - denominator * inv; // inverse mod 2**64\n        inv *= 2 - denominator * inv; // inverse mod 2**128\n        inv *= 2 - denominator * inv; // inverse mod 2**256\n\n        // Because the division is now exact we can divide by multiplying\n        // with the modular inverse of denominator. This will give us the\n        // correct result modulo 2**256. Since the precoditions guarantee\n        // that the outcome is less than 2**256, this is the final result.\n        // We don't need to compute the high bits of the result and prod1\n        // is no longer required.\n        result = prod0 * inv;\n        return result;\n    }\n\n    /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n    /// @param a The multiplicand\n    /// @param b The multiplier\n    /// @param denominator The divisor\n    /// @return result The 256-bit result\n    function mulDivRoundingUp(\n        uint256 a,\n        uint256 b,\n        uint256 denominator\n    ) internal pure returns (uint256 result) {\n        result = mulDiv(a, b, denominator);\n        if (mulmod(a, b, denominator) > 0) {\n            require(result < type(uint256).max);\n            result++;\n        }\n    }\n}"},{"file_path":"contracts/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport \"../Common/Context.sol\";\nimport \"../Math/SafeMath.sol\";\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP. Does not include\n * the optional functions; to access them see {ERC20Detailed}.\n */\ninterface IERC20 {\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\n"},{"file_path":"contracts/Common/Context.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\n/*\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with GSN meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address payable) {\n        return payable(msg.sender);\n    }\n\n    function _msgData() internal view virtual returns (bytes memory) {\n        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\n        return msg.data;\n    }\n}"},{"file_path":"contracts/Uniswap/UniswapV2OracleLibrary.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport '../Uniswap/Interfaces/IUniswapV2Pair.sol';\nimport '../Math/FixedPoint.sol';\n\n// library with helper methods for oracles that are concerned with computing average prices\nlibrary UniswapV2OracleLibrary {\n    using FixedPoint for *;\n\n    // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]\n    function currentBlockTimestamp() internal view returns (uint32) {\n        return uint32(block.timestamp % 2 ** 32);\n    }\n\n    // produces the cumulative price using counterfactuals to save gas and avoid a call to sync.\n    function currentCumulativePrices(\n        address pair\n    ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {\n        blockTimestamp = currentBlockTimestamp();\n        price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();\n        price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();\n\n        // if time has elapsed since the last update on the pair, mock the accumulated price values\n        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();\n        if (blockTimestampLast != blockTimestamp) {\n            // subtraction overflow is desired\n            uint32 timeElapsed = blockTimestamp - blockTimestampLast;\n            // addition overflow is desired\n            // counterfactual\n            price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;\n            // counterfactual\n            price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;\n        }\n    }\n}"},{"file_path":"@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},{"file_path":"contracts/Uniswap/TransferHelper.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n    function safeApprove(address token, address to, uint value) internal {\n        // bytes4(keccak256(bytes('approve(address,uint256)')));\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');\n    }\n\n    function safeTransfer(address token, address to, uint value) internal {\n        // bytes4(keccak256(bytes('transfer(address,uint256)')));\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');\n    }\n\n    function safeTransferFrom(address token, address from, address to, uint value) internal {\n        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));\n        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');\n    }\n\n    function safeTransferETH(address to, uint value) internal {\n        (bool success,) = to.call{value:value}(new bytes(0));\n        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');\n    }\n}"},{"file_path":"contracts/ERC20/ERC20.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\nimport \"../Common/Context.sol\";\nimport \"./IERC20.sol\";\nimport \"../Math/SafeMath.sol\";\nimport \"../Utils/Address.sol\";\n\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20Mintable}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin guidelines: functions revert instead\n * of returning `false` on failure. This behavior is nonetheless conventional\n * and does not conflict with the expectations of ERC20 applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\n \ncontract ERC20 is Context, IERC20 {\n    using SafeMath for uint256;\n\n    mapping (address => uint256) private _balances;\n\n    mapping (address => mapping (address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n    uint8 private _decimals;\n    \n    /**\n     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with\n     * a default value of 18.\n     *\n     * To select a different value for {decimals}, use {_setupDecimals}.\n     *\n     * All three of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor (string memory __name, string memory __symbol) public {\n        _name = __name;\n        _symbol = __symbol;\n        _decimals = 18;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5,05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is\n     * called.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view returns (uint8) {\n        return _decimals;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `recipient` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\n        _transfer(_msgSender(), recipient, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.approve(address spender, uint256 amount)\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        _approve(_msgSender(), spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20};\n     *\n     * Requirements:\n     * - `sender` and `recipient` cannot be the zero address.\n     * - `sender` must have a balance of at least `amount`.\n     * - the caller must have allowance for `sender`'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {\n        _transfer(sender, recipient, amount);\n        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, \"ERC20: decreased allowance below zero\"));\n        return true;\n    }\n\n    /**\n     * @dev Moves tokens `amount` from `sender` to `recipient`.\n     *\n     * This is internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `sender` cannot be the zero address.\n     * - `recipient` cannot be the zero address.\n     * - `sender` must have a balance of at least `amount`.\n     */\n    function _transfer(address sender, address recipient, uint256 amount) internal virtual {\n        require(sender != address(0), \"ERC20: transfer from the zero address\");\n        require(recipient != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(sender, recipient, amount);\n\n        _balances[sender] = _balances[sender].sub(amount, \"ERC20: transfer amount exceeds balance\");\n        _balances[recipient] = _balances[recipient].add(amount);\n        emit Transfer(sender, recipient, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements\n     *\n     * - `to` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply = _totalSupply.add(amount);\n        _balances[account] = _balances[account].add(amount);\n        emit Transfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from the caller.\n     *\n     * See {ERC20-_burn}.\n     */\n    function burn(uint256 amount) public virtual {\n        _burn(_msgSender(), amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n     * allowance.\n     *\n     * See {ERC20-_burn} and {ERC20-allowance}.\n     *\n     * Requirements:\n     *\n     * - the caller must have allowance for `accounts`'s tokens of at least\n     * `amount`.\n     */\n    function burnFrom(address account, uint256 amount) public virtual {\n        uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, \"ERC20: burn amount exceeds allowance\");\n\n        _approve(account, _msgSender(), decreasedAllowance);\n        _burn(account, amount);\n    }\n\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        _balances[account] = _balances[account].sub(amount, \"ERC20: burn amount exceeds balance\");\n        _totalSupply = _totalSupply.sub(amount);\n        emit Transfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.\n     *\n     * This is internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`.`amount` is then deducted\n     * from the caller's allowance.\n     *\n     * See {_burn} and {_approve}.\n     */\n    function _burnFrom(address account, uint256 amount) internal virtual {\n        _burn(account, amount);\n        _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, \"ERC20: burn amount exceeds allowance\"));\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of `from`'s tokens\n     * will be to transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of `from`'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:using-hooks.adoc[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }\n}\n"},{"file_path":"contracts/Uniswap_V3/pool/IUniswapV3PoolEvents.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n    event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n    /// @notice Emitted when liquidity is minted for a given position\n    /// @param sender The address that minted the liquidity\n    /// @param owner The owner of the position and recipient of any minted liquidity\n    /// @param tickLower The lower tick of the position\n    /// @param tickUpper The upper tick of the position\n    /// @param amount The amount of liquidity minted to the position range\n    /// @param amount0 How much token0 was required for the minted liquidity\n    /// @param amount1 How much token1 was required for the minted liquidity\n    event Mint(\n        address sender,\n        address indexed owner,\n        int24 indexed tickLower,\n        int24 indexed tickUpper,\n        uint128 amount,\n        uint256 amount0,\n        uint256 amount1\n    );\n\n    /// @notice Emitted when fees are collected by the owner of a position\n    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n    /// @param owner The owner of the position for which fees are collected\n    /// @param tickLower The lower tick of the position\n    /// @param tickUpper The upper tick of the position\n    /// @param amount0 The amount of token0 fees collected\n    /// @param amount1 The amount of token1 fees collected\n    event Collect(\n        address indexed owner,\n        address recipient,\n        int24 indexed tickLower,\n        int24 indexed tickUpper,\n        uint128 amount0,\n        uint128 amount1\n    );\n\n    /// @notice Emitted when a position's liquidity is removed\n    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n    /// @param owner The owner of the position for which liquidity is removed\n    /// @param tickLower The lower tick of the position\n    /// @param tickUpper The upper tick of the position\n    /// @param amount The amount of liquidity to remove\n    /// @param amount0 The amount of token0 withdrawn\n    /// @param amount1 The amount of token1 withdrawn\n    event Burn(\n        address indexed owner,\n        int24 indexed tickLower,\n        int24 indexed tickUpper,\n        uint128 amount,\n        uint256 amount0,\n        uint256 amount1\n    );\n\n    /// @notice Emitted by the pool for any swaps between token0 and token1\n    /// @param sender The address that initiated the swap call, and that received the callback\n    /// @param recipient The address that received the output of the swap\n    /// @param amount0 The delta of the token0 balance of the pool\n    /// @param amount1 The delta of the token1 balance of the pool\n    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n    /// @param liquidity The liquidity of the pool after the swap\n    /// @param tick The log base 1.0001 of price of the pool after the swap\n    event Swap(\n        address indexed sender,\n        address indexed recipient,\n        int256 amount0,\n        int256 amount1,\n        uint160 sqrtPriceX96,\n        uint128 liquidity,\n        int24 tick\n    );\n\n    /// @notice Emitted by the pool for any flashes of token0/token1\n    /// @param sender The address that initiated the swap call, and that received the callback\n    /// @param recipient The address that received the tokens from flash\n    /// @param amount0 The amount of token0 that was flashed\n    /// @param amount1 The amount of token1 that was flashed\n    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n    event Flash(\n        address indexed sender,\n        address indexed recipient,\n        uint256 amount0,\n        uint256 amount1,\n        uint256 paid0,\n        uint256 paid1\n    );\n\n    /// @notice Emitted by the pool for increases to the number of observations that can be stored\n    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n    /// just before a mint/swap/burn.\n    /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n    /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n    event IncreaseObservationCardinalityNext(\n        uint16 observationCardinalityNextOld,\n        uint16 observationCardinalityNextNew\n    );\n\n    /// @notice Emitted when the protocol fee is changed by the pool\n    /// @param feeProtocol0Old The previous value of the token0 protocol fee\n    /// @param feeProtocol1Old The previous value of the token1 protocol fee\n    /// @param feeProtocol0New The updated value of the token0 protocol fee\n    /// @param feeProtocol1New The updated value of the token1 protocol fee\n    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n    /// @param sender The address that collects the protocol fees\n    /// @param recipient The address that receives the collected protocol fees\n    /// @param amount0 The amount of token0 protocol fees that is withdrawn\n    /// @param amount0 The amount of token1 protocol fees that is withdrawn\n    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n"},{"file_path":"contracts/Uniswap_V3/ISwapRouter.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.5;\npragma abicoder v2;\n\nimport '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface ISwapRouter is IUniswapV3SwapCallback {\n    struct ExactInputSingleParams {\n        address tokenIn;\n        address tokenOut;\n        uint24 fee;\n        address recipient;\n        uint256 deadline;\n        uint256 amountIn;\n        uint256 amountOutMinimum;\n        uint160 sqrtPriceLimitX96;\n    }\n\n    /// @notice Swaps `amountIn` of one token for as much as possible of another token\n    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata\n    /// @return amountOut The amount of the received token\n    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);\n\n    struct ExactInputParams {\n        bytes path;\n        address recipient;\n        uint256 deadline;\n        uint256 amountIn;\n        uint256 amountOutMinimum;\n    }\n\n    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n    /// @return amountOut The amount of the received token\n    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n\n    struct ExactOutputSingleParams {\n        address tokenIn;\n        address tokenOut;\n        uint24 fee;\n        address recipient;\n        uint256 deadline;\n        uint256 amountOut;\n        uint256 amountInMaximum;\n        uint160 sqrtPriceLimitX96;\n    }\n\n    /// @notice Swaps as little as possible of one token for `amountOut` of another token\n    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata\n    /// @return amountIn The amount of the input token\n    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);\n\n    struct ExactOutputParams {\n        bytes path;\n        address recipient;\n        uint256 deadline;\n        uint256 amountOut;\n        uint256 amountInMaximum;\n    }\n\n    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)\n    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata\n    /// @return amountIn The amount of the input token\n    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);\n}"},{"file_path":"contracts/Uniswap_V3/periphery/interfaces/IPeripheryImmutableState.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Immutable state\n/// @notice Functions that return immutable state of the router\ninterface IPeripheryImmutableState {\n    /// @return Returns the address of the Uniswap V3 factory\n    function factory() external view returns (address);\n\n    /// @return Returns the address of WETH9\n    function WETH9() external view returns (address);\n}"},{"file_path":"contracts/Uniswap_V3/pool/IUniswapV3PoolActions.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity >=0.6.11;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n    /// @notice Sets the initial price for the pool\n    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n    function initialize(uint160 sqrtPriceX96) external;\n\n    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n    /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n    /// @param recipient The address for which the liquidity will be created\n    /// @param tickLower The lower tick of the position in which to add liquidity\n    /// @param tickUpper The upper tick of the position in which to add liquidity\n    /// @param amount The amount of liquidity to mint\n    /// @param data Any data that should be passed through to the callback\n    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n    function mint(\n        address recipient,\n        int24 tickLower,\n        int24 tickUpper,\n        uint128 amount,\n        bytes calldata data\n    ) external returns (uint256 amount0, uint256 amount1);\n\n    /// @notice Collects tokens owed to a position\n    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n    /// @param recipient The address which should receive the fees collected\n    /// @param tickLower The lower tick of the position for which to collect fees\n    /// @param tickUpper The upper tick of the position for which to collect fees\n    /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n    /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n    /// @return amount0 The amount of fees collected in token0\n    /// @return amount1 The amount of fees collected in token1\n    function collect(\n        address recipient,\n        int24 tickLower,\n        int24 tickUpper,\n        uint128 amount0Requested,\n        uint128 amount1Requested\n    ) external returns (uint128 amount0, uint128 amount1);\n\n    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n    /// @dev Fees must be collected separately via a call to #collect\n    /// @param tickLower The lower tick of the position for which to burn liquidity\n    /// @param tickUpper The upper tick of the position for which to burn liquidity\n    /// @param amount How much liquidity to burn\n    /// @return amount0 The amount of token0 sent to the recipient\n    /// @return amount1 The amount of token1 sent to the recipient\n    function burn(\n        int24 tickLower,\n        int24 tickUpper,\n        uint128 amount\n    ) external returns (uint256 amount0, uint256 amount1);\n\n    /// @notice Swap token0 for token1, or token1 for token0\n    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n    /// @param recipient The address to receive the output of the swap\n    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n    /// @param data Any data to be passed through to the callback\n    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n    function swap(\n        address recipient,\n        bool zeroForOne,\n        int256 amountSpecified,\n        uint160 sqrtPriceLimitX96,\n        bytes calldata data\n    ) external returns (int256 amount0, int256 amount1);\n\n    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n    /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n    /// @param recipient The address which will receive the token0 and token1 amounts\n    /// @param amount0 The amount of token0 to send\n    /// @param amount1 The amount of token1 to send\n    /// @param data Any data to be passed through to the callback\n    function flash(\n        address recipient,\n        uint256 amount0,\n        uint256 amount1,\n        bytes calldata data\n    ) external;\n\n    /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n    /// the input observationCardinalityNext.\n    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n"},{"file_path":"contracts/Uniswap_V3/pool/IUniswapV3PoolImmutables.sol","source_code":"// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.11;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n    /// @return The contract address\n    function factory() external view returns (address);\n\n    /// @notice The first of the two tokens of the pool, sorted by address\n    /// @return The token contract address\n    function token0() external view returns (address);\n\n    /// @notice The second of the two tokens of the pool, sorted by address\n    /// @return The token contract address\n    function token1() external view returns (address);\n\n    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n    /// @return The fee\n    function fee() external view returns (uint24);\n\n    /// @notice The pool tick spacing\n    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n    /// This value is an int24 to avoid casting even though it is always positive.\n    /// @return The tick spacing\n    function tickSpacing() external view returns (int24);\n\n    /// @notice The maximum amount of position liquidity that can use any tick in the range\n    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n    /// @return The max amount of liquidity per tick\n    function maxLiquidityPerTick() external view returns (uint128);\n}\n"},{"file_path":"contracts/Utils/EnumerableSet.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.11;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`\n * (`UintSet`) are supported.\n */\nlibrary EnumerableSet {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping (bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) { // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs\n            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.\n\n            bytes32 lastvalue = set._values[lastIndex];\n\n            // Move the last value to the index where the value to delete is\n            set._values[toDeleteIndex] = lastvalue;\n            // Update the index for the moved value\n            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n   /**\n    * @dev Returns the value stored at position `index` in the set. O(1).\n    *\n    * Note that there are no guarantees on the ordering of values inside the\n    * array, and it may change when more values are added or removed.\n    *\n    * Requirements:\n    *\n    * - `index` must be strictly less than {length}.\n    */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        require(set._values.length > index, \"EnumerableSet: index out of bounds\");\n        return set._values[index];\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(bytes20(value)));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(bytes20(value)));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(bytes20(value)));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n   /**\n    * @dev Returns the value stored at position `index` in the set. O(1).\n    *\n    * Note that there are no guarantees on the ordering of values inside the\n    * array, and it may change when more values are added or removed.\n    *\n    * Requirements:\n    *\n    * - `index` must be strictly less than {length}.\n    */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(bytes20(_at(set._inner, index)));\n    }\n\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n   /**\n    * @dev Returns the value stored at position `index` in the set. O(1).\n    *\n    * Note that there are no guarantees on the ordering of values inside the\n    * array, and it may change when more values are added or removed.\n    *\n    * Requirements:\n    *\n    * - `index` must be strictly less than {length}.\n    */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"_creator_address","type":"address"},{"internalType":"address","name":"_custodian_address","type":"address"},{"internalType":"address","name":"_frax_contract_address","type":"address"},{"internalType":"address","name":"_fxs_contract_address","type":"address"},{"internalType":"address","name":"_timelock_address","type":"address"},{"internalType":"address","name":"_pool_address","type":"address"},{"internalType":"address","name":"_pool_collateral_address","type":"address"},{"internalType":"address","name":"_univ3_factory_address","type":"address"},{"internalType":"address","name":"_univ3_positions_address","type":"address"},{"internalType":"address","name":"_univ3_router_address","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RecoveredERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"RecoveredERC721","type":"event"},{"inputs":[],"name":"TotalLiquidityFrax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"accumulatedProfit","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collat_addr","type":"address"}],"name":"addCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allCollateralAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowed_collaterals","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"use_safe_approve","type":"bool"}],"name":"approveTarget","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"borrowed_collat_historical","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFRAX","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFXS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burned_sum_historical","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collatDollarBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collat_borrow_cap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"collateral_addresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"custodian_address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeColDolVal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"giveCollatBack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"min_cr","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collat_addr","type":"address"},{"internalType":"uint256","name":"_amountCollateral","type":"uint256"},{"internalType":"uint256","name":"_amountFrax","type":"uint256"},{"internalType":"uint24","name":"_fee_tier","type":"uint24"},{"internalType":"int24","name":"_tickLower","type":"int24"},{"internalType":"int24","name":"_tickUpper","type":"int24"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"frax_amount","type":"uint256"}],"name":"mintFRAXForInvestments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"frax_amount","type":"uint256"}],"name":"mintRedeemPart1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintRedeemPart2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mint_cap","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintedBalance","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minted_sum_historical","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"missing_decimals","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":[],"name":"numPositions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool_address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool_collateral_address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"positions_array","outputs":[{"internalType":"uint256","name":"token_id","type":"uint256"},{"internalType":"address","name":"collateral_address","type":"address"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint24","name":"fee_tier","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"positions_mapping","outputs":[{"internalType":"uint256","name":"token_id","type":"uint256"},{"internalType":"address","name":"collateral_address","type":"address"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint24","name":"fee_tier","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"token_id","type":"uint256"}],"name":"recoverERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"returned_collat_historical","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_custodian_address","type":"address"}],"name":"setCustodian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool_address","type":"address"},{"internalType":"address","name":"_pool_collateral_address","type":"address"},{"internalType":"uint256","name":"_missing_decimals","type":"uint256"}],"name":"setPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min_cr","type":"uint256"},{"internalType":"uint256","name":"_mint_cap","type":"uint256"},{"internalType":"uint256","name":"_collat_borrow_cap","type":"uint256"}],"name":"setSafetyParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"new_timelock","type":"address"}],"name":"setTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"showAllocations","outputs":[{"internalType":"uint256[4]","name":"allocations","type":"uint256[4]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenA","type":"address"},{"internalType":"address","name":"_tokenB","type":"address"},{"internalType":"uint24","name":"_fee_tier","type":"uint24"},{"internalType":"uint256","name":"_amountAtoB","type":"uint256"},{"internalType":"uint256","name":"_amountOutMinimum","type":"uint256"},{"internalType":"uint160","name":"_sqrtPriceLimitX96","type":"uint160"}],"name":"swap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timelock_address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"univ3_factory","outputs":[{"internalType":"contract IUniswapV3Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"univ3_positions","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"univ3_router","outputs":[{"internalType":"contract ISwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_token_id","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x000000000000000000000000234d953a9404bf9dbc3b526271d440cd2870bcd20000000000000000000000005180db0237291a6449dda9ed33ad90a38787621c000000000000000000000000853d955acef822db058eb8505911ed77f175b99e0000000000000000000000003432b6a60d23ca0dfca7761b7ab56459d9c964d00000000000000000000000008412ebf45bac1b340bbe8f318b928c466c4e39ca0000000000000000000000001864ca3d47aab98ee78d11fc9dcc5e7badda1c0d000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564"}