Skip to main content

create-darkpool-vault

One PTB: balance_manager::newmint_trade_capdark_pool::create_vault<DUSDC> wired to a scaffolded binary market from registry.json. Shares the vault + BalanceManager; keeps TradeCap + VaultAdminCap with the keeper (sender).
pnpm tsx scripts/create-darkpool-vault.ts \
  --market wc26_euro_champion \
  --min-deposit 1000000 \
  --execute
Flags
FlagRequiredDescription
--marketyesSlug from .binary-markets/registry.json
--min-deposityesMinimum deposit in micro DUSDC (1_000_000 = $1)
--labelnoOverride the vault label (defaults to market label)
--executenoSign + submit
Prints VAULT_OBJECT_ID. Paste into .env.

vault-deposit

Deposits DUSDC into a DarkPoolVault with the exact PTB shape the frontend uses (split → dark_pool::deposit → receipt to sender). Smoke test + demo TVL seeder.
pnpm tsx scripts/vault-deposit.ts --amount 2 --execute
Flags
FlagRequiredDescription
--amountyesWhole DUSDC amount
--vaultnoOverride VAULT_OBJECT_ID
--executenoSign + submit
Passes attribution_hash as 32 zero bytes (Seal off). Frontend does the same.

keeper-tick

One vault keeper tick. Idempotent.
pnpm tsx scripts/keeper-tick.ts --execute                 # all idle balance
pnpm tsx scripts/keeper-tick.ts --amount 5 --ask 0.55 --execute
Market open path (state == OPEN):
dark_pool::pull_for_mint
  → settlement::mint_pair
  → balance_manager::deposit (YES + NO)
  → dark_pool::record_mint
→ [optional] pool::place_limit_order POST_ONLY (YES + NO asks) via TradeCap
V3 ask leg is auto-gated on yesPoolId / noPoolId existing in the registry. Quotes roundLot(held × 100/105) to leave 5% input-token fee headroom. Market resolved path (after mark_resolved):
cancel V3 orders
  → balance_manager::withdraw_all (YES + NO + idle DUSDC)
  → settlement::redeem_{yes,no}
  → dark_pool::receive_settlement
→ state → SETTLED
Flags
FlagRequiredDescription
--amountnoOverride pull amount (default: all idle balance)
--asknoOverride ask price for V3 asks (default: 0.55)
--executenoSign + submit