Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Update L12-Gas-optimizations.md #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

malik672
Copy link

added more gas savings tip

@ljcutts
Copy link
Contributor

ljcutts commented Jan 30, 2023

Hello @malik672, a few things here. For one, please keep the Gas emoji. Next, do not delete the Conclusion part, keep that. Also, can you fix grammar and punctuation in the additions that you made after Declaring the constructor payable? You are missing things like capitalizing words and it sounds like you repeat some lines.


## Declaring the constructor payable
Declaring the constructor as payable can potentially save a small amount of gas when deploying a contract in Solidity. This is because the Solidity compiler will skip a set of opcodes that check whether the constructor is payable at runtime if the constructor is declared as payable, resulting in a smaller contract bytecode and fewer gas units required to execute it.What this actually does is that it skips this set of opcodes :
* ```CALLVALUE```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the effort for this. I think it would be really cool if we dived into a bit of Yul in the Advanced Section or made another for Yul.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the effort for this. I think it would be really cool if we dived into a bit of Yul in the Advanced Section or made another for Yul.

yeah, we should do this, how should we do this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe leave in small content for people to be interested in this and make a sub-course for Yul?

Since Yul is almost like a language on its own, it deserves its own space, but making the content for Yul will be difficult.

Copy link
Author

@malik672 malik672 Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets take this discussion to discord, would make it more easier

@malik672
Copy link
Author

malik672 commented Feb 1, 2023

Hello @malik672, a few things here. For one, please keep the Gas emoji. Next, do not delete the Conclusion part, keep that. Also, can you fix grammar and punctuation in the additions that you made after Declaring the constructor payable? You are missing things like capitalizing words and it sounds like you repeat some lines.

will do this

@yanukadeneth99 yanukadeneth99 added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants