Contract Source Code:
File 1 of 3 : PriceFeedTestnet.sol
// 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 {} }
File 2 of 3 : IPriceFeedTestnet.sol
// 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); }
File 3 of 3 : IPriceFeed.sol
// 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; }
Please enter a contract address above to load the contract details and source code.
Please DO NOT store any passwords or private keys here. A private note (up to 100 characters) can be saved and is useful for transaction tracking.
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.