Omniscia Nexera Audit

FractionFactory Code Style Findings

FractionFactory Code Style Findings

FFY-01C: Potentially Misleading Comment

Description:

The referenced comment implies that the subtraction is safe to execute due to the fact that the FractionFactory::_estimateAndValidateFeesAndApproveDms function will consume the full totalNativeFee amount in external calls with native value attached, however, it fails to accommodate for potential funds that already existed within the FractionFactory.

Example:

contracts/dataManagers/fractionalizers/factories/FractionFactory.sol
160function _prepareAndDeployOtherChains(
161 DeploymentConfig calldata deploymentConfig,
162 FractionInitializationData memory initData,
163 bytes32 salt,
164 DataPoint dp,
165 address fractionDM,
166 address payable refundAddress
167) private returns (uint256 refund) {
168 bytes memory message = _buildLzSendMessage(salt, initData);
169 (uint256[] memory deployFees, uint256 totalNativeFee) = _estimateAndValidateFeesAndApproveDms(
170 deploymentConfig.chainIds,
171 dp,
172 fractionDM,
173 message,
174 refundAddress
175 );
176 _deployOnOtherChains(deploymentConfig.chainIds, message, refundAddress, deployFees);
177 refund = msg.value - totalNativeFee; // This is safe to do, because if msg.value was not enough we would already fail
178}

Recommendation:

Although the code presently behaves as expected, it should not be wrapped in an unchecked code block given that it might result in an underflow if native funds have been forced within the FractionFactory contract, such as via a selfdestruct of a newly created smart contract.

Alleviation:

The referenced comment has been omitted so as to ensure that the code is never wrapped in an unchecked code block, addressing this exhibit.