Skip to content

Mixed visibility (Lesson 9: Hardhat Smart Contract Lottery) #183

Answered by PatrickAlphaC
02b2 asked this question in Q&A
Discussion options

You must be logged in to vote

Summary

  1. It's useful for devs to know if a function is storage, immutable, or constant for gas purposes.
  2. We want a user-friendly function for developers who interact with our application. getPlayer(0) is much nicer than s_players[0].

More information

  1. It's useful for devs to know if a function is storage, immutable, or constant for gas purposes.

Giving engineers a visual signal of "oh, this is a storage variable, maybe I shouldn't read and write to it a lot" has proved helpful.

  1. We want a user-friendly function for developers who interact with our application. getPlayer(0) is much nicer than s_players[0]

...and it reveals internal implementation details about the contract that a develo…

Replies: 2 comments 6 replies

Comment options

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

Comment options

You must be logged in to vote
5 replies
@02b2
Comment options

@PatrickAlphaC
Comment options

@PatrickAlphaC
Comment options

@02b2
Comment options

@PatrickAlphaC
Comment options

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