Minus Withdrawals

Stacks address:{SP1FHVF49BGKR0GM1YFV5TMZ962454N9RYBDNPEGC}.

Issue: When Withdrawing, since blocks take some time to confirm, user can place multiple orders greater than their trading account balance. For example, when I had a balance of 100 Xusd, I first placed a withdraw request for 50, then placed a withdraw request for 70, 80, 90. All of these requests are queued up now. Some are going to fail as my total balance itself is just 100. Also between now and then I can still go and do some trading which can even bring down my balance.

I can see that the Locked Fund is shown only after sometime and by then the harm was done. Now my locked fund now is 290, where my total balance itself in trading account was only 100!! Now I am trying to ‘Withdraw’ again even though my balance is displayed as <0.0001 Xusd. And now I can withdraw 189 Xusd again!!! I think now system is seeing a negative balance in me and it just shows up the negative amount in the field. In the confirmation window it shows up as <0.0001, with the hover message showing it as ‘-189’

Discord ID: DayalKS2#5405
Telegram ID: @DayalKS2

-2
This is surely a UIUX issue, your withdrawal could have failed once the blockchain takes confirmation of your trading account.
But it is good to optimize the logic here to avoid confusing

Actually, the other transaction is not getting failed. It will remain in pending status and will get executed the next time when user adds up an amount to Trading Account. The other impact of this flaw is that my remaining amount is going to get locked for ever. In my case, 1st transaction for 50 got executed and my remaining balance of 40 got locked because 3 open orders worth 140 or so was in pending status for which I didnt had the balance to serve. As I added amount to my trading balance next time, all these 3 orders got executed. To summarize, these wrong orders will not get executed and will lock the delta amount in user’s trading account.