This repository is mainly to test any gas saving technique we see or here about to know how much gas we really save to know whether it is effective.
for.sol - contains gas optimization techniques for for loop
require.sol - contains gas optimization techniques for handling reverts i.e require & custom reverts
return.sol - checks how much gas spent with the way we return valies in function calls
variables.sol - checks how much gas the various initialization of variables coding styles cost
if.sol - contains the best gas optimizing way to write multiple conditions in an if
swap.sol - checks how much gas you will save when using two different styles in swapping variables
bitwise.sol - contains bitwise gas optimizations for common arithmetic operations like /2 or *4
bitwiseAccessControl.sol - is a style of access control using bitwise operators i saw and i think its cool
- All the twitter accounts that tweet about Gas
- https://github.com/devanshbatham/Solidity-Gas-Optimization-Tips - inspired the bitwise.sol, swap.sol, 4th and 5th function of for.sol.
$ forge build
$ forge test