Skip to content

In Lesson 4: fund-me-fcc (library Q&A) #5640

Discussion options

You must be logged in to vote

@KarthickSakthi This is all because solidity does not work with decimal numbers. So this logic is for correct math.

Price return by price feed contains 8 decimals, i.e if the price is 1840 then the value will be 184000000000, now as we know solidity's smallest unit is wei which contains 18 decimals, i.e 1 ether will be equal to 1000000000000000000. So we added 10 more decimals to 8 decimals so the price will be in the 18 decimal system.

Now for comparing the value so we can identify whether the user has deposited the correct amount or not we do all this math;

first, we declared the minimum price for the deposit MINIMUM_USD = 50 * 10 ** 18; 50 * which is 50, so what value will be in wei? …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@KarthickSakthi
Comment options

@alymurtazamemon
Comment options

@KarthickSakthi
Comment options

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