Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ChainlinkOracle
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.4;
import {IOracle} from "../interfaces/IOracle.sol";
import {IChainlinkAggregator} from "../interfaces/IChainlinkAggregator.sol";
/**
* @title Chainlink Oracle
*
* @notice Provides a value onchain from a chainlink oracle aggregator
*/
contract ChainlinkOracle is IOracle {
// The address of the Chainlink Aggregator contract
IChainlinkAggregator public immutable oracle;
uint256 public immutable stalenessThresholdSecs;
constructor(address _oracle, uint256 _stalenessThresholdSecs) {
oracle = IChainlinkAggregator(_oracle);
stalenessThresholdSecs = _stalenessThresholdSecs;
}
/**
* @notice Fetches the decimal precision used in the market price from chainlink
* @return priceDecimals_: Number of decimals in the price
*/
function priceDecimals() external view override returns (uint256) {
return oracle.decimals();
}
/**
* @notice Fetches the latest market price from chainlink
* @return Value: Latest market price.
* valid: Boolean indicating an value was fetched successfully.
*/
function getData() external view override returns (uint256, bool) {
(, int256 answer, , uint256 updatedAt, ) = oracle.latestRoundData();
uint256 diff = block.timestamp - updatedAt;
return (uint256(answer), diff <= stalenessThresholdSecs);
}
}// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
interface IChainlinkAggregator {
function decimals() external view returns (uint8);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}// SPDX-License-Identifier: GPL-3.0-or-later
interface IOracle {
function priceDecimals() external view returns (uint256);
function getData() external view returns (uint256, bool);
}{
"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[{"inputs":[{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"uint256","name":"_stalenessThresholdSecs","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getData","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"contract IChainlinkAggregator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stalenessThresholdSecs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c060405234801561001057600080fd5b5060405161041138038061041183398101604081905261002f9161004a565b60609190911b6001600160601b03191660805260a052610082565b6000806040838503121561005c578182fd5b82516001600160a01b0381168114610072578283fd5b6020939093015192949293505050565b60805160601c60a0516103556100bc600039600081816071015261023a01526000818160b50152818160f3015261019201526103556000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806305300b281461005157806315eac3e31461006c5780633bc5de30146100935780637dc0d1d0146100b0575b600080fd5b6100596100ef565b6040519081526020015b60405180910390f35b6100597f000000000000000000000000000000000000000000000000000000000000000081565b61009b61018a565b60408051928352901515602083015201610063565b6100d77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610063565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561014a57600080fd5b505afa15801561015e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018291906102d4565b60ff16905090565b6000806000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156101e957600080fd5b505afa1580156101fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102219190610285565b509350509250506000814261023691906102fc565b92957f00000000000000000000000000000000000000000000000000000000000000009093111594509192505050565b805169ffffffffffffffffffff8116811461028057600080fd5b919050565b600080600080600060a0868803121561029c578081fd5b6102a586610266565b94506020860151935060408601519250606086015191506102c860808701610266565b90509295509295909350565b6000602082840312156102e5578081fd5b815160ff811681146102f5578182fd5b9392505050565b60008282101561031a57634e487b7160e01b81526011600452602481fd5b50039056fea2646970667358221220bf911f767b4a1a4f5f358602b91c875b198190a1e98e9470f3cc8accad53d0d564736f6c634300080400330000000000000000000000000518673439245bb95a58688bc31cd513f3d5bdd60000000000000000000000000000000000000000000000000000000000015180
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806305300b281461005157806315eac3e31461006c5780633bc5de30146100935780637dc0d1d0146100b0575b600080fd5b6100596100ef565b6040519081526020015b60405180910390f35b6100597f000000000000000000000000000000000000000000000000000000000001518081565b61009b61018a565b60408051928352901515602083015201610063565b6100d77f0000000000000000000000000518673439245bb95a58688bc31cd513f3d5bdd681565b6040516001600160a01b039091168152602001610063565b60007f0000000000000000000000000518673439245bb95a58688bc31cd513f3d5bdd66001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561014a57600080fd5b505afa15801561015e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018291906102d4565b60ff16905090565b6000806000807f0000000000000000000000000518673439245bb95a58688bc31cd513f3d5bdd66001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156101e957600080fd5b505afa1580156101fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102219190610285565b509350509250506000814261023691906102fc565b92957f00000000000000000000000000000000000000000000000000000000000151809093111594509192505050565b805169ffffffffffffffffffff8116811461028057600080fd5b919050565b600080600080600060a0868803121561029c578081fd5b6102a586610266565b94506020860151935060408601519250606086015191506102c860808701610266565b90509295509295909350565b6000602082840312156102e5578081fd5b815160ff811681146102f5578182fd5b9392505050565b60008282101561031a57634e487b7160e01b81526011600452602481fd5b50039056fea2646970667358221220bf911f767b4a1a4f5f358602b91c875b198190a1e98e9470f3cc8accad53d0d564736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000518673439245bb95a58688bc31cd513f3d5bdd60000000000000000000000000000000000000000000000000000000000015180
-----Decoded View---------------
Arg [0] : _oracle (address): 0x0518673439245BB95A58688Bc31cd513F3D5bDd6
Arg [1] : _stalenessThresholdSecs (uint256): 86400
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000518673439245bb95a58688bc31cd513f3d5bdd6
Arg [1] : 0000000000000000000000000000000000000000000000000000000000015180
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.