bosonprotocol / contracts

[DEPRECATED] Boson Protocol v1
GNU Lesser General Public License v3.0
69 stars 17 forks source link

Redundant Local Variable Declaration #325

Closed zajck closed 2 years ago

zajck commented 2 years ago

VKL-01S: Redundant Local Variable Declaration

Type Severity Location
Gas Optimization Informational VoucherKernel.sol:L206, L207

Description:

The linked local variable declarations can be substituted with a contract-level constant.

Example:

uint256 _complainPeriod = 7 * 1 days;
uint256 _cancelFaultPeriod = 7 * 1 days;
complainPeriod = _complainPeriod;
cancelFaultPeriod = _cancelFaultPeriod;

emit LogComplainPeriodChanged(_complainPeriod, msg.sender);
emit LogCancelFaultPeriodChanged(_cancelFaultPeriod, msg.sender);

Recommendation:

We advise one to be declared to optimize the gas cost of the contract's construction.