Eggstravaganza

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

Changing function visibility from Public to External can save gas

Summary

If a function is marked public but is not used internally, consider marking it as external.

WHY:
external functions use less gas when called from other contracts or externally (e.g. from dapps).

public functions create a wrapper to allow both internal and external calls, which consumes more gas.

Vulnerability Details

Following functions in src/EggVault.sol are declared public but never used internally:

function depositEgg(uint256 tokenId, address depositor) public { };
function withdrawEgg(uint256 tokenId) public { };
function isEggDeposited(uint256 tokenId) public view returns (bool) { };

Impact

Impact: Low, making these functions external can save gas since they are not used internally.

Recommendations

Change the visibility of these functions from public to external since they are not used internally.

Updates

Lead Judging Commences

m3dython Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Gas optimization

Strategy to save gas and minimize transaction costs

Support

FAQs

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

Give us feedback!