Constitutional risk layer for autonomous treasuries on Mantle.
TreasuryOS is a constitutional risk layer for autonomous treasuries on Mantle. AI proposes capital actions. TreasuryOS stress-tests them against treasury law. Unsafe actions are blocked, safe actions are allowed, and decisions can be proven on-chain.
Use exactly this wording everywhere public (no paraphrase):
TreasuryOS is a constitutional risk layer for autonomous treasuries on Mantle. AI proposes capital actions. TreasuryOS stress-tests them against treasury law. Unsafe actions are blocked, safe actions are allowed, and decisions can be proven on-chain.
Suggested GitHub “About” description: Constitutional risk layer for autonomous treasuries on Mantle — AI proposes; treasury law allows or blocks; decisions auditable on-chain.
| What | Where |
|---|---|
| Live app | treasuryos-web-production.up.railway.app |
| API health | treasuryos-backend-production.up.railway.app/health |
| Repository | github.com/loquit-tud/TreasuryOS |
| On-chain proof | packages/contracts — deploy + verify steps in packages/contracts/README.md |
| DoraHacks / demo video | (add submission URL and video link when published) |
90s judge demo: homepage or dashboard → Run 90s Judge Demo (or open /dashboard?judge90=1 — auto-runs the full sequence). Step-by-step UI: /demo (primary judge path).
- Is: A policy engine for autonomous treasuries: bind a vault constitution, submit capital intents, get deterministic ALLOW / REJECT, run stress simulations, export evidence, and optionally log attestations on Mantle via
ExecutionLog. - Is not: A lending product, invoice factoring, or credit-line app. Constitutional fields like non-stable sleeve caps are risk limits, not claims about tokenized real-world receivables.
apps/web— Next.js UI (landing, dashboard, constitution, simulations, guided demo).apps/api— FastAPI Constitution Engine, PostgreSQL, optional Mantle execution logging.packages/contracts— minimal on-chain audit surface (registry + execution log).infra— Docker Compose for Postgres (and full stack).
cd apps/web
npm install
npm run devcd apps/api
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
set DATABASE_URL=postgresql+psycopg://postgres:postgres@localhost:5432/treasuryos
uvicorn app.main:app --reload --port 8000Optional real on-chain execution logging (Mantle mainnet — matches apps/api/.env.example):
set MANTLE_RPC_URL=https://rpc.mantle.xyz
set MANTLE_CHAIN_ID=5000
set EXECUTION_LOG_CONTRACT=0xA22ebFf573BedA62202490A87eCE31C7c91462b9
set TREASURY_EXECUTOR_PRIVATE_KEY=<private_key>
# or
set TREASURY_EXECUTOR_MNEMONIC="word1 word2 ... word12"Railway: set the same variable names on the API service (root directory apps/api). Add DATABASE_URL, APP_ENV, CORS_ALLOW_ORIGINS for production.
cd infra
docker compose -f compose.yml up -dcd apps/api
python -m pip install -r requirements.txt
python -m pytest tests/ -vCI: on push/PR to main/master, GitHub Actions runs the same tests (.github/workflows/ci.yml).
cd infra
docker compose -f compose.full.yml up --buildSee SELF_HOST.md for details.
- Auth: set
API_KEYSon the API service andBACKEND_API_KEYon the web service. - CORS:
APP_ENV=productionrequires explicitCORS_ALLOW_ORIGINS(no wildcard). - Migrations: API runs
alembic upgrade headon startup; ensure DB is reachable during deploy. - Observability: use
X-Request-Idto trace a single request through Railway logs (JSON per request). - Evidence:
GET /evidence/proposal/{proposal_id}returns an audit pack (vault, proposal, ledger, constitution versions). - On-chain verification:
GET /monitoring/onchain/execution-log/{tx_hash}decodesExecutionLogevents (read-only).
- Swagger:
http://127.0.0.1:8000/docs - Health:
GET /health POST /proposals/{proposal_id}/execution-record(with chain env configured, can submit a real Mantle tx)
SQLAlchemy migrations (Alembic)— Done:alembic upgrade headon API startup; baseline001_initial.Redis event feed— Done:REDIS_URL→ decisions on evaluate;GET /monitoring/decisions/recent.Simulation charts— Done:/simulationswith Recharts + motion,prefers-reduced-motionrespected.Contracts on Mantle— Done: Hardhatmantle/mantleSepolia;npm run deploy:mantle→deployments/mantle.json; API envEXECUTION_LOG_CONTRACT+MANTLE_CHAIN_ID=5000. Seepackages/contracts/README.md.Constitutional e2e tests— Done:cd apps/api && python -m pytest tests/ -v.