The cost
field in the Treat
struct is incorrectly initialized in the addTreat
function. In the addTreat
function, the field is referred to as uint256 _rate
instead of uint256 cost
. This mismatch can lead to confusion and improper initialization of the cost
value within the struct, potentially leading to incorrect behavior in the contract.
The cost
field in the Treat
struct is not correctly initialized when creating a Treat
. Since the addTreat
function uses uint256 _rate
instead of uint256 cost
, it leads to ambiguity and can result in the cost
field being set to the default value of 0
. This could cause unintended behavior when treating or displaying the cost
of the treat.
The struct is defined as follows:
However, in the addTreat
function, the cost is referred to as _rate
, creating a mismatch:
The _rate
is used to initialize the cost
field, but the inconsistency in naming can lead to confusion, especially in future modifications or external reviews.
If the addTreat
function doesn't properly assign the cost
value due to the use of _rate
, treats could be initialized with a default cost of 0
. This would allow users to acquire treats without paying the intended cost, causing loss of revenue or inconsistent contract behavior.
Manual Review
** Update the** addTreat
function to use consistent naming by replacing _rate
with cost
to avoid ambiguity.
Ensure that when the Treat
struct is initialized, the cost
is explicitly set to the intended value, preventing the default value of 0
from being used unintentionally.
By updating the addTreat
function and using consistent naming, you ensure that the cost
field is properly initialized, reducing the risk of treats being assigned a zero cost unintentionally.
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.