Contract 0xa0ef47d2b81d22cf45161db7c422655b9686dd23

 
  Note: Our ether balance display is temporarily unavailable. Please check back later.
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xf452e33b996afd7da087c2bc4729759a8ac9e3c9dbf6fd8490860168e482c324Update33443862021-11-26 6:59:506 days 23 hrs ago0xde485812e28824e542b9c2270b6b8ed9232b7d0b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001572882662 ETH
0xfab1b871032b3391ff4c0eeff927f79e951bb1c16307e7e66fa591ebd973e0aeUpdate33366422021-11-25 22:59:587 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.00169209331 ETH
0x10065798b25a99f3bc811d9a765d6c962c2b8b30fc9a20d7a04de1d0b6b282c9Update33229512021-11-25 11:59:197 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001633746864 ETH
0x6730f8304f00415b72d38a04a8db89e49c0daa7cee63e570c5199a14a0c5ca29Update33092732021-11-24 22:59:068 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001659933913 ETH
0x798b6d18e907a668286caa3f90435f6a0bf3cf8dc9833f88d124b19b395ebdaeUpdate32960152021-11-24 11:59:538 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001593056676 ETH
0x99a1faabf961016438eea2ef068fafe9e531fcd117d72468f7de334ff06fd2b9Update32817372021-11-23 22:59:399 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001652376348 ETH
0xff76595425aaebe231e434890fc869c30f35661a593297d5e54f655536cf8f5dUpdate32695642021-11-23 11:59:409 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001640970631 ETH
0xfcb9621b18b202e51e6e7cd740db6f3e78b34d2f5b361ad5e798b97e71077aa0Update32545692021-11-22 22:59:2710 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001699865417 ETH
0xcecf82df8c7612c8232611e9196c4bbc378b279035a1174c54e1bc1bb8730d3cUpdate32381762021-11-22 11:59:0010 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001630970092 ETH
0x2342961bcb5f7e10c3aa5d466eab9c325958d09f3b7d17626e4aadfe4531fcf0Update32241342021-11-21 22:59:2511 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001520158635 ETH
0x880cb459f2b2c03c19979359929b0ef7fd518bc08fd2f03b584a78fe1a79aa64Update32101942021-11-21 11:59:1611 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001439798937 ETH
0x29e19c952834e274b2c666938b763b5183e36964a59e264b0f9ff5957717c5d4Update31924372021-11-20 23:00:0312 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001595967443 ETH
0xaf45b02d56da871e3c51b89185bc9b1986f5862bdf9e0b4c598e7f6e3f92e3f0Update31706672021-11-20 11:59:3412 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001634304796 ETH
0x6955cc15954c7382315bae7a336a466b2a3f42950a8587b9c55a202ee3429fdbUpdate31569232021-11-19 22:59:2513 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001828016698 ETH
0x03c5be83764f2282dfd5539b97f301360cb9fb09f16f4320c7e91717cae1b0acUpdate31469002021-11-19 11:59:2913 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001837984183 ETH
0xfda3d478703abb668cf852a4f7bb2044c2f08fac82392b5fc19eea426a3a22bbUpdate31346452021-11-18 22:59:5314 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001982895443 ETH
0xbd778db5f0f660fb58cd76e9a74b99c016bcb62c2595ff206d28f9a29fb00aa9Update31232842021-11-18 11:59:3614 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001811321061 ETH
0x3e8172d992a69526317957b4d335ab4f5952d1c42f433fa4cdbfbf4af24bd544Update31139762021-11-17 22:59:0615 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001895604438 ETH
0x1f5f5bdd566546bf833cd96718afe0de9782abfcba99142609fb2246523bc92bUpdate31043362021-11-17 11:59:0215 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001912192618 ETH
0x5af155e62a643ee4bfb030bd939b6ccc3c7f4cdfab635ea27f3df3c78986a222Update30910852021-11-16 22:58:5116 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.00197003538 ETH
0x8fd7107964d7328c54930a1148ed9d9a3811ff4d797794983d1e17b245da5067Update30812872021-11-16 11:58:5716 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001917291709 ETH
0x51202211b8e96ed7f544f3de709906f549e749992b2d2f8bc4cc72aa096f9c3bUpdate30565282021-11-15 11:59:1217 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001663453691 ETH
0x8bbcde21e241f9e33d5361856d4b9c67a9c3c17e7fc20998b6b869454fd2b866Update30456492021-11-14 22:59:1318 days 7 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001693723174 ETH
0x02d53bb88cf7d002cadab951ee26a8db3e317fe7f7663c8d244f832a74c78fc7Update30354372021-11-14 11:59:5018 days 18 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001782532919 ETH
0x4ff4c040db86b6fc01693cff3a7f6fc96a2fc46fa0c2b4bcbc9daaf05600f3c8Update30258142021-11-14 0:00:0119 days 6 hrs ago0xc490de9ca4e020f16f3d768b6a4f6fff513e117b IN  0xa0ef47d2b81d22cf45161db7c422655b9686dd230 ETH0.001891223494 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UniswapV2Oracle

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : UniswapV2Oracle.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IOracle } from "./interfaces/IOracle.sol";
import { IUniswapV2Pair } from "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import { IERC20 } from "./interfaces/IERC20.sol";
import { AggregatorV3Interface } from "./interfaces/AggregatorV3Interface.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
import { FixedPoint } from "@uniswap/lib/contracts/libraries/FixedPoint.sol";
import { UniswapV2Library } from "@uniswap/v2-periphery/contracts/libraries/UniswapV2Library.sol";
import { UniswapV2OracleLibrary } from "@uniswap/v2-periphery/contracts/libraries/UniswapV2OracleLibrary.sol";

