Loans
From the smart contract perspective (which is reflected on the way loans are
displayed on the kairos webapp) each loan corresponds to one nft collateral. If
a borrower used multiple collaterals in one transaction, it means kairos issued
multiple loans, that can be repaid/liquidated independently.
Once issued, only a contract upgrade can modify any loan term.
All loan terms are stored onchain. A loan concerns only one ERC20 lent, and only
one immutable interest rate.
The interests to pay accrue linearly on a per-second basis. Loans are stored
onchain in the form of Loan structs
.
They are caracterized by
- an amount
lent
- a share of the value of the nft used as
collateral
. As borrowers can borrow less than the full value of their nft, the protocol keeps track of which share of the nft is considered being the collateral of the loan. If this share is less than one, the borrower is considered the owner of the remaining share. To avoid creating fungible shares of an NFT outside of the protocol, repaying a loan or buying an NFT in auction always results in the trsanfer of the full NFT. The notion of the borrower retaining ownership on a share of its NFT results in the borrower being able to repay interests on less than the full value of its NFT, and claiming an share of the sale proceeds of its NFT in case of liquidation. - a start date (date of the borrow transaction).
- an end date. The borrower can repay its loan any time after issuance (including in the same transaction), and repay interests only for the time it kept the funds. After the end date, the nft used as collateral enters a dutch auction. Interests to pay continue accruing during the auction and the borrower can still repay its loan once the auction has started, while the nft is not sold. This design decision corresponds roughly to the grace period implemented in other protocols. The end date is found by determining the shortest loan offer duration used in loan and adding it to the start date.
- the auction parameters. (cf auction)
- the interest rate.
- the borrower address.
- The payment info of the loan, including
- the amount paid as principal + interests or as sale of the collateral NFT (a non 0 value meaning the loan lifecycle is over, a 0 value not necessarly meaning the loan is active).
- the minimum amount that must be repaid. This corresponds to the amount the borrower has to repay if repaying at the same second as borrowing, or after a short time. After some time, the amount effectively needing to be repaid becomes greater.
- wether the loan has been liquidated. If this is the case, the loan lifecycle is over. The paid amount can still be 0 in the case of an NFT sold in dutch auction after the price hit 0.
- wether the borrower has claimed his rights on the share of the NFT that is not considered being used as collateral. This is considered the case if the borrower repaid (as it got its whole NFT back) or if it claimed its share of the liquidation sale.
- The corresponding supply positions.