Open code423n4 opened 2 years ago
token
is the address of the token we got from the claim identifier, disagree that it can be reused
@GalloDaSballo to clarify, my suggestion would be to store all the token
results of line 301 in an array to reuse this array on line 318
That is correct and would save 100 + 100 gas (give or take) per token as each time we are STATIC_CALLing (100 gas) to get the token back and the SLOAD would be from hot slot (100 gas)
[GAS - 01] In
claimBribesFromHiddenHand
,token
could be reusedThe same external call is made twice:
https://github.com/Badger-Finance/vested-aura/blob/d504684e4f9b56660a9e6c6dfb839dcebac3c174/contracts/MyStrategy.sol#L318 https://github.com/Badger-Finance/vested-aura/blob/d504684e4f9b56660a9e6c6dfb839dcebac3c174/contracts/MyStrategy.sol#L301
Therefore gas could saved using a memory array to avoid doing the same external call twice.