The setTreatCost function lacks a check to prevent setting a treat’s cost to zero. If the owner inadvertently sets a treat’s cost to zero, users will be unable to complete the trickOrTreat function due to a require check that treat.cost must be greater than zero. This effectively locks the treat, preventing any further minting of that treat and the owner would be unable to update its cost again due to the same check in setTreatCost.
Setting the cost to zero renders the treat inaccessible in trickOrTreat and prevents the owner from setting a valid non-zero cost in the future, effectively locking that treat indefinitely.
Add a zero check on the _cost parameter to prevent setting a treat’s cost to zero:
The cost of the treat is set only by the owner (in the constructor, in addTreat and in setTreatCost). That means the cost of the treat will always be greater than zero.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.