How to create a Line of Credit
To create a TrueFi Line of Credit, follow the process below:
Connect your wallet.
For demo vaults, make sure you are connected to Optimism Sepolia network.
If deploying on mainnet, make sure your connected address has been allowlisted by TrueFi governance. Only allowlisted addresses are able to deploy a Line of Credit. Deployment transaction by non-allowlisted addresses will fail.
Configure Line of Credit. See below for descriptions of each parameter:
Deployment Network: choose between deployment on Ethereum, Arbitrum, or Optimism
Underlying Asset: select ERC-20 borrow/lend asset
Deposit Controller:
Lender Restrictions: borrower sets KYC/KYB policy to one of following
All lenders allowed
TrustLabs-managed KYC whitelist
: delegate KYC onboarding to Archblock/TrustLabs)
Custom whitelist
: borrower manages own whitelist
Withdraw Controller: for Line of Credit, select Default
Transfer Restrictions: borrower sets policy for whether lenders can transfer LP token
All transfers allowed
No transfers allowed
Configure interest rate curve Borrower defines parameters of interest rate curve w/ up to two kinks.
Provide token name, token symbol, and borrower description. The token name and symbol will show onchain and on Etherscan pages, etc. The description will show in the TrueFi app front end only.
Deploy Line of Credit. Review and verify all configuration details. Once confirmed, click "Continue" to create onchain transaction and sign in wallet.
Automated lending pools governed by supply/demand curve
For technical docs, see Lines of Credit technical details
TrueFi Lines of Credit (also referred to as Automated Lines of Credit or "ALOCs”) are lending pools for a single borrower, where the interest rate paid by borrowers is determined by a configurable interest rate curve.
For a brief demo, see the video below:
TrueFi Lines of Credit provide borrowers a flexible way to raise capital and lenders a way to deploy capital while maintaining high liquidity.
TrueFi Lines of Credit use supply and demand dynamics to set interest rates, giving lenders incentive to supply capital to pools above target utilization rates and borrowers incentive to maintain optimal liquidity ratios in each pool.
It’s generally (but not always) the case that as utilization increases, the interest rate increases (but not past a ceiling interest rate, chosen by the borrower) and as utilization decreases, the interest rate decreases (but not past a floor interest rate, chosen by the borrower)
From the borrower’s perspective: Borrower expresses that they are willing to borrow between [x]% and [y]%, with an ideal utilization rate of [90]% so that some amount of instant liquidity is available to lenders.
From the lender’s perspective: Lenders want to deploy capital to loan opportunities without losing the ability to withdraw funds when needed. In return, lenders earn a dynamic rate based on the pool utilization and interest rate curve configuration.
Yes, each line of credit has a specified maturity date (endDate
). All debt and interest is due by this maturity date. Once maturity has passed, borrowers cannot draw additional capital and lenders cannot lend additional funds to this line of credit.
Once a Line of Credit is created, lenders can put funds into the pool if they meet the lender restriction requirements that have been configured (lines of credit can be permissionless, or permissioned pools).
Lenders can withdraw from the pool’s idle funds at any time funds are available. As lenders enter or exit the pool, the utilization of the pool changes, and thus, the lender APY changes as the interest rate paid by the borrower changes.
Once a line of credit has been created, borrowers can withdraw idle funds at any time before the pool's maturity (endDate
). After maturity, deposit and borrow actions within the line of credit are disabled, and borrower must repay all principal and interest accrued.
Interest owed by the borrower is accrued block-by-block. Similarly, lenders accrue interest each block as the pool value increases (pool value = principal + interest accrued).
Note that for borrowers, interest owed is calculated upon the principal borrowed (i.e. interest amount is not compounded, borrower does not “pay interest on interest”).
Borrowers work with TrueFi DAO governance to create a line of credit. This should be done as a standard proposal to TrueFi DAO describing all the parameters involved in the proposal. It is a 2 step process.
Borrower requests Line of Credit approval by the TrueFi DAO and recommends parameters (see section below What are the parameters for each Line of Credit?)
If vote passes, then the address requesting creation is allowlisted for line of credit creation. Borrower deploys Line of Credit with approved parameters.
Borrowers define base parameters:
Underlying token: can denominate pool in any ERC20 (including but not limited to USDC, USDT, WETH, etc)
protocolFee (const) = 50 bps paid by lender at withdrawal
premiumFee [optional]: = set to 0 by default; can be configured by borrower
endDate: all loans must be repaid by end date
maxSize: principal in pool cannot exceed this amount
“Lender restrictions” (aka deposit strategy): pool can be permissioned, can use whitelist or signature to determine who can lend
Configure Interest rate curve (similar to Aave/Compound/other protocols, borrowing rates are defined by a rate curve). For a worksheet example, see this spreadsheet.
Set Interest rate min/optimum/max
Set interest rate curve “kinks”
Note: TrueFi contributors are happy to consult with borrowers to help set these curves.
For brief demo of configuration, please see this for video of Lines of Credit interest rate curve configuration: https://twitter.com/TrueFiDAO/status/1511034505028583426
Lines of Credit pay a protocol fee to the TrueFi DAO treasury. Fees are quoted on a per annum basis, 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 line of credit 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 line of credit 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
For up-to-date fee rates on each vault, please see vault pages at https://app.truefi.io/.
Yes, see here: https://github.com/g0-group/Audits/blob/master/TrueFiDec2022.pdf
Yes, see Line of Credit tutorial.
AutomatedLineOfCredit
is a contract that serves as a lending pool of funds managed by the borrower, who is the sole party who can borrow the funds. The borrower can: borrow funds, repay funds, set AutomatedLineOfCredit
max size, add/remove deposit strategies, add/remove withdraw strategies, and change the transfer strategy. The borrower can also upgrade the AutomatedLineOfCredit implementation.
AutomatedLineOfCredit
satisfies ERC-4626 requirements, meaning it meets all features described here.
An audit of AutomatedLineOfCredit
and AutomatedLineOfCreditFactory
by g0 Group can be found here: https://github.com/g0-group/Audits/blob/master/TrueFiDec2022.pdf
Details on Automated Line of Credit and related contracts can be found in Github below:
beryllium_automatedLineOfCredit
Arbitrum One
beryllium_automatedLineOfCreditFactory
Arbitrum One
beryllium_automatedLineOfCreditFactory_proxy
Arbitrum One
beryllium_protocolConfig
Arbitrum One
beryllium_protocolConfig_proxy
Arbitrum One
beryllium_depositController
Arbitrum One
beryllium_allowAllLenderVerifier
Arbitrum One
beryllium_withdrawController
Arbitrum One
beryllium_openTransferController
Arbitrum One
AutomatedLineOfCreditFactory
serves for deploying new AutomatedLinesOfCredit. All of the AutomatedLineOfCredit
parameters are chosen by the borrower, except for ProtocolConfig
.
When a borrower repays a given amount of borrowed funds, they owe interest. This interest is added to their balance of the outstanding debt. The amount of interest they owe is based on the utilization rate of the funds in the AutomatedLineOfCredit
at the time they repay a given amount of debt. The interest rate that the Borrower pays on their funds is a function of the utilization of the AutomatedLineOfCredit
. This function is parameterized by six values which are determined by the borrower when the AutomatedLineOfCredit
is created:
A (1) minimum interest rate utilization threshold up to which point the interest rate is equal to the (2) minimum interest rate,
An (3) optimum utilization rate and (4) optimum interest rate. The interest rate is determined by linearly interpolating between the minimum interest rate and the optimum interest rate when the utilization rate is between the minimum interest rate utilization threshold and the optimum utilization rate,
A (5) maximum interest rate utilization threshold beyond which the interest rate is equal to the (6) maximum interest rate. The interest rate is determined by linearly interpolating between the optimum interest rate and the maximum interest rate when the utilization rate is between the optimum utilization rate and the maximum interest rate utilization threshold.
The utilization
of an AutomatedLineOfCredit is equal to:
(borrowed_funds + unpaid_interest) / value
The value
of an AutomatedLineOfCredit is equal to:
liquid_funds_in_ALOC + borrowed_funds + unpaid_interest - unclaimed_fees
When the Borrower borrows from the AutomatedLineOfCredit
, utilization
increases. When a Lender deposits into the AutomatedLineOfCredit
, utilization
decreases. When a Lender withdraws from the AutomatedLineOfCredit
, utilization
increases.
Whenever an action that changes AutomatedLineOfCredit
value is performed (borrow
/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 AutomatedLineOfCredit
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 accruedFee
value is equal to:
(current_timestamp - last_update_timestamp) / YEAR * protocol_fee_rate * portfolio_value
**portfolio_value
does not take into account the interest that has been accrued since the last update.
protocol_fee_rate
is the rate taken from the ProtocolConfig
contract the last time an update was made. This means that if the DAO decides to increase the fees, the higher rate will be applied for accruedFee
calculation since the next update, not the current one.
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.