// fixed window oracle that recomputes the average price for the entire period once every period
// note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period
contract UniswapV2Oracle is Ownable, IOracle {
    using FixedPoint for *;
    using SafeMath for uint256;

    struct Observation {
        uint32 timestamp;
        uint256 price0Cumulative;
        uint256 price1Cumulative;
        uint256 feedPrice;
    }

    uint256 public period;

    IUniswapV2Pair public immutable pair;
    AggregatorV3Interface public immutable priceFeed;
    address public immutable token;
    address public immutable token0;
    address public immutable token1;
    uint8 public immutable decimals;

    uint256 private latestAnswer;

    Observation[] public observations;

    constructor(
        address _pair,
        address _token,
        address _priceFeed
    ) public {
        pair = IUniswapV2Pair(_pair);
        address _token0 = IUniswapV2Pair(_pair).token0();
        address _token1 = IUniswapV2Pair(_pair).token1();
        token0 = _token0;
        token1 = _token1;
        require(_token == _token0 || _token == _token1, "UniswapV2Oracle: INVALID_TOKEN");
        token = _token;
        decimals = IERC20(_token).decimals();
        (uint112 reserve0, uint112 reserve1, ) = IUniswapV2Pair(_pair).getReserves();
        require(reserve0 != 0 && reserve1 != 0, "UniswapV2Oracle: NO_RESERVES"); // ensure that there's liquidity in the pair
        priceFeed = AggregatorV3Interface(_priceFeed);

        (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary
            .currentCumulativePrices(_pair);
        (, int256 feedPrice, , , ) = AggregatorV3Interface(_priceFeed).latestRoundData();
        observations.push(Observation(blockTimestamp, price0Cumulative, price1Cumulative, uint256(feedPrice)));

        period = 2 hours;
        emit UpdatePeriod(period);
    }

    function setPeriod(uint256 _period) external onlyOwner {
        period = _period;
        emit UpdatePeriod(_period);
    }

    function update() external {
        require(_update(), "UniswapV2Oracle: PERIOD_NOT_ELAPSED");
    }

    function getPriceInUSD() external override returns (uint256) {
        _update();
        uint256 price = consult(10**uint256(decimals));
        latestAnswer = price;
        emit PriceUpdated(token, price);
        return price;
    }

    function viewPriceInUSD() external view override returns (uint256) {
        return latestAnswer;
    }

    function observationLength() external view returns (uint256) {
        return observations.length;
    }

    function lastObservation() public view returns (Observation memory) {
        return observations[observations.length - 1];
    }

    function quote(uint256 amountIn, uint256 granularity) external view returns (uint256 amountOut) {
        uint256 priceAverageCumulative = 0;
        uint256 length = observations.length - 1;
        uint256 i = length.sub(granularity);

        uint256 nextIndex = 0;
        if (token == token0) {
            for (; i < length; i++) {
                nextIndex = i + 1;
                priceAverageCumulative += computeAmountOut(
                    observations[i].price0Cumulative,
                    observations[nextIndex].price0Cumulative,
                    observations[nextIndex].feedPrice,
                    amountIn,
                    observations[nextIndex].timestamp - observations[i].timestamp
                );
            }
        } else if (token == token1) {
            for (; i < length; i++) {
                nextIndex = i + 1;
                priceAverageCumulative += computeAmountOut(
                    observations[i].price1Cumulative,
                    observations[nextIndex].price1Cumulative,
                    observations[nextIndex].feedPrice,
                    amountIn,
                    observations[nextIndex].timestamp - observations[i].timestamp
                );
            }
        }
        amountOut = priceAverageCumulative.div(granularity);
    }

    function prices(uint256 amountIn, uint256 points) external view returns (uint256[] memory) {
        return sample(amountIn, points, 1);
    }

    function hourly(uint256 amountIn, uint256 points) external view returns (uint256[] memory) {
        return sample(amountIn, points, 1 hours / period);
    }

    function daily(uint256 amountIn, uint256 points) external view returns (uint256[] memory) {
        return sample(amountIn, points, 1 days / period);
    }

    function weekly(uint256 amountIn, uint256 points) external view returns (uint256[] memory) {
        return sample(amountIn, points, 1 weeks / period);
    }

    function sample(
        uint256 amountIn,
        uint256 points,
        uint256 window
    ) public view returns (uint256[] memory) {
        uint256[] memory _prices = new uint256[](points);

        uint256 length = observations.length - 1;
        uint256 i = length.sub(points * window);
        uint256 nextIndex = 0;
        uint256 index = 0;

        if (token == token0) {
            for (; i < length; i += window) {
                nextIndex = i + window;
                _prices[index] = computeAmountOut(
                    observations[i].price0Cumulative,
                    observations[nextIndex].price0Cumulative,
                    observations[nextIndex].feedPrice,
                    amountIn,
                    observations[nextIndex].timestamp - observations[i].timestamp
                );
                index = index + 1;
            }
        } else if (token == token1) {
            for (; i < length; i += window) {
                nextIndex = i + window;
                _prices[index] = computeAmountOut(
                    observations[i].price1Cumulative,
                    observations[nextIndex].price1Cumulative,
                    observations[nextIndex].feedPrice,
                    amountIn,
                    observations[nextIndex].timestamp - observations[i].timestamp
                );
                index = index + 1;
            }
        }
        return _prices;
    }

    function consult(uint256 amountIn) public view returns (uint256 amountOut) {
        Observation memory _observation = lastObservation();
        (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary
            .currentCumulativePrices(address(pair));
        if (blockTimestamp == _observation.timestamp) {
            _observation = observations[observations.length - 2];
        }

        uint32 timeElapsed = blockTimestamp - _observation.timestamp;
        timeElapsed = timeElapsed == 0 ? 1 : timeElapsed;
        if (token == token0) {
            amountOut = computeAmountOut(
                _observation.price0Cumulative,
                price0Cumulative,
                _observation.feedPrice,
                amountIn,
                timeElapsed
            );
        } else if (token == token1) {
            amountOut = computeAmountOut(
                _observation.price1Cumulative,
                price1Cumulative,
                _observation.feedPrice,
                amountIn,
                timeElapsed
            );
        }
    }

    /// @dev sqrt calculates the square root of a given number x
    /// @dev for precision into decimals the number must first
    /// @dev be multiplied by the precision factor desired
    /// @param x uint256 number for the calculation of square root
    function sqrt(uint256 x) public pure returns (uint256) {
        uint256 c = (x + 1) / 2;
        uint256 b = x;
        while (c < b) {
            b = c;
            c = (x / c + c) / 2;
        }
        return b;
    }

    /// @dev stddev calculates the standard deviation for an array of integers
    /// @dev precision is the same as sqrt above meaning for higher precision
    /// @dev the decimal place must be moved prior to passing the params
    /// @param numbers uint[] array of numbers to be used in calculation
    function stddev(uint256[] memory numbers) public pure returns (uint256 sd) {
        uint256 sum = 0;
        for (uint256 i = 0; i < numbers.length; i++) {
            sum += numbers[i];
        }
        uint256 mean = sum / numbers.length; // Integral value; float not supported in Solidity
        sum = 0;
        uint256 i;
        for (i = 0; i < numbers.length; i++) {
            sum += (numbers[i] - mean)**2;
        }
        sd = sqrt(sum / (numbers.length - 1)); //Integral value; float not supported in Solidity
        return sd;
    }

    /// @dev blackScholesEstimate calculates a rough price estimate for an ATM option
    /// @dev input parameters should be transformed prior to being passed to the function
    /// @dev so as to remove decimal places otherwise results will be far less accurate
    /// @param _vol uint256 volatility of the underlying converted to remove decimals
    /// @param _underlying uint256 price of the underlying asset
    /// @param _time uint256 days to expiration in years multiplied to remove decimals
    function blackScholesEstimate(
        uint256 _vol,
        uint256 _underlying,
        uint256 _time
    ) public pure returns (uint256 estimate) {
        estimate = 40 * _vol * _underlying * sqrt(_time);
        return estimate;
    }

    /// @dev fromReturnsBSestimate first calculates the stddev of an array of price returns
    /// @dev then uses that as the volatility param for the blackScholesEstimate
    /// @param _numbers uint256[] array of price returns for volatility calculation
    /// @param _underlying uint256 price of the underlying asset
    /// @param _time uint256 days to expiration in years multiplied to remove decimals
    function retBasedBlackScholesEstimate(
        uint256[] memory _numbers,
        uint256 _underlying,
        uint256 _time
    ) public pure {
        uint256 _vol = stddev(_numbers);
        blackScholesEstimate(_vol, _underlying, _time);
    }

    function _update() internal returns (bool) {
        Observation memory _point = lastObservation();
        (uint256 price0Cumulative, uint256 price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary
            .currentCumulativePrices(address(pair));
        uint32 timeElapsed = blockTimestamp - _point.timestamp; // overflow is desired

        // ensure that at least one full period has passed since the last update
        if (timeElapsed >= period) {
            (, int256 feedPrice, , , ) = priceFeed.latestRoundData();
            observations.push(Observation(blockTimestamp, price0Cumulative, price1Cumulative, uint256(feedPrice)));
            return true;
        } else {
            return false;
        }
    }

    function computeAmountOut(
        uint256 priceCumulativeStart,
        uint256 priceCumulativeEnd,
        uint256 feedPrice,
        uint256 amountIn,
        uint32 timeElapsed
    ) internal view returns (uint256 amountOut) {
        // overflow is desired.
        FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(
            uint224((priceCumulativeEnd - priceCumulativeStart) / timeElapsed)
        );
        amountOut = priceAverage.mul(amountIn).decode144();
        amountOut = amountOut.mul(feedPrice).div(10**uint256(decimals));
    }

    event UpdatePeriod(uint256 period);
}

File 2 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

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

File 3 of 15 : IOracle.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.16;

interface IOracle {
    event PriceUpdated(address asset, uint256 newPrice);

    function getPriceInUSD() external returns (uint256);

    function viewPriceInUSD() external view returns (uint256);
}

File 4 of 15 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 5 of 15 : IERC20.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.16;

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);

    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address owner) external view returns (uint256);

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);
}

