From eba65258f5cba8079e2e7a2e9d6d7860a9254a11 Mon Sep 17 00:00:00 2001 From: Taylor Brent Date: Mon, 28 Oct 2024 17:46:52 -0700 Subject: [PATCH] add natspec to exchange rate oracle --- .../factories/ExchangeRateOracleFactory.sol | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/contracts/facade/factories/ExchangeRateOracleFactory.sol b/contracts/facade/factories/ExchangeRateOracleFactory.sol index b5e97899b..48f278088 100644 --- a/contracts/facade/factories/ExchangeRateOracleFactory.sol +++ b/contracts/facade/factories/ExchangeRateOracleFactory.sol @@ -10,6 +10,21 @@ interface IMinimalRToken { function totalSupply() external view returns (uint256); } +/** + * @title ExchangeRateOracle + * @notice An immutable Exchange Rate Oracle for an RToken + * + * Warning! In the event of an RToken taking a loss in excess of the StRSR overcollateralization + * layer, the devaluation will not be reflected until the RToken is done trading. This causes + * the exchange rate to be too high during the rebalancing phase. If the exchange rate is relied + * upon naively, then it could be misleading. + * + * As a consumer of this oracle, you may want to guard against this case by monitoring: + * `rToken.status() == 0 && rToken.fullyCollateralized()` + * + * However, note that `fullyCollateralized()` is extremely gas-costly. We recommend executing + * the function off-chain. `status()` is cheap and more reasonable to be called from on-chain. + */ contract ExchangeRateOracle { error MissingRToken(); @@ -42,6 +57,8 @@ contract ExchangeRateOracle { uint80 answeredInRound ) { + // TODO + // make better to work with more than just Morpho return (0, int256(exchangeRate()), 0, 0, 0); }