Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 5.12 KB

README.md

File metadata and controls

64 lines (50 loc) · 5.12 KB

Getting Started

curl -L https://foundry.paradigm.xyz | bash
foundryup
brew install libusb

Running Test

  • Test all files

      forge test
    
  • Test all files with traces

      forge test -vvvv
    
  • Test for individual file

      forge test --match-path test/Arithmetic.t.sol
    
  • Test for individual files with traces

      forge test --match-path test/Arithmetic.t.sol -vvvv
    

Gas Optimization

Title Guide Contract Proof of Concept
Arithmetic & Bitwise Operators Guide Contract PoC
Public vs External Guide Contract PoC
Default Initialization (x) Guide Contract PoC
Revert Strings Guide Contract PoC
Redundant Checks Guide Contract PoC
Nested If Statements Guide Contract PoC
State Variable vs Local Variable Guide Contract PoC
Packing Variables Guide Contract PoC
Data Types Guide Contract PoC
Addition Guide Contract PoC
Garbage Collection Guide Contract PoC
Swap Guide Contract PoC
Call Data vs Memory Guide Contract PoC
Immutable Guide Contract PoC
Solidity Version Guide
Unsigned Integer Comparision Guide Contract PoC
Boolean Guide
Custom Errors Guide Contract PoC
Optimization Guide
Use of Library Guide
String vs Bytes32 Guide Contract PoC
Multiple Require Guide Contract PoC
Loop Post Condition Guide Contract PoC
Dead Code Guide
Short Circuiting Guide

References

  1. https://betterprogramming.pub/how-to-write-smart-contracts-that-optimize-gas-spent-on-ethereum-30b5e9c5db85?gi=227bef2ca134
  2. https://mudit.blog/solidity-gas-optimization-tips/
  3. https://blog.polymath.network/solidity-tips-and-tricks-to-save-gas-and-reduce-bytecode-size-c44580b218e6
  4. https://gist.github.com/hrkrshnn/ee8fabd532058307229d65dcd5836ddc
  5. https://medium.com/coinmonks/8-ways-of-reducing-the-gas-consumption-of-your-smart-contracts-9a506b339c0a
  6. https://ethereum.stackexchange.com/questions/28813/how-to-write-an-optimized-gas-cost-smart-contract
  7. https://forum.openzeppelin.com/t/a-collection-of-gas-optimisation-tricks/19966
  8. https://medium.com/coinmonks/8-ways-of-reducing-the-gas-consumption-of-your-smart-contracts-9a506b339c0a