Skip to content

Deployment Guide

Benjamin Smith edited this page Dec 23, 2019 · 9 revisions

Mainnet deployment

Setup your personalized local environment:

 export NETWORK_NAME=mainnet
 export GAS_PRICE_GWEI=13
 export PK=$YOUR_PRIVATE_KEY

Note the space before the private key export ensures that this will not be recorded in your bash history.

# clear build directory
rm -r build
npx truffle compile
npm run networks-inject
npx truffle migrate --reset --network $NETWORK_NAME --onlyMigrateStableX=true 
npm run networks-extract
npx truffle run verify BatchExchange --network $NETWORK_NAME

If last command (verifier) doesn't work, do it manually using the flattener:

npx truffle-flattener contracts/BatchExchange.sol > flattend.txt

Commit new network.json file

npm version patch -m “New deployment”
npm publish

Adding tokens to exchange

 npx truffle exec scripts/stablex/add_token_list.js --network $NETWORK_NAME

Depositing Tokens and Placing Orders:

# Deposit OWL:
npx truffle exec scripts/stablex/deposit.js --accountId=0 --tokenId=0 --amount=30 --network $NETWORK_NAME

Obtaining Listed Token IDs

npx truffle exec scripts/stablex/invokeViewFunction.js ‘tokenAddressToIdMap’ <Token Address> --network $NETWORK_NAME
export TOKEN_ID=<Result of Previous Command>

Depositing

npx truffle exec scripts/stablex/deposit.js --accountId=0 --tokenId=$TOKEN_ID --amount=98 --network $NETWORK_NAME

Token Addresses

DAI  - 0x6b175474e89094c44da98b954eedeac495271d0f
TUSD - 0x0000000000085d4780B73119b644AE5ecd22b376
USDC - 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48



Placing Orders

OWL for DAI order:

npx truffle exec scripts/stablex/place_order.js --accountId=0 --buyToken=$TOKEN_ID_DAI --sellToken=0 --minBuy=1000 --maxSell=1000 --validFor=2000 --network $NETWORK_NAME

Market maker order TUSD vs DAI:

npx truffle exec scripts/stablex/place_order.js --accountId=0 --buyToken=$TOKEN_ID_DAI --sellToken=$TOKEN_ID_TUSD --minBuy=1000 --maxSell=998 --validFor=200 --network $NETWORK_NAME

Market maker order DAI vs TUSD

npx truffle exec scripts/stablex/place_order.js --accountId=0 --buyToken=$TOKEN_ID_TUSD --sellToken=$TOKEN_ID_DAI --minBuy=1000 --maxSell=998 --validFor=200 --network $NETWORK_NAME
Clone this wiki locally