FlexiblePortfolio
is a contract that serves as a portfolio of funds managed by the portfolio manager.
FlexiblePortfolio
allows the portfolio manager to define allowed debt instruments that the portfolio will handle. This is the latest iteration of the previous portfolio contract version (called ManagedPortfolio
).
FlexiblePortfolio
FlexiblePortfolioFactory
FlexiblePortfolio
satisfies ERC-4626 requirements, meaning it meets all features described here.
FlexiblePortfolio
supports loans that yield both principal and interest amounts on repayments. That is, the principal amount goes straight to portfolio liquid funds and can be withdrawn/lent at any moment. Interest is split between all lenders proportionally to the amount of portfolio tokens they hold. This implies that if the tokens are held in a contract (e.g. Uniswap pool), the interest will be frozen in the portfolio.
FlexiblePortfolio
valuation is handled by the ValuationStrategy
, which is a contract that holds information on all the loans the portfolio holds and can evaluate them properly. This requires the portfolio to call onInstrumentFunded
when a loan is funded and onInstrumentUpdated
when a loan might change its status (e.g. is repaid or gets defaulted). Valuation strategies cannot be switched as they hold the state of the portfolio loans.
Whenever an action that changes FlexiblePortfolio
value is performed (fundInstrument
/repay
/deposit
/mint
/withdraw
/redeem
/updateAndPayFee
), a fee for the TrueFi DAO is calculated and immediately transferred to the TrueFi DAO Treasury address. The fee is deducted from the FlexiblePortfolio
value, so actions like borrow/withdraw/redeem cannot move the funds that are designated as fees. If the accrued fee cannot be repaid at the moment because of the lack of liquidity, additional information about the fee amount is stored in the contract and will be used to make the overdue payment the moment it will be possible. The same behavior is followed by the fee of the manager.
The protocolAccruedFee
value is equal to:
(current_timestamp - last_update_timestamp) / YEAR * protocol_fee_rate * portfolio_value
The managerAccruedFee
value is equal to:
(current_timestamp - last_update_timestamp) / YEAR * manager_fee_rate * portfolio_value
**protocol_fee_rate
is the rate taken from the Protocol Config contract the last time an update was made. The same goes for manager_fee_rate
, which is taken from Fee Strategy
Functions enabling Lenders to deposit/withdraw funds to/from the contract can additionally be limited by Deposit/Withdraw Strategy. These strategies (if set), are called with a hook every time a specific action is performed on the contract. The same calldata as for the initial call is passed to them, and then the strategy independently decides if this action can or cannot be performed. The strategies might also write some state to themselves on such hooks, but this is not a mandatory behavior. Additionally, these hooks can return a fee that would be applied for the action that is being performed. The fees are calculated independently by the strategy and have to be returned as absolute values and always in assets(not shares).
Here we present a few examples to better understand this process:
deposit(assets: 100)
is being called, the strategy onDeposit()
returns (true, fee: 10).
This means that 10 would be transferred to the manager, and the shares would be minted to the Lender based on the remaining 90.
mint(shares: 100)
is being called, the strategy onMint()
returns (true, fee: 10)
Let’s assume shares:assets are 1:1. 100 has to be transferred to the portfolio and 10 to the manager to satisfy the fee and the Lender’s desire to have 100 shares minted. We calculate the fees for withdraw/redeem the same way.
This contract serves for deploying a new Flexible Portfolio. All of the FlexiblePortfolio
parameters are chosen by the portfolio manager, except for ProtocolConfig
.
Configurable lending pools governed by 3rd party PMs
For technical docs, see Flexible Portfolio contracts
Flexible Portfolios are configurable lending pools run by independent managers on TrueFi infrastructure. Portfolio Managers ("PMs") have discretion over loan terms, as well as other items such as the pool's maximum size, maturity date, and lender access/restrictions.
Portfolios can serve real world financing borrowers and use cases, as covered by PYMNTS here, as well as crypto-focused borrowers (institutions, DAOs, etc., as covered by Bloomberg here).
Portfolio managers define who can lend into each portfolio (i.e. whether portfolios are permissioned or permissionless).
For permissioned portfolios, lenders can gain access to the portfolio by completing onboarding per the manager's instruction (ex. completing KYC process directed by the portfolio manager).
Portfolio Managers (PMs) make decisions on underwriting loans, managing relationships with borrowers, and configuring portfolios. Lenders are responsible for conducting diligence on PMs and portfolios before lending.
Lenders can withdraw funds only after the portfolio's maturity date. Funds are locked up in the portfolio until the portfolio’s maturity is reached.
No, portfolio tokens are non-transferrable by default.
Managers can enable transfers if desired.
Portfolios pay a protocol fee per annum to the TrueFi DAO treasury. Fees accrue block-by-block and are paid upon each smart contract interaction (lend/withdraw/disburse loan/repay loan).
The example below illustrates how the protocol fee works:
Protocol Fee example
Take an example portfolio Verum Fund, which holds 1,000,000 USDC worth of loans and assume protocol fee = 50 bps per annum (0.50%).
Assuming the value of Verum Fund grows linearly from 1,000,000 USDC to 1,100,000 USDC over the course of 30 days (avg. value of 1,050,000 USDC), the portfolio would pay a protocol fee of 431.51 USDC for this time period:
Protocol fee = 1,050,000 USDC * 0.50% * (30/365) = 431.51 USDC
Additionally, PMs can set an optional Portfolio Fee. Portfolio Fees are paid to the PM, and can be configured such that they are accrued linearly over time, or paid as a flat fee at time of deposit and/or withdrawal.
ManagedPortfolio
is in the process of being sunset.
New TrueFi Capital Markets portfolios deployed after June 2022 use contractFlexiblePortfolio
ManagedPortfolio
represents a portfolio of BulletLoans. Lenders put funds into the portfolio, the manager uses funds to issue loans to borrowers, and borrowers repay principal and interest back into the portfolio. ManagedPortfolio
issues ERC-20 Liquidity Provider tokens to lenders in proportion to the amount they lend. These tokens represent a lender's share of the funds in the pool, including the interest accumulated from loans repaid by borrowers.
All of the portfolio operations are up to the manager's discretion. The Portfolio Manager makes decisions about issuing new loans, marking them as defaulted, altering portfolio params and so on. 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).
Portfolio tokens represent lenders' share in the pooled funds. Lenders put funds into the portfolio if they trust the manager is going to abide by a reasonable policy. Funds from the portfolio are only available for withdrawal after the portfolio's close date.
Lends a certain amount of underlying tokens to the portfolio. If the portfolio has lender restrictions enabled, this function requires metadata to validate the lender’s address is allowed to lend.
After the portfolio’s close date, lender can withdraw funds, i.e. redeeming the portfolio token for underlying pool tokens.
Creates bullet loan token using BulletLoans contract.
Only the portfolio’s manager can mark a loan as resolved. Intended to be used for situations after partial repayment where a loan workout has been agreed to.
Manager can change portfolio’s close date, or EndDate
. Note that the portfolio’s close date can only be decreased. Close date can NOT be moved further into the future, nor can it be decreased to a date earlier than any active loan’s maturity date.
Manager can set the lender verifier contract to enforce lender restrictions. Manager can leverage three different types of restrictions:
Whitelist: contract that implements simple, universal whitelist.
WhitelistLenderVerifier: 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: contract that requires the lender to provide a signature of a predefined message.
Manager can set the portfolio fee, or managerFee, in basis points. Portfolio fee is charged on deployed capital
Manager sets a cap, or maxSize
, for a portfolio. Lenders can not put more funds into the portfolio if it would cause the total principal amount lent into the portfolio to exceed the maxSize
.
Manager can modify loan terms, changing maturity date or total debt to be repaid. In order to change the maturity date to an earlier date or increase the repayment value, the borrower must consent and provide a signature.
View Methods
Returns status of the portfolio. If current date is past the portfolio’s close date, will return ‘Closed’. If portfolio holds defaulted loans, will return ‘Frozen’.
Returns the amount of portfolio tokens that would be minted for a given amount of tokens to be lent (e.g. if 1000 USDC are lent, 995 tfExamplePortfolio tokens would be minted).
getOpenLoanIds()
Returns list of open loan tokens.
illiquidValue()
Returns estimated value of active, illiquid loans. Calculated on straight-line basis.
value()
Returns total estimated value of portfolio (liquidValue
+ illiquidValue
).
Below are examples of typical flows in TrueFi Capital Markets pools:
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.
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 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.
Contract that allows easy portfolio configuration and creation. A particular instance of the factory can only be accessed by whitelisted addresses.
Contract holding key system params.
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.
A contract that implements simple, universal whitelist.
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.
A contract that requires lender to provide a signature of a predefined message.