Developer Guide
Below is a brief overview of TrueFi Lending Marketplace contracts.

Overview

TrueFi is a decentralized protocol for uncollateralized lending. The TrueFi Lending Marketplace enables third parties to create and manage portfolios of financial instruments.

Typical Flows 🌊

Typical flow encounters:
  • Manager creates ManagedPortfolio using ManagedPortfolioFactory.
  • Lender lends funds into the ManagedPortfolio.
  • Manager issues a BulletLoans token to the ManagedPortfolio (portfolio sends funds to the Borrower).
  • Borrower repays BulletLoans an owed amount (BulletLoans will send funds to the debt owner - in this case the ManagedPortfolio).
  • Lender withdraws funds from the ManagedPortfolio.
Additional actions that might happen:
  • Manager can change loan parameters (with a Borrower's approval if necessary).
  • Manager can set loan status to Defaulted if Borrower does not return funds on time (and eventually set loan status to Resolved once the debt is settled).
  • Manager can change various ManagedPortfolio properties.

Contracts

TrueFi Lending Marketplace consists of the following main smart contracts:
And periphery smart contracts:

​

​BulletLoans​

BulletLoans is an ERC-721 contract. Each of the tokens represents a single loan. All the loan parameters can be read from LoanMetadata struct. BulletLoans contract enables loan creation, facilitates loan repayment and allows managing the loan's state and parameters.

​ManagedPortfolio​

ManagedPortfolio is an ERC-20 token facilitates funds management and allows loan issuance. Portfolio tokens represent lenders' share in the pooled funds. All of the portfolio operations are up to the managers discretion. Manager makes the decisions about issuing new loans, marking them as defaulted, altering portfolios params and so on. Lenders only lend funds into the portfolio if they trust the manager is going to abide by a reasonable policy. Manager also specifies an ILenderVerifier contract that is responsible for handling the permissions to join the portfolio (portfolios might be permissionless, but typically are not and only offer entrance to a defined group of lenders). Funds from the portfolio are only available for the withdrawal after the final closing date.

ManagedPortfolioFactory

Contract that allows easy portfolio configuration and creation. A particular instance of the factory can only be accessed by whitelisted addresses.

ProtocolConfig

Contract holding key system params.

BorrowerSignatureVerifier

A contract that verifies borrower's consent to change the loan parameters. Manager can freely change the loan parameters in borrower's favour (reduce owned amount, increase time), but needs an explicit, borrower's approval to do the opposite.

ILenderVerifier

Whitelist

A contract that implements simple, universal whitelist.

WhitelistLenderVerifier

A contract that implements a unique whitelist for each of the portfolios, which are using this verifier. Managers of particular portfolios have the authority to manage respective whitelists.

SignatureOnlyLenderVerifier

A contract that requires lender to provide a signature of a predefined message.
​

Audits & Security