Submitted by PP1004, also found by hansfriese
https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/RubiconRouter.sol#L290
https://github.com/code-423n4/2022-05-rubicon/blob/8c312a63a91193c6a192a9aab44ff980fbfd7741/contracts/RubiconRouter.sol#L307
The two functions maxSellAllAmount and maxBuyAllAmount will always revert in case at least (100-fee)% of users balance can be matched with orders.
Lets say Bob placed an order selling 100 USDC with a low USDT price of 1:0.95.
Alice currently has 50 USDT and they want to maxSellAllAmount into USDC.
The function will pass 50 as amount into RubiconMarkets buyAll function where it fully matches with Bobs order. Here, the buy() function will first transfer alices 50 USDT in and later 50 * feeBPS / BPS as fee. In this case, alice can not afford to pay.
Therefore, the two functions maxSellAllAmount and maxBuyAllAmount are useless in case users request can be fully matched.
Add the fee calculating before passing the amount to the RubiconMarkets buyAll, sellAll function.
bghughes (Rubicon) confirmed 
HickupHH3 (judge) commented:
