Skip to content

LESSON 13: const amountDaiToBorrow = availableBorrowsETH.toString() * 0.95 * (1 / daiPrice.toNumber()) #1295

Answered by alymurtazamemon
buikhacnam asked this question in Q&A
Discussion options

You must be logged in to vote

@buikhacnam

availableBorrowsETH.toString()

This is an available borrow amount in ETH that we can borrow.

availableBorrowsETH.toString() * 0.95

here we are multiplying with 95% so we can only borrow 95 of the amount, if we do 100% the health factor of aave will hit and liquidate us.

(1 / daiPrice.toNumber())

Here we are dividing diaPrice by 1 to convert it to 1 DAI token.

And the whole line says, get the borrow amount and dia price to convert it to total DAI that we can borrow.

Hope it clears your query.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@buikhacnam
Comment options

Answer selected by alymurtazamemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants