Wrong balanceOf user after minting legendary gobbler #333
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
old-submission-method
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-09-artgobblers/blob/d2087c5a8a6a4f1b9784520e7fe75afa3a9cbdbe/src/ArtGobblers.sol#L458
Vulnerability details
Impact
In
ArtGobblers.mintLegendaryGobbler()
function, line 458 calculates the number of gobblers user owned after mintingIt added 1 to factor in the new legendary. But actually, this new legendary is accounted in
_mint()
function alreadySo the result is
gobblersOwned
is updated incorrectly. AndbalanceOf()
will return wrong value.Proof of Concept
Script modified from
testMintLegendaryGobbler()
Tools Used
Foundry
Recommended Mitigation Steps
Consider remove adding 1 when calculating
gobblersOwned
The text was updated successfully, but these errors were encountered: