4.1 KiB
4.1 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:
- name "Mock"
- RPC URL http://localhost:8545
- chain ID 31337
- token name ETH. Metamask complains about the token name but ignore the warning.
- Create a mock account in your wallet
- use "import wallet" in metamask
- private key is 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6
- public address 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720
- this is the well-known Dev Account #9 and you can see the private key and address in hardhat startup.
- starts with 10,000 ETH on any anvil chain
- under your Dev Account, import a few important tokens:
- WETH
- 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
- 18 decimals
- USDT
- 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9
- 6 decimals
- USDC
- 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
- 6 decimals
- WETH
- Configure the wallet for a new chain:
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