Source Code
Overview
S Balance
S Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
OracleForQA
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
import {IERC20Metadata} from "openzeppelin5/token/ERC20/extensions/IERC20Metadata.sol";
import {ISiloOracle} from "silo-core/contracts/interfaces/ISiloOracle.sol";
contract OracleForQA is ISiloOracle {
address public immutable QUOTE_TOKEN;
uint256 public immutable BASE_DECIMALS;
address public immutable ADMIN;
uint256 public priceOfOneBaseToken;
error ZeroPrice();
error OnlyAdminCanSetPrice();
constructor (address base, address _quote, address _admin) {
QUOTE_TOKEN = _quote;
BASE_DECIMALS = IERC20Metadata(base).decimals();
ADMIN = _admin;
}
/// @param _price if oracle is set for WETH/USDC, where USDC is quote, then correct price would be 3000e6
function setPriceOfOneBaseToken(uint256 _price) external {
require(ADMIN == address(0) || msg.sender == ADMIN, OnlyAdminCanSetPrice());
priceOfOneBaseToken = _price;
}
function quoteToken() external view override virtual returns (address) {
return QUOTE_TOKEN;
}
/// @inheritdoc ISiloOracle
function quote(uint256 _baseAmount, address _baseToken) external view virtual returns (uint256 quoteAmount) {
quoteAmount = _baseToken == QUOTE_TOKEN
? _baseAmount
: _baseAmount * priceOfOneBaseToken / (10 ** BASE_DECIMALS);
require(quoteAmount != 0, ZeroPrice());
}
function beforeQuote(address) external pure virtual override {
// nothing to execute
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface ISiloOracle {
/// @notice Hook function to call before `quote` function reads price
/// @dev This hook function can be used to change state right before the price is read. For example it can be used
/// for curve read only reentrancy protection. In majority of implementations this will be an empty function.
/// WARNING: reverts are propagated to Silo so if `beforeQuote` reverts, Silo reverts as well.
/// @param _baseToken Address of priced token
function beforeQuote(address _baseToken) external;
/// @return quoteAmount Returns quote price for _baseAmount of _baseToken
/// @param _baseAmount Amount of priced token
/// @param _baseToken Address of priced token
function quote(uint256 _baseAmount, address _baseToken) external view returns (uint256 quoteAmount);
/// @return address of token in which quote (price) is denominated
function quoteToken() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}{
"remappings": [
"forge-std/=gitmodules/forge-std/src/",
"silo-foundry-utils/=gitmodules/silo-foundry-utils/contracts/",
"properties/=gitmodules/crytic/properties/contracts/",
"silo-core/=silo-core/",
"silo-oracles/=silo-oracles/",
"silo-vaults/=silo-vaults/",
"@openzeppelin/=gitmodules/openzeppelin-contracts-5/",
"morpho-blue/=gitmodules/morpho-blue/src/",
"openzeppelin5/=gitmodules/openzeppelin-contracts-5/contracts/",
"openzeppelin5-upgradeable/=gitmodules/openzeppelin-contracts-upgradeable-5/contracts/",
"chainlink/=gitmodules/chainlink/contracts/src/",
"chainlink-ccip/=gitmodules/chainlink-ccip/contracts/src/",
"uniswap/=gitmodules/uniswap/",
"@uniswap/v3-core/=gitmodules/uniswap/v3-core/",
"pyth-sdk-solidity/=gitmodules/pyth-sdk-solidity/target_chains/ethereum/sdk/solidity/",
"a16z-erc4626-tests/=gitmodules/a16z-erc4626-tests/",
"@ensdomains/=node_modules/@ensdomains/",
"@solidity-parser/=node_modules/prettier-plugin-solidity/node_modules/@solidity-parser/",
"ERC4626/=gitmodules/crytic/properties/lib/ERC4626/contracts/",
"createx/=gitmodules/pyth-sdk-solidity/lazer/contracts/evm/lib/createx/src/",
"crytic/=gitmodules/crytic/",
"ds-test/=gitmodules/openzeppelin-contracts-5/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=gitmodules/openzeppelin-contracts-5/lib/erc4626-tests/",
"halmos-cheatcodes/=gitmodules/morpho-blue/lib/halmos-cheatcodes/src/",
"hardhat/=node_modules/hardhat/",
"openzeppelin-contracts-5/=gitmodules/openzeppelin-contracts-5/",
"openzeppelin-contracts-upgradeable-5/=gitmodules/openzeppelin-contracts-upgradeable-5/",
"openzeppelin-contracts-upgradeable/=gitmodules/pyth-sdk-solidity/lazer/contracts/evm/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=gitmodules/openzeppelin-contracts-upgradeable-5/lib/openzeppelin-contracts/",
"prettier-plugin-solidity/=node_modules/prettier-plugin-solidity/",
"solady/=gitmodules/pyth-sdk-solidity/lazer/contracts/evm/lib/createx/lib/solady/",
"solmate/=gitmodules/crytic/properties/lib/solmate/src/",
"x-silo/=node_modules/x-silo/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"base","type":"address"},{"internalType":"address","name":"_quote","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"OnlyAdminCanSetPrice","type":"error"},{"inputs":[],"name":"ZeroPrice","type":"error"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BASE_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"QUOTE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"beforeQuote","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"priceOfOneBaseToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseAmount","type":"uint256"},{"internalType":"address","name":"_baseToken","type":"address"}],"name":"quote","outputs":[{"internalType":"uint256","name":"quoteAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoteToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPriceOfOneBaseToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60e060405234801561000f575f5ffd5b5060405161062e38038061062e83398101604081905261002e916100dd565b816001600160a01b03166080816001600160a01b031681525050826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610084573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100a8919061011d565b60ff1660a0526001600160a01b031660c052506101449050565b80516001600160a01b03811681146100d8575f5ffd5b919050565b5f5f5f606084860312156100ef575f5ffd5b6100f8846100c2565b9250610106602085016100c2565b9150610114604085016100c2565b90509250925092565b5f6020828403121561012d575f5ffd5b815160ff8116811461013d575f5ffd5b9392505050565b60805160a05160c05161049f61018f5f395f818160ee01528181610238015261027201525f818161015101526101cb01525f818160b10152818161012a015261018f015261049f5ff3fe608060405234801561000f575f5ffd5b5060043610610085575f3560e01c806378892cea1161005857806378892cea146101255780638b09578d1461014c578063de72582c14610173578063f9fa619a1461017b575f5ffd5b806313b0be3314610089578063217a4b70146100af5780632a0acc6a146100e9578063715eb51b14610110575b5f5ffd5b61009c6100973660046102d0565b61018c565b6040519081526020015b60405180910390f35b7f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020016100a6565b6100d17f000000000000000000000000000000000000000000000000000000000000000081565b61012361011e3660046102fa565b610236565b005b6100d17f000000000000000000000000000000000000000000000000000000000000000081565b61009c7f000000000000000000000000000000000000000000000000000000000000000081565b61009c5f5481565b610123610189366004610311565b50565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161461020c576101f17f0000000000000000000000000000000000000000000000000000000000000000600a610428565b5f546101fd9085610433565b610207919061044a565b61020e565b825b9050805f0361023057604051634dfba02360e01b815260040160405180910390fd5b92915050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031615806102945750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b6102b1576040516347c9b3d560e11b815260040160405180910390fd5b5f55565b80356001600160a01b03811681146102cb575f5ffd5b919050565b5f5f604083850312156102e1575f5ffd5b823591506102f1602084016102b5565b90509250929050565b5f6020828403121561030a575f5ffd5b5035919050565b5f60208284031215610321575f5ffd5b61032a826102b5565b9392505050565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156103805780850481111561036457610364610331565b600184161561037257908102905b60019390931c928002610349565b935093915050565b5f8261039657506001610230565b816103a257505f610230565b81600181146103b857600281146103c2576103de565b6001915050610230565b60ff8411156103d3576103d3610331565b50506001821b610230565b5060208310610133831016604e8410600b8410161715610401575081810a610230565b61040d5f198484610345565b805f190482111561042057610420610331565b029392505050565b5f61032a8383610388565b808202811582820484141761023057610230610331565b5f8261046457634e487b7160e01b5f52601260045260245ffd5b50049056fea2646970667358221220a969fd575f01aa0348b4aca52559f68a9d83789180cf68c1a690de2298aa24bd64736f6c634300081c0033000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388940000000000000000000000001ff60e85852ac73cd05b69a8b6641fc24a3fc011
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610085575f3560e01c806378892cea1161005857806378892cea146101255780638b09578d1461014c578063de72582c14610173578063f9fa619a1461017b575f5ffd5b806313b0be3314610089578063217a4b70146100af5780632a0acc6a146100e9578063715eb51b14610110575b5f5ffd5b61009c6100973660046102d0565b61018c565b6040519081526020015b60405180910390f35b7f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388945b6040516001600160a01b0390911681526020016100a6565b6100d17f0000000000000000000000001ff60e85852ac73cd05b69a8b6641fc24a3fc01181565b61012361011e3660046102fa565b610236565b005b6100d17f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889481565b61009c7f000000000000000000000000000000000000000000000000000000000000001281565b61009c5f5481565b610123610189366004610311565b50565b5f7f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b0316826001600160a01b03161461020c576101f17f0000000000000000000000000000000000000000000000000000000000000012600a610428565b5f546101fd9085610433565b610207919061044a565b61020e565b825b9050805f0361023057604051634dfba02360e01b815260040160405180910390fd5b92915050565b7f0000000000000000000000001ff60e85852ac73cd05b69a8b6641fc24a3fc0116001600160a01b031615806102945750336001600160a01b037f0000000000000000000000001ff60e85852ac73cd05b69a8b6641fc24a3fc01116145b6102b1576040516347c9b3d560e11b815260040160405180910390fd5b5f55565b80356001600160a01b03811681146102cb575f5ffd5b919050565b5f5f604083850312156102e1575f5ffd5b823591506102f1602084016102b5565b90509250929050565b5f6020828403121561030a575f5ffd5b5035919050565b5f60208284031215610321575f5ffd5b61032a826102b5565b9392505050565b634e487b7160e01b5f52601160045260245ffd5b6001815b60018411156103805780850481111561036457610364610331565b600184161561037257908102905b60019390931c928002610349565b935093915050565b5f8261039657506001610230565b816103a257505f610230565b81600181146103b857600281146103c2576103de565b6001915050610230565b60ff8411156103d3576103d3610331565b50506001821b610230565b5060208310610133831016604e8410600b8410161715610401575081810a610230565b61040d5f198484610345565b805f190482111561042057610420610331565b029392505050565b5f61032a8383610388565b808202811582820484141761023057610230610331565b5f8261046457634e487b7160e01b5f52601260045260245ffd5b50049056fea2646970667358221220a969fd575f01aa0348b4aca52559f68a9d83789180cf68c1a690de2298aa24bd64736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388940000000000000000000000001ff60e85852ac73cd05b69a8b6641fc24a3fc011
-----Decoded View---------------
Arg [0] : base (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38
Arg [1] : _quote (address): 0x29219dd400f2Bf60E5a23d13Be72B486D4038894
Arg [2] : _admin (address): 0x1fF60e85852Ac73cd05B69A8B6641fc24A3FC011
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [1] : 00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894
Arg [2] : 0000000000000000000000001ff60e85852ac73cd05b69a8b6641fc24a3fc011
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
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.