Skip to main content
Explore the Stability Pool, the cornerstone of the Roots protocol’s liquidation mechanism and a source of earning opportunities for MEAD depositors. This contract secures the system by absorbing debt from liquidated Troves and rewards participants with the liquidated collateral. Delve into its functions for managing deposits, claiming gains, and tracking rewards, alongside the events that signal its critical operations.

Functions

DECIMAL_PRECISION()

Returns the decimal precision used in calculations. (View)

P()

Returns the product P, a factor used in calculating depositor rewards. (View)

ROOTS_CORE()

Returns the address of the IRootsCore contract. (View)

SCALE_FACTOR()

Returns the scale factor used in reward calculations. (View)

SUNSET_DURATION()

Returns the duration of the sunset period for collateral types. (View)

accountDeposits

Returns deposit amounts for a specific account. (View)

claimCollateralGains

Allows a depositor to claim their accrued collateral gains.

claimReward

Allows a depositor to claim their MEAD rewards from staking in the Stability Pool.

claimableReward

Returns the amount of MEAD reward a depositor can currently claim. (View)

collateralGainsByDepositor

Returns collateral gains for a depositor by collateral index. (View)

collateralTokens

Returns the address of a collateral token at a given index. (View)

currentEpoch()

Returns the current epoch. (View)

currentScale()

Returns the current scale. (View)

debtToken()

Returns the address of the IDebtToken contract. (View)

depositSnapshots

Returns snapshot data for a specific depositor. (View)

depositSums

Returns deposit sums for an account and index. (View)

enableCollateral

Enables a new collateral type to be managed by the Stability Pool.

endCollateralSunset

Ends the sunset period for a specific collateral index.

epochToScaleToG

Returns the G value (cumulative sum of collateral gains per unit of stake) for a given epoch and scale. (View)

epochToScaleToSums

Returns sum values related to epochs and scales for a specific index. (View)

factory()

Returns the factory address. (View)

getCompoundedDebtDeposit

Calculates and returns the compounded debt deposit for a depositor. (View)

getDepositorCollateralGain

Returns all collateral gains for a specific depositor across all collateral types. (View)

getTotalDebtTokenDeposits()

Returns the total amount of MEAD (debt token) deposited in the Stability Pool. (View)

getWeek()

Returns the current week number. (View)

guardian()

Returns the guardian address. (View)

indexByCollateral

Returns the index for a given collateral token address. (View)

initialize

Initializes the StabilityPool contract.

lastCollateralError_Offset

Returns the last collateral error offset for a given index. (View)

lastDebtLossError_Offset()

Returns the last debt loss error offset. (View)

lastRewardsError()

Returns the last rewards error value. (View)

lastUpdate()

Returns the timestamp of the last update. (View)

liquidationManager()

Returns the address of the Liquidation Manager contract. (View)

offset

Offsets debt with collateral gains when a Trove is liquidated.

owner()

Returns the owner address of the contract. (View)

periodFinish()

Returns the timestamp when the current reward period finishes. (View)

provideToSP

Deposits a specified amount of MEAD into the Stability Pool.

rewardRate()

Returns the current reward rate. (View)

scheduler()

Returns the address of the EmissionScheduler contract. (View)

startCollateralSunset

Initiates the sunset period for a specific collateral type.

withdrawFromSP

Withdraws a specified amount of MEAD from the Stability Pool.

Events

CollateralGainWithdrawn

Emitted when a depositor withdraws their collateral gains.

CollateralOverwritten

Emitted when an old collateral token is overwritten with a new one.

CollateralSunset

Emitted when a collateral type starts its sunset period.

DepositSnapshotUpdated (Version 1)

Emitted when a depositor’s snapshot (P and G values) is updated.

DepositSnapshotUpdated (Version 2)

Emitted when a depositor’s snapshot (P value) is updated.

EpochUpdated

Emitted when the current epoch is updated.

G_Updated

Emitted when the G value (cumulative sum of collateral gains) is updated for an epoch and scale.

P_Updated

Emitted when the P value (product factor for rewards) is updated.

RewardClaimed

Emitted when a user claims rewards.

S_Updated

Emitted when the S value (sum of stakes with factor S) is updated for an index, epoch, and scale.

ScaleUpdated

Emitted when the current scale is updated.

StabilityPoolDebtBalanceUpdated

Emitted when the Stability Pool’s total MEAD (debt token) balance is updated.

UserDepositChanged

Emitted when a user’s MEAD deposit in the Stability Pool changes.