Omniscia Evergon Labs Audit
StakingSkeletonNID Code Style Findings
StakingSkeletonNID Code Style Findings
SSI-01C: Potential Optimization of NFT IDs
| Type | Severity | Location |
|---|---|---|
| Standard Conformity | ![]() | StakingSkeletonNID.sol:L245 |
Description:
The current StakingSkeletonNID::_stakeBeneficiary minting mechanism will use a sequentially increasing NFT ID system that is shared across all campaigns.
Example:
221function _stakeBeneficiary(222 uint256 campaignId,223 uint256 amountOfPackets,224 uint256 timeLockPeriod,225 address beneficiary226) internal {227 GeneralStorage.Campaign storage campaignInfo = GeneralStorage.layout().campaignsInfo[campaignId];228
229 if (campaignInfo.state != 2) {230 revert CampaignDoesNotExist(campaignId);231 }232
233 IAmountsFacet(address(this)).checkInputPackets(campaignId, 0, amountOfPackets);234 ILockVariationsFacet(address(this)).checkTimeLock(campaignId, timeLockPeriod);235 uint256 stakeActiveStartingTimestamp = ICampaignTimesFacet(address(this)).checkCampaignTimesOnStake(campaignId);236 ITransferInputFacet(address(this)).transferInput(237 campaignId,238 msg.sender,239 campaignInfo.inputAssetKeeper,240 amountOfPackets241 );242
243 uint256 nftId = ++GeneralStorage.layout().totalNfts;244
245 IERC721Facet(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.
SSI-02C: Redundant Parenthesis Statement
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | StakingSkeletonNID.sol:L673 |
Description:
The referenced statement is redundantly wrapped in parenthesis (()).
Example:
673(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.
SSI-03C: Repetitive Value Literal
| Type | Severity | Location |
|---|---|---|
| Code Style | ![]() | StakingSkeletonNID.sol:L229 |
Description:
The linked value literal is repeated across the codebase multiple times.
Example:
229if (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.
