What does "s_variable" mean? #2970
-
Sorry, just saw some variables named as "s_<variable_name>". |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@yangyueche It is a Chainlink style guide, that in order to remember a variable whether it is a state variable, immutable variable, constant variable, or local variable. They introduce suffix for them, here And someone can question why should we remember that. So the answer is while writing contracts we can know which variable we are using if suppose it is a state variable so we will become careful to perform any operation on it because as you know performing operations on state variables cost gas. Read a state variable has different gas and updating/storing in a state variable has a different cost. |
Beta Was this translation helpful? Give feedback.
-
Thank you! |
Beta Was this translation helpful? Give feedback.
@yangyueche It is a Chainlink style guide, that in order to remember a variable whether it is a state variable, immutable variable, constant variable, or local variable. They introduce suffix for them, here
s
represent a state variable.And someone can question why should we remember that.
So the answer is while writing contracts we can know which variable we are using if suppose it is a state variable so we will become careful to perform any operation on it because as you know performing operations on state variables cost gas. Read a state variable has different gas and updating/storing in a state variable has a different cost.