Description: the MartenitsaEvent
contract inherits the MartenitsaToken
contract so it itself is an ERC721 token which introduces its own state variables such as _nextTokenId
, producers
, countMartenitsaTokensOwner
, isProducer
, tokenDesigns
which ignores previous values stored in the main MartenitsaToken
contract.
This approach is not a design choice, as evidenced by the deployment script (BaseTest
), where a new MartenitsaToken
is used as the ERC721 token instead of MartenitsaEvent
. Additionally, the marketplace uses the Token
contract, not the Event
one, as its token input.
Impact: This issue leads to several problems for the event contract:
MartenitsaEvent::joinEvent
uses the MartenitsaEvent::isProducer
mapping to check if the user is not a producer. However, this mapping is empty, and previous producers are in MartenitsaToken::isProducer
. If producers buy a HealthToken
, they can enter the event, which is not crucial for project functionality but is against documentation.
MartenitsaEvent::joinEvent
uses the MartenitsaEvent::_addProducer()
function to add users as producers during event time, allowing them to create new NFTs. However, users cannot mint NFTs if they call MartenitsaToken::createMartenitsa
; it will fail because they are not a producer in this contract. If they accidentally call MartenitsaEvent::createMartenitsa
, there will be two instances of the ERC721 contract with the same token IDs.
if users happen to create any tokens in MartenitsaEvent::createMartenitsa
, they wont be able to list them to market during the event period.
Proof of Concept: To prove this concept, add the following test to the existing test suite:
Event starts.
User gets 3 NFTs, mints a HealthToken
.
User joins the event and becomes a producer.
User mints new NFTs in MartenitsaEvent::createMartenitsa
but is unable to list it to MarketPlace
.
User is unable to mint any NFTs in MartenitsaToken::createMartenitsa
.
Recommended Mitigation: Instead of inheriting the Token
contract, get the address as input and create it as a state variable in the constructor. This way, the ERC721 contract will be the same for all NFTs, whether created during or before the event.
here is a possible recomendation:
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.