Project

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

dao tier minted value will be unsynced when `upgradeTier` being called

Summary

The minted value becomes unsynchronized when using upgradeTier, as it does not update this value.

Vulnerability Details

In the upgradeTier function, tokens are burned from the current tier and minted in the new tier without updating the minted count for each corresponding tier. This resulting minted variable will be unsynced, thus affecting the minted accounting for tiers.

function upgradeTier(address daoMembershipAddress, uint256 fromTierIndex) external {
require(daos[daoMembershipAddress].daoType == DAOType.SPONSORED, "Upgrade not allowed.");
require(daos[daoMembershipAddress].noOfTiers >= fromTierIndex + 1, "No higher tier available.");
IMembershipERC1155(daoMembershipAddress).burn(_msgSender(), fromTierIndex, 2);
IMembershipERC1155(daoMembershipAddress).mint(_msgSender(), fromTierIndex - 1, 1);
emit UserJoinedDAO(_msgSender(), daoMembershipAddress, fromTierIndex - 1);
}

If we see in the joinDAO function increments the minted value for the tier upon each new membership:

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);
}

Without synchronizing the minted values during an upgrade, the upgradeTier function can lead to inaccurate tracking of minted tokens across tiers, potentially impacting the contract’s accounting.

Impact

The minted count for each tier becomes unsynchronized, leading to inconsistent data for tier-specific token tracking.

Tools Used

None

Recommendations

Update the upgradeTier function to adjust the minted values correctly, decreasing the count for the burned tier and increasing it for the newly minted tier.

Updates

Lead Judging Commences

0xbrivan2 Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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

Give us feedback!