Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

[L-4] Getter Functions Should Be External Instead of Public

Summary

Several getter functions in the contract are declared as public, but they are not used within the contract itself. Making them external instead of public can optimize gas costs and improve contract efficiency.

Impact

  • Gas Optimization: Using external instead of public reduces gas costs when calling the functions externally.

  • Reduced Contract Size: Eliminating unnecessary function selectors can result in a smaller contract size.

  • Improved Security: Reducing the contract's public interface helps prevent unintended internal calls.

Recommendation

Change the visibility of the following functions from public to external:

Suggested Code Fix

+ function getBalanceOf(address user, address token) external view returns(uint256) {
+ }
+ function getErc20TotalMintedAmount(address erc20) external view returns(uint256) {
+ }
+ function getErc20InfoFromNft(address nft) external view returns(ERC20Info memory) {
+ }
+ function getOrderPrice(address seller, uint256 index) external view returns(uint256 price) {
+ }

Updates

Lead Judging Commences

fishy Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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