Beginner FriendlyFoundryGameFi
100 EXP
View results
Submission Details
Severity: medium
Valid

The `MartenitsaEvent.sol` contract creates a separate branch of MartenitsaTokens and Producers that cannot participate in the rest of the protocol

Summary

The MartenitsaEvent.sol contract creates a separate branch of MartenitsaTokens and Producers that cannot participate in the rest of the protocol.

Vulnerability Details

Since the MartenitsaEvent.sol is of type MartenitsaToken, the contract is completely sperate from the rest of the protocol. Users who are made Producers during the events joinEvent can create MartenitsaToken's in the MartenitsaEvent.sol contract. However, these tokens cannot interact with the rest of the protocol. Likewise, Producers set in this contract cannot make listings in the MartenitsaMarketplace contract.

Impact

Because the MartenitsaEvent contract makes a new set of MartenitsaToken's and Producers, the contract is essentially useless for the protocol.
The test below passes showing that Producers cannot like their MartenitsaToken's created in the MartenitsaEvent contract.

modifier eligibleForReward() {
vm.startPrank(chasy);
martenitsaToken.createMartenitsa("bracelet");
martenitsaToken.createMartenitsa("bracelet");
martenitsaToken.createMartenitsa("bracelet");
marketplace.listMartenitsaForSale(0, 1 wei);
marketplace.listMartenitsaForSale(1, 1 wei);
marketplace.listMartenitsaForSale(2, 1 wei);
martenitsaToken.approve(address(marketplace), 0);
martenitsaToken.approve(address(marketplace), 1);
martenitsaToken.approve(address(marketplace), 2);
marketplace.makePresent(bob, 0);
marketplace.makePresent(bob, 1);
marketplace.makePresent(bob, 2);
vm.stopPrank();
_;
}
function testBecomeProducerEventAndCannotListMarketplace() public eligibleForReward {
martenitsaEvent.startEvent(1 days);
vm.startPrank(bob);
marketplace.collectReward();
healthToken.approve(address(martenitsaEvent), 10 ** 18);
martenitsaEvent.joinEvent();
martenitsaEvent.createMartenitsa("bracelet");
vm.expectRevert();
marketplace.listMartenitsaForSale(0, 1 wei);
vm.stopPrank();
vm.warp(block.timestamp + 1 days + 1);
martenitsaEvent.stopEvent();
assert(martenitsaEvent.isProducer(bob) == false);
}

Tools Used

--Foundry

Recommendations

It is recommended to change the MartenitsaEvent contract to use the existing MartenitsaToken contract so that it can interact with the entire protocol.

Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

MartenitsaToken and MartenitsaEvent have different addresses

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.