File 6 of 15 : AggregatorV3Interface.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.16;

interface AggregatorV3Interface {
    function decimals() external view returns (uint8);

    function description() external view returns (string memory);

    function version() external view returns (uint256);

    // getRoundData and latestRoundData should both raise "No data present"
    // if they do not have data to report, instead of returning unset values
    // which could be misinterpreted as actual reported values.
    function getRoundData(uint80 _roundId)
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );

    function latestRoundData()
        external
        view
        returns (
            uint80 roundId,
            int256 answer,
            uint256 startedAt,
            uint256 updatedAt,
            uint80 answeredInRound
        );
}

File 7 of 15 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 15 : FixedPoint.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.4.0;

import './FullMath.sol';
import './Babylonian.sol';
import './BitMath.sol';

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
library FixedPoint {
    // range: [0, 2**112 - 1]
    // resolution: 1 / 2**112
    struct uq112x112 {
        uint224 _x;
    }

    // range: [0, 2**144 - 1]
    // resolution: 1 / 2**112
    struct uq144x112 {
        uint256 _x;
    }

    uint8 public constant RESOLUTION = 112;
    uint256 public constant Q112 = 0x10000000000000000000000000000; // 2**112
    uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000; // 2**224
    uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)

    // encode a uint112 as a UQ112x112
    function encode(uint112 x) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(x) << RESOLUTION);
    }

    // encodes a uint144 as a UQ144x112
    function encode144(uint144 x) internal pure returns (uq144x112 memory) {
        return uq144x112(uint256(x) << RESOLUTION);
    }

    // decode a UQ112x112 into a uint112 by truncating after the radix point
    function decode(uq112x112 memory self) internal pure returns (uint112) {
        return uint112(self._x >> RESOLUTION);
    }

    // decode a UQ144x112 into a uint144 by truncating after the radix point
    function decode144(uq144x112 memory self) internal pure returns (uint144) {
        return uint144(self._x >> RESOLUTION);
    }

    // multiply a UQ112x112 by a uint, returning a UQ144x112
    // reverts on overflow
    function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
        uint256 z = 0;
        require(y == 0 || (z = self._x * y) / y == self._x, 'FixedPoint::mul: overflow');
        return uq144x112(z);
    }

    // multiply a UQ112x112 by an int and decode, returning an int
    // reverts on overflow
    function muli(uq112x112 memory self, int256 y) internal pure returns (int256) {
        uint256 z = FullMath.mulDiv(self._x, uint256(y < 0 ? -y : y), Q112);
        require(z < 2**255, 'FixedPoint::muli: overflow');
        return y < 0 ? -int256(z) : int256(z);
    }

    // multiply a UQ112x112 by a UQ112x112, returning a UQ112x112
    // lossy
    function muluq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {
        if (self._x == 0 || other._x == 0) {
            return uq112x112(0);
        }
        uint112 upper_self = uint112(self._x >> RESOLUTION); // * 2^0
        uint112 lower_self = uint112(self._x & LOWER_MASK); // * 2^-112
        uint112 upper_other = uint112(other._x >> RESOLUTION); // * 2^0
        uint112 lower_other = uint112(other._x & LOWER_MASK); // * 2^-112

        // partial products
        uint224 upper = uint224(upper_self) * upper_other; // * 2^0
        uint224 lower = uint224(lower_self) * lower_other; // * 2^-224
        uint224 uppers_lowero = uint224(upper_self) * lower_other; // * 2^-112
        uint224 uppero_lowers = uint224(upper_other) * lower_self; // * 2^-112

        // so the bit shift does not overflow
        require(upper <= uint112(-1), 'FixedPoint::muluq: upper overflow');

        // this cannot exceed 256 bits, all values are 224 bits
        uint256 sum = uint256(upper << RESOLUTION) + uppers_lowero + uppero_lowers + (lower >> RESOLUTION);

        // so the cast does not overflow
        require(sum <= uint224(-1), 'FixedPoint::muluq: sum overflow');

        return uq112x112(uint224(sum));
    }

    // divide a UQ112x112 by a UQ112x112, returning a UQ112x112
    function divuq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {
        require(other._x > 0, 'FixedPoint::divuq: division by zero');
        if (self._x == other._x) {
            return uq112x112(uint224(Q112));
        }
        if (self._x <= uint144(-1)) {
            uint256 value = (uint256(self._x) << RESOLUTION) / other._x;
            require(value <= uint224(-1), 'FixedPoint::divuq: overflow');
            return uq112x112(uint224(value));
        }

        uint256 result = FullMath.mulDiv(Q112, self._x, other._x);
        require(result <= uint224(-1), 'FixedPoint::divuq: overflow');
        return uq112x112(uint224(result));
    }

    // returns a UQ112x112 which represents the ratio of the numerator to the denominator
    // can be lossy
    function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, 'FixedPoint::fraction: division by zero');
        if (numerator == 0) return FixedPoint.uq112x112(0);

        if (numerator <= uint144(-1)) {
            uint256 result = (numerator << RESOLUTION) / denominator;
            require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
            return uq112x112(uint224(result));
        } else {
            uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
            require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
            return uq112x112(uint224(result));
        }
    }

    // take the reciprocal of a UQ112x112
    // reverts on overflow
    // lossy
    function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        require(self._x != 0, 'FixedPoint::reciprocal: reciprocal of zero');
        require(self._x != 1, 'FixedPoint::reciprocal: overflow');
        return uq112x112(uint224(Q224 / self._x));
    }

    // square root of a UQ112x112
    // lossy between 0/1 and 40 bits
    function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        if (self._x <= uint144(-1)) {
            return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
        }

        uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
        safeShiftBits -= safeShiftBits % 2;
        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
    }
}

