Skip to content

Commit 08a70ba

Browse files
BowTiedDevOpskenrogers
authored andcommitted
feat: add page with details on how to stop stacking
1 parent 4b18fea commit 08a70ba

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
* [Solo Stack](guides-and-tutorials/stack-stx/stacking-flow.md)
115115
* [Operate a Pool](guides-and-tutorials/stack-stx/operate-a-pool.md)
116116
* [Stack with a Pool](guides-and-tutorials/stack-stx/stack-with-a-pool.md)
117+
* [Stop Stacking](guides-and-tutorials/stack-stx/stop-stacking.md)
117118
* [Community Tutorials](guides-and-tutorials/community-tutorials.md)
118119

119120
## 📚 Reference
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Stop Stacking
2+
3+
When you decide it's time to stop stacking your STX tokens, the process depends on whether you are stacking solo or delegating your tokens to a pool operator. This guide explains the steps for both scenarios.
4+
5+
---
6+
7+
## Stopping Solo Stacking
8+
9+
When stacking solo using the `stack-stx` function, your STX tokens are locked for a fixed period (the lock period) defined when you initiated stacking. **No additional action is required to stop stacking.** Simply wait until the lock period expires.
10+
11+
{% hint style="info" %}
12+
In solo stacking, the `stack-stx` function returns an object that includes the `unlock-burn-height`. This is the burn block height at which your tokens will be automatically unlocked.
13+
{% endhint %}
14+
15+
---
16+
17+
## Stopping Pooled Stacking
18+
19+
If you're stacking with a pool (where you delegate your STX via the `delegate-stx` function), the process to stop stacking requires one extra step before the tokens are eventually unlocked.
20+
21+
### Step 1: Revoke Delegation
22+
23+
Before your tokens can be unlocked, you must cancel the delegation with the pool operator. This is done by calling the `revoke-delegate-stx` function through the pool's interface, or within the [pox-4](https://explorer.hiro.so/txid/SP000000000000000000002Q6VF78.pox-4?chain=mainnet) contract.
24+
25+
<details>
26+
27+
<summary>Function source code</summary>
28+
29+
```clojure
30+
;; Revokes the delegation to the current stacking pool.
31+
;; New in pox-4: Fails if the delegation was already revoked.
32+
;; Returns the last delegation state.
33+
(define-public (revoke-delegate-stx)
34+
(let ((last-delegation-state (get-check-delegation tx-sender)))
35+
;; must be called directly by the tx-sender or by an allowed contract-caller
36+
(asserts! (check-caller-allowed)
37+
(err ERR_STACKING_PERMISSION_DENIED))
38+
(asserts! (is-some last-delegation-state) (err ERR_DELEGATION_ALREADY_REVOKED))
39+
(asserts! (map-delete delegation-state { stacker: tx-sender }) (err ERR_DELEGATION_ALREADY_REVOKED))
40+
(ok last-delegation-state)))
41+
```
42+
43+
</details>
44+
45+
Calling `revoke-delegate-stx` cancels your STX delegation, revoking the pool's access to further lock/stack your funds. Even after revoking the delegation, your STX will remain locked until the end of the last stacking cycle chosen by the pool.
46+
47+
{% hint style="warning" %}
48+
Failing to revoke your delegation will mean that you continue to allow the pool to stack your STX until the reach of the burn block height mentioned in the delegate function (`delegate-stx`). Ensure that you have successfully called `revoke-delegate-stx` if you want to stop stacking sooner.
49+
{% endhint %}
50+
51+
### Step 2: Wait for Funds to Unlock
52+
After revoking your delegation, your STX tokens will still remain locked until the last stacking cycle chosen by the pool completes. The unlock occurs automatically at the predefined unlock burn height for that cycle.
53+
54+
{% hint style="info" %}
55+
Even in pooled stacking, the unlocking mechanism follows the same blockchain timing as solo stacking. Revoking delegation only stops future stacking actions, it does not immediately unlock your tokens.
56+
{% endhint %}
57+
58+
## Considerations
59+
- Monitor Your Stacking Status: Use your wallet's interface or the [Hiro Explorer](https://explorer.hiro.so?chain=mainnet) to track the status of your lock period and confirm when your tokens are available.
60+
- Plan Ahead: Since the unlocking is bound to cycle's timing, plan your stacking period or revocation accordingly to minimize delays in accessing your funds.

0 commit comments

Comments
 (0)