Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x7FbFbe6C...F711D99DB The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
API3OracleWrapper
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 100000 runs
Other Settings:
berlin EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import "@api3/contracts/v0.8/interfaces/IProxy.sol";
import {ICLSynchronicityPriceAdapter} from "./interfaces/ICLSynchronicityPriceAdapter.sol";
contract API3OracleWrapper is Ownable, ICLSynchronicityPriceAdapter {
// The proxy contract address obtained from the API3 Market UI.
address public immutable proxyAddress;
uint256 public validityDuration = 1 days;
constructor(address _proxyAddress) {
proxyAddress = _proxyAddress;
}
function setValidityDuration(uint256 _validityDuration) external onlyOwner {
validityDuration = _validityDuration;
}
/// @inheritdoc ICLSynchronicityPriceAdapter
function latestAnswer() public view virtual override returns (int256) {
(int224 value, uint256 timestamp) = IProxy(proxyAddress).read();
require(block.timestamp - timestamp < validityDuration, "price expired");
//convert decimals, api3 decimal is 18
int256 convertedValue = int256(value) / 1e10;
return convertedValue;
}
function decimals() external pure returns (uint8) {
return 8;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @dev See DapiProxy.sol for comments about usage
interface IProxy {
function read() external view returns (int224 value, uint32 timestamp);
function api3ServerV1() external view returns (address);
}// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@api3/airnode-protocol-v1/contracts/api3-server-v1/proxies/interfaces/IProxy.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../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.
*
* 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() {
_transferOwnership(_msgSender());
}
/**
* @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 {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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 v4.9.4) (utils/Context.sol)
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) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ICLSynchronicityPriceAdapter {
/**
* @notice Calculates the current answer based on the aggregators.
*/
function latestAnswer() external view returns (int256);
error DecimalsAboveLimit();
error DecimalsNotEqual();
}{
"optimizer": {
"enabled": true,
"runs": 100000
},
"evmVersion": "berlin",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_proxyAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DecimalsAboveLimit","type":"error"},{"inputs":[],"name":"DecimalsNotEqual","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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_validityDuration","type":"uint256"}],"name":"setValidityDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"validityDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
0x60a06040526201518060015534801561001757600080fd5b506040516106f73803806106f7833981016040819052610036916100a0565b61003f33610050565b6001600160a01b03166080526100d0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100b257600080fd5b81516001600160a01b03811681146100c957600080fd5b9392505050565b6080516106066100f1600039600081816092015261016e01526106066000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063683ce0321161005b578063683ce03214610118578063715018a6146101215780638da5cb5b14610129578063f2fde38b1461014757600080fd5b806323f5c02d1461008d578063313ce567146100de57806343aa9df7146100ed57806350d25bcd14610102575b600080fd5b6100b47f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b604051600881526020016100d5565b6101006100fb36600461045c565b61015a565b005b61010a610167565b6040519081526020016100d5565b61010a60015481565b61010061029b565b60005473ffffffffffffffffffffffffffffffffffffffff166100b4565b610100610155366004610475565b6102af565b610162610366565b600155565b60008060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b81526004016040805180830381865afa1580156101d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fa91906104b2565b60015491935063ffffffff169150610212824261052a565b1061027e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f707269636520657870697265640000000000000000000000000000000000000060448201526064015b60405180910390fd5b60006102936402540be400601b85900b610541565b949350505050565b6102a3610366565b6102ad60006103e7565b565b6102b7610366565b73ffffffffffffffffffffffffffffffffffffffff811661035a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610275565b610363816103e7565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610275565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561046e57600080fd5b5035919050565b60006020828403121561048757600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146104ab57600080fd5b9392505050565b600080604083850312156104c557600080fd5b825180601b0b81146104d657600080fd5b602084015190925063ffffffff811681146104f057600080fd5b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561053c5761053c6104fb565b500390565b600082610577577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f8000000000000000000000000000000000000000000000000000000000000000831416156105cb576105cb6104fb565b50059056fea2646970667358221220d5fea52e2a2c5dadc86f8e3fe9e101d64011762090c2c1e9ca7f6892659befba64736f6c634300080a0033000000000000000000000000d76ec3edcf5547b4183bf5a82a4080ff95b58c59
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063683ce0321161005b578063683ce03214610118578063715018a6146101215780638da5cb5b14610129578063f2fde38b1461014757600080fd5b806323f5c02d1461008d578063313ce567146100de57806343aa9df7146100ed57806350d25bcd14610102575b600080fd5b6100b47f000000000000000000000000d76ec3edcf5547b4183bf5a82a4080ff95b58c5981565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b604051600881526020016100d5565b6101006100fb36600461045c565b61015a565b005b61010a610167565b6040519081526020016100d5565b61010a60015481565b61010061029b565b60005473ffffffffffffffffffffffffffffffffffffffff166100b4565b610100610155366004610475565b6102af565b610162610366565b600155565b60008060007f000000000000000000000000d76ec3edcf5547b4183bf5a82a4080ff95b58c5973ffffffffffffffffffffffffffffffffffffffff166357de26a46040518163ffffffff1660e01b81526004016040805180830381865afa1580156101d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fa91906104b2565b60015491935063ffffffff169150610212824261052a565b1061027e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f707269636520657870697265640000000000000000000000000000000000000060448201526064015b60405180910390fd5b60006102936402540be400601b85900b610541565b949350505050565b6102a3610366565b6102ad60006103e7565b565b6102b7610366565b73ffffffffffffffffffffffffffffffffffffffff811661035a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610275565b610363816103e7565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610275565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561046e57600080fd5b5035919050565b60006020828403121561048757600080fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146104ab57600080fd5b9392505050565b600080604083850312156104c557600080fd5b825180601b0b81146104d657600080fd5b602084015190925063ffffffff811681146104f057600080fd5b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561053c5761053c6104fb565b500390565b600082610577577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f8000000000000000000000000000000000000000000000000000000000000000831416156105cb576105cb6104fb565b50059056fea2646970667358221220d5fea52e2a2c5dadc86f8e3fe9e101d64011762090c2c1e9ca7f6892659befba64736f6c634300080a0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
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.