Contract 0x935D74E5c18Fb5f3c1dc8Cde51c249f315D78EfC

 
Txn Hash
Block
From
To
Value [Txn Fee]
0x6bf5e5777f78abcda61e7a97f5501f12fcc77dbace24452dae8d05b529fb969063934092021-04-08 18:32:214 days ago0x62ca555de2d65f8e9d45a9b3d5c1b92ac1a64ecc IN  0x935d74e5c18fb5f3c1dc8cde51c249f315d78efc0 BNB0.00058439
0x99b26913fa4e0db928a2f4093676e7b6b5a32715e879a1a404a072740ba1aa3763929182021-04-08 18:06:474 days 26 mins agoIron Finance: Deployer IN  0x935d74e5c18fb5f3c1dc8cde51c249f315d78efc0 BNB0.00084258
0x57078cdf0efea49f22706a2be9f99bfb6399ac3ed09580024aff63c17d540ee063929022021-04-08 18:05:574 days 27 mins agoIron Finance: Deployer IN  0x935d74e5c18fb5f3c1dc8cde51c249f315d78efc0 BNB0.00108065
0x1514102003948767b15332acd837bdc7928b9fadde3f24466b816d1b5378ad4c63928812021-04-08 18:04:434 days 28 mins agoIron Finance: Deployer IN  0x935d74e5c18fb5f3c1dc8cde51c249f315d78efc0 BNB0.0001373
0x3f945a801dbe12cc378e682fd36d241a383309c4de99fa5e2569aa3632694b0963927102021-04-08 17:55:374 days 37 mins agoIron Finance: Deployer IN  Contract Creation0 BNB0.00856321
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VPegOracle

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 13 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/Context.sol";

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

File 3 of 13 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 13 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";

