DeBank - My Loans UI
The following is a detailed description of the protocol
Only stable coins can be lent to or borrowed from the protocol.
i. On BSC, only BUSD and USDT can be lent or borrowed
ii. On Polygon, only USDC and USDT can be lent or borrowed.
i. On BSC, BNB, ETNA token and ETNA NFTs are assets that can be used as collateral. Any other ERC20 token on BSC can be integrated at a later time.
ii. On Polygon, Matic, ETNA token and ETNA NFTs are assets that can be used as collateral. Any other ERC20 token on Polygon can be integrated at a later time.
The interest rates algorithm is as follows:
This gives the lending rate as:
And the borrowing rate as:
The above rates are variable so when they change as
changes, active loan rates and active deposits (assets lent to the platform) rates also changes except for borrowers who took a loan at a fixed rate. In this case, the borrower’s rate is at a premium and it is given by:
i.e, such a borrower's rate is increased by
and in this case, it stays fixed even if the rates in the protocol changes due to changes in
is the ration of amount borrowed to total deposited for any given borrowable asset. It is which given by:
goes above 0.95 (say 0.951), borrowing access for that particular asset stops until the percentage drops either by some borrowers paying back all or part of their loans or more lenders lending to the protocol.
If the total amount of BUSD lent to the protocol at a given time is
and total amount already borrowed is
then we have:
With the following parameters set as follows:
Then lenders get paid:
And borrowers get charged:
With both the lender's and the borrower's rates varying as
If the borrower rather takes the loan at a fixed rate, such a borrower will be charged a fixed interest rate of:
There is an exception when a borrower's loan is collateralized with ETNA tokens or ETNA NFTs. In both cases, the loan are at zero interest rate charged.
Each collateral asset has a borrowing power defined by a borrowing factor
. For each collateral asset, the maximum amount that can be borrowed
is given by:
is the value of the collateral or collaterals used.
For a collateral asset (say ETNA Token) with
. If a borrower uses ETNA that worth $10,000 as collateral, the maximum amount the borrower can take out as loan is:
Which can be taken out in BUSD, USDC or USDT.
With this collateral value, the user can take out a maximum of 2500 but can choose borrow any amount between 0 – 2,500 BUSD/USDC, the remaining amount not taken will remain as accessible credit that can be taken at a later time.
With depreciation of the value of the collateral used by a borrower, the loan taken by the borrower is flagged for liquidation if the collateral depreciates up to a certain value.
The value at which liquidation flagging occurs is determined by a liquidation factor
The value the collateral depreciates to, at which loan is flagged for liquidation (
) is also dependent on the amount borrowed and it is given by:
For example, if
and the user takes out the max amount of
BUSD, then the loan is flagged for liquidation when the collateral value drops to:
The borrower can prevent liquidation by paying back some part or the whole loan or by depositing more collateral to increase his borrowable limit.
When liquidation occurs, the total amount by which the loan is deliquescent is liquidated plus a liquidation fee, this is given by:
is the liquidation fee factor.
, for the loan in the previous section, the amount of the borrower’s collateral that is liquidated is:
Since the collateral in this example is ETNA, then ETNA amount that worth $2,750 is liquidated.
Again, user can prevent this by paying all or part of the loan back or by depositing more collateral to increase his/her borrowable limit.
The protocol have a function for appointing liquidator account roles. It allows the appointment of up to 100 accounts to be liquidators. When an account is appointed as a liquidator, such an account can see loans that are flagged for liquidation, this displays in the liquidation dashboard.
Accounts appointed are only accounts from users of the vault contract. Top users of the vault are appointed to be liquidators.
The liquidation fee is given by:
As with the above example where
, the total fee charged for liquidation is:
The payment for liquidators is a percentage of this fee defined by a payment parameter
. This payment is given by:
, the liquidator's payment is:
The remaining portion of the liquidation fee is paid as an admin fee and it is given by:
For this example, we have
For example, in this senerio, user deposited the following:
10000 ETNA which worths $2000
10 BNB which worths $6000
ETNA Borrowing factor is 0.2 and BNB Borrowing factor is 0.3
This means the user allowed borrowing amount is: 2000x0.2 + 6000x0.3 = $2200
If user borrowed all the $2200.
If user does not pay anything back, with effective apr = 7.5% (assuming constant for calculation purpose), after a year user will owe = 2365
If also the liquidation occurs when calateral value dropped to amount owed*(1+0.25) = 2365 x 1.25 =2956.25
at this time, let us asume the collateral sum total is now 2940 due to market crash. Liquidation should always take the most from BNB and then the rest from ETNA. so if there is any portion of collateral to be returned in the case of multiple collateral, it should be ETNA to be returned since liquidation will always take the most possible from other collaterals used and then what ever remaining to be taken is taken from ETNA