VARIABLES WHICH ARE ASSIGNED FIXED VALUES DURING INITIALIZATION CAN BE DEFINED AS CONSTANTS
Summary
Variables which are assigned fixed values during initialization of the contract and for which no setter functions are defined to change their respective values can be defined as constants.
Vulnerability Detail
The variables withdrawVaultFee and withdrawVaultFeeWindow are defined as public variables in the ProtocolConfig.sol contract. And they are initialized fixed values inside the initialize() function of the contract. But no setter functions are defined to change their values afterwards.
Impact
Since these variables are set fixed values during the initialization of the contract and no setter functions are defined to change their values they can be defined as constants to save gas and better format and readability of the code.
Udsen
false
VARIABLES WHICH ARE ASSIGNED FIXED VALUES DURING INITIALIZATION CAN BE DEFINED AS CONSTANTS
Summary
Variables which are assigned fixed values during initialization of the contract and for which no setter functions are defined to change their respective values can be defined as constants.
Vulnerability Detail
The variables
withdrawVaultFee
andwithdrawVaultFeeWindow
are defined as public variables in theProtocolConfig.sol
contract. And they are initialized fixed values inside theinitialize()
function of the contract. But no setter functions are defined to change their values afterwards.Impact
Since these variables are set fixed values during the initialization of the contract and no setter functions are defined to change their values they can be defined as constants to save gas and better format and readability of the code.
Code Snippet
https://github.com/sherlock-audit/2023-02-blueberry/blob/main/contracts/ProtocolConfig.sol#L39-L40
Tool used
Manual Review
Recommendation
It is recommended to declare both
withdrawVaultFee
andwithdrawVaultFeeWindow
as constants and save gas during initialization of the contract.