File 9 of 15 : UniswapV2Library.sol
pragma solidity >=0.5.0;

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';

import "./SafeMath.sol";

library UniswapV2Library {
    using SafeMath for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(997);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(1000).add(amountInWithFee);
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(1000);
        uint denominator = reserveOut.sub(amountOut).mul(997);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }
}

File 10 of 15 : UniswapV2OracleLibrary.sol
pragma solidity >=0.5.0;

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@uniswap/lib/contracts/libraries/FixedPoint.sol';

// library with helper methods for oracles that are concerned with computing average prices
library UniswapV2OracleLibrary {
    using FixedPoint for *;

    // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]
    function currentBlockTimestamp() internal view returns (uint32) {
        return uint32(block.timestamp % 2 ** 32);
    }

    // produces the cumulative price using counterfactuals to save gas and avoid a call to sync.
    function currentCumulativePrices(
        address pair
    ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) {
        blockTimestamp = currentBlockTimestamp();
        price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();
        price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();

        // if time has elapsed since the last update on the pair, mock the accumulated price values
        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();
        if (blockTimestampLast != blockTimestamp) {
            // subtraction overflow is desired
            uint32 timeElapsed = blockTimestamp - blockTimestampLast;
            // addition overflow is desired
            // counterfactual
            price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;
            // counterfactual
            price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;
        }
    }
}

File 11 of 15 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 12 of 15 : FullMath.sol
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.4.0;

// taken from https://medium.com/coinmonks/math-in-solidity-part-3-percents-and-proportions-4db014e080b1
// license is CC-BY-4.0
library FullMath {
    function fullMul(uint256 x, uint256 y) internal pure returns (uint256 l, uint256 h) {
        uint256 mm = mulmod(x, y, uint256(-1));
        l = x * y;
        h = mm - l;
        if (mm < l) h -= 1;
    }

    function fullDiv(
        uint256 l,
        uint256 h,
        uint256 d
    ) private pure returns (uint256) {
        uint256 pow2 = d & -d;
        d /= pow2;
        l /= pow2;
        l += h * ((-pow2) / pow2 + 1);
        uint256 r = 1;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        return l * r;
    }

    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 d
    ) internal pure returns (uint256) {
        (uint256 l, uint256 h) = fullMul(x, y);

        uint256 mm = mulmod(x, y, d);
        if (mm > l) h -= 1;
        l -= mm;

        if (h == 0) return l / d;

        require(h < d, 'FullMath: FULLDIV_OVERFLOW');
        return fullDiv(l, h, d);
    }
}

File 13 of 15 : Babylonian.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.4.0;

// computes square roots using the babylonian method
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
library Babylonian {
    // credit for this implementation goes to
    // https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
    function sqrt(uint256 x) internal pure returns (uint256) {
        if (x == 0) return 0;
        // this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2);
        // however that code costs significantly more gas
        uint256 xx = x;
        uint256 r = 1;
        if (xx >= 0x100000000000000000000000000000000) {
            xx >>= 128;
            r <<= 64;
        }
        if (xx >= 0x10000000000000000) {
            xx >>= 64;
            r <<= 32;
        }
        if (xx >= 0x100000000) {
            xx >>= 32;
            r <<= 16;
        }
        if (xx >= 0x10000) {
            xx >>= 16;
            r <<= 8;
        }
        if (xx >= 0x100) {
            xx >>= 8;
            r <<= 4;
        }
        if (xx >= 0x10) {
            xx >>= 4;
            r <<= 2;
        }
        if (xx >= 0x8) {
            r <<= 1;
        }
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1; // Seven iterations should be enough
        uint256 r1 = x / r;
        return (r < r1 ? r : r1);
    }
}

File 14 of 15 : BitMath.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.5.0;

library BitMath {
    // returns the 0 indexed position of the most significant bit of the input x
    // s.t. x >= 2**msb and x < 2**(msb+1)
    function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
        require(x > 0, 'BitMath::mostSignificantBit: zero');

        if (x >= 0x100000000000000000000000000000000) {
            x >>= 128;
            r += 128;
        }
        if (x >= 0x10000000000000000) {
            x >>= 64;
            r += 64;
        }
        if (x >= 0x100000000) {
            x >>= 32;
            r += 32;
        }
        if (x >= 0x10000) {
            x >>= 16;
            r += 16;
        }
        if (x >= 0x100) {
            x >>= 8;
            r += 8;
        }
        if (x >= 0x10) {
            x >>= 4;
            r += 4;
        }
        if (x >= 0x4) {
            x >>= 2;
            r += 2;
        }
        if (x >= 0x2) r += 1;
    }

    // returns the 0 indexed position of the least significant bit of the input x
    // s.t. (x & 2**lsb) != 0 and (x & (2**(lsb) - 1)) == 0)
    // i.e. the bit at the index is set and the mask of all lower bits is 0
    function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
        require(x > 0, 'BitMath::leastSignificantBit: zero');

        r = 255;
        if (x & uint128(-1) > 0) {
            r -= 128;
        } else {
            x >>= 128;
        }
        if (x & uint64(-1) > 0) {
            r -= 64;
        } else {
            x >>= 64;
        }
        if (x & uint32(-1) > 0) {
            r -= 32;
        } else {
            x >>= 32;
        }
        if (x & uint16(-1) > 0) {
            r -= 16;
        } else {
            x >>= 16;
        }
        if (x & uint8(-1) > 0) {
            r -= 8;
        } else {
            x >>= 8;
        }
        if (x & 0xf > 0) {
            r -= 4;
        } else {
            x >>= 4;
        }
        if (x & 0x3 > 0) {
            r -= 2;
        } else {
            x >>= 2;
        }
        if (x & 0x1 > 0) r -= 1;
    }
}

File 15 of 15 : SafeMath.sol
pragma solidity =0.6.6;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }
}

Settings
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "optimizer": {
    "enabled": true,
    "runs": 800
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_pair","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_priceFeed","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"}],"name":"UpdatePeriod","type":"event"},{"inputs":[{"internalType":"uint256","name":"_vol","type":"uint256"},{"internalType":"uint256","name":"_underlying","type":"uint256"},{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"blackScholesEstimate","outputs":[{"internalType":"uint256","name":"estimate","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"consult","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"}],"name":"daily","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceInUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"}],"name":"hourly","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastObservation","outputs":[{"components":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint256","name":"price0Cumulative","type":"uint256"},{"internalType":"uint256","name":"price1Cumulative","type":"uint256"},{"internalType":"uint256","name":"feedPrice","type":"uint256"}],"internalType":"struct UniswapV2Oracle.Observation","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"observationLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint256","name":"price0Cumulative","type":"uint256"},{"internalType":"uint256","name":"price1Cumulative","type":"uint256"},{"internalType":"uint256","name":"feedPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeed","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"}],"name":"prices","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"granularity","type":"uint256"}],"name":"quote","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_numbers","type":"uint256[]"},{"internalType":"uint256","name":"_underlying","type":"uint256"},{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"retBasedBlackScholesEstimate","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"}],"name":"sample","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"sqrt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"numbers","type":"uint256[]"}],"name":"stddev","outputs":[{"internalType":"uint256","name":"sd","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"viewPriceInUSD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"}],"name":"weekly","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}]

6101406040523480156200001257600080fd5b5060405162002b6538038062002b65833981016040819052620000359162000a45565b60006200004a6001600160e01b036200056a16565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350826001600160a01b03166080816001600160a01b031660601b815250506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620000ed57600080fd5b505afa15801562000102573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000128919062000a1c565b90506000846001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200016657600080fd5b505afa1580156200017b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001a1919062000a1c565b6001600160601b0319606084811b821660e05282901b166101005290506001600160a01b038481169083161480620001ea5750806001600160a01b0316846001600160a01b0316145b620002125760405162461bcd60e51b8152600401620002099062000b79565b60405180910390fd5b836001600160a01b031660c0816001600160a01b031660601b81525050836001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200026957600080fd5b505afa1580156200027e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002a4919062000b56565b60ff166101208160ff1660f81b81525050600080866001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015620002f257600080fd5b505afa15801562000307573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200032d919062000a98565b5091509150816001600160701b03166000141580156200035557506001600160701b03811615155b620003745760405162461bcd60e51b8152600401620002099062000c64565b846001600160a01b031660a0816001600160a01b031660601b815250506000806000620003ac8a6200056e60201b620010c31760201c565b9250925092506000886001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015620003ee57600080fd5b505afa15801562000403573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000429919062000b00565b50506040805160808101825263ffffffff8781168252602082018a81528284018a815260608401878152600380546001808201835560009290925295517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b6004909702968701805463ffffffff1916919096161790945591517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c850155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d840155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e90920191909155611c209081905590519294507fd1c043d38a3243c01780647a1340049807cd98af891021c89c32c99a8e0c59e79350620005519290915062000c9b565b60405180910390a1505050505050505050505062000cd3565b3390565b60008080620005856001600160e01b036200079e16565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b158015620005c157600080fd5b505afa158015620005d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005fc919062000ae7565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b1580156200063857600080fd5b505afa1580156200064d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000673919062000ae7565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015620006b457600080fd5b505afa158015620006c9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006ef919062000a98565b9250925092508363ffffffff168163ffffffff16146200079457600081850390508063ffffffff1662000740846001600160701b0316866001600160701b0316620007a860201b620015701760201c565b600001516001600160e01b031602870196508063ffffffff1662000782856001600160701b0316856001600160701b0316620007a860201b620015701760201c565b516001600160e01b0316029590950194505b5050509193909250565b63ffffffff421690565b620007b2620009f2565b60008211620007d55760405162461bcd60e51b8152600401620002099062000bb0565b82620007f15750604080516020810190915260008152620008a8565b6001600160901b0383116200085e57600082607085901b816200081057fe5b0490506001600160e01b038111156200083d5760405162461bcd60e51b8152600401620002099062000c2d565b6040518060200160405280826001600160e01b0316815250915050620008a8565b60006200087c84600160701b85620008ae60201b620016691760201c565b90506001600160e01b038111156200083d5760405162461bcd60e51b8152600401620002099062000c2d565b92915050565b60008080620008c786866001600160e01b036200095116565b9150915060008480620008d657fe5b868809905082811115620008eb576001820391505b9182900391816200090c578483816200090057fe5b0493505050506200094a565b8482106200092e5760405162461bcd60e51b8152600401620002099062000bf6565b620009448383876001600160e01b036200097f16565b93505050505b9392505050565b600080806000198486099050838502925082810391508281101562000977576001820391505b509250929050565b600081810382168083816200099057fe5b0492508085816200099d57fe5b049450808160000381620009ad57fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b60408051602081019091526000815290565b80516001600160501b0381168114620008a857600080fd5b60006020828403121562000a2e578081fd5b81516001600160a01b03811681146200094a578182fd5b60008060006060848603121562000a5a578182fd5b835162000a678162000ca4565b602085015190935062000a7a8162000ca4565b604085015190925062000a8d8162000ca4565b809150509250925092565b60008060006060848603121562000aad578283fd5b835162000aba8162000cbd565b602085015190935062000acd8162000cbd565b604085015190925063ffffffff8116811462000a8d578182fd5b60006020828403121562000af9578081fd5b5051919050565b600080600080600060a0868803121562000b18578081fd5b62000b24878762000a04565b945060208601519350604086015192506060860151915062000b4a876080880162000a04565b90509295509295909350565b60006020828403121562000b68578081fd5b815160ff811681146200094a578182fd5b6020808252601e908201527f556e697377617056324f7261636c653a20494e56414c49445f544f4b454e0000604082015260600190565b60208082526026908201527f4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206260408201526579207a65726f60d01b606082015260800190565b6020808252601a908201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604082015260600190565b6020808252601e908201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604082015260600190565b6020808252601c908201527f556e697377617056324f7261636c653a204e4f5f524553455256455300000000604082015260600190565b90815260200190565b6001600160a01b038116811462000cba57600080fd5b50565b6001600160701b038116811462000cba57600080fd5b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c6101205160f81c611ddc62000d89600039806104cd5280610bb05280611052525080610645528061088f5280610b7c5280610eb55250806103c0528061051552806108195280610dbe52508061053f528061066f528061084352806108b95280610c065280610d925280610edf5280610fa15250806109e8528061132f52508061075e5280610b5852806112eb5250611ddc6000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80638373a7ab116100f9578063e2a6f54711610097578063f2fde38b11610071578063f2fde38b14610369578063f4ecfcef1461037c578063f55fa17f1461038f578063fc0c546a14610397576101c4565b8063e2a6f54714610346578063ebeb31db14610359578063ef78d4fd14610361576101c4565b8063a2e62045116100d3578063a2e6204514610326578063a8aa1b311461032e578063d21220a714610336578063e1aa60361461033e576101c4565b80638373a7ab146102f65780638a7b8cf2146103095780638da5cb5b1461031e576101c4565b80634411935e116101665780636ba0f64d116101405780636ba0f64d146102c0578063715018a6146102d3578063741bef1a146102db5780638226613b146102e3576101c4565b80634411935e1461028757806361e25d831461029a578063677342ce146102ad576101c4565b806323fe1e96116101a257806323fe1e961461020f578063252c09d71461022f578063313ce56714610252578063315f1a4114610267576101c4565b8063064141e5146101c95780630dfe1681146101de5780630f3a9f65146101fc575b600080fd5b6101dc6101d73660046118e1565b61039f565b005b6101e66103be565b6040516101f39190611a4e565b60405180910390f35b6101dc61020a366004611981565b6103e2565b61022261021d3660046119b1565b61046a565b6040516101f39190611a7b565b61024261023d366004611981565b61048d565b6040516101f39493929190611d7f565b61025a6104cb565b6040516101f39190611da2565b61027a6102753660046119b1565b6104ef565b6040516101f39190611d76565b61027a6102953660046119d2565b610724565b61027a6102a8366004611981565b610740565b61027a6102bb366004611981565b610909565b6102226102ce3660046119b1565b61093b565b6101dc610950565b6101e66109e6565b6102226102f13660046119b1565b610a0a565b61027a6103043660046118a6565b610a1f565b610311610aba565b6040516101f39190611d45565b6101e6610b21565b6101dc610b30565b6101e6610b56565b6101e6610b7a565b61027a610b9e565b6102226103543660046119b1565b610c41565b61027a610c4f565b61027a610c55565b6101dc61037736600461187f565b610c5b565b61022261038a3660046119d2565b610d28565b61027a610f99565b6101e6610f9f565b60006103aa84610a1f565b90506103b7818484610724565b5050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6103ea610fc3565b6001600160a01b03166103fb610b21565b6001600160a01b03161461042a5760405162461bcd60e51b815260040161042190611cd9565b60405180910390fd5b60018190556040517fd1c043d38a3243c01780647a1340049807cd98af891021c89c32c99a8e0c59e79061045f908390611d76565b60405180910390a150565b60606104848383600154610e108161047e57fe5b04610d28565b90505b92915050565b6003818154811061049a57fe5b6000918252602090912060049091020180546001820154600283015460039093015463ffffffff9092169350919084565b7f000000000000000000000000000000000000000000000000000000000000000081565b6003546000908190600019018161050c828663ffffffff610fc716565b905060008090507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161415610643575b8282101561063e5781600101905061062f6003838154811061058c57fe5b906000526020600020906004020160010154600383815481106105ab57fe5b906000526020600020906004020160010154600384815481106105ca57fe5b9060005260206000209060040201600301548a600387815481106105ea57fe5b60009182526020909120600490910201546003805463ffffffff909216918890811061061257fe5b600091825260209091206004909102015463ffffffff1603610fef565b9093019260019091019061056e565b610709565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161415610709575b82821015610709578160010190506106fa600383815481106106bc57fe5b906000526020600020906004020160020154600383815481106106db57fe5b906000526020600020906004020160020154600384815481106105ca57fe5b9093019260019091019061069e565b610719848763ffffffff61109116565b979650505050505050565b600061072f82610909565b8484020260280290505b9392505050565b600061074a61177f565b610752610aba565b905060008060006107827f00000000000000000000000000000000000000000000000000000000000000006110c3565b925092509250836000015163ffffffff168163ffffffff1614156107fc576003805460011981019081106107b257fe5b6000918252602091829020604080516080810182526004909302909101805463ffffffff168352600181015493830193909352600283015490820152600390910154606082015293505b8351810363ffffffff8116156108125780610815565b60015b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316141561088d5761088685602001518587606001518a85610fef565b95506108ff565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614156108ff576108fc85604001518487606001518a85610fef565b95505b5050505050919050565b600060026001830104825b8082101561073957508060028180868161092a57fe5b04018161093357fe5b049150610914565b6060610484838360015462093a808161047e57fe5b610958610fc3565b6001600160a01b0316610969610b21565b6001600160a01b03161461098f5760405162461bcd60e51b815260040161042190611cd9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b60606104848383600154620151808161047e57fe5b600080805b8351811015610a5257838181518110610a3957fe5b6020026020010151820191508080600101915050610a24565b50600083518281610a5f57fe5b60009350049050815b8451811015610a9b57600282868381518110610a8057fe5b6020026020010151030a830192508080600101915050610a68565b610ab160018651038481610aab57fe5b04610909565b95945050505050565b610ac261177f565b600380546000198101908110610ad457fe5b6000918252602091829020604080516080810182526004909302909101805463ffffffff168352600181015493830193909352600283015490820152600390910154606082015290505b90565b6000546001600160a01b031690565b610b386112cd565b610b545760405162461bcd60e51b815260040161042190611c1e565b565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000610ba86112cd565b506000610bda7f000000000000000000000000000000000000000000000000000000000000000060ff16600a0a610740565b9050806002819055507f0d86730737b142fc160892fa8a0f2db687a92a0e294d1ad70624cf5acef03b847f000000000000000000000000000000000000000000000000000000000000000082604051610c34929190611a62565b60405180910390a1905090565b606061048483836001610d28565b60035490565b60015481565b610c63610fc3565b6001600160a01b0316610c74610b21565b6001600160a01b031614610c9a5760405162461bcd60e51b815260040161042190611cd9565b6001600160a01b038116610cc05760405162461bcd60e51b815260040161042190611abf565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6060808367ffffffffffffffff81118015610d4257600080fd5b50604051908082528060200260200182016040528015610d6c578160200160208202803683370190505b50600354909150600019016000610d8b8287870263ffffffff610fc716565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b039081167f0000000000000000000000000000000000000000000000000000000000000000919091161415610eb3575b83831015610eae578683019150610e8b60038481548110610e0557fe5b90600052602060002090600402016001015460038481548110610e2457fe5b90600052602060002090600402016001015460038581548110610e4357fe5b9060005260206000209060040201600301548c60038881548110610e6357fe5b60009182526020909120600490910201546003805463ffffffff909216918990811061061257fe5b858281518110610e9757fe5b602090810291909101015291860191600101610de8565b610f8c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161415610f8c575b83831015610f8c578683019150610f6960038481548110610f2b57fe5b90600052602060002090600402016002015460038481548110610f4a57fe5b90600052602060002090600402016002015460038581548110610e4357fe5b858281518110610f7557fe5b602090810291909101015291860191600101610f0e565b5092979650505050505050565b60025490565b7f000000000000000000000000000000000000000000000000000000000000000081565b3390565b600082821115610fe95760405162461bcd60e51b815260040161042190611b53565b50900390565b6000610ff96117ad565b60405180602001604052808463ffffffff168989038161101557fe5b046001600160e01b03169052905061103561103082866114c6565b611525565b71ffffffffffffffffffffffffffffffffffff16915061071960ff7f000000000000000000000000000000000000000000000000000000000000000016600a0a611085848863ffffffff61152c16565b9063ffffffff61109116565b60008082116110b25760405162461bcd60e51b815260040161042190611b8a565b8183816110bb57fe5b049392505050565b60008060006110d0611566565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561110b57600080fd5b505afa15801561111f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111439190611999565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b15801561117e57600080fd5b505afa158015611192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b69190611999565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156111f657600080fd5b505afa15801561120a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122e919061192d565b9250925092508363ffffffff168163ffffffff16146112c35780840363ffffffff811661126e6dffffffffffffffffffffffffffff808616908716611570565b600001516001600160e01b031602870196508063ffffffff166112b1856dffffffffffffffffffffffffffff16856dffffffffffffffffffffffffffff16611570565b516001600160e01b0316029590950194505b5050509193909250565b60006112d761177f565b6112df610aba565b9050600080600061130f7f00000000000000000000000000000000000000000000000000000000000000006110c3565b8651600154939650919450925082039063ffffffff8216106114b85760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561138657600080fd5b505afa15801561139a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113be91906119fd565b50506040805160808101825263ffffffff978816815260208101998a5290810197885260608101928352600380546001808201835560009290925291517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b6004909302928301805463ffffffff1916919099161790975597517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c8901555094517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d870155505091517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e90930192909255509150610b1e9050565b600095505050505050610b1e565b6114ce6117bf565b60008215806114f457505082516001600160e01b0316828102908382816114f157fe5b04145b6115105760405162461bcd60e51b815260040161042190611b1c565b60408051602081019091529081529392505050565b5160701c90565b60008261153b57506000610487565b8282028284828161154857fe5b04146104845760405162461bcd60e51b815260040161042190611c61565b63ffffffff421690565b6115786117ad565b600082116115985760405162461bcd60e51b815260040161042190611bc1565b826115b25750604080516020810190915260008152610487565b71ffffffffffffffffffffffffffffffffffff831161162457600082607085901b816115da57fe5b0490506001600160e01b038111156116045760405162461bcd60e51b815260040161042190611d0e565b6040518060200160405280826001600160e01b0316815250915050610487565b6000611640846e01000000000000000000000000000085611669565b90506001600160e01b038111156116045760405162461bcd60e51b815260040161042190611d0e565b600080600061167886866116e2565b915091506000848061168657fe5b86880990508281111561169a576001820391505b9182900391816116b8578483816116ad57fe5b049350505050610739565b8482106116d75760405162461bcd60e51b815260040161042190611ca2565b61071983838761170f565b6000808060001984860990508385029250828103915082811015611707576001820391505b509250929050565b6000818103821680838161171f57fe5b04925080858161172b57fe5b04945080816000038161173a57fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b6040518060800160405280600063ffffffff1681526020016000815260200160008152602001600081525090565b60408051602081019091526000815290565b6040518060200160405280600081525090565b600082601f8301126117e2578081fd5b813567ffffffffffffffff808211156117f9578283fd5b602080830260405182828201018181108582111715611816578687fd5b60405284815294508185019250858201818701830188101561183757600080fd5b600091505b8482101561185a57803584529282019260019190910190820161183c565b505050505092915050565b805169ffffffffffffffffffff8116811461048757600080fd5b600060208284031215611890578081fd5b81356001600160a01b0381168114610484578182fd5b6000602082840312156118b7578081fd5b813567ffffffffffffffff8111156118cd578182fd5b6118d9848285016117d2565b949350505050565b6000806000606084860312156118f5578182fd5b833567ffffffffffffffff81111561190b578283fd5b611917868287016117d2565b9660208601359650604090950135949350505050565b600080600060608486031215611941578283fd5b835161194c81611db0565b602085015190935061195d81611db0565b604085015190925063ffffffff81168114611976578182fd5b809150509250925092565b600060208284031215611992578081fd5b5035919050565b6000602082840312156119aa578081fd5b5051919050565b600080604083850312156119c3578182fd5b50508035926020909101359150565b6000806000606084860312156119e6578283fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215611a14578081fd5b611a1e8787611865565b9450602086015193506040860151925060608601519150611a428760808801611865565b90509295509295909350565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015611ab357835183529284019291840191600101611a97565b50909695505050505050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4669786564506f696e743a3a6d756c3a206f766572666c6f7700000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b60208082526026908201527f4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206260408201527f79207a65726f0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526023908201527f556e697377617056324f7261636c653a20504552494f445f4e4f545f454c415060408201526214d15160ea1b606082015260800190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601a908201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f57000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601e908201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604082015260600190565b815163ffffffff16815260208083015190820152604080830151908201526060918201519181019190915260800190565b90815260200190565b63ffffffff94909416845260208401929092526040830152606082015260800190565b60ff91909116815260200190565b6dffffffffffffffffffffffffffff81168114611dcc57600080fd5b5056fea164736f6c6343000606000a0000000000000000000000000c1cf6883efa1b496b01f654e247b9b4198730540000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee55000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba612

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

0000000000000000000000000c1cf6883efa1b496b01f654e247b9b4198730540000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee55000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba612

-----Decoded View---------------
Arg [0] : _pair (address): 0x0c1cf6883efa1b496b01f654e247b9b419873054
Arg [1] : _token (address): 0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55
Arg [2] : _priceFeed (address): 0x639fe6ab55c921f74e7fac1ee960c0b6293ba612

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000c1cf6883efa1b496b01f654e247b9b419873054
Arg [1] : 0000000000000000000000006c2c06790b3e3e3c38e12ee22f8183b37a13ee55
Arg [2] : 000000000000000000000000639fe6ab55c921f74e7fac1ee960c0b6293ba612


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.