Settlement<COLLATERAL> object. Multiple depositors share an anonymity set; the vault (not the depositors) is the trader on DeepBook V3 pools.
Vault
Receipt
Lifecycle functions
Create (admin)
VaultAdminCap to the keeper. See scripts/create-darkpool-vault.ts.
Deposit
vault.state == OPEN, attribution_hash.length() == 32, coin_in.value >= min_deposit_micro.
Keeper: pull + mint accounting
settlement::mint_pair → BM deposit → record_mint.
Settlement
receive_settlement accepts the post-redeem DUSDC payout and flips state → SETTLED. Users then call redeem to claim their pro-rata share.
Pro-rata math
Errors
| Const | Code | Meaning |
|---|---|---|
ENotAdmin | 1 | Cap doesn’t match vault |
EVaultClosed | 2 | State != OPEN |
EBelowMinDeposit | 3 | Coin value < min_deposit_micro |
ENoShares | 4 | Receipt shares == 0 |
ESettlementNotReady | 5 | State != SETTLED on redeem |
EAlreadySettled | 6 | receive_settlement after first call |
EHashLenMismatch | 7 | Attribution hash not 32 bytes |
Tests
tests/dark_pool_tests.move. 6 tests: full lifecycle with pro-rata payout, min-deposit abort, redeem-before-settlement abort, admin-gated record_mint, double-settle abort, receipt views.