User is able to drain CapitalPool with TokenManager::withdraw, as long as he has least 1 of the corresponding token recorded in TokenManager::userTokenBalanceMap mapping, due to withdrawer's withdrawable balace doesn't reset
Let's see what's happening in scenario where Bob creates a bid offer, abort his offer and refund all his funds:
Firstly Bob creates offer with PreMarkets::createOffer, where he creates offer and deposits X amount of specified token
Right after that Bob closes his offer with PreMarkets::closeOffer(while offer.usedPoints are still 0). During the execution TokenManager::addBalance is called and now Bob is able to withdraw back X amount of specified token
After that Bob calls TokenManager::withdraw, to get his funds back.
Now Bob received his X tokens, but there is no code that resets his withdrawable balance, which means that Bob is still able to withdraw X tokens again and again until there is no more _tokenAddress tokens in CapitalPool
Loss of funds for users, due to withdraw revert, because of not enough tokens in CapitalPool
Manual review
Valid critical severity finding, the lack of clearance of the `userTokenBalanceMap` mapping allows complete draining of the CapitalPool contract. Note: This would require the approval issues highlighted in other issues to be fixed first (i.e. wrong approval address within `_transfer` and lack of approvals within `_safe_transfer_from` during ERC20 withdrawals)
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.