How-to guide
Deploy the Trading contracts
Trading ships as one factory and one router at deterministic addresses derived from the core deployment. This guide deploys them from the browser or from a script.
Use an installed public-network core
The root mainnet and Sepolia manifests describe planned deterministic addresses; they do not prove that the contracts are live. Continue only after the selected network has reviewed core code at those addresses. The deployment status reference explains that distinction.
From ui/trading, start the standalone UI:
docker network inspect zoltar >/dev/null 2>&1 \
|| docker network create zoltar
docker compose up --build --force-recreate
- Open
http://localhost:4163/#/deploy. The UI selects the canonical deployment and its default public RPC, then checks the RPC chain, canonical proxy, and core factory. To use another supported network or RPC URL, open Settings beside the wallet before connecting. - Connect a wallet and review the status shown for the Trading factory and Trading router.
- Submit the factory transaction, then the router transaction. Progress reaches
2 / 2once both deterministic contracts and their immutable links have been verified. If you return with the same settings, the flow resumes at the first missing contract.
Browser-led deployment uses a fixed 0.30% trading fee. Deploying a trading pool for a market is not part of this setup: browse SecurityPools afterwards and deploy a pool only for a selected SecurityPool that does not have one. Its deployment prompt states the immutable fee as a percentage before submission.
For local source development instead of Docker, run bun run app:serve:trading from the repository root and open the same #/deploy route.
Use local Anvil
Complete the repository root setup, then start Anvil as chain ID 1 so it uses the mainnet deterministic-address profile:
bun run anvil -- --chain-id 1 \
--block-base-fee-per-gas 0 --gas-price 0 --no-priority-fee
- In another terminal, run
bun run app:serve:statoblast, openhttp://localhost:12347/?rpcUrl=http://127.0.0.1:8545#/deploy, connect an Anvil account, and use the Statoblast deployment screen to install the core contracts and security pool factory. Wait until its deployment plan is complete. - Start the Trading Docker UI from
ui/tradingwith the Compose command above. - Open
http://localhost:4163/#/deployand follow the public-network steps with Ethereum Mainnet andhttp://127.0.0.1:8545. The browser deploys the trading factory and router through the same deterministic proxy.
For script or integration testing, run the local deployment script against the matching root manifest from the repository root:
ZOLTAR_DEPLOYMENT_MANIFEST=docs/mainnet-deployment-addresses.json \
TRADING_RPC_URL=http://127.0.0.1:8545 \
bun run trading:deploy:local
The script verifies code at the configured core SecurityPoolFactory, deploys TwoWayConstantProductFactory(coreFactory, feeBps), deploys TwoWayConstantProductRouter(factory), and records chain ID, inputs, outputs, transaction hashes, compiler settings, and bytecode hashes. The configuration reference lists its environment variables and the manifest it writes. The fee is immutable and no economically optimal value is claimed.