Skip to content

Commit

Permalink
oracle state check in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
rbajollari committed Dec 6, 2024
1 parent 1b9e9ed commit b216be3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/OjoPTOraclePriceAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ contract OjoPTOraclePriceAdapter is MinimalAggregatorV3Interface {
market = _market;
description = _description;
decimals = MinimalAggregatorV3Interface(_market).decimals();
}

/// @inheritdoc MinimalAggregatorV3Interface
/// @dev Returns zero for roundId, startedAt, updatedAt and answeredInRound.
/// @dev Silently overflows if `price`'s average is greater than `type(int256).max`.
function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {
IPTOracle oracle = IPTOracle(PTOracle);

{
Expand All @@ -45,6 +40,13 @@ contract OjoPTOraclePriceAdapter is MinimalAggregatorV3Interface {
revert OjoPTOraclePriceAdapterError(PendleOracle__MarketNotInitialized);
}
}
}

/// @inheritdoc MinimalAggregatorV3Interface
/// @dev Returns zero for roundId, startedAt, updatedAt and answeredInRound.
/// @dev Silently overflows if `price`'s average is greater than `type(int256).max`.
function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) {
IPTOracle oracle = IPTOracle(PTOracle);

uint256 price = oracle.getPtToAssetRate(
market,
Expand Down

0 comments on commit b216be3

Please sign in to comment.