Skip to content
AugurProjectPublic

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Latest commit

 

History

2,616 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zoltar + Augur Statoblast

This repository contains two protocol layers:

  • Zoltar: the forkable oracle base layer
  • Augur Statoblast: the prediction-market application layer built on top of Zoltar

It also contains the OpenOracle price feed integration, the Statoblast Trading exchange, the augurScan explorer, and operator bots. ARCHITECTURE.md maps how these pieces depend on one another and where code belongs.

Documentation

  • Protocol documentation: start with the system overview, then follow the tutorials, how-to guides, explanations, and contract reference. Trading is documented there too.
  • Protocol glossary: the canonical definitions of REP, universe, question ledger, fork, and the other protocol terms.
  • Further reading: bot operator guides, the augurScan explorer, the security regression suite, and the design-research repository.
  • This README covers developer setup, local development, and repository commands.

Repository layout

Directory Contents
solidity/ Contracts, protocol test support, tests, and generated contract artifacts; Trading contracts live under solidity/contracts/trading/
ui/coreShared/ Runtime-neutral UI primitives, wallet and chain integration, shared workflows, and the simulation engine used by all four interfaces
ui/zoltarShared/, ui/statoblastShared/ Reusable product libraries without application bootstrap, routing, or pages
ui/zoltar/, ui/statoblast/, ui/trading/, ui/openoracle/ The Zoltar, Statoblast, Trading, and OpenOracle interfaces; each is its own package with a dev server and production build
shared/ Independently built Core, Zoltar, OpenOracle, Statoblast, and Trading runtime packages used by Solidity tooling and the UI; shared/trading/ts/trading/ holds the reusable AMM math
docs/ The published protocol documentation
design/ Standalone design explainers for one pull request or design decision; outside the published documentation corpus, see ARCHITECTURE.md
tooling/ Typed repository metadata plus CI, contract-safety, documentation, testing, and UI build orchestration; scripts/ retains only the pinned Uniswap deployment artifact
bots/ Chaos, liquidator, and OpenOracle arbitrager bots
augurScan/ The read-only protocol explorer and indexer
testnetwork/ Docker Compose setup for the repository-pinned local Anvil network
reth/ Docker Compose setup for a pruned Sepolia Reth and Lighthouse node

The runnable packages (ui/zoltar, ui/statoblast, ui/trading, and ui/openoracle) are dependency leaves: they own bootstrap, routes, application composition, and tests. Reusable product capabilities live in the matching shared library, and runtime-neutral primitives live in ui/coreShared/ts. Package exports and the UI boundary checker prevent shared libraries from importing runnable applications or applications from importing one another.

OpenOracle owns report browsing, standalone report creation, disputes, settlement, and withdrawals. Statoblast keeps pool price requests, request status, and finalization.

Prerequisites

  • Bun 1.4.4 (the version pinned by packageManager and CI)
  • Node.js 20+ on PATH: bun x tsc and other package binaries honor their #!/usr/bin/env node shebangs, so setup, UI builds, and TypeScript checks fail without it
  • Docker, only for the container workflows (testnetwork/, reth/, bot images, and UI publishing)

Setup

On a fresh checkout, run the complete bootstrap:

bun run setup

Important:

  • bun run setup installs the Bun workspace from the root frozen lockfile once, generates shared contract and vendor inputs once, and builds the UI and test outputs in dependency order.
  • The root install includes the repository-pinned native Anvil binary on supported platforms. Set ANVIL_BIN to another installation only when overriding it intentionally.
  • Standalone commands like bun run tsc and bun run test assume the root dependencies are already installed.

Local Development

After completing Setup, start an app with its serve command from Common Commands; for rebuilds while iterating, use the corresponding watch command in that table. Then choose what the app talks to:

  • No chain: open the app with ?simulate=1. Browser Simulation needs neither a wallet nor a node.
  • Local chain: follow testnetwork/README.md. It starts the repository-pinned Anvil node with Sepolia's chain ID, deploys the contracts with bun run deploy:testnet, and gives the ?network=sepolia&rpcUrl=… URL that points an app at the node.
  • Public network: see RPC Configuration and Sepolia.

The apps have network profiles only for mainnet and Sepolia, so a local node must run with chain ID 11155111. bun run anvil starts the same pinned Anvil binary directly, but without arguments it uses Anvil's default chain ID, which the apps cannot follow; pass it the flags from testnetwork/Dockerfile when you run it outside Docker.

RPC Configuration

The mainnet UI read backend defaults to https://ethereum.dark.florist; Sepolia defaults to its profile RPC at https://ethereum-sepolia-rpc.publicnode.com. You can override the active network's default without changing code:

  • Add ?rpcUrl=https://your-rpc.example to the app URL
  • Open Settings and set the RPC URL for the selected network
  • Set globalThis.__ZOLTAR_RPC_URL__ before bootstrapping the app
  • Set the ZOLTAR_RPC_URL environment variable for environments that inject process.env

Sepolia

Open the app with ?network=sepolia in the page or route query, for example #/deploy?network=sepolia. The app uses chain ID 11155111. For Zoltar, Statoblast, or Trading, choose the truthful Augur V2 fork outcome in the app, or pass genesis=yes or genesis=no in the same query. OpenOracle needs only the network setting.

Testnet deployment

bun run deploy:testnet installs the complete deterministic infrastructure on Sepolia or another compatible testnet and is safe to rerun. The full procedure, including the GitHub Actions workflow, private-key handling, spending limits, and recovery, is in Deploy testnet contracts.

Browser Simulation

The UI also supports a walletless browser-local simulation mode for manual QA. After completing Setup:

  1. Start your app with its serve command from Common Commands.
  2. Open http://localhost:4153/?simulate=1, http://localhost:12347/?simulate=1, http://localhost:4163/?simulate=1, or http://localhost:4143/?simulate=1

While a dev server is running, UI_DEV_SERVER_URL=http://localhost:4153 bun run ui:browser-smoke:zoltar, UI_DEV_SERVER_URL=http://localhost:12347 bun run ui:browser-smoke:statoblast, UI_DEV_SERVER_URL=http://localhost:4163 bun run ui:browser-smoke:trading, or UI_DEV_SERVER_URL=http://localhost:4143 bun run ui:browser-smoke:openoracle opens the app in headless Chromium and fails if it does not mount cleanly. Set CHROMIUM_PATH to use a Chromium executable that is not on PATH; the smoke check and ui:layout-scan both honor it.

bun run ui:layout-scan -- --app <apps> builds and serves the named apps (one or more, comma separated; --app is required), then walks every route, view tab, disclosure, and dialog launcher it can reach in each simulation scenario at five viewport sizes, and reports content that is cut off, runs off the screen, overlaps, or is squeezed. Each finding explains the measured problem, the likely cause and fix, the source files involved, and links a highlighted screenshot; --help lists the options for narrowing the scan or scanning a running server.

Simulation uses a browser-local chain with funded test accounts. You can use it on production app URLs as a demo. Simulated balances and transactions describe that tab’s sandbox. Save from the simulation banner to persist a state in browser storage.

  • All apps support simScenario=baseline and simScenario=deployed.
  • Zoltar adds two-questions and forked-categorical.
  • Statoblast and OpenOracle add portfolio-auction, security-pool, and securitypoolx2.
  • Trading defaults to trading-funded and also supports trading-usdc and trading-forked. The forked fixture exposes migration from the funded parent market.

Serve commands prepare Yes-genesis scenario snapshots. To rebuild or check them directly, use bun run ui:snapshots <app> or bun run ui:snapshots:check.

Common Commands

Each serve command first builds the selected app and its dependencies, then serves the app. Watch commands also rebuild the selected app and its dependencies as you edit.

Application Serve command Watch command Local URL
Zoltar bun run app:serve:zoltar bun run app:watch:zoltar http://localhost:4153
Statoblast bun run app:serve:statoblast bun run app:watch:statoblast http://localhost:12347
Trading bun run app:serve:trading bun run app:watch:trading http://localhost:4163
OpenOracle bun run app:serve:openoracle bun run app:watch:openoracle http://localhost:4143

Which command do I run?

I want to… Run
Set up a fresh checkout bun run setup
Develop one app bun run app:serve:<app> or bun run app:watch:<app> (zoltar, statoblast, trading, openoracle)
Regenerate contract bindings and vendor assets bun run generate (contracts only: bun run compile-contracts)
Build every UI app and test bundle bun run ui:build (production bundles: bun run ui:build:prod)
Type-check bun run tsc
Find and run focused tests bun run test:plan, then run the relevant suggested test commands
Run checks for affected projects bun run check:affected (preview with bun run check:affected -- --dry-run)
Run comprehensive local validation bun run validate
Run the root test suite bun run test
Lint and check what I changed bun run check:changed
Run the full lint, documentation, and repository checks bun run check
Format, or verify formatting bun run format, bun run format:check
Find dead code bun run knip

Script families

