Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Unused Functions (EggVault)

Description:
The functions withdrawEgg() and isEggDeposited() are defined in the contract but are not utilized in the current implementation. This results in unnecessary code bloat, which can increase deployment costs and reduce code readability.

Impact:
While there is no direct security impact, unused functions contribute to increased gas costs during deployment and make the codebase harder to maintain.

Proof of Concept:

function withdrawEgg(uint256 tokenId) external {
// Unused function logic
}
function isEggDeposited(uint256 tokenId) external view returns (bool) {
// Unused function logic
}

Recommended Mitigation:

  1. Remove the unused functions if they are not required for the current or future implementation.

  2. Alternatively, document these functions as utility functions if they are intended for future use or testing purposes.

[G-3] Literal instead of constant

Instances:
100 should be a constant in EggHuntGame::setEggFindThreshold().
100 should be a constant in EggHuntGame::searchForEgg().

Description:
Define and use constant variables instead of using literals like 100. If the same constant literal value is used multiple times, create a constant state variable and reference it throughout the contract as it is cheaper to use that way

Impact:
Gas - Code bloat but no direct security impact.

Proof of Concept:

uint256 constant MAX_EGGS = 100;

Recommended Mitigation:
Replace all occurrences of the literal 100 with a defined constant variable such as MAX_EGGS.

Updates

Lead Judging Commences

m3dython Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!