CappedRateInternals ​
Inherits:Variables, Events, OracleError
Functions ​
_getNewRateRaw ​
read the exchange rate from the external contract e.g. wstETH or rsETH exchange rate, yet to be scaled to 1e27 To be implemented by inheriting contract
function _getNewRateRaw() internal view virtual returns (uint256 exchangeRate_);
_percentDiffForValue ​
gets the percentage difference between oldValue_
and newValue_
in relation to oldValue_
in percent (10000 = 1%, 1 = 0.0001%).
function _percentDiffForValue(uint256 oldValue_, uint256 newValue_)
internal
pure
returns (uint256 configPercentDiff_);
_getUpdateRates ​
get new rate from external source and return updated related parameters.
function _getUpdateRates(uint256 maxReachedRate_, Slot0 memory slot0_, uint256 maxAPRPercent_)
internal
view
virtual
returns (uint256 newRate_, uint256 maxRate_, bool isUpMaxAPRCapped_, bool isRateBelowMaxReached_);
_updateRates ​
updates the values in storage according to the newly fetched rate from external source.
function _updateRates(bool forceUpdate_) internal virtual returns (uint256 newRate_);
_calcDownCappedRate ​
returns the downwards capped rate max(downCappedRate_, rate_), where downCappedRate_ is capped at maxReachedAPRCappedRate_ - _maxDownFromMaxReachedPercent %.
function _calcDownCappedRate(uint256 rate_, uint256 maxReachedRate_, uint256 maxDownPercent_)
internal
pure
returns (uint256 downCappedRate_);
_calcMaxAPRCappedRate ​
returns the upwards capped rate min(upCappedRate_, rate_), where upCappedRate_ is capped at maxReachedAPRCappedRate_ + _maxAPRPercent % adjusted for passed time since last update time.
function _calcMaxAPRCappedRate(uint256 rate_, uint256 maxReachedRate_, Slot0 memory slot0_, uint256 maxAPRPercent_)
internal
view
returns (uint256 maxRate_);
_isHeartbeatTrigger ​
returns true if last update timestamp is too long ago so heartbeat update should trigger
function _isHeartbeatTrigger(Slot0 memory slot0_) internal view returns (bool);
_invertRateIfNeeded ​
returns inverted rate if needed (when _INVERT_CENTER_PRICE flag is set to true)
function _invertRateIfNeeded(uint256 exchangeRate_) internal view returns (uint256);