MockPriceFeed.sol
Chainlink-style price feed stub for marking the equity bucket.
35 lines979 BSolidity
| 1 | // SPDX-License-Identifier: MIT |
| 2 | pragma solidity ^0.8.24; |
| 3 | |
| 4 | /// @dev Chainlink AggregatorV3-shaped price feed. Used to MARK the equity reserve — |
| 5 | /// the protocol never marks equities from an on-chain swap quote. |
| 6 | contract MockPriceFeed { |
| 7 | uint8 public decimals; |
| 8 | string public description; |
| 9 | int256 public answer; |
| 10 | uint256 public updatedAt; |
| 11 | uint80 public roundId; |
| 12 | |
| 13 | constructor(uint8 d, int256 initialAnswer, string memory desc) { |
| 14 | decimals = d; |
| 15 | answer = initialAnswer; |
| 16 | description = desc; |
| 17 | updatedAt = block.timestamp; |
| 18 | roundId = 1; |
| 19 | } |
| 20 | |
| 21 | function setAnswer(int256 a) external { |
| 22 | answer = a; |
| 23 | updatedAt = block.timestamp; |
| 24 | roundId += 1; |
| 25 | } |
| 26 | |
| 27 | function setUpdatedAt(uint256 t) external { |
| 28 | updatedAt = t; |
| 29 | } |
| 30 | |
| 31 | function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) { |
| 32 | return (roundId, answer, updatedAt, updatedAt, roundId); |
| 33 | } |
| 34 | } |
| 35 |
Click any line number to deep-link to it — the target line highlights on load.