Repository navigation
Conversation
pox-5 is the active PoX contract on mainnet (cycle 141+) and removed every pox-4 function the skill called. Port the pox-5 staking implementation from aibtcdev/aibtc-mcp-server#682: - StackingService rebuilt on pox-5: stake / stake-update / unstake with a signer manager, signer-set walk, claim-style detection, and sBTC reward pull + staker claim. Deny-mode post-conditions (staking lock amount, performs-PoX, sBTC only out of pox-5 / the manager). Pre-checks refuse before signing: prepare phase, already/not staking, unregistered signer, balance, 1-96 cycles. - Added over the MCP version: every write confirms pox-5 is still the network's active PoX contract, and a dependency seam replaces module mocks in tests. - CLI: get-pox-info, get-stacking-status, list-signers, stack-stx, extend-stacking, unstake-stx, get-rewards, claim-rewards; strict argument parsing; optional BTC payout calldata. - pillar-direct: Fast Pool stack and revoke refuse while pox-4 is not active (the Pillar wallet contract hardcodes pox-4). - btcAddressToPoxAddr in src/lib/utils/bitcoin.ts; POX_5 replaces POX_4. - @stacks/* bumped to ^7.6.0 for the staking and pox post-condition types. Closes #429. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #429. Skills-side counterpart of aibtcdev/aibtc-mcp-server#682 (part of aibtc-mcp-server#677).
Why
pox-5 has been the active PoX contract on mainnet since cycle 141 and removed every function the stacking skill called. #424 made writes refuse; this adds real pox-5 staking.
What
Ported from aibtc-mcp-server#682, which I checked against mainnet before porting: its
stake,stake-updateandunstakearguments and post-conditions match real successful transactions, and its reward-claim post-conditions match the Xverse signer manager's payout code.get-pox-infoget-pox-info+ burn height: cycle, next cycle start, prepare phaseget-stacking-statusget-staker-info,get-bond-membership, locked/unlocked balancelist-signers(new)stack-stxstake(signer-manager, amount, num-cycles, start-burn-ht, signer-calldata)extend-stackingstake-update: extend, increase, switch signer, change payout calldataunstake-stx(new)unstakeget-rewards(new)claim-rewards(new)claim-staker-rewardsstack-stx/extend-stackingflags change: signer manager instead of a PoX BTC address and burn height. Optional--btc-reward-address(+--max-withdrawal-fee-sats) encodes{pox-addr, max-fee}calldata;--signer-calldata-hexpasses raw calldata.Differences from the MCP version
/v2/poxstill reports pox-5, and refuses before signing otherwise (fail closed if unreadable), keeping fix(stacking): refuse writes when pox-4 is not the active PoX contract; read pox-5 staking status #424's protection for a future PoX bump.StackingServicetakes an optional{ hiro, callContract }for tests, instead of module mocks, which leak across files underbun test.Also
pillar-direct:direct-stack-stx --pool fast-poolanddirect-revoke-fast-poolrefuse while pox-4 is not active (the Pillar wallet contract hardcodes pox-4; the real fix is on Pillar's side). The Stacking DAO path is unchanged.@stacks/*→ ^7.6.0 (staking / pox post-condition types). The lockfile change is limited to those packages.Verification
get-pox-info(cycle 143, prepare phase from 968350);list-signers→ 26 signers for cycle 144 (same as the MCP PR);get-stacking-statusfor a real Xverse staker → 500 STX, unlock burn height 1170050, matching Hiro'sburnchain_unlock_height;get-rewards→ claim stylestaker-arg.src/lib/services/stacking.service.test.ts: the 16 MCP tests ported, plus 2 for the active-contract guard (verified to fail with the guard removed).bun run typecheck,bun run validate;stacking/stacking.tsandpillar/pillar-direct.tstype-checked separately (the repo'stypecheckonly coverssrc/).bun test(Bun 1.4.2): 180 pass / 38 fail vsmain162 / 38. The 38 failures are the existing cross-file mock leak; x402 files pass alone (72/72) on 7.6.0.🤖 Generated with Claude Code