User Guide

How does a Broker mint and burn WXCH

Basic setup

  1. 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()

  1. 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

  1. It queries the custodian's deposit address. Function: Bridge.custodianDepositAddress()

  1. Broker generates a XCH tx to Custodian address for 1.005 XCH. But does not send it yet.

  2. Broker calls ​addMintRequest​ with:

    1. amount = 1e12

    2. xchTxid = the tx id

    3. xchDepositAdress = custodian deposit address

  1. The Broker sends the XCH tx on the Chia network. And give Custodian the minting request nonce.

  2. Custodian reads the nonce info ​getMintRequest()

  1. 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.

  1. ​​Broker calls ​burn​ with amount 1e12. And let Custodian know the nonce of the request.

  1. Custodian reads the burn request ​getBurnRequest

  1. Custodian sends 0.995 XCH to the deposit address of the request.

  2. Custodian calls ​confirmBurnRequest ​with the burn request hash and the XCH tx hash

Appendix

WXCH Contract Addresses

Last updated