Core Protocol Interaction Theoretical

Minting fTokens

Minting is the process of converting underlying assets in your canister balance to fTokens. fTokens allow you to earn money from the interest payments that borrowers owe to the protocol. The conversion between the amount of fTokens one receives from minting or the amount of underlying tokens one receives from redeeming their fTokens is given below.

Click here šŸ‘‰ #Exchange Rate to view the parameters of the exchange rate

If you look carefully at the equation and combine this with the fact that each minute a borrower owes the market money over time, the amount of underlying tokens you receive per fToken will never go below the amount you initially minted at.

Redeem

Redeeming is the process of converting your fTokens back to underlying tokens which get sent to your canister balance.

Checks before redeeming

  1. IMPORTANT: If the token you plan to redeem is part of the #entered markets i.e. used as collateral, you will only be able to redeem to the # Zero Liquidty Point. Note liquidation occurs before the # Zero Liquidity point at the # Liquidation Point.

  2. The market must have more total cash than you want to redeem

  3. You can only redeem the amount of fTokens you have

RedeemUnderlying

Redeem underlying allows a user to specify the amount of underlying fTokens they would like to recieve from the protocol which gets converted to # of fTokens in the backend.

Checks before redeemUnderlying

  1. IMPORTANT: If the token you plan to redeem is part of the # entered markets i.e. used as collateral, you will only be able to redeem to the # Zero Liquidty Point. Note liquidation occurs before the # Zero Liquidity point at the # Liquidation Point.

  2. NOTE: If you put more an underlying value which gets computed to be more than the fTokens you have, we will attempt to redeem all of your fTokens.

  3. The market must have more total cash than you want to redeem

Borrow

Borrow describes the amount of assets you can borrow. In order to borrow, you must have these checks.

  1. More dollar liquidity in collateral than you plan to borrow

  2. The market must have more cash than you can borrow

  3. The amount to borrow must be greater than the default token fee.

Accruing Interest on Borrows

Interest rates on borrows are accumulated by the following equation

UtilizationRateMantissa is not a atomic unit of our protocol and can be calculated using

After X amount of blocks, borrowed balances and total borrows get updated via

An amount of interest goes to #Reserves. Note, the subtraction of reserves is not done in the #TotalBorrow parameter. Instead, the subtraction occurs in the #Exchange Rate when redeeming fTokens for underlying

Repaying

Specifying how much of your borrow balance you want to repay

NOTE: Due to increases in borrow amount as calling borrow accrues interest causing a change in the borrow balance, user's specifying a repayment amount for the entire balance may miss slightly. Therefore a specified repayment amount greater than the borrow balance will repay all borrows. Only the amount repaid will be taken from your balance so rest assured you are not being charged anymore than whats repaid.

Last updated