jingswap-cycle-agent
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesejingswap-cycle-agent
JingSwap周期监控Agent
What it does
功能介绍
Monitors the active JingSwap cycle and evaluates whether the Pyth oracle settlement rate offers a favourable sBTC acquisition opportunity relative to live DEX prices.
| Data source | What it reads | Why it matters |
|---|---|---|
| Cycle ID, phase, blocks elapsed, deposits, minimums | Is the cycle in deposit phase? Is sBTC available? |
| Pyth Hermes oracle | BTC/USD and STX/USD live prices | Computes oracle STX/sBTC settlement rate |
| DLMM pool price (1e10 / raw) | Best DEX rate for comparison |
| XYK pool price (raw / 1e8) | Secondary DEX rate cross-check |
JingSwap settles at the Pyth oracle rate, not the DEX rate. When oracle < DEX, depositing STX acquires sBTC cheaper than buying on-market — the arbitrage window. This skill quantifies that spread in real time.
监控JingSwap的活跃周期,评估Pyth预言机结算率相对于实时DEX价格是否提供了有利的sBTC获取机会。
| 数据来源 | 读取内容 | 重要性 |
|---|---|---|
| 周期ID、阶段、已过区块数、存款金额、最低要求 | 当前周期是否处于存款阶段?是否有sBTC可获取? |
| Pyth Hermes预言机 | BTC/USD和STX/USD实时价格 | 计算预言机STX/sBTC结算率 |
| DLMM池价格(1e10 / 原始值) | 用于对比的最佳DEX汇率 |
| XYK池价格(原始值 / 1e8) | 次要DEX汇率交叉验证 |
JingSwap以Pyth预言机汇率结算,而非DEX汇率。当预言机汇率低于DEX汇率时,存入STX获取sBTC的成本低于在市场上直接购买——这就是套利窗口。本技能可实时量化该价差。
Why agents need it
为什么Agent需要它
JingSwap's API () requires an . This skill bypasses it entirely by reading the Stacks contract directly via the public Hiro read-only endpoint. No credentials needed.
faktory-dao-backend.vercel.appx-api-keyThe command distils the cycle state + two price sources into a single field — agents don't need to know the contract encoding or Pyth feed IDs.
analyzeactionJingSwap的API()需要。本技能通过公共Hiro只读端点直接读取Stacks合约,完全绕过了该API,无需任何凭证。
faktory-dao-backend.vercel.appx-api-keyanalyzeactionSafety notes
安全说明
- Read-only for ,
doctor,status— no wallet required.analyze - (without
participate) outputs a--dry-runJSON payload — parent agent must confirm before callingDEPOSIT_READY.jingswap_deposit_stx - Mainnet only — JingSwap v2 contract is mainnet-only.
- Always uses live contract reads — never caches cycle state.
- 、
doctor、status命令为只读操作——无需钱包。analyze - (不带
participate参数)会输出--dry-runJSON负载——父Agent必须确认后才能调用DEPOSIT_READY。jingswap_deposit_stx - 仅支持主网——JingSwap v2合约仅部署在主网。
- 始终使用实时合约读取——从不缓存周期状态。
Commands
命令
doctor
doctor命令
Checks Hiro contract API and Pyth Hermes connectivity.
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts doctorOutput:
json
{
"result": "ready",
"checks": {
"hiro_contract_api": "ok",
"pyth_hermes_api": "ok"
},
"contract": "SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2"
}检查Hiro合约API和Pyth Hermes的连通性。
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts doctor输出:
json
{
"result": "ready",
"checks": {
"hiro_contract_api": "ok",
"pyth_hermes_api": "ok"
},
"contract": "SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2"
}status
status命令
Fetches full cycle state + price snapshot.
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts statusOutput:
json
{
"skill": "jingswap-cycle-agent",
"timestamp": "2026-03-29T15:22:18.792Z",
"contract": "SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2",
"cycle": {
"id": 9,
"phase": "deposit",
"blocks_elapsed": 191,
"sbtc_deposited": "0.01929494 sBTC",
"stx_deposited": "0.00 STX",
"min_stx_deposit": "1.00 STX",
"min_sbtc_deposit": "0.00001000 sBTC"
},
"prices": {
"btc_usd": "66488.42",
"stx_usd": "0.216440",
"oracle_stx_per_sbtc": "307191.64",
"dex_stx_per_sbtc_dlmm": "305922.66",
"dex_stx_per_sbtc_xyk": "305306.01",
"oracle_vs_dex_discount_pct": "-0.394"
},
"summary": "Cycle 9 in deposit phase. Oracle 0.39% MORE EXPENSIVE than DEX."
}获取完整周期状态与价格快照。
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts status输出:
json
{
"skill": "jingswap-cycle-agent",
"timestamp": "2026-03-29T15:22:18.792Z",
"contract": "SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2",
"cycle": {
"id": 9,
"phase": "deposit",
"blocks_elapsed": 191,
"sbtc_deposited": "0.01929494 sBTC",
"stx_deposited": "0.00 STX",
"min_stx_deposit": "1.00 STX",
"min_sbtc_deposit": "0.00001000 sBTC"
},
"prices": {
"btc_usd": "66488.42",
"stx_usd": "0.216440",
"oracle_stx_per_sbtc": "307191.64",
"dex_stx_per_sbtc_dlmm": "305922.66",
"dex_stx_per_sbtc_xyk": "305306.01",
"oracle_vs_dex_discount_pct": "-0.394"
},
"summary": "Cycle 9 in deposit phase. Oracle 0.39% MORE EXPENSIVE than DEX."
}analyze
analyze命令
Evaluates whether the current cycle offers a favourable entry.
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts analyze
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts analyze --min-discount 2.0Options:
- (default:
--min-discount <pct>) — minimum oracle discount vs DEX to trigger PARTICIPATE1.0
Output:
json
{
"skill": "jingswap-cycle-agent",
"timestamp": "2026-03-29T15:22:27.573Z",
"contract": "SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2",
"input": { "min_discount_pct": 1 },
"cycle": {
"id": 9,
"phase": "deposit",
"sbtc_available": "0.01929494 sBTC",
"stx_deposited": "0.00 STX"
},
"pricing": {
"oracle_stx_per_sbtc": "307148.46",
"dex_stx_per_sbtc": "305922.66",
"discount_pct": "-0.401"
},
"action": "MONITOR",
"confidence": "high",
"is_favourable": false,
"rationale": "Oracle rate (307148 STX/sBTC) is 0.40% MORE expensive than DEX (305923 STX/sBTC). Spread does not meet minimum discount threshold of 1%.",
"summary": "MONITOR (high confidence) — cycle 9 (deposit), oracle 0.40% premium vs DEX."
}评估当前周期是否提供有利的参与机会。
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts analyze
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts analyze --min-discount 2.0选项:
- (默认值:
--min-discount <pct>)——触发PARTICIPATE指令所需的预言机相对DEX的最低折扣率1.0
输出:
json
{
"skill": "jingswap-cycle-agent",
"timestamp": "2026-03-29T15:22:27.573Z",
"contract": "SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2",
"input": { "min_discount_pct": 1 },
"cycle": {
"id": 9,
"phase": "deposit",
"sbtc_available": "0.01929494 sBTC",
"stx_deposited": "0.00 STX"
},
"pricing": {
"oracle_stx_per_sbtc": "307148.46",
"dex_stx_per_sbtc": "305922.66",
"discount_pct": "-0.401"
},
"action": "MONITOR",
"confidence": "high",
"is_favourable": false,
"rationale": "Oracle rate (307148 STX/sBTC) is 0.40% MORE expensive than DEX (305923 STX/sBTC). Spread does not meet minimum discount threshold of 1%.",
"summary": "MONITOR (high confidence) — cycle 9 (deposit), oracle 0.40% premium vs DEX."
}participate
participate命令
Evaluates opportunity and (if favourable) prepares deposit parameters for parent agent execution.
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts participate --amount-stx 100
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts participate --amount-stx 100 --min-discount 2.0 --dry-runOptions:
- (required) — STX amount to deposit
--amount-stx <amount> - (default:
--min-discount <pct>) — minimum discount required to proceed1.0 - — analyse only, do not output execution payload
--dry-run
When favourable, outputs:
json
{
"skill": "jingswap-cycle-agent",
"action": "DEPOSIT_READY",
"deposit_params": {
"amount_stx": 100,
"amount_micro_stx": 100000000,
"market": "sbtc-stx",
"cycle": 9
},
"instruction": "Parent agent: call jingswap_deposit_stx with amount=100000000 and market=sbtc-stx to execute this deposit. Confirm before proceeding."
}评估机会,若有利则为父Agent准备存款参数以执行操作。
bash
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts participate --amount-stx 100
bun run jingswap-cycle-agent/jingswap-cycle-agent.ts participate --amount-stx 100 --min-discount 2.0 --dry-run选项:
- (必填)——要存入的STX金额
--amount-stx <amount> - (默认值:
--min-discount <pct>)——执行操作所需的最低折扣率1.0 - ——仅分析,不输出执行负载
--dry-run
当机会有利时,输出:
json
{
"skill": "jingswap-cycle-agent",
"action": "DEPOSIT_READY",
"deposit_params": {
"amount_stx": 100,
"amount_micro_stx": 100000000,
"market": "sbtc-stx",
"cycle": 9
},
"instruction": "Parent agent: call jingswap_deposit_stx with amount=100000000 and market=sbtc-stx to execute this deposit. Confirm before proceeding."
}Action values
指令值说明
| Action | Meaning |
|---|---|
| Oracle < DEX by ≥ min-discount — deposit STX to acquire sBTC below market |
| Spread present but below threshold — watch and retry |
| Cycle is in buffer or settle phase — deposits closed |
| No sBTC deposited in current cycle — nothing to acquire |
Confidence:
- — discount ≥ 2% or clearly unfavourable
high - — discount 1–2%
medium - — borderline
low
| 指令 | 含义 |
|---|---|
| 预言机汇率比DEX汇率低≥最低折扣率——存入STX以低于市场价格获取sBTC |
| 存在价差但未达到阈值——持续观察并重试 |
| 周期处于缓冲或结算阶段——存款已关闭 |
| 当前周期无sBTC存入——无可获取的sBTC |
置信度:
- ——折扣≥2%或明显无利可图
high - ——折扣1–2%
medium - ——临界状态
low
Technical notes
技术说明
- Contract: (v2, current; v1 was on cycle 5)
SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2 - DLMM price formula: (contract stores inverse ratio)
STX/sBTC = 1e10 / dlmmRaw - XYK price formula: (contract stores direct ratio with 1e8 scale)
STX/sBTC = xykRaw / 1e8 - Oracle price: Pyth Hermes
BTC/USD ÷ STX/USD = STX/sBTC - No API key required for any data source
- All Hiro reads use sender (burn address, valid for read-only calls)
SP000000000000000000002Q6VF78
- 合约:(v2,当前版本;v1用于周期5)
SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.sbtc-stx-jing-v2 - DLMM价格公式:(合约存储反比)
STX/sBTC = 1e10 / dlmmRaw - XYK价格公式:(合约存储带1e8缩放的正比)
STX/sBTC = xykRaw / 1e8 - 预言机价格:Pyth Hermes
BTC/USD ÷ STX/USD = STX/sBTC - 所有数据源均无需API密钥
- 所有Hiro读取操作使用发送方(销毁地址,适用于只读调用)
SP000000000000000000002Q6VF78
Output contract
输出约定
All outputs are JSON to stdout.
Error:
json
{ "error": "descriptive message" }所有输出均为JSON格式并输出至标准输出。
错误输出:
json
{ "error": "descriptive message" }Origin
起源
Winner of AIBTC x Bitflow Skills Pay the Bills competition.
Original author: @teflonmusk
Competition PR: https://github.com/BitflowFinance/bff-skills/pull/78
AIBTC x Bitflow Skills Pay the Bills竞赛获胜作品。
原作者:@teflonmusk
竞赛PR:https://github.com/BitflowFinance/bff-skills/pull/78