| Object | Owns | Used by |
|---|---|---|
PredictManager | DUSDC balance + position entries (oracle, expiry, strike, is_up) | Predict price markets (/markets) |
BalanceManager | DUSDC + YES + NO coin balances + open V3 orders | DeepBook V3 pools (event markets, vault, agents) |
/profile exposes the PredictManager controls; the agent wizard on /agents creates BalanceManagers for delegated trading.
PredictManager
Created viapredict::create_manager. After Predict shares the new manager internally, the script picks the new id from objectChanges and writes it to AGENT_PREDICT_MANAGER_ID.
Fund it via predict_manager::deposit<T>. The wallet splits a DUSDC coin and credits the manager’s internal balance. Required before any predict::mint.
Frontend hook: useMyManagers discovers all managers owned by the connected address and surfaces them on /profile (one active prominently, others collapsed behind a toggle).
After a deposit / withdraw,
PredictAccountControls.refetchAccount() replaces a one-shot refetch with awaitBalanceChange. 6 × 500ms polls of acct.refetch() that exit as soon as wallet OR manager balance differs from the pre-tx snapshot. This papers over Sui RPC eventual-consistency on getCoins.BalanceManager
The DeepBook V3 BalanceManager is a shared account object owning DUSDC + open V3 orders. Two roles can act on it:- Owner. Deposits / withdraws via
balance_manager::deposit/withdraw_all. Owner-only by Move check. - TradeCap holder. Places / cancels orders via
pool::place_limit_order/pool::swap_exact_quantity. Cannot withdraw.
- Dark-pool vault.
scripts/create-darkpool-vault.tsmints a fresh BalanceManager in one PTB, shares it, mints a TradeCap to the keeper. The vault stores both ids. - Agent. The
/agentsCreate-agent wizard does the same plusagent::register_agent. - Seeder.
scripts/seed-v3-liquidity.tsmints + uses + reshares one BalanceManager in a single PTB for two-sided liquidity provisioning.
How they relate
A dark-pool vault’s BalanceManager holds the YES + NO + DUSDC across all depositors. An agent’s BalanceManager holds only that agent’s DUSDC. Both are TradeCap-delegated so the trading party (keeper / agent runtime) is separated from the withdrawal party (vault admin / agent owner). For users trading on/markets (Predict price markets), only the PredictManager is involved. V3 BalanceManager is invisible. For users trading on /event-markets/:id (DeepBook V3 pools), the swap goes through their connected wallet directly, no BalanceManager required. pool::swap_exact_quantity accepts a free coin in.