Submitted by PierrickGT, also found by Evo, caventa, 0xNineDec and carlitox477.
In the buy function of the RubiconMarket contract, a fee is subtracted on taker trades.
The default feeBPS is set to 1 which is equivalent to a fee of 0.01% or 0.0001 in decimal form.
For tokens like gUSD with a low decimal precision of 2, no fees will be taken on 3 figure trades since Solidity will round down the result to 0.
The taker fee is calculated in the buy function of the RubiconMarket contract on L338 and also in the calcAmountAfterFee function on L583.
The following reasoning also apply to the maker fee on L346 and L586.
Lets take, for example, a 500 gUSD trade. Mathematically the fee would be:
500 * 0.0001 = 0.05.
In solidity, for a token with 2 decimal places, we would get:
amount * feeBPS / 100_000 = 50000 * 1 / 100_000 = 0 cause it rounds down to 0.
It would allow a user to not pay any taker and/or maker fee on 3 figure trades.
Foundry unit test available here
You could either not support these type of tokens or add the following requires:
daoio (Rubicon) acknowledged and commented:
HickupHH3 (judge) commented:
