Cycle Lifecycle
Understanding the state machine that drives portfolio automation
A cycleis the protocol's long-lived execution state for a vault. It starts when a credit is consumed, remains open across multiple calls, and ends only when a close path succeeds or the vault owner explicitly exits.
Cycle Phases
1. Start
A new cycle begins when an allowed execution call reaches a vault with no active cycle. One owner credit is consumed, the opening portfolio state is recorded, and the vault's selected engine family/version is pinned for that cycle.
2. Active Rebalancing
During an active cycle, each allowed execution call evaluates the pinned engine module, applies any permitted trade path, refreshes the cycle snapshot, and then checks whether the cycle can close.
3. Close Eligibility
Close logic is two-stage: the vault's check mode must first hit its trigger condition, and the post-step secured NAV must still satisfy the configured threshold. If either condition fails, the cycle remains open.
4. Close & Rollover
If close conditions hold, the cycle either rolls into a new cycle or closes terminally. Terminal settlement behavior depends on the vault's check mode: mode 1 settles to TOKEN0, mode 2 settles to TOKEN1, and mode 3 leaves balances in place.
Close Reasons
| Code | Reason | Description |
|---|---|---|
| 1 | Rollover | Close conditions held and a new cycle started immediately. |
| 2 | Terminal | Close conditions held, but the cycle ended without rollover. |
| 3 | User Close | The vault owner used an exit action to close the active cycle. |
| 4 | Protective Close | A privileged protective action ended the cycle without a normal user exit. |