Logic error occurs in SpookySwap::setTreatCost
function, that will not allow owner to change SpookySwap::Treat::cost
, if it was assigned as 0
(by mistake)
The SpookySwap::setTreatCost
function will not allow to change SpookySwap::Treat::cost
, if it was assigned as 0
(by mistake), and as a result, this treat will not be usable for Trick or Treat.
Proof of Concepts:
Owner deploys contract with pre-revealed array of treats.
By mistake, in one of the Treat::cost
revealed 0.
Calling SpookySwap::setTreatCost
function, will only revert, not giving an opportunity to change cost
.
It is possible to check it, launch the following code from test folder.
Human factor, assigning Trait::cost
as 0
, may impact on diversity of treats that players will like to mint.
Foundry
There are a few ways how to mitigate this issue:
To prevent this mistake we can make small modification in
SpookySwap::setTreatCost
:
This will allow to change cost even if owner, by mistake, assinged it as 0
: in deployment process or calling SpookySwap::setTreatCost
to change cost price.
Another way to make modification of
SpookySwap::addTreat
:
The contract deployment will fail, and will not be created on the blockchain.
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.