Assessment reports>Suilend>Threat Model>Function claim_fees

Function claim_fees

This function returns the spread fees and the borrow fees as token balances. There are no checks on this function on the caller, but it is a friend function that is only called from lending_market, where the caller is checked.

The borrow fees are always kept in a separate account on the reserve object, so the borrow fees are always completely withdrawn. On the other hand, the spread fees are kept in the pool and can even be lent out. Before any spread fees are withdrawn, the function calculates the maximum withdraw amount that does not put the available balance below the minimum value and withdraws up to that amount instead. If no funds can be withdrawn without breaching the minimum, then no funds are withdrawn from the spread fees.

Zellic © 2025Back to top ↑