Omniscia Nexera Audit

PurchaseDiscountGenesisIdsMixerStorage Code Style Findings

PurchaseDiscountGenesisIdsMixerStorage Code Style Findings

PDI-01C: Implicit Return Variables

Description:

The referenced return variables have no name declared and the call performed is significantly dynamic.

Example:

packages/contracts/contracts/internalFacets/purchasePhaseFacets/purchaseDiscountFacets/genesisIds/PurchaseDiscountGenesisIdsMixerStorage.sol
163function applyDiscount(
164 Layout storage l,
165 uint256 campaignId,
166 uint256 amountOfFractions,
167 address account,
168 bytes calldata operationData
169) internal returns (uint256, uint256) {
170 (bytes4 selector, bytes memory encodedData) = abi.decode(operationData, (bytes4, bytes));
171
172 if (!l.isDiscountModelForId[campaignId][selector]) revert UnsupportedDiscountModel();
173
174 bytes memory callDataInput = abi.encodeWithSelector(selector, campaignId, amountOfFractions, account, encodedData);
175 (bool success, bytes memory returnData) = address(this).call(callDataInput);
176
177 if (!success) {
178 assembly ("memory-safe") {
179 revert(add(returnData, 32), mload(returnData))
180 }
181 }
182
183 return abi.decode(returnData, (uint256, uint256));
184}

Recommendation:

We advise an explicit name to be introduced for each variable, optimizing the codebase's legibility.

Alleviation (d682057ecb0e254069773d64f32c068cedb71e2a):

The code was updated to specify explicit names for the return variables of the function, greatly increasing its legibility.

PDI-02C: Inexistent Documentation of Storage Slot

Description:

The referenced STORAGE_SLOT does not have its actual result specified in its in-line documentation as it remains a TO-DO.

Example:

packages/contracts/contracts/internalFacets/purchasePhaseFacets/purchaseDiscountFacets/genesisIds/PurchaseDiscountGenesisIdsMixerStorage.sol
28/** ================================================== STORAGE =================================================
29 * @dev Unique identifier for the storage slot where the Layout struct is stored. Derived from the ERC7201 formula.
30 * STORAGE_SLOT: TO-DO
31 */
32bytes32 internal constant STORAGE_SLOT =
33 keccak256(abi.encode(uint256(keccak256("Evergonlabs.Tmi-Tokenizer.storage.PurchaseDiscountGenesisIdsMixerStorage")) - 1)) &
34 ~bytes32(uint256(0xff));

Recommendation:

We advise the 0x8f34022d2c5f3bf785ebc9e46d08e1c3fc389b204b72d9bb38868d77fb6d5500 storage slot to be properly specified in its comments, aiding in debugging of the contract's structure.

Alleviation (d682057ecb0e254069773d64f32c068cedb71e2a):

The correct storage slot has been specified as advised.