TrueFi Docs
Search…
⌃K

Structured Credit Vault contracts

Structured Credit Vaults are multi-vault portfolios allowing lenders to deposit into one or more specific buckets of funds ("tranches") managed by the portfolio manager. Structured Credit Vaults can have up to 3 tranches, enabling each tranche to deliver unique risk-return profiles.
Below is an overview of Strucuted Credit Vault contracts in detail.

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 LoansManager 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 debt waterfall 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 contract 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 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 manager
All of these parameters are settable by the protocol admin.

LoansManager

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

DepositController

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

WithdrawController

WithdrawController whether lender is allowed to withdraw and checks maximum withdrawal amounts for each lender. Manager can choose to enable or disable withdrawals. (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).

Notes

Debt Waterfall

In structured 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 would receive principal plus target interest, and then Tranche C would receive the remainder of 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 future performance of deployed capital and thus the vault is only calculating how to split idle funds between different lenders.