TrueFi Docs
  • What is TrueFi?
  • 🔎User Guide
    • Lend
      • How to lend
      • How to withdraw
      • Onboarding / KYC (for permissioned pools)
    • Borrow
      • Receiving a loan
      • Repaying a loan
    • Manage
      • Onboarding for managers
      • Creating a vault
      • Disbursing loans
      • Managing KYC/KYB requirements
  • âš¡TrueFi Protocol
    • Lines of Credit
      • Line of Credit tutorial
      • Lines of Credit technical details
    • Asset Vaults
      • Asset Vault tutorial
      • Asset Vault technical details
    • Credit Vaults
      • Credit Vault tutorial
      • Credit Vault technical details
        • Credit Vault contract overview
        • Waterfall details
    • Index Vaults
      • Index Vault tutorial
      • Index Vault technical details
    • TRU token
      • Staked TRU
      • How to Get TRU
    • Other concepts
      • Controllers
      • Instruments
        • FixedInterestOnlyLoan
        • BulletLoans
      • [Legacy] DAO pools
        • delt.ai loan: Jan 2023 airdrop claiming instructions
        • delt.ai loan: July 2023 airdrop claiming instructions
        • delt.ai loan: October 2023 airdrop claiming instructions
        • delt.ai loan: Jan 2024 airdrop claiming instructions
        • delt.ai loan: Apr 2024 airdrop claiming instructions
        • delt.ai loan: Nov 2024 airdrop claiming instructions
        • Loan approval process
        • Lender FAQs
          • Lending to DAO pools
          • Farming TRU rewards
          • Withdrawing funds
          • How lending pool (LP) tokens work
          • How loan tokens work
          • SAFU (Secure Asset Fund for Users)
          • Risk Mitigation
        • Developer docs
      • Other legacy contracts
        • Managed Portfolio [legacy]
        • Flexible Portfolios [legacy]
          • Flexible Portfolio contracts
    • Audits
Powered by GitBook

General

  • TrueFi app
  • Docs

Governance

  • Tally
  • Snapshot

Community

  • Forum
  • Twitter
On this page
  • Contracts
  • StructuredPortfolio
  • StructuredPortfolioFactory
  • TrancheVault
  • ProtocolConfig
  • LoansManager
  • Controllers
  • DepositController
  • WithdrawController
  • TransferController
  • Debt Waterfall

Was this helpful?

Export as PDF
  1. TrueFi Protocol
  2. Credit Vaults
  3. Credit Vault technical details

Credit Vault contract overview

PreviousCredit Vault technical detailsNextWaterfall details

Last updated 1 year ago

Was this helpful?

are multi-tranche vaults allowing lenders to deposit into one or more specific buckets of funds ("tranches") managed by the portfolio manager. Credit Vaults can have up to 3 tranches, enabling each tranche to deliver unique risk-return profiles.

Below is an overview of Credit Vault contracts.

Contracts

StructuredPortfolio

StructuredPortfolio is a contract responsible for loan management and Tranche value calculations. It might hold any number of tranches (limited by gas) but at launch, credit vaults are intended to contain 1, 2, or 3 tranches.

StructuredPortfolio extends contract.

StructuredPortfolio has 3 states: CapitalFormation, Live and Closed.

The credit vault goes into Live state when the start() method is called. It transfers all funds from tranches to the credit vault and enables the ability to create and fund loans. Each tranche value is now calculated using the algorithm.

Creating and funding loans is only possible in Live state.

When the vault's end date passes, anyone can close the vault. Manager can close a vault prematurely if there are no ongoing loans. This will transfer funds back to tranches according to the waterfall algorithm.

StructuredPortfolioFactory

StructuredPortfolioFactory is a factory contract that creates StructuredPortfolio contracts along with its TrancheVault contracts and controllers.

TrancheVault

TrancheVault is the contract that allows users to deposit/withdraw funds and to manage the vault. TrancheVault creates checkpoints on every action that changes total tranche value. This allows the vault to calculate linear growth since the last change in waterfall calculations.

TrancheVault handles paying fees to the manager and to the protocol. Fees are calculated continuously but are transferred on every checkpoint update.

TrancheVault also manages DepositController, WithdrawController and TransferController. TrancheVault supports ERC20, ERC165 and ERC4626 interfaces.

ProtocolConfig

The ProtocolConfig contract holds parameters necessary for fee accruals.

These parameters are:

  • defaultProtocolFeeRate: the protocol fee (in basis points) that will be charged on each vault

  • protocolAdmin: the address of the protocol owner

  • protocolTreasury: the address where all fees are transferred

  • pauserAddress: address of developer multisig for emergency pausing the protocol

  • customFeeRates: custom fee model that can be defined by the manager

All of these parameters are settable by the protocol admin.

LoansManager

Controllers

Controllers regulate different aspects of how TrueFi products work.

DepositController

DepositController checks whether a lender is allowed to deposit and checks maximum deposit amounts for each lender. Managers can choose to enable or disable deposits.

WithdrawController

WithdrawController manages whether a lender can withdraw and checks maximum withdrawal amounts for each lender. Managers can choose to enable or disable withdrawals prior to the vault's maturity date. This controller is similar to DepositController but for withdrawals.

TransferController

TransferController has a single method onTransfer that is called when a tranche's ERC20 transfer is made.

The basic implementation of this controller always returns true (all transfers enabled). This could be swapped for a different controller to add custom functionality (e.g. only transfers between specific addresses allowed, no transfers allowed, etc).

Debt Waterfall

In credit vaults, the senior tranches are entitled to receive principal plus accrued interest (fixed rate target interest) in higher priority over the more junior tranches.

Thus in a three-tranche credit vault, the waterfall of repayments works as follows:

First, Tranche A receives principal plus target interest, then Tranche B receives principal plus target interest, and then Tranche C receives the remainder of the funds in the vault.

In summary, juniormost tranches absorb performance-based volatility within the vault, while more senior tranches feel losses only if losses exceed the size of subordinated junior tranches.

It is important to note that in CapitalFormation and Closed states, the vault consists only of idle funds. In CapitalFormation and Closed states, there are no assumptions about the future performance of deployed capital and thus the vault is only calculating how to split idle funds between different lenders.

LoansManager is an abstract contract that is an adapter to that allows to add/fund/cancel/repay them.

âš¡
FixedInterestOnlyLoans
Credit Vaults
LoansManager
debt waterfall