Borrowing
Borrowing using NFTs as collateral is done through an onchain method call.
One can borrow from one or multiple NFTs at the same time. If only one NFT
is sued as collateral, the borrower doesn't need to approve it to kairos
before the borrow transaction through the use of the onERC721Received
hook
in the borrow facet.
To borrow using multiple NFTs as collateral at once, kairos must be approved
to transfer them before hand, or set as operator
(cf the ERC721 spec) of all the
erc721 contracts intended for use. To borrow using one or multiple NFTs as
collateral, the borrow
function can be used.
Through a BorrowArg[]
array, the borrower specifies for each collateral used
- one or multiple loan offers (issued by lenders) it his willing to borrow from
- the amount borrowed from each offer. During the borrow transaction, the protocol keeps track of how much of the value (represented as a share of the total) of the collateral has been used with each offer according to the amounts borrowable set by the lenders. The borrower has no obligation to borrow the full value of its collateral. Borrowing less results in less amount to repay/a claimable share of the proceeds of the collateral sale in case of liquidation.
As each offer used to borrow mints a supply position for the lender to use as claim for its share of interests or liquidation, there is a ddos risk if a borrower spams the use of offers with small amounts (I.e this spam would let the lender with many dust positions to claim onchain, which may be not financially viable due to gas costs), there is a minimum amount borrowable per used offer and a minimum amount to repay per offer.
During the borrow transaction, all NFTs used as collateral are transferred from the borrower wallet to the kairos contract that will hold them in escrow, and the borrowed funds are transferred directly from the lender(s) wallet(s) to the borrower wallet.
At the borrow transaction time, all terms of the loan(s) that will be issued are public. No loan term can be modified after issuance (excluding in the case of a contract upgrade). This is so borrowers can take informed decisions.