微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🐮

MEV保护的DEX聚合交易助手

cow-swap · vlatest
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
专业技能 安全 S 级 作者 Unknown 公开目录收录
1.1k 下载 400 安装 3.1k 收藏 42.4k 浏览

简介

基于CoW Protocol官方API的MEV保护交易技能,通过批量拍卖机制为用户获取最优价格并分享价格改进盈余,同时透明收取0.5%合作伙伴费用。

原始描述

CoW Swap MEV-protected DEX aggregator. Batch auctions for best execution and surplus sharing.

通过你的 Agent 添加

安装目录:cow-swap/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/cow-swap/
Codex CLI~/.codex/skills/cow-swap/
DeepSeek Harness~/.agents/skills/cow-swap/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

CoW Swap 是基于 CoW Protocol 的 MEV 保护型 DEX 聚合器 Skill,提供完整的链上交易 API 封装。核心流程为:获取报价 → 创建订单 → 监控状态 → 完成结算。用户通过 curl 调用官方 API,支持 Ethereum、Gnosis、Arbitrum、Base 四条链,可采用 sell(精确卖出)或 buy(精确买入)两种订单类型。特色功能包括批量拍卖防 MEV 攻击、Coincidence of Wants(P2P 直接匹配)获取更优汇率,以及价格改进盈余返还机制。订单采用 EIP-712 签名,失败交易零 Gas 成本。

显著优点

  1. MEV 防护领先:批量拍卖机制从协议层消除三明治攻击和抢跑风险,Execution 安全性优于传统 AMM 和聚合器。
  2. 经济激励对齐:价格改进盈余(surplus)与合作伙伴分享,用户实际成交价常优于初始报价。
  3. 无风险尝试:Gasless 订单设计意味着签名后若未成交,用户无需承担任何 Gas 费用。
  4. 多链覆盖:支持主流 L1 和 L2,流动性聚合范围广泛。
  5. 费用透明:0.5% 合作伙伴费用在文档和 API 参数中完全公开披露,无隐藏收费。

潜在缺点与局限性

  1. 执行延迟:批量拍卖需等待 solver 竞争和区块打包,成交时间从数秒到数分钟不等,不适合极致追求速度的场景。
  2. 订单生命周期复杂:涉及报价过期、签名、上链、结算多阶段,新手理解门槛高于一键 Swap。
  3. 流动性依赖 solver 生态:若特定交易对 solver 竞争不足,实际执行价格可能不及预期。
  4. T3 来源可信度:社区项目维护,非官方 CoW Protocol 团队直接背书,长期维护和应急响应能力存不确定性。

适合人群

  • 大额交易用户(MEV 攻击高风险场景)
  • 对价格敏感、愿等待更优成交价的交易者
  • 多链 DeFi 用户,需统一接口管理跨链仓位
  • 能接受链下签名、理解订单簿模式的经验用户

常规风险

  • 智能合约风险:CoW Protocol 合约虽经审计,但仍存在潜在漏洞可能。
  • 签名风险:EIP-712 签名授权需仔细核对 appData 中的费用参数,防止误签恶意订单。
  • 报价失效:市场行情剧烈波动时,30 分钟有效期内的报价可能偏离实际价格。
  • 合作伙伴费用争议:虽透明披露,但部分用户可能对额外 0.5% 费用敏感。
  • API 可用性:依赖 CoW 官方 API 服务稳定性,极端情况下可能出现延迟或不可用。

技能正文


name: cow-swap description: CoW Swap MEV-protected DEX aggregator. Batch auctions for best execution and surplus sharing. metadata: {"clawdbot":{"emoji":"🐮","always":true,"requires":{"bins":["curl","jq"]}}}

CoW Swap 🐮

MEV-protected DEX aggregator using batch auctions. Get the best execution with surplus sharing.

💎 Partner Fee Configuration

This skill includes a partner fee (0.5%) to support development. The fee is transparently disclosed to users.

Variable Value Description
PARTNER_FEE_BPS 50 0.5% partner fee (50 basis points)
PARTNER_FEE_RECIPIENT 0x890CACd9dEC1E1409C6598Da18DC3d634e600b45 EVM wallet to receive fees

Fee Breakdown:

  • User pays: 0.5% of swap output
  • Partner receives: 100% of fee
  • Fees are collected on-chain after order execution

💡 CoW Protocol also shares price improvement surplus with partners!

Features

  • 🛡️ MEV Protection - Batch auctions prevent front-running
  • 💰 Surplus Sharing - Get better prices than quoted
  • 🔄 Coincidence of Wants - P2P matching for better rates
  • ⛓️ Multi-Chain - Ethereum, Gnosis, Arbitrum, Base
  • 🆓 Gasless Orders - No gas for failed transactions

API Base URL

https://api.cow.fi

Get Quote

CHAIN="mainnet"  # mainnet, gnosis, arbitrum, base

# Token addresses
SELL_TOKEN="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"  # WETH
BUY_TOKEN="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"   # USDC
SELL_AMOUNT="1000000000000000000"  # 1 ETH in wei
FROM_ADDRESS="<YOUR_WALLET>"

# Partner fee configuration
PARTNER_FEE_BPS="50"  # 0.5%
PARTNER_FEE_RECIPIENT="0x890CACd9dEC1E1409C6598Da18DC3d634e600b45"

curl -s -X POST "https://api.cow.fi/${CHAIN}/api/v1/quote" \
  -H "Content-Type: application/json" \
  -d "{
    \"sellToken\": \"${SELL_TOKEN}\",
    \"buyToken\": \"${BUY_TOKEN}\",
    \"sellAmountBeforeFee\": \"${SELL_AMOUNT}\",
    \"from\": \"${FROM_ADDRESS}\",
    \"kind\": \"sell\",
    \"partiallyFillable\": false,
    \"appData\": \"{\\\"partnerFee\\\":{\\\"bps\\\":${PARTNER_FEE_BPS},\\\"recipient\\\":\\\"${PARTNER_FEE_RECIPIENT}\\\"}}\",
    \"appDataHash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\"
  }" | jq '{
    quote: {
      sellAmount: .quote.sellAmount,
      buyAmount: .quote.buyAmount,
      feeAmount: .quote.feeAmount
    },
    expiration: .expiration,
    id: .id
  }'

Create Order

# After getting quote, create order
QUOTE_ID="<QUOTE_ID>"

curl -s -X POST "https://api.cow.fi/${CHAIN}/api/v1/orders" \
  -H "Content-Type: application/json" \
  -d "{
    \"sellToken\": \"${SELL_TOKEN}\",
    \"buyToken\": \"${BUY_TOKEN}\",
    \"sellAmount\": \"${SELL_AMOUNT}\",
    \"buyAmount\": \"<MIN_BUY_AMOUNT>\",
    \"validTo\": $(( $(date +%s) + 1800 )),
    \"appData\": \"{\\\"partnerFee\\\":{\\\"bps\\\":${PARTNER_FEE_BPS},\\\"recipient\\\":\\\"${PARTNER_FEE_RECIPIENT}\\\"}}\",
    \"feeAmount\": \"<FEE_AMOUNT>\",
    \"kind\": \"sell\",
    \"partiallyFillable\": false,
    \"receiver\": \"${FROM_ADDRESS}\",
    \"signature\": \"<EIP712_SIGNATURE>\",
    \"signingScheme\": \"eip712\",
    \"from\": \"${FROM_ADDRESS}\"
  }" | jq '.'

Check Order Status

ORDER_UID="<ORDER_UID>"

curl -s "https://api.cow.fi/${CHAIN}/api/v1/orders/${ORDER_UID}" | jq '{
  status: .status,
  executedSellAmount: .executedSellAmount,
  executedBuyAmount: .executedBuyAmount,
  surplus: .surplus
}'

Get User Orders

USER_ADDRESS="<YOUR_WALLET>"

curl -s "https://api.cow.fi/${CHAIN}/api/v1/account/${USER_ADDRESS}/orders" | jq '.[:5] | .[] | {
  uid: .uid,
  status: .status,
  sellToken: .sellToken,
  buyToken: .buyToken
}'

Cancel Order

ORDER_UID="<ORDER_UID>"

curl -s -X DELETE "https://api.cow.fi/${CHAIN}/api/v1/orders/${ORDER_UID}" \
  -H "Content-Type: application/json" \
  -d "{
    \"signature\": \"<CANCELLATION_SIGNATURE>\",
    \"signingScheme\": \"eip712\"
  }"

Supported Chains

Chain API Path Native Token
Ethereum mainnet ETH
Gnosis gnosis xDAI
Arbitrum arbitrum ETH
Base base ETH

Order Types

Type Description
sell Sell exact amount, receive at least buyAmount
buy Buy exact amount, spend at most sellAmount

Order Status

Status Description
open Order is active
fulfilled Order fully executed
cancelled Order cancelled
expired Order expired
presignaturePending Awaiting signature

AppData Structure (Partner Fee)

{
  "version": "1.1.0",
  "metadata": {
    "partnerFee": {
      "bps": 50,
      "recipient": "0x742d35Cc6634C0532925a3b844Bc9e7595f5bE21"
    }
  }
}

Safety Rules

  1. ALWAYS display quote details before signing
  2. VERIFY minimum buy amount
  3. CHECK order expiration time
  4. WARN if price impact > 1%
  5. NEVER sign without user confirmation

Error Handling

Error Cause Solution
InsufficientBalance Low balance Check wallet balance
InsufficientAllowance Token not approved Approve token first
OrderNotFound Invalid order UID Check order UID
QuoteExpired Quote too old Get new quote

Links

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

finance-accountingapiautomationdefiblockchain

同类 Skill