Submitted by hansfriese, also found by ktg
Bidders might fail to withdraw their unused funds after the auction was finalized because the contract doesnt have enough balance.
The main flaw is the seller might receive more quote tokens than the bidders offer after the auction was finalized.
If there is no other auctions to use the same quote token, the last bidder will fail to withdraw his funds because the contract doesnt have enough balance of quote token.
After the auction was finalized, the seller receives the filledQuote amount of quote token using data.filledBase.
But when the bidders withdraw the funds using withdraw(), they offer the quote token using this formula.
Even if they use the same clearing price, the total amount of quote token that the bidders offer might be less than the amount that the seller charged during finalization because the round down would happen several times with the bidders.
This is the test to show the scenario.
The test result shows the seller charged more quote token than the bidders offer so the last bidder cant withdraw his unused quote token because the contract doesnt have enough balance.
Foundry
Currently, the FinalizeData struct contains the filledBase only and calculates the filledQuote using the clearing price.
I think we should add one more field filledQuote and update it during auction finalization.
And the seller can recieve the sum of filledQuote of all bidders to avoid the rounding issue.
Also, each bidder can pay the filledQuote of quote token and receive the filledBase of base token without calculating again using the clearing price.
RagePit (SIZE) confirmed
