Contracts Overview

List of all Tinlake contracts

TitleTracks ownership of each loan. Implements the NFT interface so loans themselves become NFTs.
LightswitchTriggers settlement of the Tinlake system if the value of the collateral falls below a certain threshold or some other condition is met (e.g the MakerDAO CDP gets bitten)
PileManages loan debt and token balance, pays out to borrower and receives repayments
ShelfKeeps track of approved NFTs and owns NFTs
ValveControls minting and burning of Collateral Value Token
CollateralThe collateral value token (CVT) ERC20 contract
AppraiserAppraiser is a module that can be plugged in that returns the value of the collateral.
ReceptionWrapper contract for borrowers
DeskThe "trading desk", wrapper contract for the administrator to manage the lender side
MakerAdapterManages a CDP to borrow Dai from MakerDAO by depositing CVT
BackerAdapterUses a single account to manage payment transfers in the lending process
DeployerDeploys all components in one transaction, and sets the right access control

Main Interactions

Whitelist an NFT

Admin.whitelist(address registry, uint nft, uint principal, uint appraisal, uint fee, address usr)

An admin (underwriter) can whitelist an NFT for Tinlake. The admin has to define a principal, appraisal and interest rate (APR) for the NFT. Only whitelisted NFTs can be used to receive loans.

Borrow a loan

Reception.borrow(uint loan, address deposit)

The owner of a whitelisted NFT can call borrow on the reception contract. As a first step, the ownership of the NFT is transferred to the Tinlake shelf contract. (Pre required is an approve in the NFT registry contract). The new locked NFT causes a value (appraisal) increase of the collateral pool. New CVT are minted to represent the increase. Afterwards, the new CVT are used as collateral in a decentralized lending protocol like Maker or Compound (depending on the adapter) to receive funding in DAI (principal amount). The borrow transaction automatically whithdraws the received DAI to the deposit address. If borrow is successful, the loan status changes to ongoing and interest accrues.

Repay a loan

Reception.close(uint loan, address usr)

An ongoing loan can be repaid in any point in time by calling the close function. (Pre required is an approve on DAI ERC20 contract). Tinlake transfers the debt (principal + interest) to the decentralized lending protocol to receive back the CVT. After that, the underlying NFT is removed from the pool by transferring the ownership back to the borrower. The NFT transfer causes a value decrease in the pool. Therefore, the received CVT are burned. During the entire loan cycle the total amount of CVT represents the value of the locked NFT. If close is successful, the loan status changes to repaid.