ETH Price: $3,261.51 (+3.40%)
Gas: 3 Gwei

Contract

0x285DcE453285596cD5d760E4527536560c9d6f0E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...158187702022-10-24 15:11:47641 days ago1666624307IN
0x285DcE45...60c9d6f0E
0 ETH0.0015865355.49446119
Add Floor Oracle158187672022-10-24 15:11:11641 days ago1666624271IN
0x285DcE45...60c9d6f0E
0 ETH0.0027205158.3225022
Add Floor Oracle158187632022-10-24 15:10:23641 days ago1666624223IN
0x285DcE45...60c9d6f0E
0 ETH0.0029985964.28410818
Add Floor Oracle157184492022-10-10 14:59:11655 days ago1665413951IN
0x285DcE45...60c9d6f0E
0 ETH0.0016760535.93128617
Add Floor Oracle157184442022-10-10 14:58:11655 days ago1665413891IN
0x285DcE45...60c9d6f0E
0 ETH0.0015533533.30100923
Add Floor Oracle157184402022-10-10 14:57:23655 days ago1665413843IN
0x285DcE45...60c9d6f0E
0 ETH0.0016408135.18502808
Add Floor Oracle157184352022-10-10 14:56:23655 days ago1665413783IN
0x285DcE45...60c9d6f0E
0 ETH0.0016140134.60125824
0x60806040157180032022-10-10 13:28:47655 days ago1665408527IN
 Create: JPEGOraclesAggregator
0 ETH0.0213043441.68600304

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
JPEGOraclesAggregator

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 5 : JPEGOraclesAggregator.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

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

import "../interfaces/IAggregatorV3Interface.sol";
import "../interfaces/IUniswapV2Oracle.sol";

contract JPEGOraclesAggregator is Ownable {
    error Unauthorized();
    error InvalidOracleResults();
    error ZeroAddress();

    IUniswapV2Oracle public jpegOracle;

    mapping(address => IAggregatorV3Interface) public floorMap;

    constructor(IUniswapV2Oracle _jpegOracle) {
        if (address(_jpegOracle) == address(0))
            revert ZeroAddress();

        jpegOracle = _jpegOracle;
    }

    /// @notice Can only be called by whitelisted addresses.
    /// @return The floor value for the collection, in ETH.
    function getFloorETH() external view returns (uint256) {
        IAggregatorV3Interface aggregator = floorMap[msg.sender];
        if (address(aggregator) == address(0))
            revert Unauthorized();

        return _normalizeAggregatorAnswer(aggregator);
    }

    /// @notice Updates (if necessary) and returns the current JPEG/ETH price
    /// @return result The current JPEG/ETH price
    function consultJPEGPriceETH(address _token) external returns (uint256 result) {
        result = jpegOracle.consultAndUpdateIfNecessary(_token, 1 ether);
        if (result == 0) revert InvalidOracleResults();
    }

    /// @notice Allows the owner to whitelist addresses for the getFloorETH function
    function addFloorOracle(IAggregatorV3Interface _oracle, address _vault) external onlyOwner {
        if (address(_vault) == address(0))
            revert ZeroAddress();
        floorMap[_vault] = _oracle;
    }

    /// @dev Fetches and converts to 18 decimals precision the latest answer of a Chainlink aggregator
    /// @param aggregator The aggregator to fetch the answer from
    /// @return The latest aggregator answer, normalized
    function _normalizeAggregatorAnswer(IAggregatorV3Interface aggregator)
        internal
        view
        returns (uint256)
    {
        (, int256 answer, , uint256 timestamp, ) = aggregator.latestRoundData();

        if (answer == 0 || timestamp == 0) revert InvalidOracleResults();

        uint8 decimals = aggregator.decimals();

        unchecked {
            //converts the answer to have 18 decimals
            return
                decimals > 18
                    ? uint256(answer) / 10**(decimals - 18)
                    : uint256(answer) * 10**(18 - decimals);
        }
    }
}

File 2 of 5 : 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 5 : IAggregatorV3Interface.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

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

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

File 4 of 5 : IUniswapV2Oracle.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

interface IUniswapV2Oracle {
    function consultAndUpdateIfNecessary(address token, uint256 amountIn)
        external
        returns (uint256);
}

File 5 of 5 : 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": 800
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IUniswapV2Oracle","name":"_jpegOracle","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidOracleResults","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract IAggregatorV3Interface","name":"_oracle","type":"address"},{"internalType":"address","name":"_vault","type":"address"}],"name":"addFloorOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"consultJPEGPriceETH","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"floorMap","outputs":[{"internalType":"contract IAggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFloorETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"jpegOracle","outputs":[{"internalType":"contract IUniswapV2Oracle","name":"","type":"address"}],"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":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5060405161087238038061087283398101604081905261002f916100d4565b61003833610084565b6001600160a01b03811661005f5760405163d92e233d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055610102565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100e5578081fd5b81516001600160a01b03811681146100fb578182fd5b9392505050565b610761806101116000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146100fb578063904d32611461010c578063b82b11cf14610135578063f2fde38b1461013d57600080fd5b80632a8c14251461008d57806332c4fe13146100bd57806341e4ef76146100de578063715018a6146100f3575b600080fd5b6001546100a0906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d06100cb366004610633565b610150565b6040519081526020016100b4565b6100f16100ec366004610656565b610202565b005b6100f16102c5565b6000546001600160a01b03166100a0565b6100a061011a366004610633565b6002602052600090815260409020546001600160a01b031681565b6100d061032b565b6100f161014b366004610633565b610370565b60015460405162cdeb8f60e31b81526001600160a01b038381166004830152670de0b6b3a76400006024830152600092169063066f5c7890604401602060405180830381600087803b1580156101a557600080fd5b505af11580156101b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101dd919061068e565b9050806101fd5760405163043adc8d60e21b815260040160405180910390fd5b919050565b6000546001600160a01b031633146102615760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b0381166102885760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03908116600090815260026020526040902080549190921673ffffffffffffffffffffffffffffffffffffffff19909116179055565b6000546001600160a01b0316331461031f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610258565b6103296000610452565b565b336000908152600260205260408120546001600160a01b031680610361576040516282b42960e81b815260040160405180910390fd5b61036a816104af565b91505090565b6000546001600160a01b031633146103ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610258565b6001600160a01b0381166104465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610258565b61044f81610452565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000836001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156104ed57600080fd5b505afa158015610501573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052591906106a6565b509350509250508160001480610539575080155b156105575760405163043adc8d60e21b815260040160405180910390fd5b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca91906106f5565b905060128160ff16116105e8578060120360ff16600a0a8302610610565b6012810360ff16600a0a838161060e57634e487b7160e01b600052601260045260246000fd5b045b95945050505050565b805169ffffffffffffffffffff811681146101fd57600080fd5b600060208284031215610644578081fd5b813561064f81610716565b9392505050565b60008060408385031215610668578081fd5b823561067381610716565b9150602083013561068381610716565b809150509250929050565b60006020828403121561069f578081fd5b5051919050565b600080600080600060a086880312156106bd578081fd5b6106c686610619565b94506020860151935060408601519250606086015191506106e960808701610619565b90509295509295909350565b600060208284031215610706578081fd5b815160ff8116811461064f578182fd5b6001600160a01b038116811461044f57600080fdfea2646970667358221220dd2dc48c7e9c8dad7fb06d4d316b2f6def843868fb9576a14dc4836d3d0d90d964736f6c63430008040033000000000000000000000000c77bcd51391d675a51eb2f041f348bec8b5ce503

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146100fb578063904d32611461010c578063b82b11cf14610135578063f2fde38b1461013d57600080fd5b80632a8c14251461008d57806332c4fe13146100bd57806341e4ef76146100de578063715018a6146100f3575b600080fd5b6001546100a0906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6100d06100cb366004610633565b610150565b6040519081526020016100b4565b6100f16100ec366004610656565b610202565b005b6100f16102c5565b6000546001600160a01b03166100a0565b6100a061011a366004610633565b6002602052600090815260409020546001600160a01b031681565b6100d061032b565b6100f161014b366004610633565b610370565b60015460405162cdeb8f60e31b81526001600160a01b038381166004830152670de0b6b3a76400006024830152600092169063066f5c7890604401602060405180830381600087803b1580156101a557600080fd5b505af11580156101b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101dd919061068e565b9050806101fd5760405163043adc8d60e21b815260040160405180910390fd5b919050565b6000546001600160a01b031633146102615760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b0381166102885760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03908116600090815260026020526040902080549190921673ffffffffffffffffffffffffffffffffffffffff19909116179055565b6000546001600160a01b0316331461031f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610258565b6103296000610452565b565b336000908152600260205260408120546001600160a01b031680610361576040516282b42960e81b815260040160405180910390fd5b61036a816104af565b91505090565b6000546001600160a01b031633146103ca5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610258565b6001600160a01b0381166104465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610258565b61044f81610452565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000836001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156104ed57600080fd5b505afa158015610501573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052591906106a6565b509350509250508160001480610539575080155b156105575760405163043adc8d60e21b815260040160405180910390fd5b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca91906106f5565b905060128160ff16116105e8578060120360ff16600a0a8302610610565b6012810360ff16600a0a838161060e57634e487b7160e01b600052601260045260246000fd5b045b95945050505050565b805169ffffffffffffffffffff811681146101fd57600080fd5b600060208284031215610644578081fd5b813561064f81610716565b9392505050565b60008060408385031215610668578081fd5b823561067381610716565b9150602083013561068381610716565b809150509250929050565b60006020828403121561069f578081fd5b5051919050565b600080600080600060a086880312156106bd578081fd5b6106c686610619565b94506020860151935060408601519250606086015191506106e960808701610619565b90509295509295909350565b600060208284031215610706578081fd5b815160ff8116811461064f578182fd5b6001600160a01b038116811461044f57600080fdfea2646970667358221220dd2dc48c7e9c8dad7fb06d4d316b2f6def843868fb9576a14dc4836d3d0d90d964736f6c63430008040033

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

000000000000000000000000c77bcd51391d675a51eb2f041f348bec8b5ce503

-----Decoded View---------------
Arg [0] : _jpegOracle (address): 0xC77BCd51391D675A51EB2F041F348bEc8b5ce503

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c77bcd51391d675a51eb2f041f348bec8b5ce503


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.