Project

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

There is no tierconfigs.length in the structs

Summary

There is no tierconfigs.length in the structs

Vulnerability Details

uint64 constant TIER_MAX = 7;

enum DAOType {
PUBLIC,
PRIVATE,
SPONSORED
}

struct DAOConfig {
string ensname;
DAOType daoType;
TierConfig[] tiers;
address currency;
uint256 maxMembers;
uint256 noOfTiers;
//joined members check
}

struct DAOInputConfig {
string ensname;
DAOType daoType;
address currency;
uint256 maxMembers;
uint256 noOfTiers;
}

struct TierConfig {
uint256 amount;
uint256 price;
uint256 power;
uint256 minted;
}

require(daoConfig.noOfTiers == tierConfigs.length, "Invalid tier input.");
require(daoConfig.noOfTiers > 0 && daoConfig.noOfTiers <= TIER_MAX, "Invalid tier count.");
/// @notice Creates a new DAO membership
/// @param daoConfig The configuration for the DAO
/// @param tierConfigs The configurations for the tiers
/// @return The address of the newly created Membership ERC1155 proxy contract
function createNewDAOMembership(DAOInputConfig calldata daoConfig, TierConfig[] calldata tierConfigs)
external returns (address) {
require(currencyManager.isCurrencyWhitelisted(daoConfig.currency), "Currency not accepted.");
require(daoConfig.noOfTiers == tierConfigs.length, "Invalid tier input.");
require(daoConfig.noOfTiers > 0 && daoConfig.noOfTiers <= TIER_MAX, "Invalid tier count.");
require(getENSAddress[daoConfig.ensname] == address(0), "DAO already exist.");
if (daoConfig.daoType == DAOType.SPONSORED) {
require(daoConfig.noOfTiers == TIER_MAX, "Invalid tier count for sponsored.");
}

When creating a new DAO membership, there are a number of requirements for the creation to proceed. one of the require statement ensures if the nooftiers is equal to the configs length. The problem is that there is no tierconfigs.length. This means the check will not pass and the code will revert.

As can be seen in the structs above, there is no struct for tierconfigs.length. NewDAOMembership cannot be created.

Impact

Error in the require statements. This will lead to erroneous reverts

Tools Used

Manual Review

Recommendations

remove - require(daoConfig.noOfTiers == tierConfigs.length, "Invalid tier input.");

or add add tierconfigs.length to the structs

Updates

Lead Judging Commences

0xbrivan2 Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality
0xbrivan2 Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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