├── .gitignore ├── docs ├── img │ ├── bot-account.png │ ├── run-docker.png │ └── state-of-auction.png ├── cli.md └── bots.md ├── bots ├── claim ├── cli ├── LICENSE.md ├── base-command ├── conf └── bots.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .history 2 | *.log -------------------------------------------------------------------------------- /docs/img/bot-account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnosis/dx-examples-liquidity-bots/HEAD/docs/img/bot-account.png -------------------------------------------------------------------------------- /docs/img/run-docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnosis/dx-examples-liquidity-bots/HEAD/docs/img/run-docker.png -------------------------------------------------------------------------------- /docs/img/state-of-auction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnosis/dx-examples-liquidity-bots/HEAD/docs/img/state-of-auction.png -------------------------------------------------------------------------------- /bots: -------------------------------------------------------------------------------- 1 | APP_COMMAND="node src/runBots.js" 2 | APP_NAME="bots" 3 | 4 | # Base command: Pulls the docker image and run the app command 5 | source ./base-command 6 | -------------------------------------------------------------------------------- /claim: -------------------------------------------------------------------------------- 1 | APP_NAME="claim" 2 | APP_COMMAND="node src/tasks/claimFunds.js" 3 | 4 | # Base command: Pulls the docker image and run the app command 5 | source ./base-command -------------------------------------------------------------------------------- /cli: -------------------------------------------------------------------------------- 1 | APP_NAME="CLI" 2 | CLI_PARAMS=${@:--h} 3 | APP_COMMAND="node src/cli/cli.js $CLI_PARAMS" 4 | 5 | # Base command: Pulls the docker image and run the app command 6 | source ./base-command -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Gnosis Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /base-command: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Config 4 | DX_SERVICE_VERSION=staging # Check: https://hub.docker.com/r/gnosispm/dx-services/tags/ 5 | MNEMONIC="super secret thing that nobody should know" 6 | ETHEREUM_RPC_URL=https://rinkeby.infura.io 7 | NETWORK=rinkeby 8 | ENVIRONMENT=pre # local, pre, pro 9 | SHOW_COLORS=true 10 | DEBUG_MESSAGES=DEBUG=ERROR-*,WARN-*,INFO-*,DEBUG-dx-service:services:*,DEBUG-dx-service:repositories:PriceRepo* 11 | #DEBUG_MESSAGES=DEBUG=ERROR-*,WARN-*,INFO-*,DEBUG-* 12 | #DEBUG_MESSAGES=DEBUG=ERROR-*,WARN-*,INFO-* 13 | 14 | BUY_LIQUIDITY_BOT_CHECK_TIME_MS=10000 15 | 16 | # Markets info 17 | #WETH_TOKEN_ADDRESS= 18 | #RDN_TOKEN_ADDRESS= 19 | 20 | # NOTE: 21 | # - All the config is in conf/bots.js 22 | # - The bots have some default config, but it can be overrided using that file 23 | CONF_DIR=conf 24 | CONF_FILE_NAME=bots.js 25 | 26 | DOCKER_IMAGE="gnosispm/dx-services:$DX_SERVICE_VERSION" 27 | 28 | echo 29 | echo " ********* DutchX $APP_NAME - $DX_SERVICE_VERSION *********" 30 | echo " Docker image: $DOCKER_IMAGE" 31 | echo " Config file: ./$CONF_DIR/$CONF_FILE_NAME" 32 | echo " Run command: $APP_COMMAND" 33 | echo " *********************************" 34 | echo 35 | echo "[$APP_NAME] Getting docker image: $DOCKER_IMAGE..." 36 | docker pull $DOCKER_IMAGE 37 | 38 | echo 39 | echo "[$APP_NAME] Run docker..." 40 | CONTAINER_CONF_DIR=/usr/src/app/custom_conf 41 | docker run \ 42 | -p 8081:8081 \ 43 | -e MNEMONIC="$MNEMONIC" \ 44 | -e NETWORK="$NETWORK" \ 45 | -e ETHEREUM_RPC_URL=$ETHEREUM_RPC_URL \ 46 | -e NODE_ENV=$ENVIRONMENT \ 47 | -e DEBUG=$DEBUG_MESSAGES \ 48 | -e NODE_ENV=$ENVIRONMENT \ 49 | -e DEBUG_COLORS=$SHOW_COLORS \ 50 | --mount type=bind,source="$(pwd)"/$CONF_DIR,destination=$CONTAINER_CONF_DIR \ 51 | -e CONFIG_FILE=$CONTAINER_CONF_DIR/$CONF_FILE_NAME \ 52 | $DOCKER_IMAGE \ 53 | $APP_COMMAND 54 | # npm run --silent bots 55 | 56 | 57 | #-e WETH_TOKEN_ADDRESS=$WETH_TOKEN_ADDRESS \ 58 | #-e RDN_TOKEN_ADDRESS=$RDN_TOKEN_ADDRESS \ -------------------------------------------------------------------------------- /conf/bots.js: -------------------------------------------------------------------------------- 1 | // Markets 2 | const DEFAULT_GAS_PRICE_USED = 'fast' // safeLow, average, fast 3 | const MARKETS = [ 4 | { tokenA: 'WETH', tokenB: 'RDN' } 5 | ] 6 | 7 | // Token addresses 8 | const TOKEN_ADDRESSES = { 9 | WETH_TOKEN_ADDRESS: '0xc58b96a0278bd2c77bc93e01b148282fb8e753a5', 10 | RDN_TOKEN_ADDRESS: '0x3615757011112560521536258c1e7325ae3b48ae' 11 | } 12 | 13 | // Buy bot rules 14 | const BUY_LIQUIDITY_RULES_DEFAULT = [ 15 | // Buy 1/2 if price falls below 99% 16 | { 17 | marketPriceRatio: { 18 | numerator: 99, 19 | denominator: 100 20 | }, 21 | buyRatio: { 22 | numerator: 1, 23 | denominator: 2 24 | } 25 | }, 26 | 27 | // Buy the 100% if price falls below 96% 28 | { 29 | marketPriceRatio: { 30 | numerator: 96, 31 | denominator: 100 32 | }, 33 | buyRatio: { 34 | numerator: 1, 35 | denominator: 1 36 | } 37 | } 38 | ] 39 | 40 | // Buy bots 41 | const MAIN_BOT_ACCOUNT = 0 42 | const BUY_LIQUIDITY_BOTS = [{ 43 | name: 'Main buyer bot', 44 | markets: MARKETS, 45 | accountIndex: MAIN_BOT_ACCOUNT, 46 | rules: BUY_LIQUIDITY_RULES_DEFAULT, 47 | notifications: [{ 48 | type: 'slack', 49 | channel: '' // If none provided uses SLACK_CHANNEL_BOT_TRANSACTIONS 50 | }], 51 | checkTimeInMilliseconds: 10 * 1000 // 60s 52 | }] 53 | 54 | // Sell Bots 55 | const SELL_LIQUIDITY_BOTS = [{ 56 | name: 'Main seller bot', 57 | markets: MARKETS, 58 | accountIndex: MAIN_BOT_ACCOUNT, 59 | notifications: [{ 60 | type: 'slack', 61 | channel: '' // If none provided uses SLACK_CHANNEL_BOT_TRANSACTIONS 62 | }], 63 | checkTimeInMilliseconds: 60 * 1000 // 60s 64 | }] 65 | 66 | const EXCHANGE_PRICE_FEED_STRATEGIES_DEFAULT = { 67 | strategy: 'sequence', // TODO: More strategies can be implemented. i.e. averages, median, ponderated volumes, ... 68 | feeds: ['binance', 'huobi', 'kraken', 'bitfinex'] 69 | } 70 | 71 | const EXCHANGE_PRICE_FEED_STRATEGIES = { 72 | 'WETH-RDN': { 73 | strategy: 'sequence', 74 | feeds: ['huobi', 'binance', 'bitfinex'] 75 | } 76 | } 77 | 78 | 79 | // Bots API Port 80 | BOTS_API_PORT = 8081 81 | 82 | module.exports = { 83 | // Market and tokens 84 | MARKETS, 85 | ...TOKEN_ADDRESSES, 86 | DEFAULT_GAS_PRICE_USED, 87 | 88 | // Bot config 89 | MAIN_BOT_ACCOUNT, 90 | BUY_LIQUIDITY_RULES_DEFAULT, 91 | BUY_LIQUIDITY_BOTS, 92 | SELL_LIQUIDITY_BOTS, 93 | BOTS_API_PORT, 94 | 95 | // Price feed config 96 | EXCHANGE_PRICE_FEED_STRATEGIES_DEFAULT, 97 | EXCHANGE_PRICE_FEED_STRATEGIES, 98 | } 99 | -------------------------------------------------------------------------------- /docs/cli.md: -------------------------------------------------------------------------------- 1 | # DutchX Cli (Command Line Interface) 2 | In the docker image, it's also available a CLI, with some basic operations for 3 | using the DutchX. 4 | 5 | You can use it for getting the state of a token pair, or to trade in an auction 6 | among other things. 7 | 8 | ## Create a script for the CLI 9 | It's simpler to use, if we just create a basic script. 10 | 11 | You can use [this one](../cli) as a template. 12 | 13 | > Remember to grant it with execution permissions: 14 | > 15 | > `chmod +x ./cli` 16 | 17 | ## Get started with the CLI 18 | 19 | To check that the script is working, run the `version` command: 20 | ```bash 21 | ./cli --version 22 | ``` 23 | 24 | You should get the version of the CLI. 25 | 26 | To get a complete list of the operations, use the help: 27 | 28 | ```bash 29 | ./cli -h 30 | ``` 31 | 32 | You will get the list of commands and the syntax for them: 33 | 34 | ```bash 35 | Commands: 36 | cli.js state Get the state for a given pair (i.e. WETH-RDN) 37 | cli.js price Get the current price for a token pair 38 | cli.js market-price Get the market price for a token pair 39 | cli.js closing-prices [count] Get the closing prices for a given pair (i.e. WETH-RDN) 40 | cli.js seller-balances Get the seller balances for the las auctions (i.e. claimable-tokens WETH-RDN,WETH-OMG) 41 | cli.js claimable-tokens [count] Get the claimable tokens for a list of token pair (i.e. claimable-tokens WETH-RDN,WETH-OMG) 42 | cli.js send Send tokens to another account 43 | cli.js deposit Deposit the DX account depositing tokens into it 44 | cli.js buy [auction-index] Buy in a auction for a token pair 45 | cli.js sell [auction-index] Sell in a auction for a token pair 46 | cli.js sell-liquidity Ensure the sell liquidity for a token pair 47 | cli.js buy-liquidity Ensure the buy liquidity for a token pair 48 | ``` 49 | 50 | There's many operations, and more to come, we will show here just some of them. 51 | 52 | ## State 53 | Shows the of a token pair. 54 | 55 | It displays a lot of useful information, like: 56 | * State: `Running` or `Waiting for funding` 57 | * Auction Index 58 | * Start time 59 | * Time when we will reach the theoretical market price (6h aprox) 60 | * Total volumes (buy, sell) 61 | * Bought percentage from the sell volume 62 | 63 | For example, to get the state of the `WETH-RDN` token pair: 64 | 65 | ```bash 66 | ./cli state WETH-RDN 67 | ``` 68 | 69 | ## Deposit 70 | Allows you to deposit tokens in the DutchX, so you have balance to operate on 71 | it. 72 | 73 | To fund the bots, it's important to use this function. 74 | 75 | This operation does two things: 76 | * It invokes the `approve` operation of the ERC20 token to allow the DutchX 77 | contract to use the funds for the specified amount. 78 | * It invokes the `deposit` operation of the DutchX contract, so the contract 79 | adds the tokens into the user's balance. 80 | 81 | There's a special consideration if the token is `WETH` (Wrapped Ether). 82 | * If the token is WETH, it will check if the user has enough balance on the 83 | ERC20 token to invoke the `approve` function, if it doesn't it will wrap ether 84 | automatically (just the amount that is missing). 85 | 86 | 87 | For example, to deposit `0.8 WETH` and `1500 RDN`: 88 | 89 | ```bash 90 | ./cli deposit 0.8 WETH 91 | ./cli deposit 1500 RDN 92 | ``` 93 | 94 | ## Market price 95 | Get the market price for a token pair. 96 | 97 | For example, to show the current market price for `WETH-RDN` pair: 98 | 99 | ```bash 100 | ./cli market-price WETH-RDN 101 | ``` 102 | 103 | ## Sell 104 | Allows to create a ask operation in an auction. 105 | 106 | For example, to be a seller in `WETH-RDN` with `1.2 ETH` we can execute: 107 | 108 | ```bash 109 | ./cli sell 1.2 WETH-RDN 110 | ``` 111 | 112 | ## Buy 113 | Allows to create a bid operation in an auction. 114 | 115 | For example, to be a bider in `WETH-RDN` with `500 RDN` we can execute: 116 | 117 | ```bash 118 | ./cli buy 12 WETH-RDN 119 | ``` 120 | -------------------------------------------------------------------------------- /docs/bots.md: -------------------------------------------------------------------------------- 1 | # DutchX Bots 2 | When we start the application, it will start also 3 bots. 3 | 4 | Every bot is created with one goal, so once they are up, the will try to do 5 | their jobs. 6 | 7 | # Sell Liquidity Bot 8 | This bot will make sure we meet the minimum liquidity required 9 | by the smart contract for the auction to start. 10 | 11 | In other words, it makes sure the auction starts automatically filling the 12 | missing sell volume. 13 | 14 | The smart contract won't start the auction, unless we have more than 15 | `$1.000` worth of the sell token, so this bot fill the missing difference. 16 | 17 | ## When will this bot ensure the sell liquidity? 18 | It will ensure it as soon as both of the opposite auctions clear for a token pair. 19 | 20 | ## Which of the two auctions it will fund? 21 | It will fund the one with the highest funding, so it has to fill with less worth 22 | of tokens. 23 | 24 | # Buy Liquidity Bot 25 | This bot will make sure the auction closes when we reach the market price. 26 | 27 | If nobody bids when the auction is on the market price, the price will continue 28 | to go down, and eventually, after 24h, could get to 0. 29 | 30 | To avoid this situation, the buy bot will buy automatically when the token price 31 | is at a right price. 32 | 33 | ## How does the bot know what is the market price? 34 | Right now the buy bot can check in any of these exchanges: 35 | 36 | * **Binance**: https://www.binance.com 37 | * **Bitfinex**: https://www.bitfinex.com/ 38 | * **HitBTC**: https://hitbtc.com/ 39 | * **Huobi**: https://www.huobi.com 40 | * **Kraken**: http://kraken.com 41 | * **Liquid**: https://www.liquid.com/ 42 | 43 | Depending on the token pair, we can configure an strategy for getting the 44 | market price. 45 | 46 | If you consider that none of these exchanges fits to your needs you can make a 47 | pull request and add a new one. Check here 48 | [how to add a price feed](https://dutchx.readthedocs.io/en/latest/bots-price-feed.html) 49 | 50 | 51 | ## Strategies for getting the price - Sequence 52 | The current strategy implemented by the buy bot is called `sequence`, but more 53 | strategies could be implemented for future versions. 54 | 55 | For example, we could configure the bots with the following strategies: 56 | ```js 57 | const EXCHANGE_PRICE_FEED_STRATEGIES_DEFAULT = { 58 | strategy: 'sequence', 59 | feeds: ['binance', 'huobi', 'kraken', 'bitfinex'] 60 | } 61 | 62 | const EXCHANGE_PRICE_FEED_STRATEGIES = { 63 | 'WETH-OMG': { 64 | strategy: 'sequence', 65 | feeds: ['binance', 'huobi', 'bitfinex'] 66 | }, 67 | 'WETH-RDN': { 68 | strategy: 'sequence', 69 | feeds: ['huobi', 'binance', 'bitfinex'] 70 | } 71 | } 72 | ``` 73 | 74 | For the `sequence` strategy we can define a sorted list of the exchanges we want 75 | to use for getting the price. 76 | 77 | The buy bot will try to get the price from the first exchange, if it's down or 78 | unresponsive, it will try to get the price from the second one, and so on. 79 | 80 | The idea is to pick the order using first the most trusted exchanges, for 81 | example we could use the trade volume to help us decide. 82 | 83 | ## Buy liquidity rules 84 | Another important part of the buy liquidity bot, is the buy rules. 85 | 86 | These rules allow the bot to decide how much they should buy, and in what 87 | precise moment. 88 | 89 | For example, we could define these rules: 90 | * Ensure that **1/3 of the sell volume** is bought when the **price equals the 91 | market price**. 92 | * Ensure that **2/3 of the sell volume** is bought when the **price is 2% below 93 | the market price**. 94 | * Ensure that **the whole sell volume** is bought when the **price is 4% below 95 | the market price**. 96 | 97 | This rules can be specified using this configuration: 98 | 99 | ```js 100 | const BUY_LIQUIDITY_RULES = [ 101 | // Buy 1/3 if price equals market price 102 | { 103 | marketPriceRatio: { 104 | numerator: 1, 105 | denominator: 1 106 | }, 107 | buyRatio: { 108 | numerator: 1, 109 | denominator: 3 110 | } 111 | }, 112 | 113 | // Buy 2/3 if price falls below 98% 114 | { 115 | marketPriceRatio: { 116 | numerator: 98, 117 | denominator: 100 118 | }, 119 | buyRatio: { 120 | numerator: 2, 121 | denominator: 3 122 | } 123 | }, 124 | 125 | // Buy the 100% if price falls below 96% 126 | { 127 | marketPriceRatio: { 128 | numerator: 96, 129 | denominator: 100 130 | }, 131 | buyRatio: { 132 | numerator: 1, 133 | denominator: 1 134 | } 135 | } 136 | ] 137 | ``` 138 | 139 | # CheckBalanceBot 140 | The liquidity bots are very useful, but in order to operate, they need to have 141 | enough tokens to perform the bids and asks, and also some Ether so they can 142 | pay the gas costs for the transactions. 143 | 144 | This bot will check periodically the balances for the bots and will show a 145 | warning message when we are below the defined threshold. 146 | 147 | > In the future, we will provide a way to send the notification using Slack or 148 | > mail. 149 | 150 | # Balance thresholds 151 | For example, the rules could be, notify if we are below: 152 | * `$5000` worth of any tokens 153 | * `0.4 Ether` 154 | 155 | So we would have this configuration: 156 | ```js 157 | const MINIMUM_AMOUNT_IN_USD_FOR_TOKENS = 5000 // $5000 158 | const MINIMUM_AMOUNT_FOR_ETHER = 0.4 * 1e18 // 0.4 Ether 159 | ```` 160 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # Run Bots - DutchX 6 | This is just a simple project that shows how to run the DutchX bots to ensure 7 | liquidity for any ERC20 token pair list. 8 | 9 | To make it easier, we provide a `Docker` image with all the **bots** and a 10 | **CLI**. 11 | 12 | Follow through this document to run your own bots and learn how to operate on 13 | the DutchX. 14 | 15 | If you follow through, you'll get: 16 | 17 | * The liquidity bots, up and running 18 | * You'll known how to fund them so they can operate 19 | * You'll learn how to use the CLI (command line interface) 20 | * To check the state of the auctions 21 | * To interact with the DX: Claim, buy, sell, etc. 22 | 23 | # Documentation 24 | Checkout the [DutchX Documentation](http://dutchx.readthedocs.io/en/latest). 25 | You can also check how to request a new price feed if you need it 26 | [Adding a price feed](https://dutchx.readthedocs.io/en/latest/bots-price-feed.html) 27 | 28 | # Run the bots 29 | An easy way to run the bots is to fork this project, or create a blank one with: 30 | 1. The config for the bots 31 | 2. The script to run the bots 32 | 33 | ## 1. Create the config file for the bots 34 | Create a config file for the bots, like the one in 35 | [conf/bots.js](./conf/bots.js), where: 36 | 37 | * `MARKETS`: List of the ERC20 token pairs you want the bots to watch. 38 | * Format: `-[,-]*` 39 | * Example: `WETH-RDN,WETH-OMG` 40 | * It's important that for every distinct token provided, you also provide the 41 | address, the can be passed either in the config file or as ENV_VAR: 42 | * **WETH_TOKEN_ADDRESS**: `0xc58b96a0278bd2c77bc93e01b148282fb8e753a5` 43 | * **RDN_TOKEN_ADDRESS**: `0x3615757011112560521536258c1e7325ae3b48ae` 44 | * **OMG_TOKEN_ADDRESS**: `0x00df91984582e6e96288307e9c2f20b38c8fece9` 45 | * `MAIN_BOT_ACCOUNT`: 46 | * Select the main bot account (account index of the ones generated from the `MNEMONIC`) 47 | * The main bot account that will be used to generate reports 48 | * `BUY_LIQUIDITY_BOTS`: 49 | * **name**: The name to display in notifications and messages 50 | * **markets**: An object selecting the markets to watch (explained above) 51 | * **accountIndex**: The accountIndex from the accounts generated from the `MNEMONIC` that is going to be used by this bot 52 | * **rules**: The rules to indicate the bot when to do buys 53 | * **notifications**: The notification system to be used by the bot. For now only `slack` is available 54 | * `SELL_LIQUIDITY_BOTS`: Same parameters as `BUY_LIQUIDITY_BOTS` except the don't need **rules** 55 | 56 | WARNING: If you create a new file for your configuration make sure you update [base-command](./base-command#L24) in order to use your own configuration. 57 | 58 | 59 | ## 2. Create the run script 60 | You can create a copy of [base-command](./base-command) script. 61 | 62 | Fill the environment variables in `base-command` with your own configuration: 63 | 64 | * `MNEMONIC`: 65 | * Use your secret BIP39 mnemonic. 66 | * The bot address will be the first 67 | account generated by that mnemonic. 68 | * `ETHEREUM_RPC_URL`: 69 | * Url for a Ethereum node 70 | * You can use your own node or setup infura for example: 71 | `https://rinkeby.infura.io` 72 | * `MARKETS`: List of the ERC20 token pairs you want the bots to watch. 73 | * Format: `-[,-]*` 74 | * Example: `WETH-RDN,WETH-OMG` 75 | * It's important that for every distinct token provided, you also provide the 76 | addresses, in the case of the previous example: 77 | * **WETH_TOKEN_ADDRESS**: `0xc58b96a0278bd2c77bc93e01b148282fb8e753a5` 78 | * **RDN_TOKEN_ADDRESS**: `0x3615757011112560521536258c1e7325ae3b48ae` 79 | * **OMG_TOKEN_ADDRESS**: `0x00df91984582e6e96288307e9c2f20b38c8fece9` 80 | * `NODE_ENV`: 81 | * Optional, `local` is the default 82 | * Can be one of the following: `local`, `dev`, `pre` or `pro` 83 | 84 | WARNING: If you create a new `base-command` file make sure you change the name in [bots](./bots#L3) 85 | 86 | Once you have it ready you can run `./bots`. 87 | 88 | When you run it for the first time, you should see something similar to: 89 | 90 | ![alt text](./docs/img/run-docker.png "Run the bots with docker") 91 | 92 | Don't worry for now about the **WARN** message shown at the bottom, we'll deal 93 | with it in the **Fund the bots** section. 94 | 95 | This script will: 96 | 97 | * Start **3** bots that will ensure the liquidity: `SellLiquidityBot`, 98 | `BuyLiquidityBot` and `BalanceBot` (more info about these bots in 99 | [DutchX Bots](./docs/bots.md) 100 | ) 101 | * Runs a simple API server that exposes basic information: 102 | [http://localhost:8081]() 103 | 104 | # Fund the bots 105 | The bots automatically participate in the auctions performing bids and asks when 106 | the time is right. 107 | 108 | In order to do this bids and asks, they need to have a balance in the `DutchX` 109 | smart contract. 110 | 111 | For founding the bots, we need to know their Ethereum address, this is 112 | determined by the secret mnemonic you've used to run the bots. 113 | 114 | An easy way to know the address is just to visit the about endpoint: 115 | 116 | * [http://localhost:8081]() 117 | 118 | You should see among other information, the accounts used by the bots: 119 | 120 | ![alt text](./docs/img/bot-account.png "Get the account of the bots") 121 | 122 | Once you have the **bot account**, your **secret mnemonic** and the 123 | **bots running**, you are all set for the funding. 124 | 125 | > The easiest way is to use the **DutchX CLI**. 126 | > 127 | > Check out the **Deposit** section in [https://github.com/gnosis/dx-cli](https://github.com/gnosis/dx-cli) 128 | 129 | # DutchX CLI (Command Line Interface) 130 | In the docker image, it's also available a CLI, with some basic operations for 131 | using the DutchX. 132 | 133 | You can use it for getting the state of a token pair, or to trade in an auction 134 | among other things. 135 | 136 | > Checkout the CLI documentation to learn how to use it. 137 | > * [https://github.com/gnosis/dx-cli](https://github.com/gnosis/dx-cli) 138 | 139 | This sample project also provides a simple [CLI script](./cli) you can use. 140 | 141 | ## State of a DutchX Auction 142 | There's a basic command in the CLI that is very helpful to get the state of the 143 | auctions. 144 | 145 | **Example: Get the state of the WETH-RDN aution** 146 | ```bash 147 | ./cli state WETH-RDN 148 | ``` 149 | 150 | We would get something similar to: 151 | 152 | ![alt text](./docs/img/state-of-auction.png "State of an auction") 153 | 154 | 155 | > For other methods, or to learn how to use the CLI go to: 156 | > * [DutchX Cli page](./docs/cli.md) 157 | 158 | # DutchX Bots 159 | There are 3 bots: 160 | 161 | * `SellLiquidityBot` 162 | * `BuyLiquidityBot` 163 | * `CheckBakanceBot` 164 | 165 | Find out more about them in: 166 | * [DutchX Bots page](./docs/bots.md) 167 | 168 | # Debug 169 | To increase the debug level, you can change the bot script to run with 170 | `run bots-dev` instead of `run bots`. 171 | 172 | > Don't forget to change it back for the production script. 173 | --------------------------------------------------------------------------------