Omniscia Mean Finance Audit

NFTPermissions Static Analysis Findings

NFTPermissions Static Analysis Findings

NFT-01S: Redundant Memory Declaration

Description:

The NFTPermissions::permissionPermit function will inefficiently declare a local bool variable where the signature's validity is stored as it will be "consumed" in the if conditional that follows it.

Example:

src/NFTPermissions.sol
89bool _isSignatureValid =
90 SignatureChecker.isValidSignatureNow(_owner, _hashTypedDataV4(PermissionHash.hash(_permissions, nextNonce[_owner]++, _deadline)), _signature);
91if (!_isSignatureValid) revert InvalidSignature();

Recommendation:

We advise the SignatureChecker::isValidSignatureNow function result to be directly utilized in the ensuing if statement, rendering the _isSignatureValid variable unnecessary and thus optimizing the code's gas cost.

Alleviation:

The redundant _isSignatureValid local declaration has been safely omitted, optimizing the gas cost of the function.