ETH Price: $2,415.05 (-0.19%)

Contract

0x57B39868697a595b5574A39A2462dBF8E11097c1
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Update126838492021-06-22 11:53:251181 days ago1624362805IN
0x57B39868...8E11097c1
0 ETH0.006822940.7
Update126068372021-06-10 12:42:351193 days ago1623328955IN
0x57B39868...8E11097c1
0 ETH0.0017763611
Update123393422021-04-30 3:07:471234 days ago1619752067IN
0x57B39868...8E11097c1
0 ETH0.0056710135
Update122004932021-04-08 17:21:481255 days ago1617902508IN
0x57B39868...8E11097c1
0 ETH0.02525107161
Update121452172021-03-31 5:20:451264 days ago1617168045IN
0x57B39868...8E11097c1
0 ETH0.01765342115
0x60806040121449182021-03-31 4:15:551264 days ago1617164155IN
 Contract Creation
0 ETH0.31398816239

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x1E0c171e...a3A60f79c
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
CurveOracle

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2021-02-25
*/

// File: @openzeppelin/contracts/math/SafeMath.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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.
     */
    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.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        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.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// File: @openzeppelin/contracts/GSN/Context.sol

pragma solidity ^0.6.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: @openzeppelin/contracts/token/ERC20/IERC20.sol

// -License-Identifier: MIT

pragma solidity ^0.6.0;

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

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

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

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

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

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

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

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

// File: @openzeppelin/contracts/utils/Address.sol

// -License-Identifier: MIT

pragma solidity ^0.6.2;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: @openzeppelin/contracts/token/ERC20/ERC20.sol

// -License-Identifier: MIT

pragma solidity ^0.6.0;





/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

// File: contracts/lib/Babylonian.sol

pragma solidity ^0.6.0;

library Babylonian {
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
        // else z = 0
    }
}

// File: contracts/lib/FixedPoint.sol

pragma solidity ^0.6.0;


// 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 private constant RESOLUTION = 112;
    uint256 private constant Q112 = uint256(1) << RESOLUTION;
    uint256 private constant Q224 = Q112 << RESOLUTION;

    // 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, uint256 y)
        internal
        pure
        returns (uq144x112 memory)
    {
        uint256 z;
        require(
            y == 0 || (z = uint256(self._x) * y) / y == uint256(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);
    }

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

    // square root of a UQ112x112
    function sqrt(uq112x112 memory self)
        internal
        pure
        returns (uq112x112 memory)
    {
        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x)) << 56));
    }
}

// File: contracts/interfaces/IUniswapV2Pair.sol

pragma solidity ^0.6.0;

interface IUniswapV2Pair {
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
    event Transfer(address indexed from, address indexed to, uint256 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 (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);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

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

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

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

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    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 (uint256);

    function price1CumulativeLast() external view returns (uint256);

    function kLast() external view returns (uint256);

    function mint(address to) external returns (uint256 liquidity);

    function burn(address to)
        external
        returns (uint256 amount0, uint256 amount1);

    function swap(
        uint256 amount0Out,
        uint256 amount1Out,
        address to,
        bytes calldata data
    ) external;

    function skim(address to) external;

    function sync() external;

    function initialize(address, address) external;
}

// File: contracts/lib/UniswapV2Library.sol

pragma solidity ^0.6.0;



library UniswapV2Library {
    using SafeMath for uint256;

    // 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'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // 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: contracts/lib/UniswapV2OracleLibrary.sol

pragma solidity ^0.6.0;



// 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 (
            uint256 price0Cumulative,
            uint256 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 +=
                uint256(FixedPoint.fraction(reserve1, reserve0)._x) *
                timeElapsed;
            // counterfactual
            price1Cumulative +=
                uint256(FixedPoint.fraction(reserve0, reserve1)._x) *
                timeElapsed;
        }
    }
}

// File: @openzeppelin/contracts/math/Math.sol

// -License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol

// -License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @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.
 */
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(_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: contracts/owner/Operator.sol

pragma solidity ^0.6.0;



contract Operator is Context, Ownable {
    address private _operator;

    event OperatorTransferred(
        address indexed previousOperator,
        address indexed newOperator
    );

    constructor() internal {
        _operator = _msgSender();
        emit OperatorTransferred(address(0), _operator);
    }

    function operator() public view returns (address) {
        return _operator;
    }

    modifier onlyOperator() {
        require(
            _operator == msg.sender,
            'operator: caller is not the operator'
        );
        _;
    }

    function isOperator() public view returns (bool) {
        return _msgSender() == _operator;
    }

    function transferOperator(address newOperator_) public onlyOwner {
        _transferOperator(newOperator_);
    }

    function _transferOperator(address newOperator_) internal {
        require(
            newOperator_ != address(0),
            'operator: zero address given for new operator'
        );
        emit OperatorTransferred(address(0), newOperator_);
        _operator = newOperator_;
    }
}

// File: contracts/utils/Epoch.sol

pragma solidity ^0.6.0;




contract Epoch is Operator {
    using SafeMath for uint256;

    uint256 private period;
    uint256 private startTime;
    uint256 private lastExecutedAt;

    /* ========== CONSTRUCTOR ========== */

    constructor(
        uint256 _period,
        uint256 _startTime,
        uint256 _startEpoch
    ) public {
        require(_startTime > block.timestamp, 'Epoch: invalid start time');
        period = _period;
        startTime = _startTime;
        lastExecutedAt = startTime.add(_startEpoch.mul(period));
    }

    /* ========== Modifier ========== */

    modifier checkStartTime {
        require(now >= startTime, 'Epoch: not started yet');

        _;
    }

    modifier checkEpoch {
        require(now > startTime, 'Epoch: not started yet');
        require(getCurrentEpoch() >= getNextEpoch(), 'Epoch: not allowed');

        _;

        lastExecutedAt = block.timestamp;
    }

    /* ========== VIEW FUNCTIONS ========== */

    // epoch
    function getLastEpoch() public view returns (uint256) {
        return lastExecutedAt.sub(startTime).div(period);
    }

    function getCurrentEpoch() public view returns (uint256) {
        return Math.max(startTime, block.timestamp).sub(startTime).div(period);
    }

    function getNextEpoch() public view returns (uint256) {
        if (startTime == lastExecutedAt) {
            return getLastEpoch();
        }
        return getLastEpoch().add(1);
    }

    function nextEpochPoint() public view returns (uint256) {
        return startTime.add(getNextEpoch().mul(period));
    }

    // params
    function getPeriod() public view returns (uint256) {
        return period;
    }

    function getStartTime() public view returns (uint256) {
        return startTime;
    }

    /* ========== GOVERNANCE ========== */

    function setPeriod(uint256 _period) external onlyOperator {
        period = _period;
    }
}

// File: contracts/interfaces/IUniswapV2Factory.sol

pragma solidity ^0.6.0;

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

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

    function allPairs(uint256) external view returns (address pair);

    function allPairsLength() external view returns (uint256);

    function feeTo() external view returns (address);

    function feeToSetter() external view returns (address);

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

// File: contracts/CurveOracle.sol

pragma solidity ^0.6.0;











interface ICurve {
    function balances(uint256 i) external returns (uint256);
    function coins(uint256 i) external returns (address);
    function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256);
}

// 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 CurveOracle is Epoch {
    using FixedPoint for *;
    using SafeMath for uint256;

    /* ========== STATE VARIABLES ========== */

    // curve
    address public token0;
    address public token1;
    uint256 public token0Decimals;
    uint256 public token1Decimals;
    ICurve public stableSwap;

    // oracle
    uint32 public blockTimestampLast;
    uint256 public price0Last;
    uint256 public price1Last;
    FixedPoint.uq112x112 public price0Average;
    FixedPoint.uq112x112 public price1Average;

    /* ========== CONSTRUCTOR ========== */

    constructor(
        address _stableSwap,
        uint256 _period,
        uint256 _startTime
    ) public Epoch(_period, _startTime, 0) {
        stableSwap = ICurve(_stableSwap);
        token0 = stableSwap.coins(0);
        token1 = stableSwap.coins(1);
        token0Decimals = ERC20(token0).decimals();
        token1Decimals = ERC20(token1).decimals();
        // Since MICv2 needs to query an oracle to transfer, we need to set-up one before depositing tokens into
        // Swap Pool.  Set default price = 1.
        price0Last = 10**token0Decimals;
        price1Last = 10**token1Decimals;

        price0Average =  FixedPoint.fraction(uint112(price0Last), uint112(price0Last));
        price1Average = FixedPoint.fraction(uint112(price1Last), uint112(price1Last));
    }

    function getTokensSpotPrice() public returns (uint256, uint256) {
        uint256 price0 = stableSwap.get_dy(0, 1, 10**token0Decimals);
        uint256 price1 = stableSwap.get_dy(1, 0, 10**token1Decimals);
        return (price0, price1);
    }

    /* ========== MUTABLE FUNCTIONS ========== */

    /** @dev Updates 1-day EMA price from Uniswap.  */
    function update() external checkEpoch {
        (uint256 price0, uint256 price1) = getTokensSpotPrice();

        price0Average =  FixedPoint.fraction(uint112(price0Last + price0), uint112(10**token0Decimals)).div(2);
        price1Average = FixedPoint.fraction(uint112(price1Last + price1), uint112(10**token1Decimals)).div(2);
        price0Last = price0;
        price1Last = price1;

        emit Updated(price0, price1);
    }

    // note this will always return 0 before update has been called successfully for the first time.
    function consult(address token, uint256 amountIn)
        external
        view
        returns (uint144 amountOut)
    {
        if (token == token0) {
            amountOut = price0Average.mul(amountIn).decode144();
        } else {
            require(token == token1, 'Oracle: INVALID_TOKEN');
            amountOut = price1Average.mul(amountIn).decode144();
        }
    }


    event Updated(uint256 price0, uint256 price1);
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_stableSwap","type":"address"},{"internalType":"uint256","name":"_period","type":"uint256"},{"internalType":"uint256","name":"_startTime","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"}],"name":"OperatorTransferred","type":"event"},{"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":"uint256","name":"price0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price1","type":"uint256"}],"name":"Updated","type":"event"},{"inputs":[],"name":"blockTimestampLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"consult","outputs":[{"internalType":"uint144","name":"amountOut","type":"uint144"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNextEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensSpotPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextEpochPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price0Average","outputs":[{"internalType":"uint224","name":"_x","type":"uint224"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price0Last","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price1Average","outputs":[{"internalType":"uint224","name":"_x","type":"uint224"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price1Last","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableSwap","outputs":[{"internalType":"contract ICurve","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0Decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1Decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator_","type":"address"}],"name":"transferOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80639e548b7f116100de578063c5700a0211610097578063d21220a711610071578063d21220a714610353578063d5d6f8141461035b578063efe97d0514610363578063f2fde38b1461036b5761018e565b8063c5700a0214610322578063c5967c2614610343578063c828371e1461034b5761018e565b80639e548b7f146102f2578063a2e62045146102fa578063a6bb453914610302578063b31ac6e21461030a578063b97dd9e214610312578063c40723721461031a5761018e565b80633ddac9531161014b5780635e6aaf2c116101255780635e6aaf2c1461029d578063715018a6146102c15780638034aaea146102c95780638da5cb5b146102ea5761018e565b80633ddac953146102265780634456eda214610279578063570ca735146102955761018e565b80630b77884d146101935780630dfe1681146101ad5780630f3a9f65146101d15780631ed24195146101f057806329605e77146101f8578063398bac631461021e575b600080fd5b61019b610391565b60408051918252519081900360200190f35b6101b5610397565b604080516001600160a01b039092168252519081900360200190f35b6101ee600480360360208110156101e757600080fd5b50356103a6565b005b61019b6103f4565b6101ee6004803603602081101561020e57600080fd5b50356001600160a01b03166103fb565b61019b610471565b6102526004803603604081101561023c57600080fd5b506001600160a01b03813516906020013561049b565b6040805171ffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610281610571565b604080519115158252519081900360200190f35b6101b5610597565b6102a56105a6565b604080516001600160e01b039092168252519081900360200190f35b6101ee6105b5565b6102d1610669565b6040805192835260208301919091528051918290030190f35b6101b561079c565b6101b56107ab565b6101ee6107ba565b6102a5610937565b61019b610946565b61019b61094c565b61019b61096c565b61032a610972565b6040805163ffffffff9092168252519081900360200190f35b61019b610985565b61019b6109a7565b6101b56109ad565b61019b6109bc565b61019b6109c2565b6101ee6004803603602081101561038157600080fd5b50356001600160a01b03166109f2565b60085481565b6005546001600160a01b031681565b6001546001600160a01b031633146103ef5760405162461bcd60e51b81526004018080602001828103825260248152602001806110406024913960400191505060405180910390fd5b600255565b6002545b90565b610403610c59565b6000546001600160a01b03908116911614610465576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61046e81610c5d565b50565b6000610496600254610490600354600454610cfa90919063ffffffff16565b90610d3c565b905090565b6005546000906001600160a01b03848116911614156104e7576040805160208101909152600c546001600160e01b031681526104e0906104db9084610d7e565b610dfc565b905061056b565b6006546001600160a01b03848116911614610541576040805162461bcd60e51b815260206004820152601560248201527427b930b1b6329d1024a72b20a624a22faa27a5a2a760591b604482015290519081900360640190fd5b6040805160208101909152600d546001600160e01b03168152610568906104db9084610d7e565b90505b92915050565b6001546000906001600160a01b0316610588610c59565b6001600160a01b031614905090565b6001546001600160a01b031690565b600d546001600160e01b031681565b6105bd610c59565b6000546001600160a01b0390811691161461061f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60095460075460408051635e0d443f60e01b815260006004820181905260016024830152600a9390930a604482015290519192839283926001600160a01b0390921691635e0d443f916064808301926020929190829003018186803b1580156106d157600080fd5b505afa1580156106e5573d6000803e3d6000fd5b505050506040513d60208110156106fb57600080fd5b505160095460085460408051635e0d443f60e01b815260016004820152600060248201819052600a9390930a6044820152905193945090926001600160a01b0390921691635e0d443f91606480820192602092909190829003018186803b15801561076557600080fd5b505afa158015610779573d6000803e3d6000fd5b505050506040513d602081101561078f57600080fd5b5051919350909150509091565b6000546001600160a01b031690565b6009546001600160a01b031681565b6003544211610809576040805162461bcd60e51b8152602060048201526016602482015275115c1bd8da0e881b9bdd081cdd185c9d1959081e595d60521b604482015290519081900360640190fd5b6108116109c2565b61081961094c565b1015610861576040805162461bcd60e51b8152602060048201526012602482015271115c1bd8da0e881b9bdd08185b1b1bddd95960721b604482015290519081900360640190fd5b60008061086c610669565b9150915061088e600261088884600a5401600754600a0a610baf565b90610e03565b51600c80546001600160e01b0319166001600160e01b03909216919091179055600b546008546108ca9160029161088891850190600a0a610baf565b51600d80546001600160e01b0319166001600160e01b03909216919091179055600a829055600b819055604080518381526020810183905281517fd78a0cb8bb633d06981248b816e7bd33c2a35a6089241d099fa519e361cab902929181900390910190a1505042600455565b600c546001600160e01b031681565b60075481565b600061049660025461049060035461096660035442610e93565b90610cfa565b600b5481565b600954600160a01b900463ffffffff1681565b600061049661099e6002546109986109c2565b90610afc565b60035490610b55565b60035490565b6006546001600160a01b031681565b600a5481565b600060045460035414156109df576109d8610471565b90506103f8565b61049660016109ec610471565b90610b55565b6109fa610c59565b6000546001600160a01b03908116911614610a5c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610aa15760405162461bcd60e51b8152600401808060200182810382526026815260200180610fcc6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600082610b0b5750600061056b565b82820282848281610b1857fe5b04146105685760405162461bcd60e51b815260040180806020018281038252602181526020018061101f6021913960400191505060405180910390fd5b600082820183811015610568576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b610bb7610fa6565b6000826001600160701b031611610c0f576040805162461bcd60e51b81526020600482015260176024820152764669786564506f696e743a204449565f42595f5a45524f60481b604482015290519081900360640190fd5b6040805160208101909152806001600160701b0384166dffffffffffffffffffffffffffff60701b607087901b1681610c4457fe5b046001600160e01b0316815250905092915050565b3390565b6001600160a01b038116610ca25760405162461bcd60e51b815260040180806020018281038252602d815260200180610ff2602d913960400191505060405180910390fd5b6040516001600160a01b038216906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b600061056883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610eaa565b600061056883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f41565b610d86610fb8565b6000821580610dac57505082516001600160e01b031682810290838281610da957fe5b04145b610de75760405162461bcd60e51b81526004018080602001828103825260238152602001806110646023913960400191505060405180910390fd5b60408051602081019091529081529392505050565b5160701c90565b610e0b610fa6565b6001600160701b038216610e60576040805162461bcd60e51b81526020600482015260176024820152764669786564506f696e743a204449565f42595f5a45524f60481b604482015290519081900360640190fd5b6040518060200160405280836001600160701b03166001600160e01b031685600001516001600160e01b031681610c4457fe5b600081831015610ea35781610568565b5090919050565b60008184841115610f395760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efe578181015183820152602001610ee6565b50505050905090810190601f168015610f2b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f905760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efe578181015183820152602001610ee6565b506000838581610f9c57fe5b0495945050505050565b60408051602081019091526000815290565b604051806020016040528060008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573736f70657261746f723a207a65726f206164647265737320676976656e20666f72206e6577206f70657261746f72536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657261746f724669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552464c4f57a264697066735822122060d237d52389dd1f7db2624f2f261487a2ca717b35f6d67107f7d6299682029564736f6c634300060c0033

Deployed Bytecode Sourcemap

46893:2759:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;47151:29;;;:::i;:::-;;;;;;;;;;;;;;;;47059:21;;;:::i;:::-;;;;-1:-1:-1;;;;;47059:21:0;;;;;;;;;;;;;;45520:93;;;;;;;;;;;;;;;;-1:-1:-1;45520:93:0;;:::i;:::-;;45286:83;;;:::i;43159:115::-;;;;;;;;;;;;;;;;-1:-1:-1;43159:115:0;-1:-1:-1;;;;;43159:115:0;;:::i;44657:121::-;;;:::i;49204:389::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;49204:389:0;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;43051:100;;;:::i;:::-;;;;;;;;;;;;;;;;;;42786:85;;;:::i;47386:41::-;;;:::i;:::-;;;;-1:-1:-1;;;;;47386:41:0;;;;;;;;;;;;;;41827:148;;;:::i;48289:248::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;41185:79;;;:::i;47187:24::-;;;:::i;48654:440::-;;;:::i;47338:41::-;;;:::i;47115:29::-;;;:::i;44786:146::-;;;:::i;47306:25::-;;;:::i;47235:32::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;45140:123;;;:::i;45377:89::-;;;:::i;47087:21::-;;;:::i;47274:25::-;;;:::i;44940:192::-;;;:::i;42130:244::-;;;;;;;;;;;;;;;;-1:-1:-1;42130:244:0;-1:-1:-1;;;;;42130:244:0;;:::i;47151:29::-;;;;:::o;47059:21::-;;;-1:-1:-1;;;;;47059:21:0;;:::o;45520:93::-;42936:9;;-1:-1:-1;;;;;42936:9:0;42949:10;42936:23;42914:109;;;;-1:-1:-1;;;42914:109:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;45589:6:::1;:16:::0;45520:93::o;45286:83::-;45355:6;;45286:83;;:::o;43159:115::-;41407:12;:10;:12::i;:::-;41397:6;;-1:-1:-1;;;;;41397:6:0;;;:22;;;41389:67;;;;;-1:-1:-1;;;41389:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;43235:31:::1;43253:12;43235:17;:31::i;:::-;43159:115:::0;:::o;44657:121::-;44702:7;44729:41;44763:6;;44729:29;44748:9;;44729:14;;:18;;:29;;;;:::i;:::-;:33;;:41::i;:::-;44722:48;;44657:121;:::o;49204:389::-;49352:6;;49304:17;;-1:-1:-1;;;;;49343:15:0;;;49352:6;;49343:15;49339:247;;;49387:17;;;;;;;;;:13;:17;-1:-1:-1;;;;;49387:17:0;;;:39;;:27;;49405:8;49387:17;:27::i;:::-;:37;:39::i;:::-;49375:51;;49339:247;;;49476:6;;-1:-1:-1;;;;;49467:15:0;;;49476:6;;49467:15;49459:49;;;;;-1:-1:-1;;;49459:49:0;;;;;;;;;;;;-1:-1:-1;;;49459:49:0;;;;;;;;;;;;;;;49535:17;;;;;;;;;:13;:17;-1:-1:-1;;;;;49535:17:0;;;:39;;:27;;49553:8;49535:17;:27::i;:39::-;49523:51;;49339:247;49204:389;;;;:::o;43051:100::-;43134:9;;43094:4;;-1:-1:-1;;;;;43134:9:0;43118:12;:10;:12::i;:::-;-1:-1:-1;;;;;43118:25:0;;43111:32;;43051:100;:::o;42786:85::-;42854:9;;-1:-1:-1;;;;;42854:9:0;42786:85;:::o;47386:41::-;;;-1:-1:-1;;;;;47386:41:0;;:::o;41827:148::-;41407:12;:10;:12::i;:::-;41397:6;;-1:-1:-1;;;;;41397:6:0;;;:22;;;41389:67;;;;;-1:-1:-1;;;41389:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;41934:1:::1;41918:6:::0;;41897:40:::1;::::0;-1:-1:-1;;;;;41918:6:0;;::::1;::::0;41897:40:::1;::::0;41934:1;;41897:40:::1;41965:1;41948:19:::0;;-1:-1:-1;;;;;;41948:19:0::1;::::0;;41827:148::o;48289:248::-;48381:10;;48409:14;;48381:43;;;-1:-1:-1;;;48381:43:0;;48335:7;48381:43;;;;;;:10;:43;;;;48405:2;:18;;;;48381:43;;;;;;48335:7;;;;;;-1:-1:-1;;;;;48381:10:0;;;;:17;;:43;;;;;;;;;;;;;;:10;:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;48381:43:0;48452:10;;48480:14;;48452:43;;;-1:-1:-1;;;48452:43:0;;:10;:43;;;;48435:14;48452:43;;;;;;48476:2;:18;;;;48452:43;;;;;;48381;;-1:-1:-1;48435:14:0;;-1:-1:-1;;;;;48452:10:0;;;;:17;;:43;;;;;48381;;48452;;;;;;;;:10;:43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;48452:43:0;48514:6;;-1:-1:-1;48452:43:0;;-1:-1:-1;;48289:248:0;;:::o;41185:79::-;41223:7;41250:6;-1:-1:-1;;;;;41250:6:0;41185:79;:::o;47187:24::-;;;-1:-1:-1;;;;;47187:24:0;;:::o;48654:440::-;44405:9;;44399:3;:15;44391:50;;;;;-1:-1:-1;;;44391:50:0;;;;;;;;;;;;-1:-1:-1;;;44391:50:0;;;;;;;;;;;;;;;44481:14;:12;:14::i;:::-;44460:17;:15;:17::i;:::-;:35;;44452:66;;;;;-1:-1:-1;;;44452:66:0;;;;;;;;;;;;-1:-1:-1;;;44452:66:0;;;;;;;;;;;;;;;48704:14:::1;48720::::0;48738:20:::1;:18;:20::i;:::-;48703:55;;;;48788:85;48871:1;48788:78;48829:6;48816:10;;:19;48850:14;;48846:2;:18;48788:19;:78::i;:::-;:82:::0;::::1;:85::i;:::-;48771:102:::0;:13:::1;:102:::0;;-1:-1:-1;;;;;;48771:102:0::1;-1:-1:-1::0;;;;;48771:102:0;;::::1;::::0;;;::::1;::::0;;48928:10:::1;::::0;48962:14:::1;::::0;48900:85:::1;::::0;48983:1:::1;::::0;48900:78:::1;::::0;48928:19;::::1;::::0;48958:2:::1;:18;48900:19;:78::i;:85::-;48884:101:::0;:13:::1;:101:::0;;-1:-1:-1;;;;;;48884:101:0::1;-1:-1:-1::0;;;;;48884:101:0;;::::1;::::0;;;::::1;::::0;;48996:10:::1;:19:::0;;;49026:10:::1;:19:::0;;;49063:23:::1;::::0;;;;;::::1;::::0;::::1;::::0;;;;;::::1;::::0;;;;;;;;;::::1;-1:-1:-1::0;;44562:15:0;44545:14;:32;48654:440::o;47338:41::-;;;-1:-1:-1;;;;;47338:41:0;;:::o;47115:29::-;;;;:::o;44786:146::-;44834:7;44861:63;44917:6;;44861:51;44902:9;;44861:36;44870:9;;44881:15;44861:8;:36::i;:::-;:40;;:51::i;47306:25::-;;;;:::o;47235:32::-;;;-1:-1:-1;;;47235:32:0;;;;;:::o;45140:123::-;45187:7;45214:41;45228:26;45247:6;;45228:14;:12;:14::i;:::-;:18;;:26::i;:::-;45214:9;;;:13;:41::i;45377:89::-;45449:9;;45377:89;:::o;47087:21::-;;;-1:-1:-1;;;;;47087:21:0;;:::o;47274:25::-;;;;:::o;44940:192::-;44985:7;45022:14;;45009:9;;:27;45005:81;;;45060:14;:12;:14::i;:::-;45053:21;;;;45005:81;45103:21;45122:1;45103:14;:12;:14::i;:::-;:18;;:21::i;42130:244::-;41407:12;:10;:12::i;:::-;41397:6;;-1:-1:-1;;;;;41397:6:0;;;:22;;;41389:67;;;;;-1:-1:-1;;;41389:67:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;42219:22:0;::::1;42211:73;;;;-1:-1:-1::0;;;42211:73:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;42321:6;::::0;;42300:38:::1;::::0;-1:-1:-1;;;;;42300:38:0;;::::1;::::0;42321:6;::::1;::::0;42300:38:::1;::::0;::::1;42349:6;:17:::0;;-1:-1:-1;;;;;;42349:17:0::1;-1:-1:-1::0;;;;;42349:17:0;;;::::1;::::0;;;::::1;::::0;;42130:244::o;2310:471::-;2368:7;2613:6;2609:47;;-1:-1:-1;2643:1:0;2636:8;;2609:47;2680:5;;;2684:1;2680;:5;:1;2704:5;;;;;:10;2696:56;;;;-1:-1:-1;;;2696:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;956:181;1014:7;1046:5;;;1070:6;;;;1062:46;;;;;-1:-1:-1;;;1062:46:0;;;;;;;;;;;;;;;;;;;;;;;;;;;28603:278;28711:16;;:::i;:::-;28767:1;28753:11;-1:-1:-1;;;;;28753:15:0;;28745:51;;;;;-1:-1:-1;;;28745:51:0;;;;;;;;;;;;-1:-1:-1;;;28745:51:0;;;;;;;;;;;;;;;28814:59;;;;;;;;;;-1:-1:-1;;;;;28824:48:0;;-1:-1:-1;;;27232:3:0;28825:32;;;;28824:48;;;;;;-1:-1:-1;;;;;28814:59:0;;;;28807:66;;28603:278;;;;:::o;6038:106::-;6126:10;6038:106;:::o;43282:294::-;-1:-1:-1;;;;;43373:26:0;;43351:121;;;;-1:-1:-1;;;43351:121:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;43488:45;;-1:-1:-1;;;;;43488:45:0;;;43516:1;;43488:45;;43516:1;;43488:45;43544:9;:24;;-1:-1:-1;;;;;;43544:24:0;-1:-1:-1;;;;;43544:24:0;;;;;;;;;;43282:294::o;1420:136::-;1478:7;1505:43;1509:1;1512;1505:43;;;;;;;;;;;;;;;;;:3;:43::i;3257:132::-;3315:7;3342:39;3346:1;3349;3342:39;;;;;;;;;;;;;;;;;:3;:39::i;28113:334::-;28210:16;;:::i;:::-;28244:9;28286:6;;;:60;;-1:-1:-1;;28338:7:0;;-1:-1:-1;;;;;28330:16:0;28301:20;;;;28325:1;28301:20;28325:1;28296:30;;;;;:50;28286:60;28264:145;;;;-1:-1:-1;;;28264:145:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;28427:12;;;;;;;;;;;;;28113:334;-1:-1:-1;;;28113:334:0:o;29180:130::-;29280:7;27232:3;29280:21;;29180:130::o;27785:230::-;27882:16;;:::i;:::-;-1:-1:-1;;;;;27924:6:0;;27916:42;;;;;-1:-1:-1;;;27916:42:0;;;;;;;;;;;;-1:-1:-1;;;27916:42:0;;;;;;;;;;;;;;;27976:31;;;;;;;;28004:1;-1:-1:-1;;;;;27996:10:0;-1:-1:-1;;;;;27986:20:0;:4;:7;;;-1:-1:-1;;;;;27986:20:0;;;;;39456:107;39514:7;39546:1;39541;:6;;:14;;39554:1;39541:14;;;-1:-1:-1;39550:1:0;;39456:107;-1:-1:-1;39456:107:0:o;1859:192::-;1945:7;1981:12;1973:6;;;;1965:29;;;;-1:-1:-1;;;1965:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;2017:5:0;;;1859:192::o;3885:278::-;3971:7;4006:12;3999:5;3991:28;;;;-1:-1:-1;;;3991:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4030:9;4046:1;4042;:5;;;;;;;3885:278;-1:-1:-1;;;;;3885:278:0:o;-1:-1:-1:-;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;:::o

Swarm Source

ipfs://60d237d52389dd1f7db2624f2f261487a2ca717b35f6d67107f7d62996820295

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.