In certain scenarios, a Maker can bypass paying platform fees. The issue arises in the createTaker()
function, where the fee is taken from the Maker. If a Taker buys only a portion of the offer (e.g., half), the platform fee becomes zero due to rounding, effectively allowing the Maker to avoid paying fees for that portion.
Suppose Alice creates an offer to sell 100 Points
for $20
. Bob, who wants to buy half of that offer (i.e., 50 Points
for $10
), will call createTaker(address _offer, uint256 _points)
.
platformFeeRate
The platformFeeRate
is 0.5%
, as stated in this reference.
DepositAmount
After calculation, the depositAmount
is 10
.
platformFee
The final platformFee
would be 0.05
. However, since platformFee
is a uint256
and cannot represent fractional numbers, it is rounded down to 0
.
remainingPlatformFee
Since platformFee = 0
, the _updateReferralBonus()
function sets both referrerReferralBonus
and authorityReferralBonus
to 0
, resulting in a remainingPlatformFee
of 0
.
makerInfo.platformFee
Because remainingPlatformFee
is zero, and the platformFee
was initially set to zero when creating the offer, the makerInfo.platformFee
remains zero.
The rounding down of fractional platform fees to zero allows the Maker to avoid paying the required fee when a Taker buys a portion of the offer. This vulnerability could result in a loss of revenue for the platform and create an unfair advantage for Makers.
Manual Review
Set Minimum Fee Threshold: Introduce a minimum platform fee threshold, ensuring that even small transactions incur a fee that cannot be bypassed.
Low severity, this can be done using the `Rescuable.sol` contract. Arguably there is no errors here given the `platformFee` variable can represent the historical fees that the protocol has accumulated and need not be updated when fees are withdrawn. However, I believe a more explicit function can be valuable to be more transparent regarding withdrawals. However, I will leave this issue open for escalation for debates because I can see it as arguably invalid as well, but I see no arguments for it being medium severity since there is an alternative to retrieve platform fees, assuming admins are trusted.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.