Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: default
Invalid

`Magic Number` insights. May mislead or stuck users.

Summary

There are a few magic numbers that should be replaced with constants.

  1. Airdrop::claim

...
...
...
// ----------------------------------------------------
// -------------------------- ||
// ------------- \/
@> if (amountAlreadyClaimed >= numberOfDaysInCouple * 10 ** loveToken.decimals()) {
revert Airdrop__PreviousTokenAlreadyClaimed();
}
// ------------------------------------------------------------
// ------------------------------ ||
// --------------- \/
@> uint256 tokenAmountToDistribute = (numberOfDaysInCouple * 10 ** loveToken.decimals()) - amountAlreadyClaimed;
...
...
...
  1. Soulmate::totalSouls

...
...
...
function totalSouls() external view returns (uint256) {
// ----------------------
// ----------- ||
// ----- \/
@> return nextID * 2;
}
...
...
...
  1. LoveToken::initVault

function initVault(address managerContract) public {
if (msg.sender == airdropVault) {
// ----------------------------------
// ----------------- ||
// -------- \/
@> _mint(airdropVault, 500_000_000 ether);
// ---------------------------------------
// -------------------- ||
// --------- \/
@> approve(managerContract, 500_000_000 ether);
emit AirdropInitialized(managerContract);
} else if (msg.sender == stakingVault) {
// ----------------------------------
// ----------------- ||
// -------- \/
@> _mint(stakingVault, 500_000_000 ether);
// ---------------------------------------
// -------------------- ||
// --------- \/
@> approve(managerContract, 500_000_000 ether);
emit StakingInitialized(managerContract);
} else {
revert LoveToken__Unauthorized();
}
}

Impact

Could be confusing to the community developers who evolved with this convention but not mentioned by solidity docs.

Tools Used

Manual Review

Recommendations

Make constants for each of Magic Numbers.

Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.