Skip to content

Run the wind-down from the admin panel - #226

Merged
luchobonatti merged 2 commits into
mainfrom
feat/193-wind-down
Oct 13, 2026
Merged

luchobonatti merged 2 commits into
mainfrom
feat/193-wind-down

Conversation

@luchobonatti

Copy link
Copy Markdown
Member

Summary

Closes #193

Any Cycle role activates a proposed wind-down and finalizes its distribution rounds from the Cycle card on /admin.

Changes

  • useActivateWindDown and useFinalizeWindDownRound call the vault through useContractTransaction
  • toCycleActions shows activation while a wind-down is proposed or active, checked against the delay, and finalize while it is active, checked against the free reserve
  • The Wind-down group ends with both actions: conditions, resulting state, button
  • TransactionModal gains the activate-wind-down and finalize-round actions with the vault's errors mapped; the confirmed round shows the amount holders can claim

Acceptance criteria

  • No action is shown while no wind-down is proposed
  • Activation is enabled only once the delay has elapsed
  • Finalize is enabled only while the wind-down is active and the free reserve is above zero
  • Refusals name the reason in the modal

Test plan

Automated tests

npm run test — 950 passing.

Manual verification

  1. On a local network, propose a wind-down as governance, then open /admin as the manager: Activate wind-down lists "Delay elapsed" with the activation time.
  2. After the delay, activate it: Finalize round appears with "Distributes to holders as round 1."

Breaking changes

None.

Checklist

  • Self-reviewed my own diff
  • Tests added or updated
  • Docs updated (if applicable)
  • No unrelated changes bundled in

Screenshots

None.

@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strata-vault-kit-app Ready Ready Preview Oct 13, 2026 12:34pm UTC

Request Review

@luchobonatti
luchobonatti added this pull request to stack #223 October 9, 2026 15:38
@luchobonatti luchobonatti self-assigned this Oct 9, 2026
@luchobonatti
luchobonatti marked this pull request as ready for review October 9, 2026 15:41
Copilot AI balanced review requested due to automatic review settings October 9, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 useActivateWindDown and useFinalizeWindDownRound hooks calling the vault through useContractTransaction with cycleWriteKeys invalidation.
  • cycle.ts gains WindDownAction plus toActivateAction/toFinalizeAction/toWindDownActions, gating activation on the delay and finalize on a positive free reserve.
  • TransactionModal adds activate-wind-down/finalize-round flows with contract-error reasons (6046/6047/6049 and 6050/6052/6014), and CycleSection submits/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.

@luchobonatti
luchobonatti merged commit 4007542 into main Oct 13, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 58ecec5a Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cycle surface: seal, attest, settle, deploy and fund

3 participants