Withdrawing From a Master Exchange Address
Withdrawing From a Virtual Account Master Exchange Address
There are two withdrawal methods from a Virtual Account:
- From each Virtual Account deposit address
- From a Master Exchange Address
Workflow Example
User_A: VirtualAccount_A
balance is 0 MATIC.User_A: DepositAddress_A
connected toVirtualAccount_A
receives 3 MATIC.VirtualAccount_A
balance is now 3 MATIC.
Exchange_Owner
: Transfers 3 MATIC fromDepositAddress_A
toMasterExchangeAddress
.- This is a standard blockchain transfer via: Send MATIC from account to account
VirtualAccount_A
balance remains 3 MATIC.
User_A
: Withdraws and transfers 3 MATIC from VirtualAccount_A to VirtualAccount_B owned by User_B.- Endpoint: Send payment
VirtualAccount_A
balance is now 0 MATIC.VirtualAccount_B
balance is now 3 MATIC.
User_B
: Withdraws to transfer out 3 MATIC fromVirtualAccount_B
to an unrelated blockchain address.Exchange_Owner
: Store withdrawal -->/v3/offchain/withdrawal
Exchange_Owner
: Standard blockchain transfer via: Send MATIC from account to accountExchange_Owner
: Completes or Cancels the withdrawal- Complete withdrawal -->
/v3/offchain/withdrawal/{id}/{txId}
- Cancel withdrawal -->
/v3/offchain/withdrawal/{id}
- Complete withdrawal -->
How to withdraw assets from a Master Exchange Address
- Store information about withdrawal
- Check the id of the Virtual Account, the available balance or the UTXO balance
- Decrease the amount and fees from the Virtual Account
- Prepare transaction to broadcast transfer to the blockchain
- Blockchain transfer
- Standard blockchain transfer from address to address
- Verify the result of the transfer
- Complete/Rollback
- IF blockchain transfer fails - rollback VA balance
- ELSE complete withdrawal
Updated 6 months ago