Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

unsafe use of mint instead of safemint

Summary

Vulnerability Details

there is the link to the function

https://github.com/Cyfrin/2024-11-one-world/blob/1e872c7ab393c380010a507398d4b4caca1ae32b/contracts/dao/MembershipFactory.sol#L140

the mint call is used to mint a new membership token for the caller of the function, assigning it a specific tier or type based on tierIndex, but there is an issue using mint instead of safemint in erc1155 tokens, mint function does not verify whether the recipient can accept the token. If the recipient is a contract that does not implement the onERC1155Received function, the tokens could be lost or become inaccessible

there is the code

function joinDAO(address daoMembershipAddress, uint256 tierIndex) external {
require(daos[daoMembershipAddress].noOfTiers > tierIndex, "Invalid tier.");
require(daos[daoMembershipAddress].tiers[tierIndex].amount > daos[daoMembershipAddress].tiers[tierIndex].minted, "Tier full.");
uint256 tierPrice = daos[daoMembershipAddress].tiers[tierIndex].price;
uint256 platformFees = (20 * tierPrice) / 100;
daos[daoMembershipAddress].tiers[tierIndex].minted += 1;
IERC20(daos[daoMembershipAddress].currency).transferFrom(_msgSender(), owpWallet, platformFees);
IERC20(daos[daoMembershipAddress].currency).transferFrom(_msgSender(), daoMembershipAddress, tierPrice - platformFees);
@> IMembershipERC1155(daoMembershipAddress).mint(_msgSender(), tierIndex, 1);
emit UserJoinedDAO(_msgSender(), daoMembershipAddress, tierIndex);
}

Impact

If the recipient is a contract that does not implement the onERC1155Received function, the tokens could be lost or become inaccessible

Tools Used

manual review

Recommendations

use safemint instead, because The safeMint function typically includes checks to ensure that the recipient can handle the token being minted,

Updates

Lead Judging Commences

0xbrivan2 Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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