Root + Impact
Description
function createMemorabiliaCollection(
string memory name,
string memory baseUri,
uint256 priceInBeat,
uint256 maxSupply,
bool activateNow
) external onlyOrganizer returns (uint256) {
require(priceInBeat > 0, "Price must be greater than 0");
require(maxSupply > 0, "Supply must be at least 1");
require(bytes(name).length > 0, "Name required");
require(bytes(baseUri).length > 0, "URI required");
uint256 collectionId = nextCollectionId++;
collections[collectionId] = MemorabiliaCollection({
name: name,
baseUri: baseUri,
priceInBeat: priceInBeat,
maxSupply: maxSupply,
currentItemId: 1,
isActive: activateNow
});
emit CollectionCreated(collectionId, name, maxSupply);
return collectionId;
}
Risk
Likelihood: Medium
Impact:Medium
If the setting is incorrect, it cannot be corrected.
Proof of Concept
function redeemMemorabilia(uint256 collectionId) external {
MemorabiliaCollection storage collection = collections[collectionId];
require(collection.priceInBeat > 0, "Collection does not exist");
require(collection.isActive, "Collection not active");
require(collection.currentItemId < collection.maxSupply, "Collection sold out");
Recommended Mitigation
Add a function.
+ function setCollectionIsActive(uint256 collectionId,bool activateNow) public onlyOwner {
+ MemorabiliaCollection storage collection = collections[collectionId];
+ collection.isActive = activateNow;
+ }