ETH Price: $2,102.48 (+3.99%)

Contract

0xb6DbC34ebf8e608E4E826ECFbCebc16903f333d8
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Update121135982021-03-26 8:39:011831 days ago1616747941IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121127532021-03-26 5:31:071831 days ago1616736667IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121119132021-03-26 2:29:201831 days ago1616725760IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121110672021-03-25 23:22:281831 days ago1616714548IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121101822021-03-25 20:06:481832 days ago1616702808IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121092822021-03-25 16:54:351832 days ago1616691275IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121084452021-03-25 13:48:201832 days ago1616680100IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121076312021-03-25 10:38:111832 days ago1616668691IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121067972021-03-25 7:35:301832 days ago1616657730IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121059492021-03-25 4:32:221832 days ago1616646742IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121051152021-03-25 1:21:261832 days ago1616635286IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121041732021-03-24 22:05:121832 days ago1616623512IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121033442021-03-24 19:00:521833 days ago1616612452IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121025042021-03-24 15:57:491833 days ago1616601469IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121016542021-03-24 12:52:121833 days ago1616590332IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121008612021-03-24 9:47:411833 days ago1616579261IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update121000672021-03-24 6:47:201833 days ago1616568440IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120992302021-03-24 3:35:511833 days ago1616556951IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120984032021-03-24 0:35:451833 days ago1616546145IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120975162021-03-23 21:21:411833 days ago1616534501IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120966702021-03-23 18:08:131834 days ago1616522893IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120958122021-03-23 14:54:121834 days ago1616511252IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120949512021-03-23 11:50:001834 days ago1616500200IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120940942021-03-23 8:42:101834 days ago1616488930IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
Update120932392021-03-23 5:35:051834 days ago1616477705IN
0xb6DbC34e...903f333d8
0 ETH0.01541566251
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FarmOracle

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
pragma solidity 0.5.16;

import "@openzeppelin/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import '../../public/contracts/base/interface/uniswap/IUniswapV2Factory.sol';
import '../../public/contracts/base/interface/uniswap/IUniswapV2Pair.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 {
        uint _x;
    }

    uint8 private constant RESOLUTION = 112;

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

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {
        require(x != 0, 'FixedPoint: DIV_BY_ZERO');
        return uq112x112(self._x / uint224(x));
    }

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

    // returns a UQ112x112 which represents the ratio of the numerator to the denominator
    // equivalent to encode(numerator).div(denominator)
    function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, "FixedPoint: DIV_BY_ZERO");
        return uq112x112((uint224(numerator) << RESOLUTION) / denominator);
    }

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

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

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

// 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 FarmOracle is Ownable {
    using FixedPoint for *;

    uint public PERIOD = 300; // 5mins in the beginning and set to 3hrs

    IUniswapV2Pair public constant pair = IUniswapV2Pair(0x56feAccb7f750B997B36A68625C7C596F0B41A58);
    address public constant token0 = 0xa0246c9032bC3A600820415aE600c6388619A14D; // FARM
    address public constant token1 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH

    uint    public price0CumulativeLast;
    uint    public price1CumulativeLast;
    uint32  public blockTimestampLast;
    FixedPoint.uq112x112 public price0Average;
    FixedPoint.uq112x112 public price1Average;

    bool oracleActive = true;

    constructor() public {
        require(token0 == pair.token0(), "token0 constant has to match pair's token0");
        require(token1 == pair.token1(), "token1 constant has to match pair's token1");

        price0CumulativeLast = pair.price0CumulativeLast(); // fetch the current accumulated price value (1 / 0)
        price1CumulativeLast = pair.price1CumulativeLast(); // fetch the current accumulated price value (0 / 1)
        uint112 reserve0;
        uint112 reserve1;
        (reserve0, reserve1, blockTimestampLast) = pair.getReserves();
        require(reserve0 != 0 && reserve1 != 0, 'NO_RESERVES'); // ensure that there's liquidity in the pair
    }

    function setPeriod(uint256 _period) public onlyOwner {
      PERIOD = _period;
    }

    function update() external {
        (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) =
            UniswapV2OracleLibrary.currentCumulativePrices(address(pair));
        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired

        // ensure that at least one full period has passed since the last update
        require(timeElapsed >= PERIOD, 'PERIOD_NOT_ELAPSED');

        // overflow is desired, casting never truncates
        // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed
        price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - price0CumulativeLast) / timeElapsed));
        price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - price1CumulativeLast) / timeElapsed));

        price0CumulativeLast = price0Cumulative;
        price1CumulativeLast = price1Cumulative;
        blockTimestampLast = blockTimestamp;
    }

    function updateRequire() public view returns (bool) {
      (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) =
        UniswapV2OracleLibrary.currentCumulativePrices(address(pair));
      uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
      return (timeElapsed >= PERIOD);
    }

    // note this will always return 0 before update has been called successfully for the first time.
    function consult(address token, uint amountIn) external view returns (uint amountOut) {
      require(oracleActive, "Oracle has been deactivated");

        if (token == token0) {
            amountOut = price0Average.mul(amountIn).decode144();
        } else {
            require(token == token1, 'INVALID_TOKEN');
            amountOut = price1Average.mul(amountIn).decode144();
        }
    }

    function setOracleActive(bool _active) public onlyOwner {
      oracleActive = _active;
    }
}

