gate-exchange-collateralloan
Gate multi-collateral loan management skill. Use when the user asks to borrow crypto against collateral or manage existing loans. Triggers on 'collateral loan', 'current loan', 'fixed loan', 'repay', 'add collateral', 'redeem collateral'.
What this skill does
### Resolving `gate-cli` (binary path)
Resolve **`gate-cli`** in order: **(1)** **`command -v gate-cli`** and **`gate-cli --version`** succeeds; **(2)** **`${HOME}/.local/bin/gate-cli`** if executable; **(3)** **`${HOME}/.openclaw/skills/bin/gate-cli`** if executable. Canonical rules: [`exchange-runtime-rules.md`](https://github.com/gate/gate-skills/blob/master/skills/exchange-runtime-rules.md) §4 (or [`gate-runtime-rules.md`](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md) §4).
# Gate Exchange Multi-Collateral Loan Skill
## 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](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md)
- **Only use the `gate-cli` commands explicitly listed in this skill.** Commands not documented here must NOT be run for these workflows, even if other interfaces expose them.
## Skill Dependencies
### gate-cli commands used
**Query Operations (Read-only)**
- `gate-cli cex mcl current-rate`
- `gate-cli cex mcl fix-rate`
- `gate-cli cex mcl ltv`
- `gate-cli cex mcl order`
- `gate-cli cex mcl orders`
- `gate-cli cex mcl records`
- `gate-cli cex mcl repay-records`
- `gate-cli cex mcl quota`
- `gate-cli cex mcl collateral`
**Execution Operations (Write)**
- `gate-cli cex mcl create`
- `gate-cli cex mcl repay`
### Authentication
- **Interactive file setup:** when **`GATE_API_KEY`** and **`GATE_API_SECRET`** are **not** both set on the host, run **`gate-cli config init`** to complete the wizard for API key, secret, profiles, and defaults (see [gate-cli](https://github.com/gate/gate-cli)).
- **Env / flags:** **`gate-cli config init`** is **not** required when credentials are already supplied — e.g. **both** **`GATE_API_KEY`** and **`GATE_API_SECRET`** set on the host, or **`--api-key`** / **`--api-secret`** where supported — never ask the user to paste secrets into chat.
- **Permissions:** Mcl:Write
- **Portal:** create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage
### Installation Check
- **Required:** `gate-cli` (run `sh ./setup.sh` from this skill directory if missing; optional `GATE_CLI_SETUP_MODE=release`).
- Add `$HOME/.openclaw/skills/bin` to **`PATH`** if you invoke `gate-cli` by name (or the directory where [`setup.sh`](./setup.sh) installs it).
- **Credentials:** When **`GATE_API_KEY`** and **`GATE_API_SECRET`** are both set (non-empty) for the host, **do not** require **`gate-cli config init`** — that is equivalent valid config for `gate-cli`. When **both** are unset or empty, **remind** the operator to run **`gate-cli config init`** **or** to configure **`GATE_API_KEY`** / **`GATE_API_SECRET`** in the **matching skill** from the skill library (never ask the user to paste secrets into chat).
- **Sanity check:** Do not proceed with authenticated calls until the CLI behaves as expected (e.g. **`gate-cli --version`** or a read-only **`gate-cli cex ...`** command from this skill); confirm credentials resolve before mutating operations.
## Execution mode
**Read and strictly follow** [`references/gate-cli.md`](./references/gate-cli.md), then execute this skill's collateral-loan workflow.
- `SKILL.md` keeps routing and product constraints.
- `references/gate-cli.md` is the authoritative `gate-cli` execution contract for quota/LTV pre-checks, confirmation gates, and post-action verification.
## Trigger Conditions
This skill activates when the user asks about multi-collateral loan operations. Classify intent via **Routing Rules** (Cases 1–7). Trigger phrases include: "collateral loan", "current loan", "fixed loan", "repay", "add collateral", "redeem collateral", or equivalent in other languages.
## Workflow
### Step 1: Classify intent
Identify the user intent using Routing Rules (Cases 1–7). If required inputs are missing (order_id, currency, amount, fixed term), ask clarifying questions before proceeding.
### Step 2: Read-only requests (rates, LTV, quota, orders)
Call the corresponding MCP tool when the user asks for rates, LTV, quota, order list, or order detail.
Call `gate-cli cex mcl quota` with:
- `type`: `collateral` or `borrow`
- `currency`: comma-separated (borrow: single currency)
Call `gate-cli cex mcl ltv` with:
- (no params)
Call `gate-cli cex mcl fix-rate` with:
- (no params)
Call `gate-cli cex mcl current-rate` with:
- `currencies`: comma-separated currency list
Call `gate-cli cex mcl orders` with:
- `page`, `limit` (optional)
- `sort` (optional): `time_desc`, `ltv_asc`, `ltv_desc`
- `order_type` (optional): `current` or `fixed`
Call `gate-cli cex mcl order` with:
- `order_id`
Key data to extract:
- LTV thresholds, fixed/current rates, quota rows, order_id, order status, collateral and borrow details
### Step 3: Create loan (current or fixed)
If current loan:
1) Build draft (collateral list + borrow currency/amount).
2) Ask for confirmation.
3) Call `gate-cli cex mcl create` with **`order`**: JSON string (borrow_currency, borrow_amount, collateral_currencies, order_type: current).
If fixed loan:
1) Call `gate-cli cex mcl fix-rate` (returns a **list**); **filter by borrow_currency**; take `rate_7d` or `rate_30d` as **fixed_rate** (hourly rate; pass through unchanged, do not convert or relabel as annual/daily).
2) Build draft with fixed_type and fixed_rate (describe to user as hourly rate if showing).
3) Ask for confirmation.
4) Call `gate-cli cex mcl create` with **`order`**: JSON including order_type: fixed, fixed_type `7d`/`30d`, fixed_rate.
### Step 4: Repay
Build draft, ask confirmation, then call `gate-cli cex mcl repay` with:
- **`repay_loan`**: JSON string with `order_id` and `repay_items` [{ currency, amount, repaid_all }]
### Step 5: Add or redeem collateral
Build draft, ask confirmation, then call `gate-cli cex mcl collateral` with:
- **`collateral_adjust`**: JSON string with `order_id`, `type` (`append` | `redeem`), `collaterals` [{ currency, amount }]
## Judgment Logic Summary
- Determine case by keywords and required inputs (loan create / repay / add / redeem / list).
- Fixed loan requires fix_rate lookup; if not available, stop and inform user.
- All write operations must be confirmed before calling MCP.
- Auth failure (401/403) prompts API key configuration.
## Report Template
**When asking for confirmation**:
Draft:
- Type: {current|fixed|repay|append|redeem}
- Order ID: {order_id if applicable}
- Borrow: {borrow_amount} {borrow_currency}
- Collateral: {collateral_amounts}
- Fixed term/rate: {fixed_type} / {fixed_rate} (hourly rate)
Please confirm to proceed.
**On success**:
- Summary of action and key identifiers (order_id, amounts).
**On failure**:
- Error message and next-step guidance (e.g., check currency/amount/LTV).
## Prerequisites
- **MCP Dependency**: Requires [gate-mcp](https://github.com/gate/gate-mcp) to be installed.
- **Authentication**: Order list, detail, repay, collateral, quota, and records require API key; LTV, fix rate, and current rate are public without key.
- **Disclaimer**: Loan and LTV information is for reference only and does not constitute investment advice. Understand product terms and liquidation risk before borrowing.
## Available MCP Tools
| Tool | Auth | Description | Reference |
|------|------|-------------|-----------|
| `gate-cli cex mcl fix-rate` | No | 7d/30d fixed rates (list) | `references/mcl-mcp-tools.md` |
| `gate-cli cex mcl ltv` | No | LTV thresholds | `references/mcl-mcp-tools.md` |
| `gate-cli cex mcl current-rate` | No | Current rates | `references/mcl-mcp-tools.md` |
| `gate-cli cex mcl quota` | Yes | Borrow/collateral quota | `references/mcl-mcp-tools.md` |
| `gate-cli cex mcl create` | Yes | Create loan (`order` JSON) | `references/mcl-mcp-tools.md` |
| `gate-cli cex mcl orders` | Yes | List orders | `references/mcl-mcp-tools.md` |
| `gRelated in Web3
xaut-trade
IncludedBuy or sell XAUT (Tether Gold) on Ethereum. Supports market orders (Uniswap V3) and limit orders (UniswapX). Wallet modes: Foundry keystore or WDK. Delegates non-XAUT intents to registered skills (e.g. Polymarket prediction markets, Hyperliquid trading). Triggers: buy XAUT, XAUT trade, swap USDT for XAUT, sell XAUT, swap XAUT for USDT, limit order, limit buy XAUT, limit sell XAUT, check limit order, cancel limit order, XAUT when, create wallet, setup wallet, polymarket, prediction market, bet on, odds on, hyperliquid, perp, perpetual, long, short, open long, open short, close position, leverage.
qfc-openclaw-skill
IncludedQFC blockchain interaction — wallet, faucet, chain queries, staking, epoch & finality, AI inference
gate-dex-trade
IncludedExecutes on-chain token swaps via Gate DEX. Use when user wants to swap, buy, sell, exchange, or convert tokens, or bridge cross-chain. Covers full swap flow: price quotes, transaction build, signing, and submission. Do NOT use for read-only data lookups or wallet account management.
hunch
IncludedDiscover, bet on, track, and settle Hunch prediction markets in natural language. Trigger when a user wants to bet, take a position, or get odds on a crypto outcome — token market-cap milestones and flips, launchpad races (Bankr vs pump.fun volume / #1-days / launches over a cap), token head-to-head outperformance, mcap strike-ladders, and up/down price rounds. Also trigger on "what can I bet on about $TOKEN", "odds on …", "take YES/NO on …", "show my Hunch bets", "did my market resolve". Settles in USDC on Base via x402 (≤ $10 / bet); every bet returns an on-chain proof.
opensea
IncludedQuery NFT data, trade on the Seaport marketplace, and swap ERC20 tokens across Ethereum, Base, Arbitrum, Optimism, Polygon, and more.
polymarket
IncludedTrade on Polymarket prediction markets (CLOB V2) from a Privy EOA wallet. Search markets, place/cancel orders, manage positions. No private key handling. Use when the user wants to bet on event outcomes (e.g. "buy YES at 0.65 on the ceasefire market", "what are my open positions", "close my Trump bet").