Gas Optimization - This finding does not affect the contract negatively nor does it put funds or transactions at risk for the user. Optimizes the contract to use less gas
Proof of Concept
According to the Slither Analyzer documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external), public functions that are never called by the contract itself should be declared as external to save gas. This allows the contract to read directly from the call data. Allows for gas savings if you change a function from public to external, as in the external functions you do not have the extra logic to copy the data to memory.
Code snippet:
deposit() should be declared external:
function deposit() public override {...} <------ Should be declared as external
(contracts/strategies/AaveV2.sol#75-81)
Console output (Slither Analyzer):
getUnactivatedStakersPoolBalance(IERC20) should be declared external:
Handle
eriksal1217
Vulnerability details
Impact
Gas Optimization - This finding does not affect the contract negatively nor does it put funds or transactions at risk for the user. Optimizes the contract to use less gas
Proof of Concept
According to the Slither Analyzer documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external), public functions that are never called by the contract itself should be declared as external to save gas. This allows the contract to read directly from the call data. Allows for gas savings if you change a function from public to external, as in the external functions you do not have the extra logic to copy the data to memory.
Code snippet:
deposit() should be declared external:
(contracts/strategies/AaveV2.sol#75-81)
Console output (Slither Analyzer):
getUnactivatedStakersPoolBalance(IERC20) should be declared external:
getTotalUnmintedSherX(IERC20) should be declared external:
accruedDebt(bytes32,IERC20) should be declared external:
getTotalAccruedDebt(IERC20) should be declared external:
accrueSherX(IERC20) should be declared external:
accrueSherXWatsons() should be declared external:
deposit() should be declared external:
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external
Tools Used
Sherlock Contracts Solidity (v 0.7.4) Slither Analyzer (v 0.8.0)
Recommended Mitigation Steps