Claiming

Two actors can claim funds after a loan: lenders and borrowers (only in certain cases for the latter). Both actors can claim funds from multiple loans in one contract call.

As a lender

What can be claimed from a loan as a lender depends if that loan was repaid or liquidated. In every case, it is the ownership of the supply posiiton NFT that give access to the funds to its owner/approved spender and doing so results in that NFT being burned.

Claiming interests

The amount claimable from a repaid loan depends on the amount lent, the time elapsed between the borrow transaction and the loan repaiement, and the interest rate. The formula is

claimable = lent + interests
interests = time_elapsed * lent * share_of_lent_amount_accrued_per_second

If the loan were repaid shortly after being issued, the interests amount is a fixed value set by governance. As borrowers can generate an arbitrary number of supply positions that lenders will have to claim, this minimal amount is intended as a way to make sure lenders won't be at a loss just because of claiming gas fees.

Claiming ones share of a sale

Supply position issuance at borrow time can be seen by the lender as acquiring a share of the NFT collateral. This share is stored in the Provision struct. This share is acquired at the price the lender set itself by defining the loanToValue field of its loan offer. This is so in case of liquidation, the lender is at a gain or at a loss depending on how it was able to effectively predict a price that the collateral wouldn't be sold under. The lender is at a loss only if the NFT sold under that price. Since we consider the lender as owner of the share of the NFT it provided liquidity for, it can claim the same share of the proceeds of the sale. To prevent DDOS, a governance-set parameter prevents borrowers to borrow less than a certain amount per offer, so after liquidations lenders can expect that claiming their share of a sale is profitable regarding gas costs.

As a borrower

If a borrower didn't used the full value of its NFT to borrow from loan offers, it is considered owner of the remaining share. To prevent the NFT from being fractionalized it is nevertheless sold as a whole if the borrower doesn't repay its loan (no matter how small the share used as collateral). The borrower can claim the share of the sold NFT corresponding to the share it owns after the liquidation. This claim is not transferrable, so msg.sender of the claim method has to be the borrower of the loan.