Gate staking

From jiayaoqijia/cryptoskill · View interactive version

Gate staking is an AI agent skill from the GitHub repository jiayaoqijia/cryptoskill. Gate on-chain staking skill. Use when the user asks to stake POS coins, mint, or redeem staked assets. Triggers on 'staking', 'stake ETH', 'redeem staking', 'staking rewards'.

How to use this skill

Skill file

Gate Staking Query Suite

General Rules

⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding.

Do NOT select or call any tool until all rules are read. These rules have the highest priority.

→ Read gate-runtime-rules.md

exist in the MCP server.


MCP Dependencies

Required MCP Servers

| MCP Server | Status |

|------------|--------|

| Gate (main) | ✅ Required |

MCP Tools Used

Query Operations (Read-only)

Execution Operations (Write)

Authentication

Installation Check

MCP Mode

Read and strictly follow CODE0, then execute this skill's staking workflow.

Module overview

| Module | Description | Trigger keywords |

|--------|-------------|------------------|

| Positions | Query staking positions, balances, available vs locked | position, balance, staked, staking assets, holdings, redeemable |

| Rewards | Query reward history, yesterday/monthly earnings | reward, earning, profit, income, yesterday earnings, monthly earnings |

| Products | Discover available staking products, APY, min amount | products, available, APY, stakeable coins, high yield, flexible |

| Order history | Query stake/redeem order list and pagination | history, orders, transactions, staking records, redemption records |

| Stake / Redeem | Execute stake or redeem via swap (pid required) | stake, redeem, unstake, stake 100 USDT, redeem my ETH, swap staking |

Mint: Treated as immediate stake. Route to the same Stake workflow: read references/staking-swap.md, resolve product (pid) and amount, then call cex_earn_swap_staking_coin with side=0. For GUSD products, require the user to choose USDT or USDC and pass coin.

Cancel redeem (not supported): When the user intends to cancel or revoke a redeem (e.g. cancel a redemption order already submitted), do not call any tool. Reply in English that this operation is not supported.

Domain Knowledge

Product types

| productType | Label | Description |

|-------------|-------|-------------|

| 0 | Certificate | Flexible staking with instant redemption (redeemPeriod = 0) |

| 1 | Lock-up | Fixed-term staking with a defined lock period (redeemPeriod > 0) |

| 2 | US Treasury Bond | Products backed by US Treasury bonds (e.g. GUSD). Users stake crypto and receive yield derived from US Treasury interest rates. Typically has a fixed or semi-fixed APR with low risk. |

Redeemable amount calculation

The redeemable amount for a position is not mortgage_amount − freeze_amount. The correct formula is:

redeemable = mortgage_amount × exchangeRate

Where exchangeRate comes from cex_earn_find_coin for the same pid and matching currency. Some products have exchangeRate = 1 (e.g. USDT flexible), while others vary (e.g. liquid staking tokens).

Dynamic exchange rate (exchangeRate ≠ 1)

When a product’s exchange rate is not equal to 1, it is a dynamic-rate product. In stake/redeem response data (swap result or order list): amount = staked/redeemed base coin quantity; exchangeAmount (or exchange_amount) = received quote/reward coin quantity.

Display rule (English only):

When exchangeRate = 1, either field may be omitted or shown as equal; prefer showing the single amount.

Reward distribution

GUSD / multi-currency products (USDT or USDC)

When staking, redeeming, or minting GUSD (or any product whose currency or mortgage_coin is "USDT,USDC"):

Positions: status field

When viewing staking positions (position/balance/holdings queries), ignore and do not display the status field. Omit it from all user-facing position output.

Timestamps in results

Do not display or format timestamp-related fields in any result. Omit from user-facing output all timestamp fields (e.g. createStamp, redeem_stamp, updateStamp, should_bonus_stamp). Do not convert timestamps to dates, times, or relative time (e.g. no "YYYY-MM-DD", "HH:mm", "2 hours ago"). If a field is purely timestamp-based, do not show it.

Number formatting

| Category | Precision | Trailing zeros | Examples |

|----------|-----------|----------------|----------|

