You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any address can create unlimited funding vaults via deployFundingVault()
Why Fix?
Potential spam/DoS vector
Could bloat contract state and increase gas costs
Solution: Inside the FairFund.sol file
// Define a custom error
error FairFund__VaultLimitExceeded(address user, uint256 maxAllowed);
State variables
uint256 public constant MAX_VAULTS_PER_ADDRESS = 5;
mapping(address => uint256) private s_vaultsCreated;
function deployFundingVault(
address _fundingToken,
address _votingToken,
uint256 _minRequestableAmount,
uint256 _maxRequestableAmount,
uint256 _tallyDate
) external returns (address) {
// Check if the user has reached their vault creation limit
if (s_vaultsCreated[msg.sender] >= MAX_VAULTS_PER_ADDRESS) {
revert FairFund__VaultLimitExceeded(msg.sender, MAX_VAULTS_PER_ADDRESS);
}
// Increment the vault count for the user
s_vaultsCreated[msg.sender]++;
// Rest of the function logic...
}
Issue:
Any address can create unlimited funding vaults via deployFundingVault()
Why Fix?
Potential spam/DoS vector
Could bloat contract state and increase gas costs
Solution: Inside the FairFund.sol file
@adityabhattad2021 I would like to solve this bug
The text was updated successfully, but these errors were encountered: