(Lesson-13) Need a code explanation #2503
-
const amountDaiToBorrow = availableBorrowsETH.toString() * 0.95 * (1 / daiPrice.toNumber()) Q- why 0.95 is multiplied? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@Vanshika0901 : Because, we are only using 95% of our available collateral. That's why we say 0.95! And, Its best that you do not use 100% of your collateral i.e 1 , Because then you will get instantly liquidated, due to market volatility. So, you can use 50% of your available collateral i.e 0.5 or any other percentage you want, Its totally upto you that how much from your available collateral you wanna borrow against! Hopefully, It will clear your doubt! |
Beta Was this translation helpful? Give feedback.
-
@Vanshika0901 we are using 0.95 because we don't want to use up all of our available collateral and borrow all of it. We just want a percentage of it and in this case, we just want 95% which equates to 0.95. You don't have to use 0.95 you could use any percentage you want to. If you want to borrow 80% or 75% of your collateral you can multiply with 0.8 and 0.75 respectively, instead of 0.95. |
Beta Was this translation helpful? Give feedback.
-
Well, in this case, any arbitrary percentage (decimal equivalent) in accordance with how much you want to borrow works. Dependent on the risk, your collateral is safe--even if you use all of it--unless you are close to liquidation. To this end, you will have to top-up your margin in accordance with the collateral deposited to not get liquidated. |
Beta Was this translation helpful? Give feedback.
@Vanshika0901 : Because, we are only using 95% of our available collateral. That's why we say 0.95!
And, Its best that you do not use 100% of your collateral i.e 1 , Because then you will get instantly liquidated, due to market volatility.
So, you can use 50% of your available collateral i.e 0.5 or any other percentage you want, Its totally upto you that how much from your available collateral you wanna borrow against!
Hopefully, It will clear your doubt!