Gas Guard is a straightforward bash script that identifies susceptible gas leak-vulnerable code using grep regex within smart contracts.
For a single input, use the -i flag
./gasGuard.sh -i contract.sol
And for multiple inputs, use the -mi flag
./gasGuard.sh -mi contract.sol another-contract.sol
gasGuard is able to find vulnerable code related to the list below
- DEFAULT INITIALIZATION ISSUE
- CACHE ARRAY LENGTH OUTSIDE OF LOOP
- GREATER THAN 0 COMPARISON
- USE CUSTOM ERROR FOR OUTPUT
- USE ++i AND --i INSTEAD OF OTHER INC/DEC
- USE SHIFT Right/Left INSTEAD OF DIVISION/MULTIPLICATION
- USE CALLDATA INSTEAD OF MEMORY FOR FUNCTIONS
- USE ASSEMBLY TO CHECK FOR ADDRESS(0)
More are coming soon..