dashed-slug.net › Forums › Exchange extension support › Negative available balance after trade › Reply To: Negative available balance after trade
Hello,
Is it possible that, during the crash, the wallet was not the only thing damaged?
User balances have nothing to do with the hot wallet. User balances are the sum of transactions on the plugin’s ledger, and this is stored in the MySQL table wp_wallets_txs
.
Before you edit the transactions or add/remove transactions, you must understand what happened:
I recommend that you review that user’s transactions, using the SQL query:
SELECT FROM wp_wallets_txs WHERE status = 'done' AND account = <USER_ID>;
(Replace <USER_ID>
with the user’s actual numeric ID.)
This will give you all the user’s transactions that affect their balance.
Review the transactions and you will understand why the balance is what it is.
If you believe that the MySQL table was damaged, then I’m afraid you must restore it from backup.
In summary: there is nothing in the hot wallet that affects user balances directly. Hot wallets simply notify the plugin about incoming deposits, and tell the plugin whether withdrawals are successful or not. The plugin maintains its own ledger on MySQL. Therefore, if a user’s balance is negative, that means that the sum of that user’s balances on your MySQL table adds up to a negative number. Maybe a deposit was deleted, or part of an Exchange trade was corrupted/deleted, or your site was possibly hacked.
Hope this helps. Let me know if you have any more questions about this.
with regards