pragma solidity ^0.5.0;

import "../GSN/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.
 *
 * 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.
 */
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 returns (address) {
        return _owner;
    }

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

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _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 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 onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

pragma solidity ^0.5.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, 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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot overflow.
     *
     * _Available since v2.4.0._
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @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) {
        // 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 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     *
     * _Available since v2.4.0._
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

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

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;

interface IUniswapV2Factory {
  event PairCreated(address indexed token0, address indexed token1, address pair, uint);

  function getPair(address tokenA, address tokenB) external view returns (address pair);
  function allPairs(uint) external view returns (address pair);
  function allPairsLength() external view returns (uint);

  function feeTo() external view returns (address);
  function feeToSetter() external view returns (address);

  function createPair(address tokenA, address tokenB) external returns (address pair);
}

// SPDX-License-Identifier: MIT
/**
 *Submitted for verification at Etherscan.io on 2020-05-05
*/

// File: contracts/interfaces/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;
}

pragma solidity ^0.5.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.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"payable":false,"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"},{"constant":true,"inputs":[],"name":"PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"consult","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pair","outputs":[{"internalType":"contract IUniswapV2Pair","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price0Average","outputs":[{"internalType":"uint224","name":"_x","type":"uint224"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price1Average","outputs":[{"internalType":"uint224","name":"_x","type":"uint224"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"_active","type":"bool"}],"name":"setOracleActive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setPeriod","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"update","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"updateRequire","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}]

608060405261012c60019081556007805460ff191690911790553480156200002657600080fd5b5060006200003c6001600160e01b036200042a16565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600080516020620010b28339815191526001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620000cf57600080fd5b505afa158015620000e4573d6000803e3d6000fd5b505050506040513d6020811015620000fb57600080fd5b50516001600160a01b031673a0246c9032bc3a600820415ae600c6388619a14d14620001595760405162461bcd60e51b815260040180806020018281038252602a81526020018062001088602a913960400191505060405180910390fd5b600080516020620010b28339815191526001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015620001a257600080fd5b505afa158015620001b7573d6000803e3d6000fd5b505050506040513d6020811015620001ce57600080fd5b50516001600160a01b031673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2146200022c5760405162461bcd60e51b815260040180806020018281038252602a8152602001806200105e602a913960400191505060405180910390fd5b600080516020620010b28339815191526001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156200027557600080fd5b505afa1580156200028a573d6000803e3d6000fd5b505050506040513d6020811015620002a157600080fd5b505160025560408051635a3d549360e01b81529051600080516020620010b283398151915291635a3d5493916004808301926020929190829003018186803b158015620002ed57600080fd5b505afa15801562000302573d6000803e3d6000fd5b505050506040513d60208110156200031957600080fd5b505160035560408051630240bc6b60e21b815290516000918291600080516020620010b283398151915291630902f1ac916004808301926060929190829003018186803b1580156200036a57600080fd5b505afa1580156200037f573d6000803e3d6000fd5b505050506040513d60608110156200039657600080fd5b50805160208201516040909201516004805463ffffffff191663ffffffff909216919091179055925090506001600160701b03821615801590620003e257506001600160701b03811615155b62000422576040805162461bcd60e51b815260206004820152600b60248201526a4e4f5f524553455256455360a81b604482015290519081900360640190fd5b50506200042e565b3390565b610c20806200043e6000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c80638f32d59b116100a2578063a8aa1b3111610071578063a8aa1b3114610233578063b4d1d7951461023b578063c5700a0214610243578063d21220a714610264578063f2fde38b1461026c57610116565b80638f32d59b146101fc578063962452bf14610204578063a2e6204514610223578063a6bb45391461022b57610116565b80635909c0d5116100e95780635909c0d5146101b85780635a3d5493146101c05780635e6aaf2c146101c8578063715018a6146101ec5780638da5cb5b146101f457610116565b80630dfe16811461011b5780630f3a9f651461013f5780633ddac9531461015e578063559bbc2d1461019c575b600080fd5b610123610292565b604080516001600160a01b039092168252519081900360200190f35b61015c6004803603602081101561015557600080fd5b50356102aa565b005b61018a6004803603604081101561017457600080fd5b506001600160a01b0381351690602001356102f6565b60408051918252519081900360200190f35b6101a4610457565b604080519115158252519081900360200190f35b61018a610498565b61018a61049e565b6101d06104a4565b604080516001600160e01b039092168252519081900360200190f35b61015c6104b3565b610123610544565b6101a4610553565b61015c6004803603602081101561021a57600080fd5b50351515610577565b61015c6105d1565b6101d0610707565b610123610716565b61018a61072e565b61024b610734565b6040805163ffffffff9092168252519081900360200190f35b610123610740565b61015c6004803603602081101561028257600080fd5b50356001600160a01b0316610758565b73a0246c9032bc3a600820415ae600c6388619a14d81565b6102b2610553565b6102f1576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b600155565b60075460009060ff16610350576040805162461bcd60e51b815260206004820152601b60248201527f4f7261636c6520686173206265656e2064656163746976617465640000000000604482015290519081900360640190fd5b6001600160a01b03831673a0246c9032bc3a600820415ae600c6388619a14d14156103b75760408051602081019091526005546001600160e01b031681526103a7906103a2908463ffffffff6107ab16565b610829565b6001600160901b03169050610451565b6001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214610418576040805162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22faa27a5a2a760991b604482015290519081900360640190fd5b60408051602081019091526006546001600160e01b03168152610445906103a2908463ffffffff6107ab16565b6001600160901b031690505b92915050565b60008060008061047a7356feaccb7f750b997b36a68625c7c596f0b41a58610830565b60045460015463ffffffff9182169092031610159550505050505090565b60025481565b60035481565b6006546001600160e01b031681565b6104bb610553565b6104fa576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600080546001600160a01b03166105686109ff565b6001600160a01b031614905090565b61057f610553565b6105be576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b6007805460ff1916911515919091179055565b60008060006105f37356feaccb7f750b997b36a68625c7c596f0b41a58610830565b600454600154939650919450925063ffffffff9081168303919082161015610657576040805162461bcd60e51b81526020600482015260126024820152711411549253d117d393d517d153105414d15160721b604482015290519081900360640190fd5b60405180602001604052808263ffffffff1660025487038161067557fe5b046001600160e01b039081169091529051600580546001600160e01b031916919092161790556040805160208101909152600354819063ffffffff8416908603816106bc57fe5b046001600160e01b039081169091529051600680546001600160e01b03191691909216179055506002929092556003556004805463ffffffff191663ffffffff909216919091179055565b6005546001600160e01b031681565b7356feaccb7f750b997b36a68625c7c596f0b41a5881565b60015481565b60045463ffffffff1681565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b610760610553565b61079f576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b6107a881610a03565b50565b6107b3610b5d565b60008215806107d957505082516001600160e01b0316828102908382816107d657fe5b04145b6108145760405162461bcd60e51b8152600401808060200182810382526023815260200180610bc96023913960400191505060405180910390fd5b60408051602081019091529081529392505050565b5160701c90565b600080600061083d610aa3565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561087857600080fd5b505afa15801561088c573d6000803e3d6000fd5b505050506040513d60208110156108a257600080fd5b505160408051635a3d549360e01b815290519194506001600160a01b03861691635a3d549391600480820192602092909190829003018186803b1580156108e857600080fd5b505afa1580156108fc573d6000803e3d6000fd5b505050506040513d602081101561091257600080fd5b505160408051630240bc6b60e21b81529051919350600091829182916001600160a01b03891691630902f1ac916004808301926060929190829003018186803b15801561095e57600080fd5b505afa158015610972573d6000803e3d6000fd5b505050506040513d606081101561098857600080fd5b5080516020820151604090920151909450909250905063ffffffff808216908516146109f55780840363ffffffff81166109c28486610aad565b516001600160e01b031602969096019563ffffffff81166109e38585610aad565b516001600160e01b0316029590950194505b5050509193909250565b3390565b6001600160a01b038116610a485760405162461bcd60e51b8152600401808060200182810382526026815260200180610b836026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b63ffffffff421690565b610ab5610b70565b6000826001600160701b031611610b13576040805162461bcd60e51b815260206004820152601760248201527f4669786564506f696e743a204449565f42595f5a45524f000000000000000000604482015290519081900360640190fd5b6040805160208101909152806001600160701b0384166dffffffffffffffffffffffffffff60701b607087901b1681610b4857fe5b046001600160e01b0316815250905092915050565b6040518060200160405280600081525090565b6040805160208101909152600081529056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552464c4f57a265627a7a72315820f23100ddf312ae54d472a735f49bfcd557abe13b7ac60f30aa5742546a09f7a064736f6c63430005100032746f6b656e3120636f6e7374616e742068617320746f206d617463682070616972277320746f6b656e31746f6b656e3020636f6e7374616e742068617320746f206d617463682070616972277320746f6b656e3000000000000000000000000056feaccb7f750b997b36a68625c7c596f0b41a58

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638f32d59b116100a2578063a8aa1b3111610071578063a8aa1b3114610233578063b4d1d7951461023b578063c5700a0214610243578063d21220a714610264578063f2fde38b1461026c57610116565b80638f32d59b146101fc578063962452bf14610204578063a2e6204514610223578063a6bb45391461022b57610116565b80635909c0d5116100e95780635909c0d5146101b85780635a3d5493146101c05780635e6aaf2c146101c8578063715018a6146101ec5780638da5cb5b146101f457610116565b80630dfe16811461011b5780630f3a9f651461013f5780633ddac9531461015e578063559bbc2d1461019c575b600080fd5b610123610292565b604080516001600160a01b039092168252519081900360200190f35b61015c6004803603602081101561015557600080fd5b50356102aa565b005b61018a6004803603604081101561017457600080fd5b506001600160a01b0381351690602001356102f6565b60408051918252519081900360200190f35b6101a4610457565b604080519115158252519081900360200190f35b61018a610498565b61018a61049e565b6101d06104a4565b604080516001600160e01b039092168252519081900360200190f35b61015c6104b3565b610123610544565b6101a4610553565b61015c6004803603602081101561021a57600080fd5b50351515610577565b61015c6105d1565b6101d0610707565b610123610716565b61018a61072e565b61024b610734565b6040805163ffffffff9092168252519081900360200190f35b610123610740565b61015c6004803603602081101561028257600080fd5b50356001600160a01b0316610758565b73a0246c9032bc3a600820415ae600c6388619a14d81565b6102b2610553565b6102f1576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b600155565b60075460009060ff16610350576040805162461bcd60e51b815260206004820152601b60248201527f4f7261636c6520686173206265656e2064656163746976617465640000000000604482015290519081900360640190fd5b6001600160a01b03831673a0246c9032bc3a600820415ae600c6388619a14d14156103b75760408051602081019091526005546001600160e01b031681526103a7906103a2908463ffffffff6107ab16565b610829565b6001600160901b03169050610451565b6001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214610418576040805162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22faa27a5a2a760991b604482015290519081900360640190fd5b60408051602081019091526006546001600160e01b03168152610445906103a2908463ffffffff6107ab16565b6001600160901b031690505b92915050565b60008060008061047a7356feaccb7f750b997b36a68625c7c596f0b41a58610830565b60045460015463ffffffff9182169092031610159550505050505090565b60025481565b60035481565b6006546001600160e01b031681565b6104bb610553565b6104fa576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600080546001600160a01b03166105686109ff565b6001600160a01b031614905090565b61057f610553565b6105be576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b6007805460ff1916911515919091179055565b60008060006105f37356feaccb7f750b997b36a68625c7c596f0b41a58610830565b600454600154939650919450925063ffffffff9081168303919082161015610657576040805162461bcd60e51b81526020600482015260126024820152711411549253d117d393d517d153105414d15160721b604482015290519081900360640190fd5b60405180602001604052808263ffffffff1660025487038161067557fe5b046001600160e01b039081169091529051600580546001600160e01b031916919092161790556040805160208101909152600354819063ffffffff8416908603816106bc57fe5b046001600160e01b039081169091529051600680546001600160e01b03191691909216179055506002929092556003556004805463ffffffff191663ffffffff909216919091179055565b6005546001600160e01b031681565b7356feaccb7f750b997b36a68625c7c596f0b41a5881565b60015481565b60045463ffffffff1681565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b610760610553565b61079f576040805162461bcd60e51b81526020600482018190526024820152600080516020610ba9833981519152604482015290519081900360640190fd5b6107a881610a03565b50565b6107b3610b5d565b60008215806107d957505082516001600160e01b0316828102908382816107d657fe5b04145b6108145760405162461bcd60e51b8152600401808060200182810382526023815260200180610bc96023913960400191505060405180910390fd5b60408051602081019091529081529392505050565b5160701c90565b600080600061083d610aa3565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561087857600080fd5b505afa15801561088c573d6000803e3d6000fd5b505050506040513d60208110156108a257600080fd5b505160408051635a3d549360e01b815290519194506001600160a01b03861691635a3d549391600480820192602092909190829003018186803b1580156108e857600080fd5b505afa1580156108fc573d6000803e3d6000fd5b505050506040513d602081101561091257600080fd5b505160408051630240bc6b60e21b81529051919350600091829182916001600160a01b03891691630902f1ac916004808301926060929190829003018186803b15801561095e57600080fd5b505afa158015610972573d6000803e3d6000fd5b505050506040513d606081101561098857600080fd5b5080516020820151604090920151909450909250905063ffffffff808216908516146109f55780840363ffffffff81166109c28486610aad565b516001600160e01b031602969096019563ffffffff81166109e38585610aad565b516001600160e01b0316029590950194505b5050509193909250565b3390565b6001600160a01b038116610a485760405162461bcd60e51b8152600401808060200182810382526026815260200180610b836026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b63ffffffff421690565b610ab5610b70565b6000826001600160701b031611610b13576040805162461bcd60e51b815260206004820152601760248201527f4669786564506f696e743a204449565f42595f5a45524f000000000000000000604482015290519081900360640190fd5b6040805160208101909152806001600160701b0384166dffffffffffffffffffffffffffff60701b607087901b1681610b4857fe5b046001600160e01b0316815250905092915050565b6040518060200160405280600081525090565b6040805160208101909152600081529056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552464c4f57a265627a7a72315820f23100ddf312ae54d472a735f49bfcd557abe13b7ac60f30aa5742546a09f7a064736f6c63430005100032

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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