Creator fee calculation bypass in _getCreatorFee
can lead to unexpected fees on zero supply
#382
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
primary issue
Highest quality submission among a set of duplicates
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_primary
AI based primary recommendation
🤖_116_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-phi/blob/8c0985f7a10b231f916a51af5d506dd6b0c54120/src/curve/BondingCurve.sol#L128-L151
Vulnerability details
Impact
The
_getCreatorFee
function allows the creator fee calculation to bypass the zero supply check. As a result, unexpected creator fees being charged when the supply is zero, contradicting the behavior as seen in other parts of the codebase.POC
Consider the
_getCreatorFee
function:The function sets
creatorFee = 0
whensupply_ == 0
, but it doesn't return immediately. Instead it continues execution and calculates a newcreatorFee
value based on theroyaltyRate
, potentially overwriting the zero value.This means that even when the supply is zero, a creator fee might still be charged, which is likely not the intended behavior based on this part of the code in the
getPriceData
function that sets creator fee to 0 when supply is 0.Tools Used
None
Recommended Mitigation Steps
Consider modifying the
_getCreatorFee
function to return immediately whensupply_ == 0
Assessed type
Context
The text was updated successfully, but these errors were encountered: