简介
基于 Uniswap 的全自动代币交易技能,智能路由 V2/V3/V4,内置安全检查与交易模拟,保障 DeFi 交易安全高效。
原始描述
Execute a Uniswap token swap. Use when user wants to swap, trade, buy, or sell tokens. Handles quotes, safety checks, simulation, and execution autonomously. Supports V2, V3, V4, UniswapX, and cross-chain routing on all supported chains.
中文使用说明 来自收录源
核心用法
Execute Swap 是一个纯 Markdown 文档型 Skill,用于在 Uniswap 协议上执行代币兑换交易。用户通过自然语言指令(如"Swap USDC for ETH")即可触发完整的交易流程。
工作流程:
- 输入解析:提取代币符号(tokenIn/tokenOut)、金额、链网络、滑点容忍度等参数
- 安全预检:调用
check_safety_status验证支出限额、速率限制和熔断器状态 - 委托执行:通过
Task(subagent_type:trade-executor)子代理执行实际交易 - 结果反馈:以结构化格式返回交易哈希、输入/输出金额、价格、价格影响和 Gas 费用
技术特性:
- 支持 Uniswap V2/V3/V4、UniswapX 及跨链路由
- 自动代币符号解析(通过
search_tokensMCP 工具) - 链上模拟执行与多重安全检查
- 清晰的错误分类处理(限额超限、代币未授权、流动性不足等)
显著优点
| 优势 | 说明 |
|---|---|
| 零本地代码风险 | 纯 Markdown 配置,无可执行代码,消除传统代码注入漏洞 |
| 模块化架构 | 核心逻辑委托给 MCP 工具和子代理,职责分离清晰 |
| 内置安全机制 | 多层防护:支出限额、代币白名单、交易模拟、熔断保护 |
| 透明可追溯 | 所有操作通过区块链浏览器链接(如 basescan.org)公开验证 |
| 多版本兼容 | 自动选择最优路由协议(V2/V3/V4/UniswapX) |
潜在局限
- 外部依赖单一性:功能完全依赖
Agentic-UniswapMCP 服务器,若服务不可用则 Skill 失效 - 无本地降级机制:缺乏 MCP 不可用时的备选执行路径
- 风险提示不足:文档中未充分披露智能合约风险、无常损失、MEV 攻击等 DeFi 特有风险
- 大额交易无二次确认:当前设计未对高价值交易设置额外人工确认步骤
适合人群
- DeFi 活跃用户:熟悉 Uniswap 生态,需要自动化交易执行
- 多链操作者:需要跨以太坊、Base 等网络进行代币兑换
- 安全意识较强的用户:重视内置安全检查与限额控制机制
- 开发者/Agent 构建者:需要将代币交换能力集成到自动化工作流中
不适合:加密货币完全新手(缺乏充足的风险教育)、对托管型服务敏感的用户(依赖第三方 MCP 服务器)
常规风险
| 风险类别 | 具体描述 | 缓解措施 |
|---|---|---|
| 智能合约风险 | Uniswap 合约或代币合约存在漏洞可能 | 依赖 Uniswap 官方审计合约,Skill 提供 check_safety_status 预检 |
| 价格滑点风险 | 大额交易导致价格大幅偏离预期 | 默认 0.5% 滑点保护,可自定义 |
| MEV 攻击风险 | 交易可能被三明治攻击 | 依赖 UniswapX 等抗 MEV 路由选项 |
| MCP 服务风险 | 第三方服务器故障或恶意行为 | 来源为 GitHub 开源项目,可审计 |
| 网络钓鱼风险 | 代币符号解析可能误识别假币 | 建议用户核对代币合约地址 |
技能正文
description: >- Execute a Uniswap token swap. Use when user wants to swap, trade, buy, or sell tokens. Handles quotes, safety checks, simulation, and execution autonomously. Supports V2, V3, V4, UniswapX, and cross-chain routing on all supported chains. allowed-tools: >- Read, Glob, Grep, Task(subagent_type:trade-executor), mcp__uniswap__get_supported_chains, mcp__uniswap__search_tokens, mcp__uniswap__check_safety_status model: opus
Execute Swap
Execute a token swap on Uniswap with full safety validation.
Activation
Use this skill when the user says any of:
- "Swap X for Y"
- "Buy X with Y"
- "Sell X for Y"
- "Trade X for Y"
- "Exchange X to Y"
- "Convert X to Y"
Input Extraction
Extract these parameters from the user's message:
| Parameter | Required | Default | Source |
|---|---|---|---|
tokenIn |
Yes | — | Token name/symbol/address |
tokenOut |
Yes | — | Token name/symbol/address |
amount |
Yes | — | Numeric value |
chain |
No | ethereum | Chain name or context |
slippage |
No | 0.5% | Explicit percentage |
routing |
No | auto | "via V3", "use UniswapX", etc. |
Workflow
-
Validate inputs: Resolve token symbols using
search_tokens. Confirm chain is supported. -
Pre-flight safety check: Call
check_safety_statusto verify:- Spending limits have room for this trade
- Rate limits are not exhausted
- Circuit breaker is not tripped
-
Delegate to trade-executor: Launch
Task(subagent_type:trade-executor)with:- tokenIn, tokenOut, amount, chain
- slippageTolerance (in bps)
- routingPreference (auto/v2/v3/v4/uniswapx)
-
Report result to the user in a clear format:
Swap Executed Successfully
Input: 500.00 USDC
Output: 0.1538 WETH ($499.55)
Price: 1 WETH = $3,248.04
Impact: 0.01%
Gas: $0.42
Tx: https://basescan.org/tx/0xABC...
Safety: All 7 checks passed
Error Handling
| Error | User Message | Suggested Action |
|---|---|---|
SAFETY_SPENDING_LIMIT_EXCEEDED |
"This swap would exceed your $X daily limit." | Reduce amount or wait |
SAFETY_TOKEN_NOT_ALLOWED |
"TOKEN is not on your allowlist." | Add to config |
SAFETY_SIMULATION_FAILED |
"Swap simulation failed: [reason]." | Check addresses, try smaller |
INSUFFICIENT_LIQUIDITY |
"Not enough liquidity at acceptable slippage." | Try smaller amount |
MCP server dependency
This skill relies on Uniswap MCP tools for chain support lookup, token search, safety checks, and swap execution. When used in isolation (for example, from a skills catalog), ensure the Agentic Uniswap MCP server is running:
- Repo:
Agentic-UniswapMCP server - Package:
@agentic-uniswap/mcp-server
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。