false
false
0

Contract Address Details

0x9bFc3046ea26f8B09D3E85bd22AEc96C80D957e3

Contract Name
PriceFeed
Creator
0xc7d98c–7f3521 at 0xcae5ad–79f438
Balance
0 CLO
Tokens
Fetching tokens...
Transactions
66,351 Transactions
Transfers
0 Transfers
Gas Used
7,008,871,324
Last Balance Update
16292288
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
PriceFeed




Optimization enabled
true
Compiler version
v0.8.7+commit.e28d00a7




Optimization runs
200
EVM Version
default




Verified at
2024-09-26T15:33:47.192233Z

Contract source code

// SPDX-License-Identifier: No License (None)
pragma solidity ^0.8.0;

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

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

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

    /**
     * @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() == msg.sender, "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;
    }
}

contract PriceFeed is Ownable {
    address public system;
    mapping(address => uint256) internal _price;    // token price

    event SetSystem(address _system);
    event SetPrice(address token, uint256 price);

    modifier onlyOwnerOrSystem() {
        require(msg.sender == system || msg.sender == owner(), "Only system or owner");
        _;
    }

    function setSystem(address _system) onlyOwner external
    {
        system = _system;
        emit SetSystem(_system);
    }

    // returns token price in USD with 18 decimals
    function getPrice(address token) external view returns(uint256 price) {
        price = _price[token];
        require(price != 0, "Incorrect price");
    }

    // set token price in USD with 18 decimals
    function setPrice(address token, uint256 price) external onlyOwnerOrSystem {
        _price[token] = price;
        emit SetPrice(token, price);
    }

    // set tokens prices in USD with 18 decimals
    function setPrices(address[] memory token, uint256[] memory price) external onlyOwnerOrSystem {
        require(token.length == price.length, "Incorrect length");
        for (uint i=0; i<token.length; i++) {
            _price[token[i]] = price[i];
            emit SetPrice(token[i], price[i]);
        }
    }
}
        

Contract ABI

[{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SetPrice","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"price","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetSystem","inputs":[{"type":"address","name":"_system","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"price","internalType":"uint256"}],"name":"getPrice","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPrice","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"price","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPrices","inputs":[{"type":"address[]","name":"token","internalType":"address[]"},{"type":"uint256[]","name":"price","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSystem","inputs":[{"type":"address","name":"_system","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"system","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

Verify & Publish
0x608060405234801561001057600080fd5b50600080546001600160a01b0319163390811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36108c28061005f6000396000f3fe608060405234801561001057600080fd5b50600436106100875760003560e01c8063715018a61161005b578063715018a6146100ed5780638da5cb5b146100f557806395bf75fd1461011a578063f2fde38b1461012d57600080fd5b8062e4768b1461008c57806341976e09146100a15780634352fa9f146100c757806355837757146100da575b600080fd5b61009f61009a3660046106bc565b610140565b005b6100b46100af36600461069a565b610203565b6040519081526020015b60405180910390f35b61009f6100d53660046106e6565b610260565b61009f6100e836600461069a565b610408565b61009f610495565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100be565b600154610102906001600160a01b031681565b61009f61013b36600461069a565b610518565b6001546001600160a01b031633148061016357506000546001600160a01b031633145b6101ab5760405162461bcd60e51b815260206004820152601460248201527327b7363c9039bcb9ba32b69037b91037bbb732b960611b60448201526064015b60405180910390fd5b6001600160a01b038216600081815260026020908152604091829020849055815192835282018390527f95dce27040c59c8b1c445b284f81a3aaae6eecd7d08d5c7684faee64cdb514a1910160405180910390a15050565b6001600160a01b0381166000908152600260205260409020548061025b5760405162461bcd60e51b815260206004820152600f60248201526e496e636f727265637420707269636560881b60448201526064016101a2565b919050565b6001546001600160a01b031633148061028357506000546001600160a01b031633145b6102c65760405162461bcd60e51b815260206004820152601460248201527327b7363c9039bcb9ba32b69037b91037bbb732b960611b60448201526064016101a2565b805182511461030a5760405162461bcd60e51b815260206004820152601060248201526f092dcc6dee4e4cac6e840d8cadccee8d60831b60448201526064016101a2565b60005b82518110156104035781818151811061032857610328610860565b60200260200101516002600085848151811061034657610346610860565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f95dce27040c59c8b1c445b284f81a3aaae6eecd7d08d5c7684faee64cdb514a18382815181106103a5576103a5610860565b60200260200101518383815181106103bf576103bf610860565b60200260200101516040516103e99291906001600160a01b03929092168252602082015260400190565b60405180910390a1806103fb81610837565b91505061030d565b505050565b3361041b6000546001600160a01b031690565b6001600160a01b0316146104415760405162461bcd60e51b81526004016101a2906107ad565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f49cd4dad53143519125de2da7395d254bd24b8f3c049554685fadeafc1fd96c89060200160405180910390a150565b336104a86000546001600160a01b031690565b6001600160a01b0316146104ce5760405162461bcd60e51b81526004016101a2906107ad565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b3361052b6000546001600160a01b031690565b6001600160a01b0316146105515760405162461bcd60e51b81526004016101a2906107ad565b6001600160a01b0381166105b65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101a2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b038116811461025b57600080fd5b600082601f83011261063957600080fd5b8135602061064e61064983610813565b6107e2565b80838252828201915082860187848660051b890101111561066e57600080fd5b60005b8581101561068d57813584529284019290840190600101610671565b5090979650505050505050565b6000602082840312156106ac57600080fd5b6106b582610611565b9392505050565b600080604083850312156106cf57600080fd5b6106d883610611565b946020939093013593505050565b600080604083850312156106f957600080fd5b823567ffffffffffffffff8082111561071157600080fd5b818501915085601f83011261072557600080fd5b8135602061073561064983610813565b8083825282820191508286018a848660051b890101111561075557600080fd5b600096505b8487101561077f5761076b81610611565b83526001969096019591830191830161075a565b509650508601359250508082111561079657600080fd5b506107a385828601610628565b9150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561080b5761080b610876565b604052919050565b600067ffffffffffffffff82111561082d5761082d610876565b5060051b60200190565b600060001982141561085957634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220260f5c655cb913b2a7f94b3a7a82b399af967d27a19df1bf23dfb506c8b0182164736f6c63430008070033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100875760003560e01c8063715018a61161005b578063715018a6146100ed5780638da5cb5b146100f557806395bf75fd1461011a578063f2fde38b1461012d57600080fd5b8062e4768b1461008c57806341976e09146100a15780634352fa9f146100c757806355837757146100da575b600080fd5b61009f61009a3660046106bc565b610140565b005b6100b46100af36600461069a565b610203565b6040519081526020015b60405180910390f35b61009f6100d53660046106e6565b610260565b61009f6100e836600461069a565b610408565b61009f610495565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100be565b600154610102906001600160a01b031681565b61009f61013b36600461069a565b610518565b6001546001600160a01b031633148061016357506000546001600160a01b031633145b6101ab5760405162461bcd60e51b815260206004820152601460248201527327b7363c9039bcb9ba32b69037b91037bbb732b960611b60448201526064015b60405180910390fd5b6001600160a01b038216600081815260026020908152604091829020849055815192835282018390527f95dce27040c59c8b1c445b284f81a3aaae6eecd7d08d5c7684faee64cdb514a1910160405180910390a15050565b6001600160a01b0381166000908152600260205260409020548061025b5760405162461bcd60e51b815260206004820152600f60248201526e496e636f727265637420707269636560881b60448201526064016101a2565b919050565b6001546001600160a01b031633148061028357506000546001600160a01b031633145b6102c65760405162461bcd60e51b815260206004820152601460248201527327b7363c9039bcb9ba32b69037b91037bbb732b960611b60448201526064016101a2565b805182511461030a5760405162461bcd60e51b815260206004820152601060248201526f092dcc6dee4e4cac6e840d8cadccee8d60831b60448201526064016101a2565b60005b82518110156104035781818151811061032857610328610860565b60200260200101516002600085848151811061034657610346610860565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f95dce27040c59c8b1c445b284f81a3aaae6eecd7d08d5c7684faee64cdb514a18382815181106103a5576103a5610860565b60200260200101518383815181106103bf576103bf610860565b60200260200101516040516103e99291906001600160a01b03929092168252602082015260400190565b60405180910390a1806103fb81610837565b91505061030d565b505050565b3361041b6000546001600160a01b031690565b6001600160a01b0316146104415760405162461bcd60e51b81526004016101a2906107ad565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f49cd4dad53143519125de2da7395d254bd24b8f3c049554685fadeafc1fd96c89060200160405180910390a150565b336104a86000546001600160a01b031690565b6001600160a01b0316146104ce5760405162461bcd60e51b81526004016101a2906107ad565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b3361052b6000546001600160a01b031690565b6001600160a01b0316146105515760405162461bcd60e51b81526004016101a2906107ad565b6001600160a01b0381166105b65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101a2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b80356001600160a01b038116811461025b57600080fd5b600082601f83011261063957600080fd5b8135602061064e61064983610813565b6107e2565b80838252828201915082860187848660051b890101111561066e57600080fd5b60005b8581101561068d57813584529284019290840190600101610671565b5090979650505050505050565b6000602082840312156106ac57600080fd5b6106b582610611565b9392505050565b600080604083850312156106cf57600080fd5b6106d883610611565b946020939093013593505050565b600080604083850312156106f957600080fd5b823567ffffffffffffffff8082111561071157600080fd5b818501915085601f83011261072557600080fd5b8135602061073561064983610813565b8083825282820191508286018a848660051b890101111561075557600080fd5b600096505b8487101561077f5761076b81610611565b83526001969096019591830191830161075a565b509650508601359250508082111561079657600080fd5b506107a385828601610628565b9150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561080b5761080b610876565b604052919050565b600067ffffffffffffffff82111561082d5761082d610876565b5060051b60200190565b600060001982141561085957634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220260f5c655cb913b2a7f94b3a7a82b399af967d27a19df1bf23dfb506c8b0182164736f6c63430008070033