[Legacy] TrueFi DAO Pools
Below is a brief guide to TrueFi lending pool contracts.
TrueFiPool2contract is used by TrueFi DAO lending pools -- tfUSDC / tfUSDT / tfBUSD / tfTUSD. This contract enables accounts to pool tokens with the goal of earning yields on underlying tokens.
To calculate the price of the lending pool token ("LP token"), take
To calculate yield for a pool, one must calculate the weighted average of rates across each active loan in the pool and idle funds held in the pool.
pool_apy = SUM(loan_1_amount*
loan_1_apy + ... + loan_n_amount*loan_n_value) / poolValue()
Implements the lending strategy for the TrueFi pool, i.e. how loans are approved and funded.
Each LoanToken has the following parameters:
borrower(): address of borrower
amount(): principal amount of fixed term loan
term(): loan term in seconds
apy(): loan APR in basis points (i.e. 971 = 9.71%)
status(): returns loan's status, which progresses through the following states:
Awaiting:Waiting for funding to meet capital requirements
Funded:Capital requirements met, borrower can withdraw
Withdrawn:Borrower withdraws money, loan waiting to be repaid
Settled:Loan has been paid back in full with interest
Defaulted:Loan has not been paid back in full
Liquidated:Loan has Defaulted and stakers have been Liquidated
canTransfer(): returns LoanTokens are non-transferable except for whitelisted addresses
interest. Note that this does not take into account whether the loan has been repaid.
isRepaid(): returns boolean value, indicating whether a loan has been repaid in full.
profit(): returns difference between
amount(), the anticipated interest to be paid on the loan
Repaying loans to lending pools has two steps:
- 1.Borrower repays funds to loan token
reclaim()function is called on loan token, which burns the loan token and pays out fees to stkTRU.
stkTRU holders can vote
no()on each loan. The
TrueLender2contract then checks to see if each loan satisfies threshold conditions in order to be funded.
stkTRU voters receive rewards in the form of TRU tokens for voting on loan requests.
claimable()reward tokens are calculated as follows:
claimable() = (# TRU voted by user / # total TRU votes) * (Total TRU Reward), where
Total TRU Reward = (Loan interest * TRU distribution factor * rewardMultiplier)
Loan interest = (loan APR * term in days * principal) /365. Loan APR, term, and principal can be obtained from the respective loan token contract
- To calculate farm rates for each token, use the formula below:
TRU rewards per farm per day = TRU distribution per day * getShare(IERC20 token) / shares()as described below