Repository navigation
feat(app): compliance surface - #234
luchobonatti wants to merge 12 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a privileged compliance surface performing irreversible share interventions (freezes, forced transfers) plus new on-chain admin-reading and authorization logic, which warrants human review despite the strong test coverage.
1 open finding
What changed in this PR
This PR adds the Compliance admin surface (closing #194), giving the compliance and identity‑verifier‑admin authorities a screen to read a target address's allowlist/freeze/share state and act on it (allowlist add/remove, address freeze/unfreeze, partial share freeze/unfreeze, and forced transfer). Each action previews its resulting state before signing, names the contract error on refusal, and requires an extra confirmation when the action targets the vault itself. Supporting this, shared admin‑rail helpers are extracted from governance.ts into actions.ts, useIsAllowed now resolves the verifier dynamically from the share token (with retry), useAdminAuthority reads the verifier's on‑chain admin via a new readContractAdmin, and the client layer gains per‑address verifier reader/writer factories.
Changes:
- New compliance surface:
compliance.tsaction/tile builders,ComplianceSectionUI,useComplianceState/useComplianceTransactionshooks, andTransactionModalcopy + error‑code reasons (300/301/303/2001). - Shared refactor:
Built/BuiltSpec/Inputs/confirmation/confirmKey/parseAccount/clearConfirmations/withInputmoved toactions.ts; newuseRailInputshook;useAdminAuthoritygainsverifierAdminUnknownand anidentity-verifier adminrole surface. - Lib support:
readContractAdmin+ TTL‑0 handling inreadContract.ts,addAmounts/subtractAmountsinformat.ts, optionalsigneronconnectIdentityVerifier.
| File | Description |
|---|---|
| app/src/pages/compliance.ts | Core compliance action/tile builders (allow, freeze, shares, forced transfer, vault confirmation) |
| app/src/pages/actions.ts | Extracted shared rail helpers now reused by governance and compliance |
| app/src/pages/governance.ts | Refactored to consume the shared helpers from actions.ts |
| app/src/hooks/useComplianceState.ts | Reads target allowlist/frozen/balance/frozen-shares and destination allowance |
| app/src/hooks/useComplianceTransactions.ts | Admin write hooks for allow/freeze/forced-transfer with invalidation keys |
| app/src/hooks/useIsAllowed.ts | Resolves verifier from the share token, with retry and unreadable handling |
| app/src/hooks/useAdminAuthority.ts | Adds verifier-admin read, verifierAdminUnknown, and compliance surface role |
| app/src/hooks/useRailInputs.ts | New hook centralizing rail input/confirmation state |
| app/src/config/clients.ts | Per-address verifier reader/writer caches (identityVerifierAt, identityVerifierWriter) |
| app-lib/readContract.ts | New readContractAdmin reading instance-storage admin; opt-in TTL-0-is-live flag |
| app-lib/format.ts | addAmounts/subtractAmounts (floor-at-zero) helpers |
| app-lib/contracts.ts | connectIdentityVerifier accepts an optional signer |
| app/src/components/admin/ComplianceSection.tsx / .module.css | New surface UI wiring reads, rail, target input, and modal |
| app/src/components/vault/TransactionModal.tsx | Compliance action copy and new refusal reasons |
| app/src/pages/AdminPanel.tsx | Routes the compliance surface and threads verifierAdminUnknown |
Multiple *.test.* files |
Extensive new/updated unit coverage for the above |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const labels = [ | ||
| "Allowlisted", | ||
| "Frozen", | ||
| "Shares", | ||
| "Frozen shares", | ||
| "Free shares", | ||
| ] |

Summary
Closes #194
The Compliance tab reads a target address's allowlist, freeze and share state, and lets the compliance authorities allowlist it and intervene on its shares.
Changes
recover_balanceis not offered: the identity verifier has no recovery target, so it always failsAcceptance criteria
Test plan
Automated tests
npm run test— 1546 passing.Manual verification
/admin/complianceas compliance and enter an investor address: its allowlist, frozen state and shares.Breaking changes
None.
Checklist