Repository navigation
Run the wind-down from the admin panel - #226
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🔵 Needs a closer look
The changes drive financially-sensitive wind-down distribution flows for a vault, which warrants final human review despite being UI-layer, pattern-consistent, and well-tested with error codes verified against the contract.
0 open findings
What changed in this PR
This PR wires the vault's wind-down lifecycle into the operator-facing Cycle card on /admin (closing #193). Two new transaction hooks let any Cycle-role holder activate a proposed wind-down and finalize its distribution rounds, with the TransactionModal naming the vault's refusal reasons and the confirmed round showing what holders can claim. It mirrors the existing deploy/fund/attest action plumbing and adds a new "Wind-down" action group.
Changes:
- New
useActivateWindDownanduseFinalizeWindDownRoundhooks calling the vault throughuseContractTransactionwithcycleWriteKeysinvalidation. cycle.tsgainsWindDownActionplustoActivateAction/toFinalizeAction/toWindDownActions, gating activation on the delay and finalize on a positive free reserve.TransactionModaladdsactivate-wind-down/finalize-roundflows with contract-error reasons (6046/6047/6049 and 6050/6052/6014), andCycleSectionsubmits/renders them.
| File | Description |
|---|---|
| app/src/pages/cycle.ts | Adds the Wind-down action type, conditions, and builder logic |
| app/src/pages/cycle.test.ts | Tests activation/finalize conditions, outcomes, and edge cases |
| app/src/hooks/useActivateWindDown.ts | New hook submitting activate_wind_down |
| app/src/hooks/useActivateWindDown.test.ts | Covers status flow, refusals, decline, in-flight, invalidation |
| app/src/hooks/useFinalizeWindDownRound.ts | New hook submitting finalize_wind_down_round, returns credited |
| app/src/hooks/useFinalizeWindDownRound.test.ts | Covers status flow, refusals, decline, in-flight, invalidation |
| app/src/components/vault/TransactionModal.tsx | Adds modal props, error reasons, and status descriptions |
| app/src/components/vault/TransactionModal.test.tsx | Tests the two new modal flows and error messages |
| app/src/components/admin/CycleSection.tsx | Wires the hooks, run handlers, and modal flows |
| app/src/components/admin/CycleSection.test.tsx | Integration tests for the new actions in the panel |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
32ba71e to
edaa738
Compare
edaa738 to
d0935e2
Compare
d0935e2 to
d7d9af1
Compare
d7d9af1 to
f811c76
Compare
f811c76 to
58ecec5
Compare
Summary
Closes #193
Any Cycle role activates a proposed wind-down and finalizes its distribution rounds from the Cycle card on
/admin.Changes
useActivateWindDownanduseFinalizeWindDownRoundcall the vault throughuseContractTransactiontoCycleActionsshows activation while a wind-down is proposed or active, checked against the delay, and finalize while it is active, checked against the free reserveTransactionModalgains theactivate-wind-downandfinalize-roundactions with the vault's errors mapped; the confirmed round shows the amount holders can claimAcceptance criteria
Test plan
Automated tests
npm run test— 950 passing.Manual verification
/adminas the manager: Activate wind-down lists "Delay elapsed" with the activation time.Breaking changes
None.
Checklist
Screenshots
None.