Skip to content

Why are we multiplying with 1e10? #6372

Closed Answered by jho44
Codensity30 asked this question in Q&A
Discussion options

You must be logged in to vote

This is my understanding from going up to Lesson 4. Maybe I'll understand it differently after going through the hardhat section.
ChainLink will return something like 3000 * 1e8 (8 is from AggregatorV3Interface(ADDRESS).decimals). We multiply by 1e10 so we can pad up to 3000 * 1e18. And we'd like to pad up to 1e18 for a similar reason why we have 1 eth = 1e18 wei; Solidity can't support decimals so all our calculations must be in whole numbers. By padding up to 1e18, we can guarantee we will always work with whole numbers, even if we say we only want to fund 1 wei.

Replies: 1 comment 1 reply

Comment options

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

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