Assessment reports>Suilend>Threat Model>Function refresh

Function refresh

Refreshes the calculated total deposit values and borrows lower and upper thresholds.

When borrowing from the protocol, users are required to be overcollateralized. However, there is some amount of grace where even if a user falls below the collateralization requirement for the initial borrow, the user is not considered eligible for liquidation. This leads to two separate thresholds for borrowing, the maximum amount of value the user can actively borrow and the maximum amount the user could have borrowed before being liquidated (this second threshold can be reached through price fluctuations of either the collateral or the borrowed assets). Both thresholds are tracked in obligation per user.

The refresh function adds up the total value of all deposited assets and adds to the aforementioned two thresholds a portion of the total deposited value. The effect on the borrow thresholds of each asset is calculated separately, since each asset has a different price.

For the debts of the current obligation, the current function compounds it and sums together the total value of the debts. This is done separately for each asset since each asset has a different price.

This function updates prices for all relevant reserves and reverts if the price is not fresh enough.

This function does not directly liquidate or check the thresholds are met. Instead, functions calling this base function perform these actions.

Zellic © 2025Back to top ↑