Last updated
Last updated
When a user lends spot, he effectively trades Loan Tokens for Fixed Rate Tokens in the fixed rate pool. The protocol first deposits the user's Underlying Tokens (ex: USDC) in the underlying money market for Loan Tokens (ex: cUSDC). It then finds the highest tick with Fixed Rate Tokens and swap the user's Loan Tokens for Fixed USDC Tokens using the exchangeRate formula. The Fixed Rate Tokens are then sent to the lender's wallet.
For example, imagine a 1 year fixed rate USDC pool with the following outstanding limit orders from other market participants:
If a lender wants to lend 100 USDC in the pool he will need to convert his USDC to Fixed USDC tokens. The following logic will be followed when swapping USDC to Fixed USDC tokens. Note that this logic is similar to how swaps are executed in:
The protocol will find the nearest tick with Fixed Rate Tokens using the tick bitmap, in this case the 5% tick. It will then swap the 100 USDC for 105 Fixed USDC tokens using the exchangeRate formula.
It will add the 100 USDC to the 5% tick and remove 105 Fixed USDC tokens from the 5% tick. The resulting interest rate pool state will be the following: