forked from compound-finance/comet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update utils to support renzo oracle
- Loading branch information
1 parent
d667e39
commit 470c19f
Showing
6 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.15; | ||
|
||
import "../vendor/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; | ||
|
||
/** | ||
* @title Scaling price feed | ||
* @notice A custom price feed that scales up or down the price received from an underlying Chainlink price feed and returns the result | ||
* @author Compound | ||
*/ | ||
contract MockOracle { | ||
|
||
/// @notice Number of decimals for returned prices | ||
uint8 public immutable decimals; | ||
|
||
/// @notice Underlying Chainlink price feed where prices are fetched from | ||
address public immutable underlyingPriceFeed; | ||
|
||
/** | ||
* @notice Construct a new scaling price feed | ||
* @param underlyingPriceFeed_ The address of the underlying price feed to fetch prices from | ||
**/ | ||
constructor(address underlyingPriceFeed_) { | ||
underlyingPriceFeed = underlyingPriceFeed_; | ||
decimals = AggregatorV3Interface(underlyingPriceFeed_).decimals(); | ||
} | ||
|
||
/** | ||
* @notice Price for the latest round | ||
* @return roundId Round id from the underlying price feed | ||
* @return answer Latest price for the asset in terms of ETH | ||
* @return startedAt Timestamp when the round was started; passed on from underlying price feed | ||
* @return updatedAt Timestamp when the round was last updated; passed on from underlying price feed | ||
* @return answeredInRound Round id in which the answer was computed; passed on from underlying price feed | ||
**/ | ||
function latestRoundData() external view returns ( | ||
uint80 roundId, | ||
int256 answer, | ||
uint256 startedAt, | ||
uint256 updatedAt, | ||
uint80 answeredInRound | ||
) { | ||
(uint80 roundId_, int256 price, uint256 startedAt_, , uint80 answeredInRound_) = AggregatorV3Interface(underlyingPriceFeed).latestRoundData(); | ||
return (roundId_, price, startedAt_, block.timestamp, answeredInRound_); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters