DutchX - Gnosis Dutch Auction Trading Platform. This npm package provides all smartcontracts used in the project
npm install @gnosis.pm/dx-contracts

The DutchX is a fully decentralized trading protocol ("the Protocol"), which allows anyone to add any token pair. The only requirement is for tokens to be ERC20 compliant.
It uses the Dutch auction principle to prevent the problems prevalent at other exchanges (e.g. front running) to facilitate the development of a fairer Web3 ecosystem for everyone.
Please note that depending on how you use this Program, you may be required to satisfy additional local law requirements, which may include but are not limited to instating KYC/AML procedures and gaining legal authorisations from applicable regulators.
rinkeby and mainnet inbash
Install dependencies
yarn installCompile and restore the network addresses
yarn restoreShow current network addresses
yarn networks
`Execute migrations into a local ganache-cli
`bash
Make sure ganache cli is installed globally
npm install -g ganache-cliRun ganache
yarn rpcExecute the migrations
yarn migrate
`Set the Ether price and Feed expire date for development
Some migrations allow you to specify some parameter so you can change some values
at deploy time:
* ETH_USD_PRICE: Allows to set the price of the ETH-USD oracle feed. Just for
local ganache-cli. It's 500 USD/ETH by default.
* FEED_EXPIRE_PERIOD_DAYS: Allows to set the expiration date for the feed.
It's 365 days by defaultSet a different threshold for adding a new token and starting a new auction
The migration that setup the DutchX contract is parametrized, so you can
change the default value of the thresholds:
* THRESHOLD_NEW_TOKEN_PAIR_USD: Minimum USD worth of a token that the contract
requires in order to add a new token pair in the DutchX. It's 10.000 USD by
default.
* THRESHOLD_AUCTION_START_USD: Liquidity in USD required for the auction to
start. It's 1.000 USD by default.Run all tests
`bash
yarn test -s
`
The flag -s runs the tests in a silence mode. Additionally the flag -g can be added to plot the gas costs per test.
Generate a new version
`bash
In a release branch (i.e. release/vX.Y.X)
Migrate the version to the testnets, at least rinkeby, and possibly mainnet
You can optionally change the gas price using the GAS_PRICE_GWEI env variable
yarn restore
MNEMONIC=$MNEMONIC_DX yarn migrate --network rinkebyExtract the network file
yarn networks-extractVerify the contract in Etherscan
Folow the steps in "Verify contract"
Commit the network file
git add network.json
git commit -m 'Update the networks file'Generate version using Semantic Version: https://semver.org/
For example, for a minor version
npm version minor
git push && git push --tagsDeploy npm package
npm publish --access=publicMerge tag into develop, to deploy it to production, also merge it into master
git checkout develop
git merge vX.Y.X
`Verify contract on Etherscan
Flatten the smart contract:
`bash
npx truffle-flattener contracts/DutchExchangeProxy.sol > build/DutchExchangeProxy-EtherScan.sol
npx truffle-flattener contracts/DutchExchange.sol > build/DutchExchange-EtherScan.sol
npx truffle-flattener contracts/TokenFRT.sol > build/TokenFRT-EtherScan.sol
npx truffle-flattener contracts/Oracle/PriceOracleInterface.sol > build/PriceOracleInterface-EtherScan.sol
`Go to Etherscan validation page:
* Go to Verify Contract Code (version 2.0)
* Fill the information:
* Use the flattened contract
* Set the exact compiler version used for the compilation i.e.
v0.4.24+commit.e67f0147
* Optimization: Yes
* For the proxy, you'll need the ABI encoded params, you can get them by running
the following script (specify the right network).
* yarn get-abi-encoded-params --network rinkeby`An API gathers publicly available data from the Ethereum blockchain on the usage of this Program.
Please note that where you use the Program to auction off a token and no one participates on the bid side of the auction within a 24 hour period, the token to be sold will be valued at zero. Therefore, we recommend that you also ensure liquidity for the bid-side.