3.3 KiB
3.3 KiB
Dexorder Dev Environment Installation
- Initialize the submodules with
git submodule initthen pull withgit submodule update - PostgresSQL
- install PostgreSQL
sudo -u postgres psql(Ubuntu)create database dexordercreate user dexorder password 'redroxed'grant all on database dexorder to dexorder
- Install Docker
- Ubuntu:
Docker-engine install. Or install Docker Desktop with snap:
snap install dockerFix sudo required:sudo groupadd dockersudo usermod -aG docker $USER alternatively we can use containerd and update the backend/bin/df.sh script.
- Ubuntu:
Docker-engine install. Or install Docker Desktop with snap:
- Install NodeJS
- Suggested to use Node Version Manager
nvm.(Install instructions.) npm install --global yarnwe use yarn as the package manager.cd web && yarn install; cd ..cd server && yarn install; cd ..
- Suggested to use Node Version Manager
- Install Python 3.11+
- suggested to create a virtualenv under
backend/venvcd backend; python3 -m venv venv; cd ..source backend/venv/bin/activate cd backend && pip install -r requirements.txt; cd ..
- suggested to create a virtualenv under
- Get an ethereum RPC account; both a websocket and http polling url are necessary. alchemy.com has these at the free tier.
cp contract/foundry-default.toml contract/foundry.toml- set the
arbitrum_mockandarbitrum_testaliases at the bottom of thatfoundry.tomlfile:
[profile.default.rpc_endpoints] arbitrum_mock='https://arb-mainnet.g.alchemy.com/v2/Nb705...' arbitrum_test='https://arb-mainnet.g.alchemy.com/v2/Nb705...' cp backend/dexorder-mock.toml backend/dexorder.tomlcp backend/.secret-mock.toml backend/.secret.tomlcp server/.env-mock server/.envcp web/.env-mock web/.env- Install a web wallet like MetaMask. Configure the wallet for a new chain named "Mock" running on http://localhost:8545 with chain ID 1338 and token name ETH. Metamask complains about the token name but ignore the warning.
Mock Environment Execution
- run web (port 3000)
cd web && npm run dev
./bin/mock.sh(from top level dexorder directory)- builds contracts
- starts anvil, forking arbitrum_ankr (we should change this to something like arbitrum_anvil so we can each set it to whatever we want )
- runs
forge script Deploy.soland broadcasts init contracts onto the private anvil fork - resets database, all data gone
- starts dragonfly (redis clone) using Docker
- log files for background processes go into
./tmp/*.txt - the script traps ctrl-c to cleanly shut down anvil & dragonfly
- wait until the mock script says "ONCHAIN EXECUTION COMPLETE & SUCCESSFUL"
- run backend
cd backendPYTHONPATH=src python -u src/dexorder/bin/main.py
- run server (port 3001)
cd serverDEXORDER_PORT=3001 node main.js
- browse to http://localhost:3000
NOTE: you can leave the web process (Vue) running while resetting everything else from #2 onwards. Just refresh the web browser after a new mock deployment