The getClaimableInterest method on the YtPosition class calculates the amount of interest available for collection, denominated in the base token.
Usage
Parameters
Use vault.currentSyExchangeRate for the currentIndex parameter. This ensures the calculation uses the latest exchange rate from the loaded vault state.
Returns
Returns a number representing the claimable interest in raw base token units. The calculation accounts for:
- Accrued yield since the last update based on exchange rate changes
- Previously staged interest
- Protocol interest fees (deducted automatically)
- Rounding adjustments (conservative, in favor of the protocol)