code-423n4 / 2021-12-defiprotocol-findings

0 stars 0 forks source link

Unnecessary uint zero initialization #163

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

sirhashalot

Vulnerability details

Impact

The ownerSplit variable is initialized to a value of 0 on line 22 of Factory.sol. Since ownerSplit is a uint256, the default value is zero per Solidity docs: https://docs.soliditylang.org/en/latest/control-structures.html#default-value

Setting a variable to the default value it already contains is unnecessary. Removing this line would save gas.

Tools Used

Manual analysis

Recommended Mitigation Steps

Remove line 22 of Factory.sol because it is unnecessary https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Factory.sol#L22

0xleastwood commented 2 years ago

Duplicate of #45