Links

User Guide

How does a Broker mint and burn WXCH

Basic setup

  1. 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. 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. 1.
    It queries the custodian's deposit address. Function: Bridge.custodianDepositAddress()
  1. 1.
    Broker generates a XCH tx to Custodian address for 1.005 XCH. But does not send it yet.
  2. 2.
    Broker calls ​addMintRequest​ with:
    1. 1.
      amount = 1e12
    2. 2.
      xchTxid = the tx id
    3. 3.
      xchDepositAdress = custodian deposit address
  1. 1.
    The Broker sends the XCH tx on the Chia network. And give Custodian the minting request nonce.
  2. 2.
    Custodian reads the nonce info ​getMintRequest()
  1. 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. 1.
    ​​Broker calls ​burn​ with amount 1e12. And let Custodian know the nonce of the request.
  1. 1.
    Custodian reads the burn request ​getBurnRequest
  1. 1.
    Custodian sends 0.995 XCH to the deposit address of the request.
  2. 2.
    Custodian calls ​confirmBurnRequest ​with the burn request hash and the XCH tx hash

Appendix

WXCH Contract Addresses

Contract Name
Contract Address
WXCH Token
https://etherscan.io/token/0x2847c48b4FD2e7dCAcC00Cb04f555fE8dD10D504
Bridge contract
https://etherscan.io/address/0xf4e0b46029d0fEd6b865C53C2b8d34AD81152bA2