
DutchX Services
DutchX Services, is a project that contains services and other goodies to make
easier the interaction with the Dutch Exchange smart contracts.
Documentation
Checkout the DutchX Documentation.
Develop
Run a local node and setup
Setup a working environment:
yarn install
yarn rpc
yarn setup
You can make sure the auction is running:
yarn cli state RDN-WETH
You should see something like:
INFO-cli
INFO-cli ********** State of RDN-WETH **********
INFO-cli +0ms
INFO-cli Token pair: RDN-WETH
INFO-cli +0ms
INFO-cli Has the token pair been added? Yes +0ms
INFO-cli State: RUNNING
INFO-cli +0ms
INFO-cli Are tokens Approved? +0ms
INFO-cli - RDN: Yes +0ms
INFO-cli - WETH: Yes
INFO-cli +1ms
INFO-cli State info: +0ms
INFO-cli - auctionIndex: 1 +0ms
INFO-cli - auctionStart: 29/08/18 20:03 +1ms
INFO-cli - It started: a few seconds ago +1ms
INFO-cli - It will reach the last auction closing price in: 6 hours +0ms
INFO-cli +0ms
INFO-cli Auction RDN-WETH: +0ms
INFO-cli Is closed: Yes (closed from start) +0ms
INFO-cli Sell volume: 0 +0ms
INFO-cli +0ms
INFO-cli Auction WETH-RDN: +0ms
INFO-cli Is closed: No +1ms
INFO-cli Sell volume: +0ms
INFO-cli sellVolume: 13.057385 WETH +0ms
INFO-cli sellVolume: 14363.1235 USD +0ms
INFO-cli Price: +0ms
INFO-cli Current Price: 489.0246361597564471047 RDN/WETH +0ms
INFO-cli Closing Price: 245.15812699190978180926 RDN/WETH +0ms
INFO-cli Price relation: 199.47% +0ms
INFO-cli Buy volume: +0ms
INFO-cli buyVolume: 0 RDN +1ms
INFO-cli Bought percentage: 0.0000 % +0ms
INFO-cli Outstanding volume: 6385.382948822861 RDN +0ms
INFO-cli
INFO-cli **************************************
One interesting thing you can do is advance time:
yarn cli2 --time 5.5
If you check the state of the auction now, you'll see how the price droped.
Also you'll see that we are 30min away from the last closing price.
There's a lot of operations you can do with the CLI
, for some examples you
can check
dx-examples-cli project
. For a complete list, just type:
yarn cli --help
yarn cli buy --help
So for example, we can check our balance of the tokens, and our balance within
the DutchX:
yarn cli balances
yarn cli balances --account 0xf17f52151ebef6c7334fad080c5704d77216b732
Another example, we can post a buy order:
yarn cli buy 2500 WETH-RDN
The state now should show:
- That we bought most of the sell volume
- Now the outstanding volume is smaller. Note that in this case, the outstanding
volume is how much RDN do we need to clear the auction at the current
price.
INFO-cli
INFO-cli ********** State of RDN-WETH **********
INFO-cli +0ms
INFO-cli Token pair: RDN-WETH
INFO-cli +1ms
INFO-cli Has the token pair been added? Yes +0ms
INFO-cli State: RUNNING
INFO-cli +0ms
INFO-cli Are tokens Approved? +0ms
INFO-cli - RDN: Yes +0ms
INFO-cli - WETH: Yes
INFO-cli +0ms
INFO-cli State info: +0ms
INFO-cli - auctionIndex: 1 +0ms
INFO-cli - auctionStart: 29/08/18 20:03 +1ms
INFO-cli - It started: 6 hours ago +1ms
INFO-cli - It will reach the last auction closing price in: 16 minutes +1ms
INFO-cli +0ms
INFO-cli Auction RDN-WETH: +0ms
INFO-cli Is closed: Yes (closed from start) +0ms
INFO-cli Sell volume: 0 +0ms
INFO-cli +0ms
INFO-cli Auction WETH-RDN: +0ms
INFO-cli Is closed: No +0ms
INFO-cli Sell volume: +0ms
INFO-cli sellVolume: 13.057385 WETH +0ms
INFO-cli sellVolume: 14363.1235 USD +0ms
INFO-cli Price: +1ms
INFO-cli Current Price: 252.42997784500481456805 RDN/WETH +0ms
INFO-cli Closing Price: 245.15812699190978180926 RDN/WETH +0ms
INFO-cli Price relation: 102.96% +0ms
INFO-cli Buy volume: +0ms
INFO-cli buyVolume: 2487.5 RDN +0ms
INFO-cli Bought percentage: 75.4600 % +0ms
INFO-cli Outstanding volume: 808.5754062636981 RDN +0ms
INFO-cli
INFO-cli **************************************
Enjoy the CLI! These are some other examples to start with:
yarn cli balances --account 0xf17f52151ebef6c7334fad080c5704d77216b732
yarn cli state WETH-RDN
yarn cli send 0.5 WETH 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
yarn cli deposit 0.5 WETH
yarn cli deposit 150 RDN
yarn cli sell 100 WETH-RDN
yarn cli buy 100 RDN-WETH
Public API
Start API:
yarn api
Liquidity Bots
Start Bots:
yarn bots
Testnets or Mainnet
There's scripts for running the cli
, bots
and api
for testnets and rinkeby.
You just add the network like this
yarn cli-rinkeby --help
yarn bots-rinkeby
yarn api-rinkeby
Run it with docker
One easy way to run the bots
, the api
, the cli
or any other script or
utility of this proyect is using the docker image we provide:
- You can read how to run it from
dx-services
: docs/docker.md
- A better approach would be to use the Docker Image published on Docker Hub
Scope and main parts of dx-services
It contains five main elements:
License
This project is released under MIT License
Security and Liability
All the code is provided WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Contributors