This is just a simple project that shows how to run the DutchX bots to ensure liquidity for any ERC20 token pair list.
To make it easier, we provide a Docker
image with all the bots and a
CLI.
Follow through this document to run your own bots and learn how to operate on the DutchX.
If you follow through, you'll get:
- The liquidity bots, up and running
- You'll known how to fund them so they can operate
- You'll learn how to use the CLI (command line interface)
- To check the state of the auctions
- To interact with the DX: Claim, buy, sell, etc.
Checkout the DutchX Documentation. You can also check how to request a new price feed if you need it Adding a price feed
An easy way to run the bots is to fork this project, or create a blank one with:
- The config for the bots
- The script to run the bots
Create a config file for the bots, like the one in conf/bots.js, where:
MARKETS
: List of the ERC20 token pairs you want the bots to watch.- Format:
<token1>-<token2>[,<tokenN>-<tokenM>]*
- Example:
WETH-RDN,WETH-OMG
- It's important that for every distinct token provided, you also provide the address, the can be passed either in the config file or as ENV_VAR:
- WETH_TOKEN_ADDRESS:
0xc58b96a0278bd2c77bc93e01b148282fb8e753a5
- RDN_TOKEN_ADDRESS:
0x3615757011112560521536258c1e7325ae3b48ae
- OMG_TOKEN_ADDRESS:
0x00df91984582e6e96288307e9c2f20b38c8fece9
- Format:
MAIN_BOT_ACCOUNT
:- Select the main bot account (account index of the ones generated from the
MNEMONIC
) - The main bot account that will be used to generate reports
- Select the main bot account (account index of the ones generated from the
BUY_LIQUIDITY_BOTS
:- name: The name to display in notifications and messages
- markets: An object selecting the markets to watch (explained above)
- accountIndex: The accountIndex from the accounts generated from the
MNEMONIC
that is going to be used by this bot - rules: The rules to indicate the bot when to do buys
- notifications: The notification system to be used by the bot. For now only
slack
is available
SELL_LIQUIDITY_BOTS
: Same parameters asBUY_LIQUIDITY_BOTS
except the don't need rules
WARNING: If you create a new file for your configuration make sure you update base-command in order to use your own configuration.
You can create a copy of base-command script.
Fill the environment variables in base-command
with your own configuration:
MNEMONIC
:- Use your secret BIP39 mnemonic.
- The bot address will be the first account generated by that mnemonic.
ETHEREUM_RPC_URL
:- Url for a Ethereum node
- You can use your own node or setup infura for example:
https://rinkeby.infura.io
MARKETS
: List of the ERC20 token pairs you want the bots to watch.- Format:
<token1>-<token2>[,<tokenN>-<tokenM>]*
- Example:
WETH-RDN,WETH-OMG
- Example:
- It's important that for every distinct token provided, you also provide the
addresses, in the case of the previous example:
- WETH_TOKEN_ADDRESS:
0xc58b96a0278bd2c77bc93e01b148282fb8e753a5
- RDN_TOKEN_ADDRESS:
0x3615757011112560521536258c1e7325ae3b48ae
- OMG_TOKEN_ADDRESS:
0x00df91984582e6e96288307e9c2f20b38c8fece9
- WETH_TOKEN_ADDRESS:
- Format:
NODE_ENV
:- Optional,
local
is the default - Can be one of the following:
local
,dev
,pre
orpro
- Optional,
WARNING: If you create a new base-command
file make sure you change the name in bots
Once you have it ready you can run ./bots
.
When you run it for the first time, you should see something similar to:
Don't worry for now about the WARN message shown at the bottom, we'll deal with it in the Fund the bots section.
This script will:
- Start 3 bots that will ensure the liquidity:
SellLiquidityBot
,BuyLiquidityBot
andBalanceBot
(more info about these bots in DutchX Bots ) - Runs a simple API server that exposes basic information: http://localhost:8081
The bots automatically participate in the auctions performing bids and asks when the time is right.
In order to do this bids and asks, they need to have a balance in the DutchX
smart contract.
For founding the bots, we need to know their Ethereum address, this is determined by the secret mnemonic you've used to run the bots.
An easy way to know the address is just to visit the about endpoint:
You should see among other information, the accounts used by the bots:
Once you have the bot account, your secret mnemonic and the bots running, you are all set for the funding.
The easiest way is to use the DutchX CLI.
Check out the Deposit section in https://github.com/gnosis/dx-cli
In the docker image, it's also available a CLI, with some basic operations for using the DutchX.
You can use it for getting the state of a token pair, or to trade in an auction among other things.
Checkout the CLI documentation to learn how to use it.
This sample project also provides a simple CLI script you can use.
There's a basic command in the CLI that is very helpful to get the state of the auctions.
Example: Get the state of the WETH-RDN aution
./cli state WETH-RDN
We would get something similar to:
For other methods, or to learn how to use the CLI go to:
There are 3 bots:
SellLiquidityBot
BuyLiquidityBot
CheckBakanceBot
Find out more about them in:
To increase the debug level, you can change the bot script to run with
run bots-dev
instead of run bots
.
Don't forget to change it back for the production script.