Contract 0xafe7090d0D6467F0AE65C3BD0A72f3F63573E6eE

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xaa2d3a19790316a6922fb31f9e5d0890f63ab09a32e280ce607d87512ba8cdb30x60806040146809462022-05-14 10:35:297 days 20 hrs ago0xb711eb61b1903ef44b89c42bb5c00abf4f6bc32b IN  Create: WlrsPriceFeed0 AVAX0.01691287525
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WlrsPriceFeed

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 3 : WlrsPriceFeed.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts-0.8/access/Ownable.sol";

interface IOracle {
    function update() external;
    function consult(address _token, uint256 _amountIn) external view returns (uint144 amountOut);
    function twap(address _token, uint256 _amountIn) external view returns (uint144 _amountOut);
}

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

contract WlrsPriceFeed is Ownable {

    IOracle public Oracle = IOracle(0x99654324B6ECAddAc4387DE13300F5B861Fd0cF3);
    IPriceFeed public PriceFeed = IPriceFeed(0xF096872672F44d6EBA71458D74fe67F9a77a23B9);
    address public WLRS = 0x395908aeb53d33A9B8ac35e148E9805D34A555D3;

    function update() external {
        Oracle.update();
    }

    function consult(address _token, uint256 _amountIn) external view returns (uint144 amountOut) {
        return Oracle.consult(_token, _amountIn);
    }

    function twap(address _token, uint256 _amountIn) external view returns (uint144 _amountOut) {
        return Oracle.twap(_token, _amountIn);
    }

    function latestUstPrice() external view returns (int256) {
        return PriceFeed.latestAnswer();
    }

    function latestRoundUstPrice() external view returns (
        uint80 roundId,
        int256 answer,
        uint256 startedAt,
        uint256 updatedAt,
        uint80 answeredInRound
    ) {
        return PriceFeed.latestRoundData();
    }

    function latestPrice() external view returns (uint256) {
        uint256 ustPrice = uint256(PriceFeed.latestAnswer());
        uint256 price = Oracle.consult(WLRS, 1e18);
        return price * ustPrice;
    }

    function setOracle(address oracle) external onlyOwner {
        Oracle = IOracle(oracle);
    }

    function setPriceFeed(address priceFeed) external onlyOwner {
        PriceFeed = IPriceFeed(priceFeed);
    }

    function setWLRS(address wlrs) external onlyOwner {
        WLRS = wlrs;
    }
}

File 2 of 3 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^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() {
        _transferOwnership(_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 {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 3 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^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 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) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"Oracle","outputs":[{"internalType":"contract IOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PriceFeed","outputs":[{"internalType":"contract IPriceFeed","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WLRS","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"latestPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundUstPrice","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestUstPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"oracle","type":"address"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"priceFeed","type":"address"}],"name":"setPriceFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wlrs","type":"address"}],"name":"setWLRS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"twap","outputs":[{"internalType":"uint144","name":"_amountOut","type":"uint144"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600180546001600160a01b03199081167399654324b6ecaddac4387de13300f5b861fd0cf31790915560028054821673f096872672f44d6eba71458d74fe67f9a77a23b91790556003805490911673395908aeb53d33a9b8ac35e148e9805d34a555d317905534801561007657600080fd5b5061008033610085565b6100d5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610997806100e46000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806386c7eb8211610097578063c70bd1f911610066578063c70bd1f9146101e2578063d3fb2304146101f5578063f24a534e14610234578063f2fde38b1461024757600080fd5b806386c7eb82146101ae5780638da5cb5b146101c1578063a2e62045146101d2578063a3e6ba94146101da57600080fd5b80636808a128116100d35780636808a1281461016b578063715018a61461017e578063724e78da146101885780637adbf9731461019b57600080fd5b806308b7fa31146100fa5780633ddac9531461012a578063664d117114610155575b600080fd5b60025461010d906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61013d610138366004610843565b61025a565b6040516001600160901b039091168152602001610121565b61015d6102e7565b604051908152602001610121565b61013d610179366004610843565b610369565b6101866103a3565b005b610186610196366004610828565b6103e2565b6101866101a9366004610828565b61042e565b60035461010d906001600160a01b031681565b6000546001600160a01b031661010d565b61018661047a565b61015d6104e4565b6101866101f0366004610828565b61061c565b6101fd610668565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a001610121565b60015461010d906001600160a01b031681565b610186610255366004610828565b610707565b600154604051633ddac95360e01b81526001600160a01b038481166004830152602482018490526000921690633ddac953906044015b60206040518083038186803b1580156102a857600080fd5b505afa1580156102bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e09190610886565b9392505050565b600254604080516350d25bcd60e01b815290516000926001600160a01b0316916350d25bcd916004808301926020929190829003018186803b15801561032c57600080fd5b505afa158015610340573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610364919061086d565b905090565b600154604051630d01142560e31b81526001600160a01b038481166004830152602482018490526000921690636808a12890604401610290565b6000546001600160a01b031633146103d65760405162461bcd60e51b81526004016103cd906108ff565b60405180910390fd5b6103e060006107a2565b565b6000546001600160a01b0316331461040c5760405162461bcd60e51b81526004016103cd906108ff565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146104585760405162461bcd60e51b81526004016103cd906108ff565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600160009054906101000a90046001600160a01b03166001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156104ca57600080fd5b505af11580156104de573d6000803e3d6000fd5b50505050565b600080600260009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561053557600080fd5b505afa158015610549573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056d919061086d565b600154600354604051633ddac95360e01b81526001600160a01b039182166004820152670de0b6b3a76400006024820152929350600092911690633ddac9539060440160206040518083038186803b1580156105c857600080fd5b505afa1580156105dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106009190610886565b6001600160901b031690506106158282610934565b9250505090565b6000546001600160a01b031633146106465760405162461bcd60e51b81526004016103cd906108ff565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000806000806000600260009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156106be57600080fd5b505afa1580156106d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f691906108af565b945094509450945094509091929394565b6000546001600160a01b031633146107315760405162461bcd60e51b81526004016103cd906108ff565b6001600160a01b0381166107965760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103cd565b61079f816107a2565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461080957600080fd5b919050565b805169ffffffffffffffffffff8116811461080957600080fd5b60006020828403121561083a57600080fd5b6102e0826107f2565b6000806040838503121561085657600080fd5b61085f836107f2565b946020939093013593505050565b60006020828403121561087f57600080fd5b5051919050565b60006020828403121561089857600080fd5b81516001600160901b03811681146102e057600080fd5b600080600080600060a086880312156108c757600080fd5b6108d08661080e565b94506020860151935060408601519250606086015191506108f36080870161080e565b90509295509295909350565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600081600019048311821515161561095c57634e487b7160e01b600052601160045260246000fd5b50029056fea26469706673582212204059b20591f0a860fe8753697aaa55adf41823de061280b3d9209f357e86a67964736f6c63430008070033

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