By Gidon Katten, CTO of Folks Finance
This document will describe the design and features of the Folks Finance V2 Lending Protocol in a way that anyone should be able to understand.
The protocol supports listing almost 200 different pools and 15 different types of loans.
The V2 lending protocol is more scalable. It supports listing:
- Up to 189 pools e.g. ALGO, USDC, etc
- Up to 15 different types of loans e.g. General, Stablecoin Efficiency, etc.
Each pool is a smart contract which collects users’ deposits and facilitates users’ borrows for a given asset. Each loan is a smart contract which combines multiple pools together in such a way that you can deposit into one, store your collateral and borrow from another.
Multi-collateral, multi-borrow loans.
The V1 lending protocol only allowed a single collateral and single borrow per loan. Now V2 supports up to 15 collaterals and 15 borrows per loan.
Multi-collateral, multi-borrow brings several benefits to the user in terms of flexibility risk diversification: diversification of borrowed assets/collateral can reduce the liquidation risk resulting from the fluctuation of their value.
The V1 lending protocol had the concept of token pairs, where there was one collateral and one borrow for each loan. Whilst it did have its issues (see above), it also had a number of advantages.
One of these advantages was that it helped increase efficiency where we could offer custom LTV ratios depending on the price correlation between the two assets. In fact, Compound V3 launched a few months ago with this exact idea.
With V2 supporting multi-collateral, multi-borrow loans one might mistakenly think that we lose this advantage. However this is where efficiency loans jump in!
Efficiency loans work by basketing similarly price-correlated assets into a single loan type, thereby offering higher LTV ratios. Take for example stablecoin efficiency loans. They include stablecoins such as USDC and USDt with LTV ratios upwards of 90%.
A single user can have multiple loans.
As in V1, a single user can have multiple loans in their account. This helps if they want to isolate their liquidation risk and/or pair price correlated assets in the case of efficiency loans.
Each loan of a user is an escrow account which stores information about the loan and holds the collateral of the loan.
In V2, users can now also delete their old loans and recover their minimum balance fees.
A user can borrow an asset with a stable borrow rate.
The borrow interest rate a user pays is determined by market dynamics. The general idea is that more deposits (vs borrows) lowers the borrow interest rate, and more borrows (vs deposits) increases the borrow interest rate.
However the deposits and borrows continuously change, and therefore the borrow interest rate the user is paying does as well!
V2 offers users the option to lock in a borrow interest rate indefinitely so they don’t have to worry about their interest repayment increasing. This works by offering a stable borrow interest rate which is a bit higher than the variable borrow interest rate. Therefore this leaves a margin of safety where the rate can remain constant even if the variable borrow interest rate later increases even higher than the user’s locked-in stable borrow interest rate.
There are some exceptions where the user’s stable borrow interest rate may change. This can only happen in extreme circumstances i.e. almost all the funds are borrowed in a pool and a lot of the borrows are stable borrows.
The V2 smart contracts are fully composable. This means that operations can be combined together in interesting ways to create new features. And these operations don’t have to be Folks Finance operations, they can be operations on other protocols that are also composable.
One way we are making use of this composability is to reduce the number of times the user has to sign group transactions.
We are also using the composability to integrate Deflex. Loan operations can be combined with DEX operations to enable additional functionality e.g. swap and deposit, swap collateral, repay with another asset etc.
A user can swap their collateral (and repay with it).
Imagine a user has a loan with ALGO collateral and USDC borrowed. The price of ALGO is crashing and their loan is in danger of being liquidated. What can they do? They could add more collateral or could repay USDC but both of these options require the user to have funds.
The solution we offer is the ability to swap your collateral to another asset. This works by utilising the atomic group transactions in Algorand where we temporarily give you access to your collateral and allow you to do whatever you want with it (e.g. swap it into another asset), as long as you send it back afterwards.
Then we take it one step further; you can repay using the same collateral as the asset you are borrowing. Combining the two, if you wanted to repay a USDC borrow using your ALGO then you can swap the ALGO for USDC and then repay the USDC using your new USDC collateral. And don’t forget about composability; the swap and repay are combined into one group transaction to make the whole process a single step process.
Flash loans are uncollateralized loans without borrowing limits in which a user borrows funds and returns them in the same group transaction. This feature is primarily useful for developers that want to do arbitrage or liquidations.
For example, imagine 1 ALGO is selling for 0.35 USDC on Pact and 0.34 USDC on Humble. A user wants to take advantage of this but they don’t have ALGO liquidity. What they can do is (ignoring slippage):
- Flash loan borrow 100,000 ALGO
- Sell 100,000 ALGO on Pact for 35,000 USDC
- Sell 35,000 USDC on Humble for 102,941 ALGO
- Flash loan repay 100,000 ALGO (and 100 ALGO fee)
- Profit 1,841 ALGO
Enjoy Folks Finance V2.
V2 launches on 12/12/22. Be sure to transfer your assets from V1 to enjoy the features of V2. From the Folks Team to you, we wish you all the best.