Beatland Festival

First Flight #44
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Variables names don`t match variable convention, could be confusing for reading.

Variables names don`t match variable convention, could be confusing for reading

Description

Variables names don't match variable convention e.g. s_ (for state variables), which could be confusing for reading.

address public beatToken;
address public organizer;
...
uint256 public nextCollectionId = 100;
// Pass data
mapping(uint256 => uint256) public passSupply; // Current minted
mapping(uint256 => uint256) public passMaxSupply; // Max allowed
mapping(uint256 => uint256) public passPrice; // Price in ETH
// Performance data
mapping(uint256 => Performance) public performances;
mapping(uint256 => mapping(address => bool)) public hasAttended;
mapping(address => uint256) public lastCheckIn;
uint256 public performanceCount;
...
// Memorabilia collections
mapping(uint256 => MemorabiliaCollection) public collections; // collectionId => Collection
mapping(uint256 => uint256) public tokenIdToEdition; // tokenId => edition number

Risk

Impact:

Those namings could be confusing for reading to further code supporters.

Recommended Mitigation

To make code more readable we need to use s_ prefix for state, i_ prefix for immutable variable

- address public beatToken;
- address public organizer;
+ address public s_beatToken;
+ address public s_organizer;
...
-uint256 public nextCollectionId = 100;
+uint256 public s_nextCollectionId = 100;
-mapping(uint256 => uint256) public passSupply; // Current minted
-mapping(uint256 => uint256) public passMaxSupply; // Max allowed
-mapping(uint256 => uint256) public passPrice; // Price in ETH
+mapping(uint256 => uint256) public s_passSupply; // Current minted
+mapping(uint256 => uint256) public s_passMaxSupply; // Max allowed
+mapping(uint256 => uint256) public s_passPrice; // Price in ETH
-mapping(uint256 => Performance) public performances;
-mapping(uint256 => mapping(address => bool)) public hasAttended;
-mapping(address => uint256) public lastCheckIn;
-uint256 public performanceCount;
+mapping(uint256 => Performance) public s_performances;
+mapping(uint256 => mapping(address => bool)) public s_hasAttended;
+mapping(address => uint256) public s_lastCheckIn;
+uint256 public s_performanceCount;
...
-mapping(uint256 => MemorabiliaCollection) public collections; // collectionId => Collection
-mapping(uint256 => uint256) public tokenIdToEdition; // tokenId => edition number
+mapping(uint256 => MemorabiliaCollection) public s_collections; // collectionId => Collection
+mapping(uint256 => uint256) public s_tokenIdToEdition; // tokenId => edition number
Updates

Lead Judging Commences

inallhonesty Lead Judge 26 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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