Skip to content

Gas Guard, an intuitive bash script, adeptly identifies gas leak vulnerabilities in smart contracts. It enhances efficiency by pinpointing code segments that could cause excessive gas consumption, ensuring contract robustness.

Notifications You must be signed in to change notification settings

basant0x01/GasGuard

Repository files navigation

Gas Guard v0.2

image

Gas Guard is a straightforward bash script that identifies susceptible gas leak-vulnerable code using grep regex within smart contracts.

Usage

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

Gas Optimization Issues

gasGuard is able to find vulnerable code related to the list below

  1. DEFAULT INITIALIZATION ISSUE
  2. CACHE ARRAY LENGTH OUTSIDE OF LOOP
  3. GREATER THAN 0 COMPARISON
  4. USE CUSTOM ERROR FOR OUTPUT
  5. USE ++i AND --i INSTEAD OF OTHER INC/DEC
  6. USE SHIFT Right/Left INSTEAD OF DIVISION/MULTIPLICATION
  7. USE CALLDATA INSTEAD OF MEMORY FOR FUNCTIONS
  8. USE ASSEMBLY TO CHECK FOR ADDRESS(0)

More are coming soon..

Demo Output

image

About

Gas Guard, an intuitive bash script, adeptly identifies gas leak vulnerabilities in smart contracts. It enhances efficiency by pinpointing code segments that could cause excessive gas consumption, ensuring contract robustness.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published