-
pnpmv7.18.2(npmandyarnare not supported.) https://pnpm.io/installation -
docker&docker-compose
- Create a fork of this repo.
- Clone your fork installing submodules
git clone --recurse-submodules [your-github-fork-url.git]. If you clone this repo without--recurse-submodulesbe sure to go topackages/dxdao-contractsand clone necesary branch/commit pointed in./.gitmodulesfile. Or dogit submodule sync packages/dxdao-contractssync. - Install dependencies
pnpm i - Make an
.envfile in the./packages/dev-scriptsfolder (see.env.example) and write a seed phrase and deploy salt for hardhat. - Make an
.envfile in the./apps/davifolder (see.env.example).
To run project locally you need to compile contracts, run hardhat node from dev-scripts, run docker graph-node container, create/deploy local subgraphs and run davi-frontend. Currentlypnpm dev from root project won't work. To do so, you need to run 4 different processes:
- Run hardhat node locally:
pnpm run dev-scripts:dev - Start docker containers:
pnpm run graph-node:dev(Will require hardhat to be running and docker to be installed and open) - Point
deployedHashedBytecodesJSONto local in./apps/guilds-subgraph/src/mappings/Create2Deployer/mapping.ts#L13(const deployedHashedBytecodesJSON = local) - Create and deploy local subgraphs (1.5 & guilds):
pnpm run subgraph:dev(graph-node container should be running. Verify before execute start-local). - After both subgraphs are deployed locally, build DAVI graph-client & run dApp with:
pnpm run davi:dev. If you don't want to wait for hardhat node and subgraphs dodavi:dev-no-wait
First, do the steps above.
- Run a hardhat instance
cd apps/dev-scripts
pnpm dev
- In another terminal, run the Linux subgraph setup
cd apps/dxdao-subgraph
sudo ./setup-linux.sh
- When it finishes, terminate the hardhat instance
You might not have the relavant build tools for node-gyp to run. Check this if you're on Mac OS.
There's a process already running on port 5432 (usually postgres).
Run
sudo lsof -i :5432
to get the PID of the process, and
sudo kill -9 [PID]
to terminate it.
dxdao-subgraph:dev: ✖ Failed to deploy to Graph node http://127.0.0.1:8020/: subgraph validation error: [the specified block must exist on the Ethereum network]
dxdao-subgraph:dev: error Command failed with exit code 1.
dxdao-subgraph:dev: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
dxdao-subgraph:dev: ELIFECYCLE Command failed with exit code 1.
dxdao-subgraph:dev: ELIFECYCLE Command failed with exit code 1.
Then there was a problem during the Linux setup. Common sources of this are
- The subgraph was already running during the setup: make sure there are no instances of the subraph running. Run
docker compose down - The hardhat instance wasn't running while doing the setup: make sure the hardhat instance is running, and only then run the linux setup.
If you see permission denied: ./packages/graph-node/scripts/dev.sh you might need to set permissions for dev script.
chmod +x ./packages/graph-node/scripts/dev.sh
- Navigate to
apps/davi - Run
pnpm i - Make an
.envfile in thedavifolder (see.env.qa.example) - file contains all parameters forlocalhostandmetamasksetups
To run Smoke test in terminal run:
pnpm test:[testName]
All available [testName] can be found in:
apps > davi > cypress > config
Currently there are:
smokeLocal- starts localhost:3000 and runs Smoke test on localsmokeQa- runs Smoke test on QA ENVsmokeProd- runs Smoke test on PROD ENVregressionLocal- starts localhost:3000 and runs Regression test on local