StabilityPool
Write Methods
function provideToSP(uint256 _amount) external
Deposits debt tokens into the pool, accrues rewards, and updates snapshots.
Input Parameter
Type
Description
_amount
uint256
Amount of debt tokens to deposit.
function withdrawFromSP(uint256 _amount) external
Withdraws debt tokens from the pool, claims rewards, and updates snapshots.
Input Parameter
Type
Description
_amount
uint256
Amount of debt tokens to withdraw.
function claimCollateralGains(
address recipient,
uint256[] calldata collateralIndexes
) public
Claims collateral gains for specified tokens and sends them to the recipient.
Input Parameter
Type
Description
recipient
address
Address to receive gains.
collateralIndexes
uint256[]
Array of collateral indices to claim.
function claimReward(address recipient) external returns (uint256 amount)
Returns the pending Bit rewards for a depositor.
Input Parameter
Type
Description
recipient
address
Address to receive rewards.
Returns:
Return Value
Type
Description
amount
uint256
Amount of rewards claimed.
View Methods
function getTotalDebtTokenDeposits() external view returns (uint256)
Returns the total debt tokens deposited in the pool.
Returns:
Return Value
Type
Description
totalDebt
uint256
Total debt tokens deposited.
function getDepositorCollateralGain(
address _depositor
) external view returns (uint256[] memory collateralGains)
Returns the collateral gains earned by a depositor.
Input Parameter
Type
Description
_depositor
address
Depositor address.
Returns:
Return Value
Type
Description
collateralGains
uint256[]
Array of collateral gains per token.
function claimableReward(
address _depositor
) external view returns (uint256)
Returns the pending Bit rewards for a depositor.
Input Parameter
Type
Description
_depositor
address
Depositor address.
Returns:
Return Value
Type
Description
reward
uint256
Claimable reward amount.
function getCompoundedDebtDeposit(
address _depositor
) public view returns (uint256)
Calculates a depositorβs compounded debt deposit after rewards.
Input Parameter
Type
Description
_depositor
address
Depositor address.
Returns:
Return Value
Type
Description
compoundedDeposit
uint256
Compounded debt deposit amount.
Structs
struct AccountDeposit {
uint128 amount;
uint128 timestamp; // timestamp of the last deposit
}
struct Snapshots {
uint256 P;
uint256 G;
uint128 scale;
uint128 epoch;
}
struct SunsetIndex {
uint128 idx;
uint128 expiry;
}
struct Queue {
uint16 firstSunsetIndexKey;
uint16 nextSunsetIndexKey;
}
Events
event StabilityPoolDebtBalanceUpdated(uint256 _newBalance)
event P_Updated(uint256 _P)
event S_Updated(uint256 idx, uint256 _S, uint128 _epoch, uint128 _scale)
event G_Updated(uint256 _G, uint128 _epoch, uint128 _scale)
event EpochUpdated(uint128 _currentEpoch)
event ScaleUpdated(uint128 _currentScale)
event DepositSnapshotUpdated(
address indexed _depositor,
uint256 _P,
uint256 _G
)
event UserDepositChanged(address indexed _depositor, uint256 _newDeposit)
event CollateralGainWithdrawn(
address indexed _depositor,
uint256[] _collateral
)
event CollateralOverwritten(IERC20 oldCollateral, IERC20 newCollateral)
event RewardClaimed(
address indexed account,
address indexed recipient,
uint256 claimed
)
Last updated