User Guide
How does a Broker mint and burn WXCH
Basic setup
Broker: Set broker XCH deposit address. This is the address a broker is expecting to get its XCH from Custodian, after burning WXCH tokens.
Function: Bridge.setBrokerDepositAddress()
Custodian: set the deposit address to which the broker should send its XCH in minting.
Function: Bridge.setCustodianDepositAddress()
Minting
Broker wants to mint 1 WXCH
It queries the custodian's deposit address. Function: Bridge.custodianDepositAddress()
Broker generates a XCH tx to Custodian address for 1.005 XCH. But does not send it yet.
Broker calls addMintRequest with:
amount = 1e12
xchTxid = the tx id
xchDepositAdress = custodian deposit address
The Broker sends the XCH tx on the Chia network. And give Custodian the minting request nonce.
Custodian reads the nonce info getMintRequest()
Custodian confirms the minting request with confirmMintRequest() by input hash of the minting request
Burning
Broker wants to burn 1 wxch. We assume it already approved allowance to the bridge contract.
Broker calls burn with amount 1e12. And let Custodian know the nonce of the request.
Custodian reads the burn request getBurnRequest
Custodian sends 0.995 XCH to the deposit address of the request.
Custodian calls confirmBurnRequest with the burn request hash and the XCH tx hash
Appendix
WXCH Contract Addresses
Last updated