Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PriceFeedTestnet
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "./Interfaces/IPriceFeedTestnet.sol"; /* * PriceFeed placeholder for testnet and development. The price is simply set manually and saved in a state * variable. The contract does not connect to a live Chainlink price feed. */ contract PriceFeedTestnet is IPriceFeedTestnet { event LastGoodPriceUpdated(uint256 _lastGoodPrice); uint256 private _price = 200 * 1e18; // --- Functions --- // View price getter for simplicity in tests function getPrice() external view override returns (uint256) { return _price; } function lastGoodPrice() external view returns (uint256) { return _price; } function fetchPrice() external override returns (uint256, bool) { // Fire an event just like the mainnet version would. // This lets the subgraph rely on events to get the latest price even when developing locally. emit LastGoodPriceUpdated(_price); return (_price, false); } function fetchRedemptionPrice() external override returns (uint256, bool) { // Fire an event just like the mainnet version would. // This lets the subgraph rely on events to get the latest price even when developing locally. emit LastGoodPriceUpdated(_price); return (_price, false); } // Manual external price setter. function setPrice(uint256 price) external returns (bool) { _price = price; return true; } function setAddresses(address _borrowerOperationsAddress) external {} }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../../../Interfaces/IPriceFeed.sol"; interface IPriceFeedTestnet is IPriceFeed { function setPrice(uint256 _price) external returns (bool); function getPrice() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPriceFeed { function fetchPrice() external returns (uint256, bool); function fetchRedemptionPrice() external returns (uint256, bool); function lastGoodPrice() external view returns (uint256); function setAddresses(address _borrowerOperationsAddress) external; }
{ "remappings": [ "@chimera/=lib/V2-gov/lib/chimera/src/", "@ensdomains/=lib/V2-gov/lib/v4-core/node_modules/@ensdomains/", "@openzeppelin/=lib/V2-gov/lib/v4-core/lib/openzeppelin-contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "Solady/=lib/Solady/src/", "V2-gov/=lib/V2-gov/", "chimera/=lib/V2-gov/lib/chimera/src/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-gas-snapshot/=lib/V2-gov/lib/v4-core/lib/forge-gas-snapshot/src/", "forge-std/=lib/forge-std/src/", "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/", "hardhat/=lib/V2-gov/lib/v4-core/node_modules/hardhat/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/V2-gov/lib/openzeppelin-contracts/", "solmate/=lib/V2-gov/lib/v4-core/lib/solmate/src/", "v4-core/=lib/V2-gov/lib/v4-core/" ], "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, "libraries": {} }
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_lastGoodPrice","type":"uint256"}],"name":"LastGoodPriceUpdated","type":"event"},{"inputs":[],"name":"fetchPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fetchRedemptionPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastGoodPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_borrowerOperationsAddress","type":"address"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPrice","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052680ad78ebc5ac62000005f5534801561001b575f80fd5b5061018c806100295f395ff3fe608060405234801561000f575f80fd5b5060043610610060575f3560e01c80630490be83146100645780630fdb11cf1461007957806381d3c4351461009657806391b7f5ed146100a957806398d5fdca14610064578063b5b65cef14610079575b5f80fd5b5f546040519081526020015b60405180910390f35b6100816100ce565b60408051928352901515602083015201610070565b6100a76100a4366004610112565b50565b005b6100be6100b736600461013f565b5f55600190565b6040519015158152602001610070565b5f807f4d29de21de555af78a62fc82dd4bc05e9ae5b0660a37f04729527e0f22780cd35f5460405161010291815260200190565b60405180910390a150505f805491565b5f60208284031215610122575f80fd5b81356001600160a01b0381168114610138575f80fd5b9392505050565b5f6020828403121561014f575f80fd5b503591905056fea2646970667358221220705584151c703f74afd2fdc3b24b7c34706226803027aa2bb38062edddce9c5264736f6c63430008180033
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610060575f3560e01c80630490be83146100645780630fdb11cf1461007957806381d3c4351461009657806391b7f5ed146100a957806398d5fdca14610064578063b5b65cef14610079575b5f80fd5b5f546040519081526020015b60405180910390f35b6100816100ce565b60408051928352901515602083015201610070565b6100a76100a4366004610112565b50565b005b6100be6100b736600461013f565b5f55600190565b6040519015158152602001610070565b5f807f4d29de21de555af78a62fc82dd4bc05e9ae5b0660a37f04729527e0f22780cd35f5460405161010291815260200190565b60405180910390a150505f805491565b5f60208284031215610122575f80fd5b81356001600160a01b0381168114610138575f80fd5b9392505050565b5f6020828403121561014f575f80fd5b503591905056fea2646970667358221220705584151c703f74afd2fdc3b24b7c34706226803027aa2bb38062edddce9c5264736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.