Contract Address Details
contract
Swarm

0x0FDc5429C50e2a39066D8A94F3e2D2476fcc3b85

Contract Name
PriceOracle
Creator
0xe12616–dfecb2 at 0x46ffe2–067efb
Balance
0 xDAI ( )
Tokens
Fetching tokens...
Transactions
Transfers
Gas Used
Last Balance Update
18607755
Contract name:
PriceOracle




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
200
EVM Version
default




Verified at
2021-06-11 10:02:00.347963Z

Constructor Arguments

00000000000000000000000000000000000000000000000000000000000186a00000000000000000000000000000000000000000000000000000000000000064

Arg [0] (uint256) : 100000
Arg [1] (uint256) : 100

              

Contract source code

// Sources flattened with hardhat v2.3.0 https://hardhat.org
// File @openzeppelin/contracts/utils/[email protected]
// : MIT
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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File @openzeppelin/contracts/access/[email protected]
// : MIT
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 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 () {
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 src/PriceOracle.sol
// : BSD-3-Clause
pragma solidity ^0.8.4;
/**
* @title PriceOracle contract
* @author The Swarm Authors
* @dev The price oracle contract keeps track of the current prices for settlement in swap accounting.
*/
contract PriceOracle is Ownable {
/**
* @dev Emitted when the price is updated.
*/
event PriceUpdate(uint256 price);
/**
* @dev Emitted when the cheque value deduction amount is updated.
*/
event ChequeValueDeductionUpdate(uint256 chequeValueDeduction);
// current price in PLUR per accounting unit
uint256 public price;
// value deducted from first received cheque from a peer in PLUR
uint256 public chequeValueDeduction;
constructor(uint256 _price, uint256 _chequeValueDeduction) {
price = _price;
chequeValueDeduction = _chequeValueDeduction;
}
/**
* @notice Returns the current price in PLUR per accounting unit and the current cheque value deduction amount.
*/
function getPrice() external view returns (uint256, uint256) {
return (price, chequeValueDeduction);
}
/**
* @notice Update the price. Can only be called by the owner.
* @param newPrice the new price
*/
function updatePrice(uint256 newPrice) external onlyOwner {
price = newPrice;
emit PriceUpdate(price);
}
/**
* @notice Update the cheque value deduction amount. Can only be called by the owner.
* @param newChequeValueDeduction the new cheque value deduction amount
*/
function updateChequeValueDeduction(uint256 newChequeValueDeduction)
external
onlyOwner
{
chequeValueDeduction = newChequeValueDeduction;
emit ChequeValueDeductionUpdate(chequeValueDeduction);
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"uint256","name":"_chequeValueDeduction","internalType":"uint256"}]},{"type":"event","name":"ChequeValueDeductionUpdate","inputs":[{"type":"uint256","name":"chequeValueDeduction","internalType":"uint256","indexed":false}],"anonymous":false},{"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":"PriceUpdate","inputs":[{"type":"uint256","name":"price","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"chequeValueDeduction","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"price","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateChequeValueDeduction","inputs":[{"type":"uint256","name":"newChequeValueDeduction","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePrice","inputs":[{"type":"uint256","name":"newPrice","internalType":"uint256"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c806398d5fdca1161005b57806398d5fdca146100dd578063a035b1fe146100f8578063dd4899321461010f578063f2fde38b1461011857600080fd5b8063710f2dd11461008d578063715018a6146100a25780638d6cc56d146100aa5780638da5cb5b146100bd575b600080fd5b6100a061009b366004610385565b61012b565b005b6100a061019a565b6100a06100b8366004610385565b61020e565b6000546040516001600160a01b0390911681526020015b60405180910390f35b600154600254604080519283526020830191909152016100d4565b61010160015481565b6040519081526020016100d4565b61010160025481565b6100a0610126366004610357565b61026d565b6000546001600160a01b0316331461015e5760405162461bcd60e51b81526004016101559061039d565b60405180910390fd5b60028190556040518181527f0f45948e42a1e34f851df8452200e744563dae2029a99b8178ff6530458bd3df906020015b60405180910390a150565b6000546001600160a01b031633146101c45760405162461bcd60e51b81526004016101559061039d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146102385760405162461bcd60e51b81526004016101559061039d565b60018190556040518181527fae46785019700e30375a5d7b4f91e32f8060ef085111f896ebf889450aa2ab5a9060200161018f565b6000546001600160a01b031633146102975760405162461bcd60e51b81526004016101559061039d565b6001600160a01b0381166102fc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610155565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600060208284031215610368578081fd5b81356001600160a01b038116811461037e578182fd5b9392505050565b600060208284031215610396578081fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea264697066735822122069737c178b79be7973d71a433150ff2571d211a983a7f5a5ba0f7dba3d57fd7664736f6c63430008040033