Skip to content

Lesson 3: gas fee #436

Answered by PatrickAlphaC
nargeslein asked this question in Q&A
Nov 24, 2021 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Great question!

  1. We multiplied by that amount to reach a sort of "standard". Most prices and tokens are represented with 18 decimals, so we try to get the price to be represented as such as well.
  2. Per the gas costs, you're right, view functions are free to call from off-chain! However... if a smart contract calls a view function in the transaction, it has to pay the gas fees to view it, otherwise it won't know what the price is!

View functions are only free if a simulator runs them, when we call a view function in remix, we actually only simulate calling it. When a smart contract calls it, it calls it with gas!

Does that make sense?

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@nargeslein
Comment options

@PatrickAlphaC
Comment options

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