---
# System prepended metadata

title: Token exchange Withdraw Diagram

---

# Token exchange Withdraw Diagram


```plantuml

participant "Game" as game
participant "Backend" as back
participant "Frontend" as front
participant "Exchange Contract" as contract

front -> back: request in-game user balance 
back -> game: request in-game user balance
game -> back: response with user balance
back -> front: response with user balance
front -> back: Get contract with multi signer - Amount: 10000, NFT: Owned NFT
back -> back: Validation Request (Daily, Weekly, Monthly widrawable amount, NFT required check, user have enough balance in game)
back -> game: send GameCurrencyWithdrawal event
game -> game: decrease user balance
game -> back: send "success" response after balance adjustment
back -> front: Response Contract(On-Chain amount, In-game amount, xr, nft)
front -> contract: Processing Token Exchanging
contract -> front: Return TxID
front -> back: Confirm Transaction(TxID)
back -> back: Fetch Transaction(TxID)
back -> back: Validate Transaction(Fetch value: On-chain amount, in-game amount, xr, nft)
back -> game: If tx failed send RollbackWithdrawal event to restore user balance
back -> back: if tx success, exchange fee will be added to reward account
game -> back: send "success" response after balance adjustment
back -> front: Return Token Exchange Success