Operation - Claim rewards
The doClaim
operation allows users to claim accumulated collateral gains from the Stability Pool. This function is crucial for users who have contributed to the pool and have earned returns as the pool liquidates troves that fall below the required collateral-to-debt ratio.
Key Steps
Retrieve Collateral Configurations:
Begin by fetching the current configurations of collaterals used in the Stability Pool. This includes details like collateral types and their respective settings.
Get Collateral Gains:
Check for any gains associated with each type of collateral the user might have accumulated through their participation in the pool.
Check for Claimable Collateral:
Iterate through the list of collaterals to determine if there are any gains that can be claimed. If any collateral has a gain greater than zero, it is flagged as claimable.
Execute Claim Operation:
If there is claimable collateral, execute the
doClaim
method to retrieve these gains. This operation finalizes the claim and transfers the earned collateral to the user's account.
Example
Last updated