Gas Optimizations #201
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
GAS OPTIMIZATION for LIFI by PeritoFlores
Avoid using the tautology ==true and change ==false for !
Some part of the code you are using == true and ==false. You can remove ==true and change ==false for ! to save gas
Swapper.sol#LOC16
DDexManagerFacet.sol#LOC20
DexManagerFacer.sol#LOC34
DexManagerFacer.sol#LOC47
DexManagerFacer.sol#LOC66
Using uint8 instead of uint256 cost more gas and can even cause an overflow.
You are using uint8 for some loops
for (uint8 i; i < _tokens.length; i++) { HopFacets.sol#L48
First of all, in case that you send an array of more than 256 the transaction will revert with an overflow . Suppose that this case is unlikely.
EVM works with 256 bits word so every operation is on a uint256, unless you are packing variables using a shorter variable cost more gas.
So I believe that using uint8 have no benefits.
Sugestion
The text was updated successfully, but these errors were encountered: