Gas Optimizations #156
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
valid
gas
Title: Declaring var in the returns()
https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L161-L166
Remove L162 and declare
protectedTokens
inside the returns can save gasChange to:
It can save 178 gas per call
Title: Using && inside require()
https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L184-L187
Instead of using && to validate, using multiple require can save 15 execution gas fee per call (although it will cost more in deployment gas fee).
Change to:
Title: using < 32 bytes string to revert
https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L186
Strings are broken into 32 byte chunks for operations. Revert error strings over 32 bytes therefore consume extra gas than shorter strings
Title:
The text was updated successfully, but these errors were encountered: