Name: dx-examples-liquidity-bots
Owner: GNOSIS
Description: Example and template for running bots that ensure market liquidity for a given list of token pairs.
Created: 2018-04-30 16:50:17.0
Updated: 2018-05-21 12:43:52.0
Pushed: 2018-05-21 12:43:52.0
Homepage: null
Size: 439
Language: Shell
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is just a simple project that shows how to run the Dutch X 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 Dutch Exchange.
If you follow through, you'll get:
For aditional information and for reference, check out the following repositories:
Create the running script:
Create a script run-bots
with the following content:
sr/bin/env bash
er run \
8081:8081 \
MNEMONIC="super secret thing that nobody should know" \
ETHEREUM_RPC_URL=https://rinkeby.infura.io \
MARKETS=WETH-RDN \
WETH_TOKEN_ADDRESS=0xc58b96a0278bd2c77bc93e01b148282fb8e753a5 \
RDN_TOKEN_ADDRESS=0x7e2331beaec0ded82866f4a1388628322c8d5af0 \
NODE_ENV=dev \
osispm/dx-services:staging \
m run bots
-e MARKETS=WETH-RDN,WETH-OMG \
-e WETH_TOKEN_ADDRESS=0xc58b96a0278bd2c77bc93e01b148282fb8e753a5 \
-e RDN_TOKEN_ADDRESS=0x7e2331beaec0ded82866f4a1388628322c8d5af0 \
-e OMG_TOKEN_ADDRESS=0x8bdd53a53c53fbc40d38231d6219f8cb7b59a704
You can use this one as a template.
Fill the environment variables with your own configuration:
MNEMONIC
:ETHEREUM_RPC_URL
:https://rinkeby.infura.io
MARKETS
: List of the ERC20 token pairs you want the bots to watch.<token1>-<token2>[,<tokenN>-<tokenM>]*
WETH-RDN,WETH-OMG
0xc58b96a0278bd2c77bc93e01b148282fb8e753a5
0x7e2331beaec0ded82866f4a1388628322c8d5af0
0x8bdd53a53c53fbc40d38231d6219f8cb7b59a704
NODE_ENV
:local
is the defaultlocal
, dev
, pre
or pro
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:
SellLiquidityBot
,
BuyLiquidityBot
and BalanceBot
(more info about these bots in
Dutch X Bots
)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 Dutch X
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 Dutch X CLI.
Check out the Deposit section in Dutch X Cli page
In the docker image, it's also avaliable a CLI, with some basic operations for using the Dutch X.
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.
- Dutch X Cli page
- Also, you can create a cli script, the same way we did in the
run-bots
script. You can use this one as a template.
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
i 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.