Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Each skill is a self-contained directory with a `SKILL.md` (used by Claude Code
| [defi-portfolio-scanner](./defi-portfolio-scanner/) | `defi-portfolio-scanner/defi-portfolio-scanner.ts` | Cross-protocol DeFi position aggregator — scans Bitflow HODLMM, Zest Protocol, ALEX DEX, and Styx Bridge for a given STX address; produces a risk-scored portfolio summary with USD estimates. Mainnet-only. |
| [zest-auto-repay](./zest-auto-repay/) | `zest-auto-repay/zest-auto-repay.ts` | Autonomous Zest Protocol LTV guardian — monitors borrowing positions, detects liquidation risk, and executes safe repayments with enforced spend limits to protect collateral on Stacks mainnet. |
| [hodlmm-move-liquidity](./hodlmm-move-liquidity/) | `hodlmm-move-liquidity/hodlmm-move-liquidity.ts` | HODLMM Move-Liquidity & Auto-Rebalancer — withdraw from drifted bins, re-deposit around the current active bin, and run an autonomous monitoring loop that keeps LP capital earning 24/7. Mainnet-only. |
| [stacking](./stacking/) | `stacking/stacking.ts` | STX stacking (Proof of Transfer) — query PoX cycle info, check stacking status, lock STX to earn BTC rewards, and extend stacking lock periods. |
| [stacking](./stacking/) | `stacking/stacking.ts` | PoX-5 STX staking — cycle state and staking status, signer managers, stake / update / unstake STX, and sBTC reward claims. |
| [stacks-market](./stacks-market/) | `stacks-market/stacks-market.ts` | Prediction market trading on stacksmarket.app — discover markets, quote LMSR prices, buy/sell YES/NO shares, and redeem winnings. Mainnet-only. |
| [stacking-lottery](./stacking-lottery/) | `stacking-lottery/stacking-lottery.ts` | Stacking lottery pots on stackspot.app — pool STX into pots that get stacked via PoX, VRF picks a random winner for sBTC rewards, and all participants get their STX back. Mainnet-only. |
| [stackspot](./stackspot/) | `stackspot/stackspot.ts` | Stacking lottery pots on stackspot.app — pool STX into pots that get stacked via PoX, VRF picks a random winner for sBTC rewards, everyone gets STX back. Mainnet-only. |
Expand Down
17 changes: 9 additions & 8 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
"@scure/bip32": "^1.6.2",
"@scure/bip39": "^2.0.1",
"@scure/btc-signer": "^2.0.1",
"@stacks/common": "^7.3.1",
"@stacks/encryption": "^7.3.1",
"@stacks/network": "^7.3.1",
"@stacks/transactions": "^7.3.1",
"@stacks/common": "^7.6.0",
"@stacks/encryption": "^7.6.0",
"@stacks/network": "^7.6.0",
"@stacks/transactions": "^7.6.0",
"@stacks/wallet-sdk": "^7.2.0",
"alex-sdk": "^3.2.1",
"axios": "^1.13.2",
Expand Down
4 changes: 2 additions & 2 deletions pillar/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ Options:

#### direct-stack-stx

Stack STX via Fast Pool or Stacking DAO. Agent-signed, no browser needed.
Stack STX via Fast Pool or Stacking DAO. Agent-signed, no browser needed. The Fast Pool path goes through pox-4 in the Pillar wallet contract and is refused while pox-4 is not the active PoX contract (PoX-5 is live on mainnet); use the `stacking` skill for PoX-5 staking.

```
bun run pillar/pillar-direct.ts direct-stack-stx --stx-amount <microStx> --pool fast-pool|stacking-dao
Expand All @@ -433,7 +433,7 @@ Options:

#### direct-revoke-fast-pool

Revoke Fast Pool STX delegation. Agent-signed, no browser needed.
Revoke Fast Pool STX delegation. Agent-signed, no browser needed. Refused while pox-4 is not the active PoX contract (it calls pox-4 `revoke-delegate-stx`).

```
bun run pillar/pillar-direct.ts direct-revoke-fast-pool
Expand Down
34 changes: 31 additions & 3 deletions pillar/pillar-direct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1439,19 +1439,40 @@ program
// direct-stack-stx
// ---------------------------------------------------------------------------

/**
* The Pillar smart wallet's Fast Pool functions are hardcoded to pox-4
* (`pox-4.allow-contract-caller` + `pox4-fast-pool-v3.delegate-stx`, and
* `pox-4.revoke-delegate-stx`). Once PoX has moved past pox-4 those calls abort
* on chain, so refuse before signing instead of burning gas on a sure failure.
* Mirrors aibtcdev/aibtc-mcp-server#682.
*/
async function assertFastPoolPoxActive(action: string): Promise<void> {
const pox = await getHiroApi(NETWORK).getPoxInfo();
if (!pox.contract_id.endsWith(".pox-4")) {
throw new Error(
`${action} is unavailable: the Pillar smart wallet's Fast Pool path calls pox-4, but the ` +
`active PoX contract is ${pox.contract_id}, so the transaction would abort on chain. ` +
`This needs a Pillar wallet contract update. For STX staking on PoX-5, use ` +
`bun run stacking/stacking.ts stack-stx with a signer manager (see list-signers).`
);
}
}

program
.command("direct-stack-stx")
.description(
"Stack STX from your Pillar smart wallet via Fast Pool or Stacking DAO. " +
"Agent-signed, no browser needed. Backend sponsors gas."
"Agent-signed, no browser needed. Backend sponsors gas. " +
"Fast Pool goes through pox-4 and is refused while pox-4 is not the active PoX contract " +
"(PoX-5 is live; use the stacking skill for PoX-5 staking)."
)
.requiredOption(
"--stx-amount <microStx>",
"Amount of STX in micro-STX (1 STX = 1,000,000)"
)
.requiredOption(
"--pool <pool>",
"Stacking pool: fast-pool (delegates to pox4-fast-pool-v3) or stacking-dao (deposits for stSTX)"
"Stacking pool: fast-pool (delegates to pox4-fast-pool-v3; refused while pox-4 is not active) or stacking-dao (deposits for stSTX)"
)
.action(async (opts: { stxAmount: string; pool: string }) => {
try {
Expand All @@ -1466,6 +1487,10 @@ program
throw new Error(`--pool must be one of: ${validPools.join(", ")}`);
}

if (opts.pool === "fast-pool") {
await assertFastPoolPoxActive("Fast Pool stacking");
}

const stxAmount = parseInt(opts.stxAmount, 10);

const { keyService, session } = await requireActiveKey();
Expand Down Expand Up @@ -1524,7 +1549,8 @@ program
program
.command("direct-revoke-fast-pool")
.description(
"Revoke Fast Pool STX delegation from your Pillar smart wallet. " +
"Revoke Fast Pool STX delegation from your Pillar smart wallet (pox-4 revoke-delegate-stx; " +
"refused while pox-4 is not the active PoX contract). " +
"Agent-signed, no browser needed. STX stays locked until current PoX cycle ends."
)
.action(async () => {
Expand All @@ -1535,6 +1561,8 @@ program
return;
}

await assertFastPoolPoxActive("Revoking Fast Pool");

const { keyService, session } = await requireActiveKey();
const authId = generateAuthId();

Expand Down
16 changes: 12 additions & 4 deletions skills.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "0.43.1",
"generated": "2026-10-08T09:03:52.107Z",
"generated": "2026-10-08T11:51:32.921Z",
"skills": [
{
"name": "agent-lookup",
Expand Down Expand Up @@ -2379,13 +2379,17 @@
},
{
"name": "stacking",
"description": "STX stacking operations on Stacks — query PoX cycle info, check stacking status, lock STX to earn BTC rewards (stack-stx), and extend an existing stacking lock period. Write operations require an unlocked wallet.",
"description": "PoX-5 STX staking on Stacks — query cycle state and staking status, list signer managers, stake / update / unstake STX with a signer manager, and check or claim sBTC rewards. Write operations require an unlocked wallet.",
"entry": "stacking/stacking.ts",
"arguments": [
"get-pox-info",
"get-stacking-status",
"list-signers",
"stack-stx",
"extend-stacking"
"extend-stacking",
"unstake-stx",
"get-rewards",
"claim-rewards"
],
"requires": [
"wallet"
Expand All @@ -2401,8 +2405,12 @@
"mcpTools": [
"get_pox_info",
"get_stacking_status",
"list_stacking_signers",
"stack_stx",
"extend_stacking"
"extend_stacking",
"unstake_stx",
"get_stacking_rewards",
"claim_stacking_rewards"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/lib/config/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const MAINNET_CONTRACTS = {
BNS: "SP000000000000000000002Q6VF78.bns",

// Stacking
POX_4: "SP000000000000000000002Q6VF78.pox-4",
POX_5: "SP000000000000000000002Q6VF78.pox-5",

// ALEX DEX (SDK handles most operations, but we need pool contract for queries)
ALEX_AMM_POOL: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.amm-swap-pool-v1-1",
Expand Down Expand Up @@ -166,7 +166,7 @@ export const TESTNET_CONTRACTS = {
BNS: "ST000000000000000000002AMW42H.bns",

// Stacking
POX_4: "ST000000000000000000002AMW42H.pox-4",
POX_5: "ST000000000000000000002AMW42H.pox-5",

// ERC-8004 Identity & Reputation
IDENTITY_REGISTRY: "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.identity-registry-v2",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/services/hiro-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ export interface MempoolTransaction {

export interface PoxInfo {
contract_id: string;
/** sBTC token contract pox-5 pays rewards in (not always the network's default sBTC). */
pox_5_sbtc_contract?: string;
pox_activation_threshold_ustx: number;
first_burnchain_block_height: number;
current_burnchain_block_height: number;
Expand Down
Loading
Loading