Name: dx-services
Owner: GNOSIS
Description: Services, repositories and bots to interact with DX
Created: 2018-02-05 10:28:22.0
Updated: 2018-05-24 16:14:06.0
Pushed: 2018-05-24 16:23:18.0
Homepage: null
Size: 7199
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Dutch X Services, is a project that contains services and other goodies to make easier the interaction with the Duch Exchange smart contracts.
It contains five main elements:
Model: Set of convenient wrappers and utilities to provide a simpler way to interact with the Dutch X.
repositories
: Provide the data access to external data sources like
the Dutch X smart contracts, price feeds, gas price feeds, etc.
They provide also a more intuitive error handling, that gives detailed
information about the reasons a smart contract revert a operation.services
: Provides some common bussiness logic operations to make
Dutch X interactation easier.REST Api:
Exposes the Dutch X data in a REST API.
Also documents it using swagger. Check the API Documentation
For an example on how to use the API, check dx-examples-api
Cli (Command Line Interface):
Allows to interact with the Dutch X from the command line.
Allows to perform operations to retrieve the Dutch X state from any Ethereum network
Also, allow to fund accounts, deposit tokens into the Dutch X, participate in an auction as a seller or a buyer and mutch more.
For an example on how to use the CLI, check dx-examples-liquidity-bots
Liquidity Bots
Allows to launch bots watching certain token pairs with the goal or ensuring the market liquidity.
The bots will automatically participate in the auctions usign the provided configuration.
For documentation about the bots, and example on how to run your own bots, check dx-examples-liquidity-bots
Scheduled tasks:
Allow to execute certain tasks at certain times.
Used for Reporting: Allows to send reports periodically with the informarmition of the lasts auctions and the actions the bots has been taking.
Used for Autoclaiming: Allows the bots to claim their funds of past auctions so they can reuse them in the upcoming ones.
For aditional information and for reference, check out the following repositories:
Use the CLI:
er run \
NODE_ENV=pre \
ETHEREUM_RPC_URL=https://rinkeby.infura.io \
MARKETS=WETH-RDN,WETH-OMG \
RDN_TOKEN_ADDRESS=0x7e2331beaec0ded82866f4a1388628322c8d5af0 \
OMG_TOKEN_ADDRESS=0xc57b5b272ccfd0f9e4aa8c321ec22180cbb56054 \
osispm/dx-services:staging \
rn cli -- \
state WETH-RDN
In the previous command, notice that:
NODE_ENV
: Stablish the environment. Valid values are dev
, pre
, pro
.ETHEREUM_RPC_URL
: Ethereum node. i.e. http://localhost:8545 or https://rinkeby.infura.ioMARKETS
: List of token pairs in the format: <token1>-<token2>[,<tokenN>-<tokenM>]*
,
i.e. WETH-RDN,WETH-OMG
<token>__TOKEN_ADDRESS
. i.e. RDN_TOKEN_ADDRESS
.gnosispm/dx-services:staging
: Is the name of the Docker image. staging
is
the image generated out of the master branch. You can checkout other images
in https://hub.docker.com/r/gnosispm/dx-servicesyarn cli
: Is the npm script that will run the CLIstate WETH-RDN
:-h
to get the complete list.Start API:
er run \
NODE_ENV=pre \
ETHEREUM_RPC_URL=https://rinkeby.infura.io \
MARKETS=WETH-RDN,WETH-OMG \
RDN_TOKEN_ADDRESS=0x7e2331beaec0ded82866f4a1388628322c8d5af0 \
OMG_TOKEN_ADDRESS=0xc57b5b272ccfd0f9e4aa8c321ec22180cbb56054 \
8080:8080 \
osispm/dx-services:staging \
rn api
To check out the Public API, just open http://localhost:8080 in any Browser.
In the previous command, notice that it has a similar configuration as in the CLI run, with the difference of:
-p 8080:8080
: It tells Docker to expose the container port 8080 (the API one)
in the host machine.yarn api
: NPM script used to run the Public API.For more information about the Public API, checkout:
Start bots:
er run \
MNEMONIC="super secret thing that nobody should know ..." \
NODE_ENV=pre \
ETHEREUM_RPC_URL=https://rinkeby.infura.io \
MARKETS=WETH-RDN,WETH-OMG \
RDN_TOKEN_ADDRESS=0x7e2331beaec0ded82866f4a1388628322c8d5af0 \
OMG_TOKEN_ADDRESS=0xc57b5b272ccfd0f9e4aa8c321ec22180cbb56054 \
8081:8081 \
osispm/dx-services:staging \
rn bots
To check out the Bots API, just open http://localhost:8081 in any Browser.
In the previous command, notice that it has a similar configuration as in the Public API run, with the difference of:
MNEMONIC
: Allows to setup the bots account used to sign the transactions.-p 8081:8081
: The Bots API it's exposed on port 8081.yarn bots
: NPM Script used to run the Liquidity Bots.For more information about the Bots, check out the dx-examples-liquidity-bots project.
install
run rpc
run setup
Start API:
run api
Start Bots:
run bots
Use the bot-cli:
run cli
Some examples:
npm run cli -- state WETH-RDN
npm run cli -- send 0.5 WETH 0x627306090abaB3A6e1400e9345bC60c78a8BEf57
npm run cli -- deposit 0.5 WETH
npm run cli -- deposit 150 RDN
npm run cli -- sell 100 WETH-RDN
npm run cli -- buy 100 RDN-WETH
The cli2
, is deprectated, but it still has some methods that were not migrated
to the new cli (they are methods used testing during development).
Use the bot-cli2:
run cli2
Some examples:
npm run cli2 -- --balances
npm run cli2 -- --approve-token RDN
npm run cli2 -- --deposit WETH,100
npm run cli2 -- --time 0.5
This project is released under MIT License
All the code is provided WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Please, let us know any typo or error in the project or documentation.
Any idea, proposal or colaboration will be welcome.
Also, you are encouraged to participate in the Gitter Channel for the Dutch X.