Closed code423n4 closed 2 years ago
sirhashalot
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
ownerSplit
Setting a variable to the default value it already contains is unnecessary. Removing this line would save gas.
Manual analysis
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
Duplicate of #45
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-valueSetting 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