Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

Commit

Permalink
Update add-token-pair.md
Browse files Browse the repository at this point in the history
Did a general spelling/grammar check to improve readability.
  • Loading branch information
Rafanator committed Aug 24, 2018
1 parent d301be1 commit 64b5200
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions source/add-token-pair.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Add a trading token pair
The DutchX is an open platform, and as such, anybody can add it's token by
themselves.
# Add a token pair
The DutchX is an open platform, and as such, anybody can add a token pair to trade.

Check out this slides to find out more about the advantages and some information
about <a href="_static/docs/DutchX_Handbook_New_Tokens.pdf" download>Listing a token in the DutchX</a>.
Check out these slides to find out more
about <a href="_static/docs/DutchX_Handbook_New_Tokens.pdf" download>listing a token on the DutchX</a>.

There are several ways you can add a token to the DutchX. All of them end up
There are several ways to add a token pair to the DutchX. All of them end up
using the `addTokenPair` function in the
[**DutchExchange.sol**](https://github.com/gnosis/dx-contracts/blob/master/contracts/DutchExchange.sol)
contract.
Expand All @@ -16,31 +15,31 @@ of the deployed [**DutchExchangeProxy.sol**](https://github.com/gnosis/dx-contra
this <a href="https://blog.gnosis.pm/solidity-delegateproxy-contracts-e09957d0f201" target="_blank">Solidity DelegateProxy</a> post.

## 1. Get the information for adding a token pair
Let's assume that we want to add `RDN-WETH` token pair.
Let's assume we want to add the `RDN-WETH` token pair.

To add a token pair you will need the following information:
* **Address of the first token**: `WETH` in this case
* When you list a token for the first time it's mandatory to use
`Wrapped Ether` (`WETH`) as the other token in the pairing.
* Check out this [Information about what is WETH](https://weth.io/) to learn more
* Check out this [this link](https://weth.io/) in order to learn more
about Wrapped Ether.
* The addresses for `WETH` are:
* `mainnet`: [0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2](https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
* `rinkeby`: [0xc778417e063141139fce010982780140aa0cd5ab](https://rinkeby.etherscan.io/token/0xc778417e063141139fce010982780140aa0cd5ab)
* **Address of the token you want to add**: `RDN` in this case.
* This is the address of the `ERC20` token you want to add.
* For example, in mainnet `RDN` token has the address [0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6](https://etherscan.io/token/0x255aa6df07540cb5d3d297f0d0d4d84cb52bc8e6)
* For example, on the mainnet `RDN` token has the address [0x255Aa6DF07540Cb5d3d297f0D0D4D84cb52bc8e6](https://etherscan.io/token/0x255aa6df07540cb5d3d297f0d0d4d84cb52bc8e6)
* **Price of the token pair**:
* This is the price you claim that your token has against the other token,
that's `WETH-RDN` prince in this case (`584 RDN/ETH` by the time this
that's `WETH-RDN` price in this case (`584 RDN/ETH` by the time this
document was written)
* Note that there's no benefit on adding the wrong price:
* If you decide to use a very low price, anyone could participate in the
auction and buy cheap the `WETH` you deposit when you add a token pair.
* If you set it to high, the auction will take more time to reach the market
price. It'll end up closing with the market price.
* If you are confused about how the mechanism work, read the
[Blog posts](https://blog.gnosis.pm/tagged/dutchx), and for very detailed
[Blog posts](https://blog.gnosis.pm/tagged/dutchx), and for a very detailed
mathematical explanation, check out the
[Smart Contract Documentation](smart-contract-documentation.html).
* **Funding for first token** (in Weis): For example `18 WETH` (more than
Expand All @@ -52,9 +51,9 @@ To add a token pair you will need the following information:
things:
* **The price you provide**: This is the price you claim your token is
worth.
* **The price of the `WETH-USD`**: The DutchX uses a oracle that reports
* **The price of `WETH-USD`**: The DutchX uses an oracle that reports
the current price for this pairing.
* Your account should have this amount of token in it's DutchX balance. Don't
* Your account should have this amount of tokens in its DutchX balance. Don't
worry about this right now, because it's covered in the **Fund the account**
section.
* **Funding for the second token**:
Expand All @@ -79,11 +78,11 @@ smart contracts:
[**DutchExchange.sol**](https://github.com/gnosis/dx-contracts/blob/master/contracts/DutchExchange.sol)
`deposit`. You must use at least the funding amount.

The easiest way to invoke this two operations is to use the `CLI`, so please
The easiest way to invoke these two operations is to use the `CLI`, so please
set it up by following the steps described in the [CLI](./cli.html) page.


**1. Verify your account has the tokens**
**1. Verify that your account has the tokens**
We are trying to deposit some tokens into the DutchX, so first we should make
sure they are in our balance:

Expand All @@ -96,8 +95,8 @@ Once the `CLI` is ready, just execute the deposit operation, make sure:
* You use the right **network** (`rinkeby` or `mainnet`)
* You use the right **mnemonic** (the one that has the tokens you want
to deposit into the DutchX)
* **NOTE**: the `CLI` will automatically do a `approve` and a `deposit`. Aditionally
in the case of the `WETH`, it'll wrap `Ether` if you don't have enough balance.
* **NOTE**: the `CLI` will automatically do a `approve` and a `deposit`. Aditionally,
in the case of `WETH`, it'll wrap `Ether` if you don't have enough balance.

```bash
# Wrap, approve and deposit into the DutchX
Expand All @@ -111,18 +110,17 @@ to deposit into the DutchX)


## 3. Add the token pair
Once you have all the information and you have deposited in the DutchX the amount
of the funding, you are ready to invoke the `addTokenPairFunction`.
Once you have all the information and you have deposited in the DutchX the funding amount, you are ready to invoke the `addTokenPairFunction`.

There are several ways you can do this:
There are several ways to do this:
* **Use the `add-token-pair` script**: This is the recommended one, since it
also perform some validations and shows help messages.
also performs some validations and shows help messages.
* **Use truffle consolle**: Since the
[DutchX Smart Contracts](https://github.com/gnosis/dx-contracts) is a truffle
project, you can use the console to add the token pair or invoke any other
logic of the contract.
* **From a migration in your project**: Use this option if you are building a
project and you want to add the tokens in your local development node also.
project and you want to also add the tokens in your local development node.
* **Using the CLI**: The `CLI` has also a `add-token-pair` that uses the same
format as the `add-token-pair` script.

Expand Down Expand Up @@ -157,7 +155,7 @@ npm run restore

It'll check if everything is ok for adding the token pair, but it won't execute
the transaction:
* Use the mnemnonic of the account that have deposited the initial funding.
* Use the mnemnonic of the account that deposited the initial funding.
* Use the file you created in the previous step (i.e. `./ABC-WETH.js`)
* Provide the name of the network in which you want to add the token pair: `mainnet` or `rinkeby`.
* Don't forget the `--dry-run`
Expand All @@ -168,14 +166,14 @@ MNEMONIC="your secret mnemonic ..." npm run -- add-token-pairs -f ./ABC-WETH.js

If everything went smoothly, you should now be able to execute it for real.
Otherwise, the command will tell you what is the problem and what you need to
do in orther to solve it.
do in order to solve it.

**4. Run the script withouth the dry-run**:
```bash
MNEMONIC="your secret mnemonic ..." npm run -- add-token-pairs -f ./ABC-WETH.js --network mainnet
```

### 3b. Useng truffle console
### 3b. Using truffle console
Since the [DutchX Smart Contracts](https://github.com/gnosis/dx-contracts) is a
truffle project, you can use the console to add the token pair or invoke any
other logic of the contract.
Expand All @@ -193,7 +191,7 @@ npm install
**2. Enter into the truffle console**

Make sure you:
* Use the mnemnonic of the account that have deposited the initial funding.
* Use the mnemnonic of the account from which the initial funding was deposited.
* Provide the name of the network in which you want to add the token pair: `mainnet` or `rinkeby`.

```bash
Expand Down Expand Up @@ -242,10 +240,10 @@ dx.addTokenPair(
```

### 3c. From a migration in your code
To add the token pair using migrations, first you should be familiarized on
To add the token pair using migrations, you should first be familiarized on
how to build on top of the DutchX.

Make sure you have completed this two guides:
Make sure you have completed these two guides:
* [Build on top of the DutchX](./build-on-top-of-dutchx.html)
* [Use DutchX as an Oracle](./use-dutchx-as-an-oracle.html)

Expand Down Expand Up @@ -291,10 +289,10 @@ module.exports = function (deployer, network, accounts) {
```

### 3d. Using the CLI
The `CLI` has also a `add-token-pair` operation that uses the same format as the
The `CLI` has also an `add-token-pair` operation that uses the same format as the
`add-token-pair` script.

Usually is preferable to use the `add-token-pairs` script instead of the `CLI`,
Usually, it is preferable to use the `add-token-pairs` script instead of the `CLI`,
it has some advantages, so consider using it.

To use the CLI:
Expand All @@ -307,9 +305,9 @@ For example `./ABC-WETH.js`

Execute the command, and make sure:
* You use the right **network** (`rinkeby` or `mainnet`)
* You use the right **mnemonic** (the one that has the tokens in it's DutchX
* You use the right **mnemonic** (the one that has the tokens in its DutchX
balance)

```bash
./cli add-token-pair --file ./ABC-WETH.js
```
```

0 comments on commit 64b5200

Please sign in to comment.