The fee calculation in the buyOrder
function incorrectly calculates fees for orders with prices less than 100 wei, resulting in zero fees being charged.
In the buyOrder
function, fees are calculated using integer division:
Due to Solidity's integer division behavior, any order price less than 100 wei will result in fee = 0
since price/100
rounds down to 0. This means:
No platform fee is collected
No seller fee is deducted
The full amount goes to the seller
Loss of revenue for the platform on low-value transactions
Potential exploitation by users creating multiple small orders to avoid fees
Inconsistent fee application across different order values
Manual code review
Performing formal verification with Quint
Use basis points (bps) and multiply first before dividing to avoid rounding issues:
Add minimum order value checks:
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.