# User Guide

## **Basic setup**&#x20;

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.&#x20;

![](https://lh5.googleusercontent.com/F5UKT79kFdSnKj1Ej447zD5KTMwxg458fJrBLZ1IE2paiScuXvNoqQweRqE0jTtIezCYDtxN6WyaCARLqXsJ8g6cp5J4vvsV7_yNu4RVFSFvFWHc_zqcM665SxKeFWp25gaTfeqi=s0)

**Function:** Bridge.setBrokerDepositAddress()

1. **Custodian:** set the deposit address to which the broker should send its XCH in minting.

![](https://lh4.googleusercontent.com/R9L4UDCmFMBznLV3ehnGFvPiVuv60XqVzYZ5ILW4xzB1jWsRQIOF2vAidOSlVDCbsspzOPdB1uk-R-VKd607T-1TaftbcD_MJXXwxJKrBRBSg6Ol6mCmi_gfSYYcAFZFq2ie84B9=s0)

**Function:** Bridge.setCustodianDepositAddress()<br>

## **Minting**

**Broker wants to mint 1 WXCH**

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

![](https://lh6.googleusercontent.com/2ztrgeQivY-OYeAa01POycoWE6wJIcTAjB_4TC5qpddm_hDdV3ZeiX8rogwmM33fj9rw42FmsTjNhuuIY1rtTJ-Jydskw4vP50dpwbKBxHp4HHKkzNO_LOrQkppbY0Pz1ABm0qx6=s0)

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

![](https://lh4.googleusercontent.com/Fo7IkBtfcOWDx9FD7ha-Zk6IFWTKzdEUkJmUR3z-oa8-WfgpxiPKutWkzqArpqZ42vD-ofuOmWDBRafCj0nBaO3sIPkg3DGCMVttEZr-a-4CoRF8YknIPkdVbXzYuUs4vLwQPrtQ=s0)

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

![](https://lh6.googleusercontent.com/YMQYZ1ClyuksgXYDQQBfD4yMM-q1aPqnuO7TZlKRcQFZV0SaCcGTkKnSN6IFIdwopNdRqTeRcZ-grh0DH6Um4LUi-3jGYtUPUM44dHfZn0UVtOu-AAGItgBFv6aRIpGi54noiW7m=s0)

1. Custodian confirms the minting request with ​confirmMintRequest() by input hash of the minting request&#x20;

![](https://lh4.googleusercontent.com/0YkYAqHyvIQ6GVORtjfn2jwgXvTzj0H9IJxLSWc--ESLwWZ-KWPbiQCh78osM_sDSOPuxoWM2HzYIRhEpdNW2IUChdVoGnQxg-vfKNjnUBJS8bKGRSanVHqt_ysziUHQDRHah5a_=s0)

## **Burning**

Broker wants to burn 1 wxch. We assume it already approved allowance to the bridge contract.&#x20;

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

![](https://lh5.googleusercontent.com/xjuGPY483yDddGTWevcU6fh9AWjM93FRn65JZupKT11g1yufR6sk_LI2IQvMy_pQzRFujw38vMtghrdLnc6R0aKOPvVwIUuYzX08t9QVMNNpAPrNdJomu8CVWvC5qCb0ymwjEPty=s0)

1. Custodian reads the burn request ​getBurnRequest<br>

![](https://lh4.googleusercontent.com/yXqv-pbASWpSW7nV_CL5ZcBW98CnL4HnSb2hfsB9qRGShBt3Qw6rKTKIb4Et4CaLurrXWCa35ULtgA1Fk-3jV_jr_Jo6h8fvsT7hWTtI4QypkOsoE5zZyA_zXjqH6Mwy6bO22UP7=s0)

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

![](https://lh6.googleusercontent.com/Lv9ddxzOm1KywzjKWW6mHSmTMK74Ve0sTncDCNFgl-vDZBLiFneaucjHrqnUNFwKqUyg6kzFH4QwlHMTZLiwSS5UefV66m_1Pq7zeQe7oMTi5p3B-FwSibjwa3YJw2Gul6OBfxN7=s0)

## **Appendix**

### **WXCH Contract Addresses**

| **Contract Name**   | **Contract Address**                                                      |
| ------------------- | ------------------------------------------------------------------------- |
| **WXCH Token**      | <https://etherscan.io/token/0x2847c48b4FD2e7dCAcC00Cb04f555fE8dD10D504>   |
| **Bridge contract** | <https://etherscan.io/address/0xf4e0b46029d0fEd6b865C53C2b8d34AD81152bA2> |