| General amounts (mortgage_amount, freeze_amount, income_total, fee, etc.) | 8 decimals | Removed | 1.23 not 1.23000000; 100 not 100.00000000 |

| Rate fields (estimateApr, APY, APR, exchangeRate) | 2 decimals | Retained | 5.20% not 5.2%; 8.00% not 8% |

Routing rules

| Intent | Example phrases | Route to |

|--------|-----------------|----------|

| Positions | "Show my staking positions", "Check my staking assets", "What can I unstake?" | Read references/staking-assets.md |

| Rewards | "Staking rewards", "Yesterday's earnings", "Monthly earnings", "Earning records" | Read references/staking-list.md (Part 2: Reward List) |

| Products | "Available staking", "Stakeable coins", "Best APY", "Flexible only" | Read references/staking-coins.md |

| Order history | "Staking history", "Staking records", "Show redemptions", "Recent activity" | Read references/staking-list.md (Part 1: Order List) |

| Stake / Redeem | "Stake 1 BTC", "Stake 100 USDT", "Redeem my ETH", "redeem", "I want to stake", "unstake", "help me redeem" | Read references/staking-swap.md; use cex_earn_swap_staking_coin with pid required, side=0 (stake) or side=1 (redeem); before stake get product list, if multiple protocols for same coin ask user to confirm |

| Mint | "mint", "I want to mint", "Mint", "mint GT", "help me mint" | Same as Stake: route to references/staking-swap.md and execute stake (side=0). Mint = immediate stake. For GUSD, require user to choose USDT or USDC and pass coin. |

| Cancel redeem (not supported) | "cancel redeem", "revoke redeem", "undo redeem", "cancel my redemption", "withdraw redeem request" | Do not call tools. Reply in English: Cancelling or revoking a redeem is not supported here; please use the Gate website or app if needed. I can help you query positions or order history. |

| Unclear | "Help with staking", "on-chain earn" | Clarify: positions / rewards / products / history, then route |

Execution

1. Intent and parameters

2. Tool selection

| Module | MCP tool | Required | Optional params |

|--------|----------|----------|-----------------|

| Positions | cex_earn_asset_list | - | coin, pid |

| Rewards | cex_earn_award_list | - | coin, pid, page |

| Products | cex_earn_find_coin | - | cointype |

| Order history | cex_earn_order_list | - | coin, pid, type, page |

| Stake / Redeem | cex_earn_swap_staking_coin | pid | amount, side (0=stake, 1=redeem), coin (GUSD) |

3. Format response

Report template

After each query, output a short standardized result consistent with the reference (e.g. positions summary, reward summary, product table, or order list). Use the exact response fields from the API (see references) so the user sees correct field names and values.

Safety rules

User confirmation requirement (Mandatory)

NEVER call cex_earn_swap_staking_coin without explicit user confirmation. Without user confirmation, only read/query operations are allowed.

Before every stake, redeem, or mint execution:

  1. Show an Action Draft summarizing: operation type (stake/redeem/mint), product (pid + protocolName), coin, amount, side, and key risk note (e.g. lock period, exchange rate).
  2. Wait for explicit user confirmation (e.g. "Confirm", "Yes", "Go ahead").
  3. Only after receiving confirmation in the immediately previous user turn, call cex_earn_swap_staking_coin.
  4. If parameters change after confirmation (amount, pid, coin), invalidate the old confirmation and re-confirm.
  5. If confirmation is ambiguous, stale, or from a different context, do NOT execute — request fresh confirmation.

Stake, redeem, and mint

Errors

| Scenario | Action |

|----------|--------|

| Empty positions (list empty or totalCount 0) | "You don't have any staking positions. Browse available products to start earning." Suggest references/staking-coins.md. |

| No rewards yet | "No rewards found. Rewards typically start accruing 24 hours after staking." Optionally show positions from cex_earn_asset_list. |

| Product not found / no capacity | Suggest alternatives from cex_earn_find_coin() (e.g. by estimateApr). |

| API error / 401 | "Unable to fetch staking data. Please try again later." or "Please log in to view staking data." |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.