Data Model
The Transfer Agent's state lives in three places that are kept reconcilable:
The Transfer Agent's state lives in three places that are kept reconcilable:
Postgres (system of record), the on-chain ERC-3643 contracts, and the
FBO cash ledger (also in Postgres). Migrations are goose files under
transfer-agent-api/pkg/db/migrations/.
1. On-chain contracts (ERC-3643 suite)
The security is a permissioned ERC-3643 token; ownership and compliance are enforced on-chain.
| Contract | Role |
|---|---|
| SecurityToken | The ERC-3643 permissioned security. Holds balances, freezes, and enforces transfer compliance. |
| IdentityRegistry | Maps wallets to verified ONCHAINID identities; gates who may hold. |
| ModularCompliance | Pluggable transfer rules (jurisdiction, limits, lockups). |
| USDL | Stablecoin used for on-chain cash legs (USDL dividend path, settlement). |
| Settlement | Delivery-vs-payment settlement of trades. |
On the org devnet (wallet-api, chainId 8675399) the shared infra contracts
are: token_settlement, settlement_verifier, venue_module,
multisig_factory, multisig_impl, signer_guard, and usdl (deployed lazily
on first deposit). Token amounts are base units (scaled by 10^decimals).
2. Core Postgres tables (ta-api read model + modules)
| Table | Holds |
|---|---|
tokens | Registered securities (contract address, symbol, name, decimals, asset_type, supply) |
positions | Per-holder balances (wallet, token, balance, frozen), linked to holders |
holders | Holder identities (primary_wallet, onchain_id, kyc_status, accreditation, country, name, email) |
identities | Registry state per holder (registered, frozen, onchain_id) |
compliance_rules | Compliance rule definitions + versions |
distributions | Declared dividends (token_id, record_date_block, rate, status, total_holders, total_amount) |
entitlements | Per-holder dividend amounts (distribution_id, holder_id, wallet, amount [USD cents], paid, tx_hash) |
operations | Maker-checker operation ledger (kind, payload, state, maker, checker, failure_reason, tx_hash) |
audit_log | Tamper-evident, hash-chained audit trail |
chain_events | Raw indexed on-chain events |
indexer_checkpoints | Indexer progress per contract |
recon_runs, recon_diffs | On-chain vs DB reconciliation runs + drift |
captable | Imported cap-table rows (Carta) |
onchain_kv | Small on-chain-derived key/value cache |
mpc_wallets | MPC wallet provisioning saga state (keygen -> v42 -> onboarded -> ready) |
3. FBO cash sub-ledger (subledger-api)
Strict double-entry over the omnibus. Append-only; every transaction balances. Money is integer minor units (USD cents).
| Table | Holds |
|---|---|
ledger_accounts | Accounts: fbo_control, investor_subaccount, suspense, fee_revenue, settlement_clearing |
ledger_transactions | Append-only transactions (type, reference, narrative, created_by, idempotency_key) |
ledger_entries | The debit/credit legs (transaction_id, account_id, direction, amount_minor) |
account_balances | Cached balances (recomputable from entries) |
holds | Reservations reducing available balance (reason, status, amount) |
payouts | Withdrawals + dividend payouts (amount, destination, state, maker, checker, distribution_id, funding_mode, ledger_tx, bank_account_id) |
bank_transactions | Imported bank statement lines, matched to ledger |
wire_intents | Declared expected incoming wires (open/matched/cancelled) |
bank_accounts | Plaid-linked accounts (owner_type, owner_ref, plaid ids, mask, subtype, selected) |
funding_events | Operator funding of the omnibus (amount, plaid status, ledger_tx) |
subledger_recon_runs | FBO ledger vs bank reconciliation results |
The reconciliation identity
fbo_control = suspense + Σ investor wallets + fee_revenue + settlement_clearingEvery posting preserves it. Examples:
| Event | Debit | Credit |
|---|---|---|
| Deposit (wallet load) | fbo_control | investor wallet |
| Operator funding | fbo_control | suspense |
| Dividend (prefunded) | suspense | investor wallet |
| Dividend (auto) | fbo_control | investor wallet |
| Fee / interest | investor wallet / fbo_control | fee_revenue |
| Withdrawal (settle) | investor wallet | fbo_control |
4. Units summary
| Domain | Unit | Example |
|---|---|---|
| On-chain token amounts | base units (10^decimals) | 1000000000000000000 = 1 token (18 dp) |
| wallet-api wire | DISPLAY units | 1000 = 1000 tokens |
| FBO cash / dividends | USD minor units (cents) | 5000 = $50.00 |
The devnet-bridge converts wallet-api DISPLAY units to base units at the boundary; dividend entitlement amounts are computed in USD cents and map straight to the FBO ledger.