Source Code
Overview
ETH Balance
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x30a5A41C...Ed038f54C The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PriceDataProvider
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol';
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
contract PriceDataProvider is Ownable {
address[] public aggregators;
address[] public assets;
struct PriceRecord {
address contractAddress;
int256 price;
}
mapping(address => address) public assetSources; // underlying asset => source
function setAssetSources(
address[] calldata sources,
address[] calldata underlyingAssets
)
external
onlyOwner
{
require(sources.length == underlyingAssets.length, 'WRONG_INPUT');
for (uint256 i = 0; i < sources.length; i++) {
assetSources[underlyingAssets[i]] = sources[i];
aggregators.push(sources[i]);
assets.push(underlyingAssets[i]);
}
}
function getPrice(address underlying) public view returns (int256 value) {
value = IChainlinkAggregator(assetSources[underlying]).latestAnswer();
}
function getPrices() external view returns (PriceRecord[] memory) {
PriceRecord[] memory pricesData = new PriceRecord[](assets.length);
for (uint256 i = 0; i < assets.length; i++) {
PriceRecord memory priceData = pricesData[i];
priceData.contractAddress = assets[i];
priceData.price = getPrice(assets[i]);
}
return pricesData;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/*
* @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 GSN 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 payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import './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.
*/
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() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view 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;
}
}// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
interface IChainlinkAggregator {
function decimals() external view returns (uint8);
function latestAnswer() external view returns (int256);
function latestTimestamp() external view returns (uint256);
function latestRound() external view returns (uint256);
function getAnswer(uint256 roundId) external view returns (int256);
function getTimestamp(uint256 roundId) external view returns (uint256);
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);
event NewRound(uint256 indexed roundId, address indexed startedBy);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"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":"uint256","name":"","type":"uint256"}],"name":"aggregators","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"assetSources","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"assets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"}],"name":"getPrice","outputs":[{"internalType":"int256","name":"value","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrices","outputs":[{"components":[{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"int256","name":"price","type":"int256"}],"internalType":"struct PriceDataProvider.PriceRecord[]","name":"","type":"tuple[]"}],"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":"sources","type":"address[]"},{"internalType":"address[]","name":"underlyingAssets","type":"address[]"}],"name":"setAssetSources","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
0x608060405234801561001057600080fd5b50600061001b61006a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35061006e565b3390565b61086e8061007d6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638e0a94d1116100665780638e0a94d1146100f3578063abfd531014610106578063bd9a548b14610119578063cf35bdd01461012e578063f2fde38b1461014157610093565b806341976e0914610098578063715018a6146100c15780637c6c8985146100cb5780638da5cb5b146100eb575b600080fd5b6100ab6100a636600461065c565b610154565b6040516100b8919061078f565b60405180910390f35b6100c96101e4565b005b6100de6100d936600461065c565b61026c565b6040516100b89190610723565b6100de610287565b6100de61010136600461070b565b610296565b6100c961011436600461068a565b6102bd565b61012161044a565b6040516100b89190610737565b6100de61013c36600461070b565b610535565b6100c961014f36600461065c565b610542565b6001600160a01b0380821660009081526003602090815260408083205481516350d25bcd60e01b81529151939416926350d25bcd92600480840193919291829003018186803b1580156101a657600080fd5b505afa1580156101ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101de91906106f3565b92915050565b6101ec6105f8565b6000546001600160a01b039081169116146102225760405162461bcd60e51b8152600401610219906107de565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6003602052600090815260409020546001600160a01b031681565b6000546001600160a01b031690565b600181815481106102a357fe5b6000918252602090912001546001600160a01b0316905081565b6102c56105f8565b6000546001600160a01b039081169116146102f25760405162461bcd60e51b8152600401610219906107de565b8281146103115760405162461bcd60e51b815260040161021990610813565b60005b838110156104435784848281811061032857fe5b905060200201602081019061033d919061065c565b6003600085858581811061034d57fe5b9050602002016020810190610362919061065c565b6001600160a01b039081168252602082019290925260400160002080546001600160a01b0319169290911691909117905560018585838181106103a157fe5b90506020020160208101906103b6919061065c565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905560028383838181106103f657fe5b905060200201602081019061040b919061065c565b815460018082018455600093845260209093200180546001600160a01b0319166001600160a01b039290921691909117905501610314565b5050505050565b600254606090819067ffffffffffffffff8111801561046857600080fd5b506040519080825280602002602001820160405280156104a257816020015b61048f6105fc565b8152602001906001900390816104875790505b50905060005b60025481101561052f576104ba6105fc565b8282815181106104c657fe5b60200260200101519050600282815481106104dd57fe5b6000918252602090912001546001600160a01b031681526002805461052191908490811061050757fe5b6000918252602090912001546001600160a01b0316610154565b6020909101526001016104a8565b50905090565b600281815481106102a357fe5b61054a6105f8565b6000546001600160a01b039081169116146105775760405162461bcd60e51b8152600401610219906107de565b6001600160a01b03811661059d5760405162461bcd60e51b815260040161021990610798565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b604080518082019091526000808252602082015290565b60008083601f840112610624578182fd5b50813567ffffffffffffffff81111561063b578182fd5b602083019150836020808302850101111561065557600080fd5b9250929050565b60006020828403121561066d578081fd5b81356001600160a01b0381168114610683578182fd5b9392505050565b6000806000806040858703121561069f578283fd5b843567ffffffffffffffff808211156106b6578485fd5b6106c288838901610613565b909650945060208701359150808211156106da578384fd5b506106e787828801610613565b95989497509550505050565b600060208284031215610704578081fd5b5051919050565b60006020828403121561071c578081fd5b5035919050565b6001600160a01b0391909116815260200190565b602080825282518282018190526000919060409081850190868401855b8281101561078257815180516001600160a01b03168552860151868501529284019290850190600101610754565b5091979650505050505050565b90815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600b908201526a15d493d391d7d25394155560aa1b60408201526060019056fea2646970667358221220c4e64397cadaa26f477815cca2920f2c57945666303375c330aa6d3d1796454364736f6c634300060c0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638e0a94d1116100665780638e0a94d1146100f3578063abfd531014610106578063bd9a548b14610119578063cf35bdd01461012e578063f2fde38b1461014157610093565b806341976e0914610098578063715018a6146100c15780637c6c8985146100cb5780638da5cb5b146100eb575b600080fd5b6100ab6100a636600461065c565b610154565b6040516100b8919061078f565b60405180910390f35b6100c96101e4565b005b6100de6100d936600461065c565b61026c565b6040516100b89190610723565b6100de610287565b6100de61010136600461070b565b610296565b6100c961011436600461068a565b6102bd565b61012161044a565b6040516100b89190610737565b6100de61013c36600461070b565b610535565b6100c961014f36600461065c565b610542565b6001600160a01b0380821660009081526003602090815260408083205481516350d25bcd60e01b81529151939416926350d25bcd92600480840193919291829003018186803b1580156101a657600080fd5b505afa1580156101ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101de91906106f3565b92915050565b6101ec6105f8565b6000546001600160a01b039081169116146102225760405162461bcd60e51b8152600401610219906107de565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6003602052600090815260409020546001600160a01b031681565b6000546001600160a01b031690565b600181815481106102a357fe5b6000918252602090912001546001600160a01b0316905081565b6102c56105f8565b6000546001600160a01b039081169116146102f25760405162461bcd60e51b8152600401610219906107de565b8281146103115760405162461bcd60e51b815260040161021990610813565b60005b838110156104435784848281811061032857fe5b905060200201602081019061033d919061065c565b6003600085858581811061034d57fe5b9050602002016020810190610362919061065c565b6001600160a01b039081168252602082019290925260400160002080546001600160a01b0319169290911691909117905560018585838181106103a157fe5b90506020020160208101906103b6919061065c565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905560028383838181106103f657fe5b905060200201602081019061040b919061065c565b815460018082018455600093845260209093200180546001600160a01b0319166001600160a01b039290921691909117905501610314565b5050505050565b600254606090819067ffffffffffffffff8111801561046857600080fd5b506040519080825280602002602001820160405280156104a257816020015b61048f6105fc565b8152602001906001900390816104875790505b50905060005b60025481101561052f576104ba6105fc565b8282815181106104c657fe5b60200260200101519050600282815481106104dd57fe5b6000918252602090912001546001600160a01b031681526002805461052191908490811061050757fe5b6000918252602090912001546001600160a01b0316610154565b6020909101526001016104a8565b50905090565b600281815481106102a357fe5b61054a6105f8565b6000546001600160a01b039081169116146105775760405162461bcd60e51b8152600401610219906107de565b6001600160a01b03811661059d5760405162461bcd60e51b815260040161021990610798565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b604080518082019091526000808252602082015290565b60008083601f840112610624578182fd5b50813567ffffffffffffffff81111561063b578182fd5b602083019150836020808302850101111561065557600080fd5b9250929050565b60006020828403121561066d578081fd5b81356001600160a01b0381168114610683578182fd5b9392505050565b6000806000806040858703121561069f578283fd5b843567ffffffffffffffff808211156106b6578485fd5b6106c288838901610613565b909650945060208701359150808211156106da578384fd5b506106e787828801610613565b95989497509550505050565b600060208284031215610704578081fd5b5051919050565b60006020828403121561071c578081fd5b5035919050565b6001600160a01b0391909116815260200190565b602080825282518282018190526000919060409081850190868401855b8281101561078257815180516001600160a01b03168552860151868501529284019290850190600101610754565b5091979650505050505050565b90815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600b908201526a15d493d391d7d25394155560aa1b60408201526060019056fea2646970667358221220c4e64397cadaa26f477815cca2920f2c57945666303375c330aa6d3d1796454364736f6c634300060c0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.