Open code423n4 opened 2 years ago
Contract: https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L396
Issue: The _getBalance and _getPricePerFullShare can be marked as view
Recommendation: Change the function as below:
function _getBalance() internal view returns (uint256) { return IVault(vault).balance(); } function _getPricePerFullShare() internal view returns (uint256) { return IVault(vault).getPricePerFullShare(); }
Make use of ++i which is unchecked instead of i++ in loops. This will prevent gas on each loop run. One such example is at MyStrategy.sol#L116
I don't believe this saves gas
CALL and STATICCALL cost 100 both
CALL
STATICCALL
Saves 5 gas per instance
Function can be marked view to save gas
Contract: https://github.com/Badger-Finance/vested-aura/blob/v0.0.2/contracts/MyStrategy.sol#L396
Issue: The _getBalance and _getPricePerFullShare can be marked as view
Recommendation: Change the function as below:
Use ++i instead of i++
Make use of ++i which is unchecked instead of i++ in loops. This will prevent gas on each loop run. One such example is at MyStrategy.sol#L116