Skip to content

Question about the Math in the dai to borrow for improving understanding. (related to Units) #654

Answered by ZeroEkkusu
WeTheArtist asked this question in Q&A

You must be logged in to vote
amount_dai_to_borrow = (1 / dai_eth_price) * (borrowable_eth * 0.95)

For simplicity

  • let's say 1 ETH is 1000 DAI
  • you have deposited 1 ETH (ignore the interest)
  • LTV is 80% and you have not borrowed anything ⇒ borrowable_eth is 0.8 ETH

The above code then means:
??? DAI = (1 / 0.001 ETH) * (0.8 ETH * 95%)
??? DAI = 1000 DAI * 0.76 ETH
??? DAI = 760

Which is basically a way of saying:
If 1 DAI is 0.001 ETH, meaning 1 ETH is 1000 DAI, how much DAI can I borrow with 95% of my 0.8 ETH?
1 : 1000 = 0.76 : ???
??? x 1 = 1000 x 0.76
??? = 760

Replies: 1 comment 3 replies

You must be logged in to vote
3 replies
@WeTheArtist

@ZeroEkkusu

@cromewar

Answer selected by cromewar
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