cow-swap

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

7 stars

Best use case

cow-swap is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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

Teams using cow-swap should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/cow-swap/SKILL.md --create-dirs "https://raw.githubusercontent.com/Demerzels-lab/elsamultiskillagent/main/public/skills/0xterrybit/cow-swap/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/cow-swap/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How cow-swap Compares

Feature / Agentcow-swapStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

```bash
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

```bash
# 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

```bash
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

```bash
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

```bash
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)

```json
{
  "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

- [CoW Protocol Docs](https://docs.cow.fi/)
- [CoW Swap](https://swap.cow.fi/)
- [Explorer](https://explorer.cow.fi/)
- [Partner Fee Docs](https://docs.cow.fi/governance/fees/partner-fee)

Related Skills

solana-swaps

7
from Demerzels-lab/elsamultiskillagent

Swap tokens on Solana via Jupiter aggregator and check wallet balances. Use when user wants to swap tokens, check SOL/token balance, or get swap quotes.

uniswap-monitor-teneo

7
from Demerzels-lab/elsamultiskillagent

AI-powered blockchain monitoring agent with real-time monitoring of Uniswap V2, V3, and V4 most known pools. Track swaps, monitor specific liquidity pools by address, and receive intelligent insights

eachlabs-face-swap

7
from Demerzels-lab/elsamultiskillagent

Swap faces between images using EachLabs AI.

paraswap

7
from Demerzels-lab/elsamultiskillagent

ParaSwap DEX aggregator. Best swap rates across 300+ liquidity sources on Ethereum, Polygon, BSC, Arbitrum, and more.

kyberswap

7
from Demerzels-lab/elsamultiskillagent

KyberSwap DEX aggregator. Best rates across 100+ DEXs on 17+ chains with dynamic trade routing.

0x-swap

7
from Demerzels-lab/elsamultiskillagent

0x Protocol DEX aggregator. Swap tokens at the best rates across 9+ liquidity sources on Ethereum, Polygon, BSC, and more.

sushiswap-sdk

7
from Demerzels-lab/elsamultiskillagent

TypeScript SDK for interacting with the SushiSwap Aggregator and related primitives. This SDK is a typed wrapper over the SushiSwap API, providing ergonomic helpers for token amounts, prices, quotes, and swap transaction generation. USE THIS SKILL WHEN: - Building TypeScript or JavaScript applications - You want strongly typed token, amount, and fraction primitives - You need to request swap quotes or executable swap transactions via code - You want safer arithmetic, formatting, and comparisons without floating point errors - You prefer SDK-based integration over raw HTTP requests

sushiswap-api

7
from Demerzels-lab/elsamultiskillagent

REST API for optimized token swapping (including executable transaction generation), swap quoting, and pricing using the SushiSwap Aggregator. Use this skill when the user wants to: - Get a swap quote between two tokens on 40+ evm networks - Generate executable swap transaction data - Fetch token prices for a specific network or token - Retrieve token metadata - Discover supported AMM liquidity sources - Integrate SushiSwap swapping or pricing logic via HTTP/REST (and not the SushiSwap Javascript API)

paylock

7
from Demerzels-lab/elsamultiskillagent

Non-custodial SOL escrow for AI agent deals.

agent-reputation

7
from Demerzels-lab/elsamultiskillagent

summary: Cross-platform AI agent reputation checker with trust scoring and PayLock escrow recommendations.

Telecom Agent Skill

7
from Demerzels-lab/elsamultiskillagent

Turn your AI Agent into a Telecom Operator. Bulk calling, ChatOps, and Field Monitoring.

OpenClaw-Finnhub

7
from Demerzels-lab/elsamultiskillagent

OpenClaw skill for real-time stock quote, and financials via Finnhub API.