> ## Documentation Index
> Fetch the complete documentation index at: https://docs.darkpool.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> All 19 operational scripts and their conventions.

All scripts live under `scripts/` and run via `tsx`. They're typechecked together by `pnpm typecheck:scripts` (`tsc -p scripts`), which root `pnpm typecheck` chains.

## Shared conventions

* **Dry-run by default.** Every script prints what it would do without `--execute`.
* **`--execute`** signs + submits.
* **Shared CLI.** `scripts/lib/cli.ts` provides `ScriptContext`. Loads env, builds `SuiClient`, derives the keypair from `AGENT_KEY` / `RESOLVER_KEY`, parses flags, dry-run-aware `signAndExecute`, `findCreatedObject` helpers.
* All scripts respect `.env` at repo root.

## Grouped

### Bootstrap

| Script                                           | Purpose                                                    |
| ------------------------------------------------ | ---------------------------------------------------------- |
| [`parse-publish-output`](/scripts/parse-publish) | Parse `sui client publish --json` to rewrite `.env`        |
| [`create-predict-manager`](/scripts/predict)     | `predict::create_manager` + capture id                     |
| [`fund-manager`](/scripts/predict)               | Fund PredictManager via `predict_manager::deposit<T>`      |
| [`register-trade-agent`](/scripts/agent-scripts) | `darkpool::agent::register_agent`                          |
| [`register-market`](/scripts/market-scripts)     | Register a price or OO MarketLink                          |
| [`create-seal-policy`](/scripts/market-scripts)  | Share a fresh `AccessPolicy` (needed after each republish) |

### Binary event markets

| Script                                            | Purpose                                                          |
| ------------------------------------------------- | ---------------------------------------------------------------- |
| [`create-binary-market`](/scripts/binary-market)  | Scaffold to build to publish to `create_market` to registry.json |
| [`finish-create-market`](/scripts/binary-market)  | Recovery: finish a half-completed publish from its digest        |
| [`resolve-binary-market`](/scripts/binary-market) | `settlement::mark_resolved` via `ResolverCap`                    |

### DeepBook V3

| Script                             | Purpose                                                  |
| ---------------------------------- | -------------------------------------------------------- |
| [`create-v3-pools`](/scripts/v3)   | `Pool<YES,DUSDC>` + `Pool<NO,DUSDC>` (500 DEEP fee each) |
| [`seed-v3-liquidity`](/scripts/v3) | Two-sided POST\_ONLY quotes on both pools, one PTB       |

### Dark-pool vault

| Script                                    | Purpose                                                                          |
| ----------------------------------------- | -------------------------------------------------------------------------------- |
| [`create-darkpool-vault`](/scripts/vault) | One PTB: `balance_manager::new` to `mint_trade_cap` to `dark_pool::create_vault` |
| [`vault-deposit`](/scripts/vault)         | `dark_pool::deposit` smoke test                                                  |
| [`keeper-tick`](/scripts/vault)           | Vault keeper: pull to mint\_pair to BM deposit to record\_mint to V3 asks        |

### Predict + smoke

| Script                                   | Purpose                                                    |
| ---------------------------------------- | ---------------------------------------------------------- |
| [`predict-mint-smoke`](/scripts/predict) | Live `predict::mint<T>` smoke test                         |
| [`supply-plp`](/scripts/predict)         | `predict::supply<T>` to `Coin<PLP>` + DarkPool attribution |

### Optimistic Oracle

| Script                       | Purpose                                                |
| ---------------------------- | ------------------------------------------------------ |
| [`oo-propose`](/scripts/oo)  | `oo_resolution::propose<T>` with DUSDC bond            |
| [`oo-finalize`](/scripts/oo) | `finalize_auto` / `finalize_vote` with clock pre-check |

### Utility

| Script                                     | Purpose                             |
| ------------------------------------------ | ----------------------------------- |
| [`return-testnet-dusdc`](/scripts/utility) | DUSDC return sweep (80% commitment) |

## pnpm aliases

All scripts are wired into root `package.json`:

```json theme={"system"}
{
  "binary-market:create":   "tsx scripts/create-binary-market.ts",
  "binary-market:finish":   "tsx scripts/finish-create-market.ts",
  "binary-market:resolve":  "tsx scripts/resolve-binary-market.ts",
  "predict:new-manager":    "tsx scripts/create-predict-manager.ts",
  "predict:fund":           "tsx scripts/fund-manager.ts",
  "plp:supply":             "tsx scripts/supply-plp.ts",
  "smoke:mint":             "tsx scripts/predict-mint-smoke.ts",
  "market:register":        "tsx scripts/register-market.ts",
  "agent:register":         "tsx scripts/register-trade-agent.ts",
  "oo:propose":             "tsx scripts/oo-propose.ts",
  "oo:finalize":            "tsx scripts/oo-finalize.ts",
  "env:from-publish":       "tsx scripts/parse-publish-output.ts",
  "return-dusdc":           "tsx scripts/return-testnet-dusdc.ts"
}
```