/**
 * @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;

    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 virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual 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 virtual returns (uint8) {
        return _decimals;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual 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 virtual {
        _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 5 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.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 6 of 13 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

File 7 of 13 : Operator.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

abstract contract Operator is Context, Ownable {
    address private _operator;

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

    constructor() {
        _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 8 of 13 : IPairOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

interface IPairOracle {
    function consult(address token, uint256 amountIn) external view returns (uint256 amountOut);

    function twap(uint256 amountIn) external view returns (uint256 amountOut);

    function update() external;
}

File 9 of 13 : ISwap.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

interface ISwap {
    // pool data view functions
    function getA() external view returns (uint256);

    function getToken(uint8 index) external view returns (IERC20);

    function getTokenIndex(address tokenAddress) external view returns (uint8);

    function getTokenBalance(uint8 index) external view returns (uint256);

    function getTokenLength() external view returns (uint256);

    function getVirtualPrice() external view returns (uint256);

    function swapStorage()
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            uint256,
            address
        );

    // min return calculation functions
    function calculateSwap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx
    ) external view returns (uint256);

    function calculateRemoveLiquidity(uint256 amount) external view returns (uint256[] memory);

    function calculateRemoveLiquidityOneToken(uint256 tokenAmount, uint8 tokenIndex) external view returns (uint256 availableTokenAmount);

    // state modifying functions
    function swap(
        uint8 tokenIndexFrom,
        uint8 tokenIndexTo,
        uint256 dx,
        uint256 minDy,
        uint256 deadline
    ) external returns (uint256);

    function addLiquidity(
        uint256[] calldata amounts,
        uint256 minToMint,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidity(
        uint256 amount,
        uint256[] calldata minAmounts,
        uint256 deadline
    ) external returns (uint256[] memory);

    function removeLiquidityOneToken(
        uint256 tokenAmount,
        uint8 tokenIndex,
        uint256 minAmount,
        uint256 deadline
    ) external returns (uint256);

    function removeLiquidityImbalance(
        uint256[] calldata amounts,
        uint256 maxBurnAmount,
        uint256 deadline
    ) external returns (uint256);

    // withdraw fee update function
    function updateUserWithdrawFee(address recipient, uint256 transferAmount) external;

    function calculateRemoveLiquidity(address account, uint256 amount) external view returns (uint256[] memory);

    function calculateTokenAmount(
        address account,
        uint256[] calldata amounts,
        bool deposit
    ) external view returns (uint256);

    function calculateRemoveLiquidityOneToken(
        address account,
        uint256 tokenAmount,
        uint8 tokenIndex
    ) external view returns (uint256 availableTokenAmount);
}

File 10 of 13 : Babylonian.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

// computes square roots using the babylonian method
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
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 11 of 13 : FixedPoint.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

import "./Babylonian.sol";

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

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

    uint8 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 12 of 13 : UQ112x112.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))

// range: [0, 2**112 - 1]
// resolution: 1 / 2**112

library UQ112x112 {
    uint224 constant Q112 = 2**112;

    // encode a uint112 as a UQ112x112
    function encode(uint112 y) internal pure returns (uint224 z) {
        z = uint224(y) * Q112; // never overflows
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
        z = x / uint224(y);
    }
}

File 13 of 13 : VPegOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import "../interfaces/ISwap.sol";
import "../libs/FixedPoint.sol";
import "../libs/UQ112x112.sol";
import "../Operator.sol";
import "../interfaces/IPairOracle.sol";

// fixed window oracle that recomputes the average price for the entire epochPeriod once every epochPeriod
// note that the price average is only guaranteed to be over at least 1 epochPeriod, but may be over a longer epochPeriod
// @dev This version 2 supports querying twap with shorted period (ie 2hrs for BSDB reference price)
contract VPegOracle is Operator, IPairOracle {
    using FixedPoint for *;
    using SafeMath for uint256;
    using UQ112x112 for uint224;

    /* ========= CONSTANT VARIABLES ======== */

    uint256 public oneAmountTokenMain = 10**18;

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

    // epoch
    uint256 public lastEpochTime;
    uint256 public epoch; // for display only
    uint256 public epochPeriod;
    uint256 public maxEpochPeriod = 1 days;

    // 2-hours update
    uint256 public lastUpdateHour;
    uint256 public updatePeriod;

    // BPool
    address public mainToken;
    uint256 public mainTokenDecimal;
    uint8 public mainTokenIndex;
    uint8 public sideTokenIndex;
    uint256 public sideTokenDecimal;
    ISwap public pool;

    // Pool price for update in cumulative epochPeriod
    uint32 public blockTimestampCumulativeLast;
    uint256 public priceCumulative;

    // oracle
    uint32 public blockTimestampLast;
    uint256 public priceCumulativeLast;
    FixedPoint.uq112x112 public priceAverage;

    bool private _initialized = false;

    event Updated(uint256 priceCumulativeLast);

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

    function initialize(
        address _pool,
        address _mainToken,
        address _sideToken,
        uint256 _epoch,
        uint256 _epochPeriod,
        uint256 _updatePeriod
    ) public {
        require(_initialized == false, "OracleVPeg: Initialize must be false.");

        mainToken = _mainToken;
        mainTokenDecimal = ERC20(_mainToken).decimals();
        {
            pool = ISwap(_pool);

            uint8 _mainTokenIndex = pool.getTokenIndex(_mainToken);
            uint8 _sideTokenIndex = pool.getTokenIndex(_sideToken);
            require(pool.getTokenBalance(_mainTokenIndex) != 0 && pool.getTokenBalance(_sideTokenIndex) != 0, "OracleVPeg: NO_RESERVES"); // ensure that there's liquidity in the pool

            mainTokenIndex = _mainTokenIndex;
            sideTokenIndex = _sideTokenIndex;
            sideTokenDecimal = ERC20(_sideToken).decimals();
        }

        epoch = _epoch;
        epochPeriod = _epochPeriod;
        updatePeriod = _updatePeriod;
        _initialized = true;
    }

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

    function setEpoch(uint256 _epoch) external onlyOperator {
        epoch = _epoch;
    }

    function setEpochPeriod(uint256 _epochPeriod) external onlyOperator {
        require(_epochPeriod >= 1 hours && _epochPeriod <= 48 hours, "_epochPeriod out of range");
        epochPeriod = _epochPeriod;
    }

    function setLastUpdateHour(uint256 _lastUpdateHour) external onlyOperator {
        lastUpdateHour = _lastUpdateHour;
    }

    function setUpdatePeriod(uint256 _updatePeriod) external onlyOperator {
        require(_updatePeriod >= 1 hours && _updatePeriod <= epochPeriod, "_updatePeriod out of range");
        updatePeriod = _updatePeriod;
    }

    function setOneAmountTokenMain(uint256 _oneAmountTokenMain) external onlyOperator {
        oneAmountTokenMain = _oneAmountTokenMain;
    }

    function setMaxEpochPeriod(uint256 _maxEpochPeriod) external onlyOperator {
        require(_maxEpochPeriod <= 48 hours, "_maxEpochPeriod is not valid");
        maxEpochPeriod = _maxEpochPeriod;
    }

    function setPool(address _pool, address _sideToken) public onlyOperator {
        pool = ISwap(_pool);

        uint8 _mainTokenIndex = pool.getTokenIndex(mainToken);
        uint8 _sideTokenIndex = pool.getTokenIndex(_sideToken);

        require(pool.getTokenBalance(_mainTokenIndex) != 0 && pool.getTokenBalance(_sideTokenIndex) != 0, "OracleVPeg: NO_RESERVES"); // ensure that there's liquidity in the pool

        mainTokenIndex = _mainTokenIndex;
        sideTokenIndex = _sideTokenIndex;
        sideTokenDecimal = ERC20(_sideToken).decimals();
    }

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

    function nextEpochPoint() public view returns (uint256) {
        return lastEpochTime.add(epochPeriod);
    }

    function nextUpdateHour() public view returns (uint256) {
        return lastUpdateHour.add(updatePeriod);
    }

    /* ========== MUTABLE FUNCTIONS ========== */
    // update reserves and, on the first call per block, price accumulators
    function updateCumulative() public {
        uint32 blockTimestamp = uint32(block.timestamp % 2**32);
        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // Overflow is desired

        // Ensure that at least one full period has passed since the last update
        require(timeElapsed >= updatePeriod, "OracleVPeg: PERIOD_NOT_ELAPSED");

        uint256 _decimalFactor = 10**(mainTokenDecimal.sub(sideTokenDecimal));
        uint256 tokenMainPrice = pool.calculateSwap(mainTokenIndex, sideTokenIndex, oneAmountTokenMain).mul(_decimalFactor);

        require(tokenMainPrice != 0, "!price");
        require(tokenMainPrice <= uint112(-1), "OracleVPeg: overflow");

        priceCumulative += uint256(UQ112x112.encode(uint112(tokenMainPrice)).uqdiv(uint112(oneAmountTokenMain))) * timeElapsed;
        blockTimestampCumulativeLast = blockTimestamp;
    }

    function update() external override {
        updateCumulative();
        uint32 timeElapsed = blockTimestampCumulativeLast - blockTimestampLast; // overflow is desired
        require(timeElapsed >= epochPeriod, "OracleVPeg: epoch too short");
        priceAverage = FixedPoint.uq112x112(uint224((priceCumulative - priceCumulativeLast) / timeElapsed));
        priceCumulativeLast = priceCumulative;
        blockTimestampLast = blockTimestampCumulativeLast;
        emit Updated(priceCumulative);
    }

    // note this will always return 0 before update has been called successfully for the first time.
    function consult(address token, uint256 amountIn) external view override returns (uint256 amountOut) {
        require(token == mainToken, "OracleVPeg: INVALID_TOKEN");
        require(block.timestamp.sub(blockTimestampLast) <= maxEpochPeriod, "OracleVPeg: Price out-of-date");
        amountOut = priceAverage.mul(amountIn).decode144();
    }

    function twap(uint256 _amountIn) external view override returns (uint256) {
        uint32 timeElapsed = blockTimestampCumulativeLast - blockTimestampLast;
        return (timeElapsed == 0) ? priceAverage.mul(_amountIn).decode144() : FixedPoint.uq112x112(uint224((priceCumulative - priceCumulativeLast) / timeElapsed)).mul(_amountIn).decode144();
    }
}

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

Contract ABI

[{"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":"priceCumulativeLast","type":"uint256"}],"name":"Updated","type":"event"},{"inputs":[],"name":"blockTimestampCumulativeLast","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"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":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address","name":"_mainToken","type":"address"},{"internalType":"address","name":"_sideToken","type":"address"},{"internalType":"uint256","name":"_epoch","type":"uint256"},{"internalType":"uint256","name":"_epochPeriod","type":"uint256"},{"internalType":"uint256","name":"_updatePeriod","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastEpochTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateHour","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainTokenDecimal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainTokenIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxEpochPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextEpochPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextUpdateHour","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oneAmountTokenMain","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":"pool","outputs":[{"internalType":"contract ISwap","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceAverage","outputs":[{"internalType":"uint224","name":"_x","type":"uint224"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceCumulative","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceCumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epoch","type":"uint256"}],"name":"setEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epochPeriod","type":"uint256"}],"name":"setEpochPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lastUpdateHour","type":"uint256"}],"name":"setLastUpdateHour","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxEpochPeriod","type":"uint256"}],"name":"setMaxEpochPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_oneAmountTokenMain","type":"uint256"}],"name":"setOneAmountTokenMain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address","name":"_sideToken","type":"address"}],"name":"setPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_updatePeriod","type":"uint256"}],"name":"setUpdatePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sideTokenDecimal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sideTokenIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":[{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"twap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateCumulative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updatePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6080604052670de0b6b3a7640000600255620151806006556012805460ff1916905534801561002d57600080fd5b5060006100386100db565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061008a6100db565b600180546001600160a01b0319166001600160a01b0392831617908190556040519116906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a36100df565b3390565b611c63806100ee6000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c8063728cdbca11610130578063b5b7a184116100b8578063e39b80c41161007c578063e39b80c4146103ee578063e55fae77146103f6578063eb3091b114610409578063f2fde38b1461041e578063ff75cb761461043157610232565b8063b5b7a184146103c6578063c5700a02146103ce578063c5967c26146103d6578063c5b3334b146103de578063da303d9d146103e657610232565b806392f6058b116100ff57806392f6058b14610391578063981cc0dc14610399578063a2e62045146103a1578063a545e48a146103a9578063a83627de146103be57610232565b8063728cdbca1461036657806389c614b8146103795780638da5cb5b14610381578063900cf0cf1461038957610232565b80633fc15f15116101be578063609eeafb11610182578063609eeafb1461031d5780636b5f444c146103255780636c1b80e3146103385780636d242c381461034b578063715018a61461035e57610232565b80633fc15f15146102d057806341985412146102d85780634456eda2146102ed5780634e847fc714610302578063570ca7351461031557610232565b806316f0115b1161020557806316f0115b1461028557806317ffaacc1461029a57806329605e77146102a25780632f43c1bc146102b55780633ddac953146102bd57610232565b80630abb3e0b146102375780630be8e658146102555780630ceb2cef1461025d5780631598dae314610272575b600080fd5b61023f610444565b60405161024c9190611b2c565b60405180910390f35b61023f61044a565b61027061026b36600461185d565b610450565b005b61027061028036600461185d565b61049e565b61028d6104ec565b60405161024c91906118ae565b61023f6104fb565b6102706102b036600461178a565b610501565b61023f610581565b61023f6102cb366004611834565b610587565b61028d610635565b6102e0610644565b60405161024c9190611b46565b6102f5610652565b60405161024c91906118c2565b6102706103103660046117a4565b610678565b61028d6109b2565b6102e06109c1565b61027061033336600461185d565b6109ca565b61023f61034636600461185d565b610a49565b61027061035936600461185d565b610ae7565b610270610b58565b6102706103743660046117d6565b610c16565b61023f610fd3565b61028d610fd9565b61023f610fe8565b61023f610fee565b61023f610ff4565b610270610ffa565b6103b16110ed565b60405161024c9190611b35565b61023f611100565b61023f611106565b6103b161110c565b61023f611118565b61023f611136565b61027061114f565b61023f6112f2565b61027061040436600461185d565b6112f8565b610411611376565b60405161024c9190611b18565b61027061042c36600461178a565b611385565b61027061043f36600461185d565b611499565b600e5481565b600c5481565b6001546001600160a01b031633146104995760405162461bcd60e51b8152600401808060200182810382526024815260200180611be76024913960400191505060405180910390fd5b600455565b6001546001600160a01b031633146104e75760405162461bcd60e51b8152600401808060200182810382526024815260200180611be76024913960400191505060405180910390fd5b600755565b600d546001600160a01b031681565b60025481565b6105096114e7565b6001600160a01b031661051a610fd9565b6001600160a01b031614610575576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61057e816114eb565b50565b60105481565b6009546000906001600160a01b038481169116146105c05760405162461bcd60e51b81526004016105b790611a8a565b60405180910390fd5b600654600f546105db90429063ffffffff9081169061158816565b11156105f95760405162461bcd60e51b81526004016105b7906119ee565b60408051602081019091526011546001600160e01b031681526106259061062090846115ea565b611668565b6001600160901b03169392505050565b6009546001600160a01b031681565b600b54610100900460ff1681565b6001546000906001600160a01b03166106696114e7565b6001600160a01b031614905090565b6001546001600160a01b031633146106c15760405162461bcd60e51b8152600401808060200182810382526024815260200180611be76024913960400191505060405180910390fd5b600d80546001600160a01b0319166001600160a01b0384811691909117918290556009546040516319b02f4960e21b81526000938316926366c0bd249261070d929116906004016118ae565b60206040518083038186803b15801561072557600080fd5b505afa158015610739573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075d919061188d565b600d546040516319b02f4960e21b81529192506000916001600160a01b03909116906366c0bd24906107939086906004016118ae565b60206040518083038186803b1580156107ab57600080fd5b505afa1580156107bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e3919061188d565b600d546040516391ceb3eb60e01b81529192506001600160a01b0316906391ceb3eb90610814908590600401611b46565b60206040518083038186803b15801561082c57600080fd5b505afa158015610840573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108649190611875565b158015906108f05750600d546040516391ceb3eb60e01b81526001600160a01b03909116906391ceb3eb9061089d908490600401611b46565b60206040518083038186803b1580156108b557600080fd5b505afa1580156108c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ed9190611875565b15155b61090c5760405162461bcd60e51b81526004016105b7906118cd565b600b805460ff8381166101000261ff001991861660ff1990931692909217161790556040805163313ce56760e01b815290516001600160a01b0385169163313ce567916004808301926020929190829003018186803b15801561096e57600080fd5b505afa158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a6919061188d565b60ff16600c5550505050565b6001546001600160a01b031690565b600b5460ff1681565b6001546001600160a01b03163314610a135760405162461bcd60e51b8152600401808060200182810382526024815260200180611be76024913960400191505060405180910390fd5b610e108110158015610a2857506202a3008111155b610a445760405162461bcd60e51b81526004016105b790611a53565b600555565b600f54600d5460009163ffffffff908116600160a01b90920481169190910390811615610aae57610aa96106208460405180602001604052808563ffffffff16601054600e540381610a9757fe5b046001600160e01b03169052906115ea565b610ad5565b60408051602081019091526011546001600160e01b03168152610ad59061062090856115ea565b6001600160901b03169150505b919050565b6001546001600160a01b03163314610b305760405162461bcd60e51b8152600401808060200182810382526024815260200180611be76024913960400191505060405180910390fd5b6202a300811115610b535760405162461bcd60e51b81526004016105b7906119b7565b600655565b610b606114e7565b6001600160a01b0316610b71610fd9565b6001600160a01b031614610bcc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60125460ff1615610c395760405162461bcd60e51b81526004016105b790611972565b600980546001600160a01b0319166001600160a01b0387169081179091556040805163313ce56760e01b8152905163313ce56791600480820192602092909190829003018186803b158015610c8d57600080fd5b505afa158015610ca1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc5919061188d565b60ff16600a55600d80546001600160a01b0319166001600160a01b0388811691909117918290556040516319b02f4960e21b8152600092909116906366c0bd2490610d149089906004016118ae565b60206040518083038186803b158015610d2c57600080fd5b505afa158015610d40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d64919061188d565b600d546040516319b02f4960e21b81529192506000916001600160a01b03909116906366c0bd2490610d9a9089906004016118ae565b60206040518083038186803b158015610db257600080fd5b505afa158015610dc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dea919061188d565b600d546040516391ceb3eb60e01b81529192506001600160a01b0316906391ceb3eb90610e1b908590600401611b46565b60206040518083038186803b158015610e3357600080fd5b505afa158015610e47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6b9190611875565b15801590610ef75750600d546040516391ceb3eb60e01b81526001600160a01b03909116906391ceb3eb90610ea4908490600401611b46565b60206040518083038186803b158015610ebc57600080fd5b505afa158015610ed0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef49190611875565b15155b610f135760405162461bcd60e51b81526004016105b7906118cd565b600b805460ff8381166101000261ff001991861660ff1990931692909217161790556040805163313ce56760e01b815290516001600160a01b0388169163313ce567916004808301926020929190829003018186803b158015610f7557600080fd5b505afa158015610f89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fad919061188d565b60ff16600c55505060049290925560055560085550506012805460ff1916600117905550565b60035481565b6000546001600160a01b031690565b60045481565b600a5481565b60075481565b61100261114f565b600f54600d5460055463ffffffff928316600160a01b90920483169190910391821610156110425760405162461bcd60e51b81526004016105b790611904565b60405180602001604052808263ffffffff16601054600e54038161106257fe5b046001600160e01b039081169091529051601180546001600160e01b03191691909216179055600e546010819055600d54600f8054600160a01b90920463ffffffff1663ffffffff199092169190911790556040517f208509800c5cb9707f116ef96a1d456499ab9fa3c8edc1cdf381fe5216d5b173916110e291611b2c565b60405180910390a150565b600d54600160a01b900463ffffffff1681565b60085481565b60055481565b600f5463ffffffff1681565b600061113160055460035461166f90919063ffffffff16565b905090565b600061113160085460075461166f90919063ffffffff16565b600f5460085463ffffffff42811692811683039190821610156111845760405162461bcd60e51b81526004016105b790611ae1565b600061119d600c54600a5461158890919063ffffffff16565b600d54600b5460025460405163a95b089f60e01b8152600a9490940a94506000936112469386936001600160a01b039091169263a95b089f926111f09260ff808216936101009092041691600401611b54565b60206040518083038186803b15801561120857600080fd5b505afa15801561121c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112409190611875565b906116d0565b9050806112655760405162461bcd60e51b81526004016105b790611ac1565b6001600160701b0381111561128c5760405162461bcd60e51b81526004016105b790611a25565b8263ffffffff166112b16002546112a284611729565b6001600160e01b03169061173b565b600e80546001600160e01b0392909216929092020190555050600d805463ffffffff909316600160a01b0263ffffffff60a01b199093169290921790915550565b60065481565b6001546001600160a01b031633146113415760405162461bcd60e51b8152600401808060200182810382526024815260200180611be76024913960400191505060405180910390fd5b610e10811015801561135557506005548111155b6113715760405162461bcd60e51b81526004016105b79061193b565b600855565b6011546001600160e01b031681565b61138d6114e7565b6001600160a01b031661139e610fd9565b6001600160a01b0316146113f9576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661143e5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b736026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146114e25760405162461bcd60e51b8152600401808060200182810382526024815260200180611be76024913960400191505060405180910390fd5b600255565b3390565b6001600160a01b0381166115305760405162461bcd60e51b815260040180806020018281038252602d815260200180611b99602d913960400191505060405180910390fd5b6040516001600160a01b038216906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000828211156115df576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b6115f2611760565b600082158061161857505082516001600160e01b03168281029083828161161557fe5b04145b6116535760405162461bcd60e51b8152600401808060200182810382526023815260200180611c0b6023913960400191505060405180910390fd5b60408051602081019091529081529392505050565b5160701c90565b6000828201838110156116c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000826116df575060006115e4565b828202828482816116ec57fe5b04146116c95760405162461bcd60e51b8152600401808060200182810382526021815260200180611bc66021913960400191505060405180910390fd5b6001600160701b0316600160701b0290565b60006001600160701b0382166001600160e01b0384168161175857fe5b049392505050565b6040518060200160405280600081525090565b80356001600160a01b0381168114610ae257600080fd5b60006020828403121561179b578081fd5b6116c982611773565b600080604083850312156117b6578081fd5b6117bf83611773565b91506117cd60208401611773565b90509250929050565b60008060008060008060c087890312156117ee578182fd5b6117f787611773565b955061180560208801611773565b945061181360408801611773565b9350606087013592506080870135915060a087013590509295509295509295565b60008060408385031215611846578182fd5b61184f83611773565b946020939093013593505050565b60006020828403121561186e578081fd5b5035919050565b600060208284031215611886578081fd5b5051919050565b60006020828403121561189e578081fd5b815160ff811681146116c9578182fd5b6001600160a01b0391909116815260200190565b901515815260200190565b60208082526017908201527f4f7261636c65565065673a204e4f5f5245534552564553000000000000000000604082015260600190565b6020808252601b908201527f4f7261636c65565065673a2065706f636820746f6f2073686f72740000000000604082015260600190565b6020808252601a908201527f5f757064617465506572696f64206f7574206f662072616e6765000000000000604082015260600190565b60208082526025908201527f4f7261636c65565065673a20496e697469616c697a65206d757374206265206660408201526430b639b29760d91b606082015260800190565b6020808252601c908201527f5f6d617845706f6368506572696f64206973206e6f742076616c696400000000604082015260600190565b6020808252601d908201527f4f7261636c65565065673a205072696365206f75742d6f662d64617465000000604082015260600190565b6020808252601490820152734f7261636c65565065673a206f766572666c6f7760601b604082015260600190565b60208082526019908201527f5f65706f6368506572696f64206f7574206f662072616e676500000000000000604082015260600190565b60208082526019908201527f4f7261636c65565065673a20494e56414c49445f544f4b454e00000000000000604082015260600190565b60208082526006908201526521707269636560d01b604082015260600190565b6020808252601e908201527f4f7261636c65565065673a20504552494f445f4e4f545f454c41505345440000604082015260600190565b6001600160e01b0391909116815260200190565b90815260200190565b63ffffffff91909116815260200190565b60ff91909116815260200190565b60ff938416815291909216602082015260408101919091526060019056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573736f70657261746f723a207a65726f206164647265737320676976656e20666f72206e6577206f70657261746f72536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657261746f724669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552464c4f57a2646970667358221220633542c8bd30ee071b95c7d2a67e35d906601395d5f0c8848aa3862b9f0e1f3f64736f6c63430007060033

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