How-to guide
Set up Trading development
Use this guide to get the Trading contracts, SDK, and UI compiled and running on your machine.
Build and run
- From the repository root, confirm dependencies with
test -d node_modules. If they are missing, runbun install --frozen-lockfile && bun run setup;setupinstalls every project from its lockfile, compiles the contracts, and builds the UI apps and UI tests. - Run
bun run trading:compile. It compiles the contracts, builds the shared packages, and runs the Trading vendor build, which generatesui/trading/ts/generated/contractArtifact.ts. Never edit generated files. - Run
bun run trading:test, which runs the SDK, contract-facing, and UI Trading tests, andbun run trading:ui:build. - Start
bun run app:serve:trading, then openhttp://localhost:4163/?simulate=1&genesis=yesfor the browser-local simulator. Configure the Trading UI lists the Trading scenarios. The setup works when the tests pass and the simulator page loads.
To run the standalone UI in Docker instead, complete the repository-root setup first, then from ui/trading:
docker network inspect zoltar >/dev/null 2>&1 \
|| docker network create zoltar
docker compose up --build --force-recreate
Then open http://localhost:4163/#/market. On Windows, ui/trading/start.bat runs the same Compose command. The final image runs as an unprivileged user and exposes a health check at /. The Docker image copies the core deployment addresses from docs/mainnet-deployment-addresses.json and docs/sepolia-deployment-addresses.json.
Test transactions against an external node
To exercise the contracts on a local Anvil node, follow Use local Anvil; for script and integration tests, Deploy for script and integration tests covers bun run trading:deploy:local.
Other commands
bun run trading:checkruns the tests plus the bigint-number-cast guard.bun run trading:coverage:contractstraces Solidity execution and requires at least 99% production-contract line coverage.bun run trading:gas-costsreports bytecode sizes and funded-fixture operation gas.cd ui/trading && bun run docker:buildanddocker:runbuild and run the standalone UI container without Compose.
After a change that alters what the UI shows, run bun run docs:screenshots -- --app trading to recapture the documentation screenshots.