Basket might be unusable after initialization due to _initialSupply = 0 #159
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Handle
kenzo
Vulnerability details
A basket is not usable if totalSupply = 0.
When initializing a basket, the initial supply is passed as parameter, but the contract does not verify that that parameter is bigger than 0.
Impact
A basket may be unusable after deployment.
Proof of Concept
A basket should never have totalSupply = 0, as
joinPool
divides by totalSupply: (Code ref)When the basket's ERC20 facet is initialized, it does not check whether the initialSupply parameter is bigger than 0. The mint function will also not revert.
So, the basket can be deployed with initialSupply = 0 and be unusable.
Note: it is not a part of the audit, but PieFactoryContract also does not check initialSupply.
Recommended Mitigation Steps
Add a check that requires initialSupply > 0.
The text was updated successfully, but these errors were encountered: