Omniscia Evergon Labs Audit

StakingSkeleton Code Style Findings

StakingSkeleton Code Style Findings

SSN-01C: Potential Optimization of NFT IDs

Description:

The current StakingSkeleton::_stakeBeneficiary minting mechanism will use a sequentially increasing NFT ID system that is shared across all campaigns.

Example:

packages/contracts/contracts/skeletons/StakingSkeleton.sol
212uint256 nftId = ++GeneralStorage.layout().totalNfts;
213
214IERC721Facet(address(this)).mint(beneficiary, nftId);

Recommendation:

We advise NFT ID subsets to be introduced by incorporating the campaign ID in the upper bits of the NFT ID (i.e. using a uint128 / uint128 split that should be sufficient for all intents and purposes), greatly optimizing off-chain integration of the Evergon Labs staking system.

Alleviation (b64b659786cf3c84bea52feb3a69f546ba3601f0):

The NFT ID generation mechanism was revised as advised, ensuring that the upper 16 bytes incorporate the campaign's ID whilst the lower 16 bytes incorporate the campaign-specific NFT ID incrementor.

SSN-02C: Redundant Parenthesis Statement

Description:

The referenced statement is redundantly wrapped in parenthesis (()).

Example:

packages/contracts/contracts/skeletons/StakingSkeleton.sol
641(amountOfRewardPackets) = IWithdrawalVariationsFacet(address(this)).handleReward(nftId, amountOfRewardPackets);

Recommendation:

We advise them to be safely omitted, increasing the legibility of the codebase.

Alleviation (b64b659786cf3c84bea52feb3a69f546ba3601f0):

The redundant parenthesis in the referenced statement have been safely omitted.

SSN-03C: Repetitive Value Literal

Description:

The linked value literal is repeated across the codebase multiple times.

Example:

packages/contracts/contracts/skeletons/StakingSkeleton.sol
197if (campaignInfo.state != 2) {

Recommendation:

We advise it to be set to a constant variable instead, optimizing the legibility of the codebase.

In case the constant has already been declared, we advise it to be properly re-used across the code.

Alleviation (b64b659786cf3c84bea52feb3a69f546ba3601f0):

The referenced literal has been properly introduced as part of the GeneralStakingStorage declarations and specifically as a CREATED state, addressing this exhibit.