Trick or Treat

First Flight #27
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Inconsistent Naming in addTreat Function Parameter

Description

The addTreat function has a parameter named _rate, which represents the cost of the treat. However, the term _rate can be misleading, as it does not clearly convey the intent of the variable. Using a more descriptive name like _cost would make the function easier to understand and maintain.

Impact

Inconsistent naming can lead to confusion, making the code harder to read and increasing the likelihood of misunderstandings for developers interacting with the codebase. Clarity in parameter names improves maintainability and reduces the chance of errors

Recommended Mitigation

Rename the _rate parameter to _cost to reflect the actual purpose of the variable:

- function addTreat(string memory _name, uint256 _rate, string memory _metadataURI) public onlyOwner {
+ function addTreat(string memory _name, uint256 _cost_, string memory _metadataURI) public onlyOwner {
- treatList[_name] = Treat(_name, _rate, _metadataURI);
+ treatList[_name] = Treat(_name, _cost, _metadataURI);
treatNames.push(_name);
- emit TreatAdded(_name, _rate, _metadataURI);
+ emit TreatAdded(_name, _cost, _metadataURI);
}
Updates

Appeal created

bube Lead Judge about 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.