Source Code
Overview
S Balance
More Info
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Update Price | 17202408 | 17 days ago | IN | 0 S | 0.00005028 |
Loading...
Loading
Contract Name:
WhiteRockPriceFeed
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 100000 runs
Other Settings:
berlin EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; contract WhiteRockPriceFeed is Ownable { uint256 public price; constructor() Ownable(msg.sender) { } // Update the price function updatePrice(uint256 _price) external onlyOwner { price = _price; } // Get the latest price function latestAnswer() external view returns (uint256) { return price; } function updateOwner(address _newOwner) external onlyOwner { transferOwnership(_newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../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. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
{ "optimizer": { "enabled": true, "runs": 100000 }, "evmVersion": "berlin", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","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":[],"name":"latestAnswer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"updateOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"updatePrice","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50338061003757604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61004081610046565b50610096565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6102fc806100a56000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638d6cc56d1161005b5780638d6cc56d146100b65780638da5cb5b146100c9578063a035b1fe146100f1578063f2fde38b146100fa57600080fd5b806350d25bcd14610082578063715018a614610099578063880cdc31146100a3575b600080fd5b6001545b6040519081526020015b60405180910390f35b6100a161010d565b005b6100a16100b1366004610270565b610121565b6100a16100c43660046102ad565b610135565b60005460405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610090565b61008660015481565b6100a1610108366004610270565b610142565b6101156101a8565b61011f60006101fb565b565b6101296101a8565b61013281610142565b50565b61013d6101a8565b600155565b61014a6101a8565b73ffffffffffffffffffffffffffffffffffffffff811661019f576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b610132816101fb565b60005473ffffffffffffffffffffffffffffffffffffffff16331461011f576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610196565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561028257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146102a657600080fd5b9392505050565b6000602082840312156102bf57600080fd5b503591905056fea264697066735822122003a423741756afe68a00f41f93392f1ccbfc7e009e785d2a77ce24c07f3d39a164736f6c63430008160033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638d6cc56d1161005b5780638d6cc56d146100b65780638da5cb5b146100c9578063a035b1fe146100f1578063f2fde38b146100fa57600080fd5b806350d25bcd14610082578063715018a614610099578063880cdc31146100a3575b600080fd5b6001545b6040519081526020015b60405180910390f35b6100a161010d565b005b6100a16100b1366004610270565b610121565b6100a16100c43660046102ad565b610135565b60005460405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610090565b61008660015481565b6100a1610108366004610270565b610142565b6101156101a8565b61011f60006101fb565b565b6101296101a8565b61013281610142565b50565b61013d6101a8565b600155565b61014a6101a8565b73ffffffffffffffffffffffffffffffffffffffff811661019f576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b610132816101fb565b60005473ffffffffffffffffffffffffffffffffffffffff16331461011f576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610196565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561028257600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146102a657600080fd5b9392505050565b6000602082840312156102bf57600080fd5b503591905056fea264697066735822122003a423741756afe68a00f41f93392f1ccbfc7e009e785d2a77ce24c07f3d39a164736f6c63430008160033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.