Root scripts are grouped by prefix:

  • setup, generate, compile-contracts, shared:build, ui:vendor, ensure-*: install dependencies and create generated outputs. tooling/repo/generated-artifacts.ts lists every generated output with the command that recreates it.
  • app:serve:<app>, app:watch:<app>, ui:build*, ui:browser-smoke:<app>, ui:layout-scan, ui:publish:*: build, serve, smoke-test, layout-scan, and publish the UI apps.
  • test, test:*, coverage*: test runs tsc and then the canonical root suite (test:run), which includes the project registry and CI tooling tests. Run test:preflight to check that subset on its own. Browser workflow and live integration suites have dedicated commands.
  • check, check:*, lint:*, docs:check*, format*, knip*: static analysis. check runs check:static (Biome and custom lint rules), docs:check, and check:repository. check:complete adds formatting, dead-code analysis, and generated-output freshness, and is the repository's check task in validate.
  • validate: comprehensive local validation with browser smoke. test:all is an alias. CI additionally runs mutation smoke, the browser workflow tier, dependency auditing and augurScan PostgreSQL integration.
  • projects:*: run one task (setup, test, check, typecheck, workers) across the projects registered in tooling/repo/projects.ts.
  • ci:*: entry points used by GitHub Actions jobs.
  • trading:*: Trading-only shortcuts used by the Trading development guide.

A :current suffix runs the same work as the unsuffixed script against the workspace as it is: it skips the preparation step, which is usually regenerating contract artifacts or shared builds (compile-contracts:current, check:contract-safety:current, check:mainnet-deployment:current, docs:check:current, ui:build:prod:current). check:repository:current instead skips the source-size check that CI runs in a separate job, and ci:*:current and tsc:solidity:current are the names CI calls after it has restored the generated artifacts. Use :current only after bun run setup or bun run generate has run in the same checkout.

Details

Changes to global, unowned, CI, or repository-tooling paths make check:affected select the full registered check set. Project-owned changes select the owning project and its registry dependents. When a package's canonical check command already covers its typecheck, lint, or tests, affected validation runs the composite. The root composite includes documentation checks. Documentation-only plans can run docs:check directly.

CI and local validation share the component registry in tooling/repo/projects.ts. Reproduce contract-size and delegate-layout failures with bun run check:contract-safety and source-size failures with bun run check:source-size.

  • bun run tsc prepares missing or stale contract artifacts and shared build outputs, then runs the registered project typechecks. bun run tsc:app refreshes Trading vendor inputs and then typechecks the UI apps. Both commands can write generated files.
  • bun run test:launch-invariants runs the launch-focused fork, auction, and exit invariant gate.
  • bun run coverage runs every canonically discovered TypeScript test, reports weighted coverage for UI, shared, and tooling source, counts statically identified executable lines and functions in unloaded source as zero-hit coverage, and checks product TypeScript from the origin/main merge base through committed, staged, unstaged, and untracked task changes. Set COVERAGE_BASE_REF or pass --base-ref to the reporter to use another comparison ref. Use bun run coverage:full to enforce the same policy with the slower Solidity bytecode trace phase.
  • bun run lint:fix and bun run knip:fix apply automatic lint and dead-code fixes.

Gas costs

Measure Solidity gas costs with bun run gas-costs. By default, it starts an isolated Anvil node. To measure against an existing local node instead, start the repository-pinned Anvil in one terminal:

bun run anvil -- --host 127.0.0.1 --port 8545 --chain-id 1 --block-base-fee-per-gas 0 --gas-price 0 --no-priority-fee

Then run gas-costs against it from another terminal:

GAS_COST_ANVIL_RPC=http://127.0.0.1:8545 bun run gas-costs

Use GAS_COST_ANVIL_RPC=http://host.docker.internal:8545 bun run gas-costs when the command runs from a container that reaches the host through Docker routing.

Publishing the UIs to a local IPFS node

With Docker and a local IPFS (Kubo) node running, bun run ui:publish:local builds Zoltar, Statoblast, Trading, and OpenOracle in Docker and pins all four on that node. Set IPFS_API to the node's Kubo API multiaddress when it is not reachable at /dns4/host.docker.internal/tcp/5001. On Windows, double-clicking publish.bat runs the same command; it needs Bun and the repository dependencies installed. bun run ui:publish:ipfs publishes through the release publisher image instead.

Agent configuration

  • AGENTS.md files (root and nested) hold the repository rules for coding agents; CLAUDE.md points Claude Code at them.
  • .codex/ configures Codex: config.toml limits sub-agent threads and depth, agents/*.toml defines the final, visual, and documentation reviewers, and review-contract.md is their shared handoff and scoring contract. bun run check:agents validates them.
  • .agents/skills/ holds shared agent skills (currently babysit, which keeps a pull request current and green); .claude/skills/ symlinks the same skills for Claude Code, and .claude/settings.json disables Claude commit and pull-request attribution.
  • .ci-agents/ holds the Architect, Bug Hunter, Defender, and Security prompts for automated pull-request review agents; no repository script reads them.

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages