Skip to content

Variables ​

Git Source

Inherits:Constants

Constants ​

_FLAG_BITMASK_IS_RATE_BELOW_MAX_REACHED ​

solidity
uint8 internal constant _FLAG_BITMASK_IS_RATE_BELOW_MAX_REACHED = 1

_FLAG_BITMASK_IS_UP_MAX_APR_CAPPED ​

solidity
uint8 internal constant _FLAG_BITMASK_IS_UP_MAX_APR_CAPPED = 2

_FLAG_BITMASK_AVOID_FORCED_LIQUIDATIONS_COL ​

solidity
uint8 internal constant _FLAG_BITMASK_AVOID_FORCED_LIQUIDATIONS_COL = 4

_FLAG_BITMASK_AVOID_FORCED_LIQUIDATIONS_DEBT ​

solidity
uint8 internal constant _FLAG_BITMASK_AVOID_FORCED_LIQUIDATIONS_DEBT = 8

_FLAG_BITMASK_ALLOW_MAX_YIELD_JUMPS ​

solidity
uint8 internal constant _FLAG_BITMASK_ALLOW_MAX_YIELD_JUMPS = 0xE0

State Variables ​

_slot0 ​

solidity
Slot0 internal _slot0

_slot1 ​

solidity
Slot1 internal _slot1

Structs ​

Slot0 ​

solidity
struct Slot0 {
    /// @dev exchange rate as fetched from external rate source in 1e27 decimals. max value 3.74e50
    uint168 rate;
    /// @dev time when last update for rate happened
    uint40 lastUpdateTime;
    /// @dev flags bitmap:
    /// Bit 1: true if the `_rate` value is currently < _maxReachedAPRCappedRate
    ///        bool internal _isRateBelowMaxReached;

    /// Bit 2: true if the `_rate` value is currently > _maxReachedAPRCappedRate, so capped because of the maxAPR limit
    ///        bool internal _isUpMaxAPRCapped;

    /// Bit 3: Col side: config flag to signal whether to protect users vs protect protocol depending on asset reliability (accept temporary bad debt if trusting peg).
    ///        flag should only be active for trusted assets where we assume any peg can only be temporary as when this flag is on
    ///        it can lead to bad debt until asset repeg is reached. For not 100% trusted assets better to liquidate on depeg and avoid any bad debt
    ///        Configurable by Governance and Liquidity guardians
    ///        bool internal _avoidForcedLiquidationsCol;

    /// Bit 4: same as Bit 3, but for debt side
    ///        bool internal _avoidForcedLiquidationsDebt;

    /// Bit 5: ----- empty -------

    /// Bits 6,7,8: uint3 -> allowed max yield jumps. each heartbeat update where minUpdateDiff is not reached increases this by 1,
    ///                      up to a maximum of 7. Reset to 0 for any update that is > min update diff.
    ///                      For any price update, the maximum price increase is:
    ///                      normal max yield increase since lastUpdateTime + maxYieldJumps * maxYield / HeartBeatDuration
    uint8 flags;
    /// @dev Minimum time after which an update can trigger, even if it does not reach `_minUpdateDiffPercent`. Max value = 16_777_215 -> ~194 days
    ///      Configurable by Governance.
    uint24 minHeartbeat;
    /// @dev Minimum difference to trigger update in percent 1e4 decimals, 10000 = 1%. Max value = 6,5535%
    ///      Configurable by Governance.
    uint16 minUpdateDiffPercent;
}

Slot1 ​

solidity
struct Slot1 {
    /// @dev tracks the maximum ever reached rate with respect of maxAPR percent (a temporary 100x spike does not increase this value beyond max apr increase).
    /// this is only updated IF `_rate` is not == `_maxReachedAPRCappedRate`, i.e. if `_isRateBelowMaxReached || _isUpMaxAPRCapped`. max value 3.74e50
    ///
    /// Can be reset synced to match `_rate` by Govnernance and Liquidity guardians, when wanting to force skip max APR or forcing reset after rate reduced
    uint168 maxReachedAPRCappedRate;
    /// @dev maximum yield APR that exchange rate can increase in each update
    /// in 1e2 precision, 1% = 100. max value-> 167_772,15%, can be set to 0 to force no rate increase possible for upwards cap
    ///
    /// Configurable by Governance and Liquidity guardians.
    uint24 maxAPRPercent;
    /// @dev Col side: maximum down percent reduction of `_maxReachedAPRCappedRate` for rates with downward cap protection.
    /// in 1e4 precision, 1% = 1e4. max value-> 1_677,7215 % (so max configurable value = _SIX_DECIMALS which is 100% -> removing downward cap entirely)
    ///
    /// Configurable by Governance and Liquidity guardians
    uint24 maxDownFromMaxReachedPercentCol;
    /// @dev same as above but for debt
    uint24 maxDownFromMaxReachedPercentDebt;
    /// @dev Debt side: maximum up percent cap on top of `_maxReachedAPRCappedRate`, only relevant when avoid forced liquidations attack for debt side is active,
    /// when _avoidForcedLiquidationsDebt flag is true. in 1e2 precision, 1% = 100. max value-> 655,35%, can be set to 0 to have same cap as on col side.
    ///
    /// Configurable by Governance and Liquidity guardians.
    uint16 maxDebtUpCapPercent;
}