Gas Optimization in Solidity: 10 tips
FREE TRAININGS (WEB3 DEV, FLASH LOANS...)
👉 How to find your first 6-Figures Blockchain Developer Job: https://bit.ly/390ebTq
👉 Learn how to create Profitable Flashloans: https://bit.ly/3mqP6nq
OTHER LINKS
👉 https://linktr.ee/eattheblocks
CONTACT INFORMATION
Questions about EatTheBlocks courses, partnerships, projects:
👉 contact [at] eattheblocks [dot] com
Register to the FREE mini-course "become a blockchain developer" on https://eattheblocks.com to learn how to get a remote blockchain job making 100k. (Like I did myself).
How to do some gas optimization for your Solidity smart contracts? I am going to give you 10 tips:
- Tip 1: Minimize on-chain data
- Tip 2: Use libraries
- Tip 3: Use ERC 1167 for cloning contract
- Tip 4: Turn on the solidity optimizer
- Tip 5: Use events
- Tip 6: Write literal values instead of computed one
- Tip 7: Avoid to copy stuff (arrays…), use storage pointer instead
- Tip 8: Avoid for-loops over dynamic ranges
- Tip 9: Optimize the order of variable declarations
- Tip 10: Use eth-gas-reporter
Other Links:
- Forum: https://forum.eattheblocks.com
- Blog: https://eattheblocks.com
- Author Website: https://www.julienklepatch.com