SuperAPI AI Directory

@1826/woofi-swap-optimizer

Data & analytics

View repository

Updated 10-16 09:31

About this skill

🔄 WOOFi Zero-Slippage Swap Optimizer

Real-time WOOFi sPMM quote scanner + multi-aggregator comparison that ALWAYS tries WOOFi first for ultra-low slippage. Finds the absolute best swap route factoring gas, fees, and cross-chain options.


Trigger Phrases

  • "optimize swap" / "best swap route" / "compare swap quotes"
  • "swap X to Y on [chain]" / "zero slippage swap"

Workflow

Step 1 — Extract Parameters

Parameter Description Default
from_token Symbol or contract address required
to_token Symbol or contract address required
amount Human-readable or raw required
chain arbitrum, base, ethereum, bsc, polygon, optimism user's connected chain
max_slippage User-specified tolerance 1.0%

Step 2 — Balance Check

Call wallet_balance(chain, asset=from_token).

  • If balance < amount → STOP, report shortfall, suggest bridging.
  • If balance ≥ amount → proceed.

Step 3 — Fetch Quotes (WOOFi FIRST)

WOOFi sPMM (PRIMARY — always call first):

GET https://api.woofi.com/v3/{chain_id}/quote
  ?fromToken={from_addr}&toToken={to_addr}&fromAmount={raw_amount}

Chain IDs: arbitrum=42161, base=8453, ethereum=1, bsc=56, polygon=137, optimism=10
  • 503/error → retry once after 10s → if still fails, mark "WOOFi temporarily unavailable"
  • On success → record: out_amount, price_impact, fee

Fee check: GET https://api.woofi.com/v3/{chain_id}/fee?fromToken=...&toToken=...

Comparison aggregators (parallel calls):

Aggregator Endpoint
KyberSwap https://aggregator-api.kyberswap.com/{chain}/api/v1/routes
Paraswap https://apiv5.paraswap.io/prices?srcToken=...
0x Protocol https://api.0x.org/swap/v1/quote
1inch https://api.1inch.io/v5.0/{chain_id}/quote

Step 4 — Normalize & Compare

For each route: net_usd = (out_amount × token_price_usd) - gas_cost_usd - protocol_fee_usd

Gas: fetch current base fee → estimate units (WOOFi ~200k, KyberSwap ~600k, Paraswap ~650k, 0x ~450k) → gas_usd = units × base_fee_gwei × 1e-9 × eth_price

Step 5 — Rank with WOOFi Bias

WOOFi wins unless another route gives ≥ 0.3% better net USD AND lower or equal total cost.

If WOOFi unavailable → state: "⚠️ WOOFi temporarily unavailable – using best alternative. Consider retrying on WOOFi for this pair."

Step 6 — Generate Report

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔄  SWAP OPTIMIZATION REPORT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📥  Swap: [amount] [from] → [to]  |  🔗 Chain: [chain]
⏱   Analyzed: [UTC timestamp]    💲 [to_token] spot: $[price]

🏆  BEST ROUTE: [name]  |  Confidence: [bar] [%]

─────────────────────────────────────────────
🟢  WOOFi ADVANTAGE
─────────────────────────────────────────────
  [If WOOFi wins]: WOOFi sPMM delivers [X]% less slippage.
  Zero price impact on market-maker inventory model.
  Savings vs next-best: $[amount]

  [If WOOFi unavailable]:
  ⚠️ WOOFi temporarily unavailable (503). Best alternative used.

─────────────────────────────────────────────
📊  ROUTE COMPARISON
─────────────────────────────────────────────
Route        │ Out        │ Gas USD │ Slippage │ Net USD │ vs Best
─────────────┼────────────┼─────────┼──────────┼─────────┼─────────
[winner ✅]  │ [amount]   │ $[x]    │ [x]%     │ $[x]    │ BEST
[others]     │ ...        │ ...     │ ...      │ ...     │ −$[x]

─────────────────────────────────────────────
💡  PRICE IMPACT SUMMARY
─────────────────────────────────────────────
  Market price:    1 [from] = [rate] [to]  ($[price]/[to])
  Best route rate: 1 [from] = [rate] [to]  ($[implied]/[to])
  [Explain positive/negative slippage clearly]

─────────────────────────────────────────────
⚙️   EXECUTION DETAILS ([best route])
─────────────────────────────────────────────
  Protocol fee: $[fee]  |  Gas: ~[units] @ [gwei] gwei = $[cost]
  Total cost: $[total]  |  Net received: [amount] [token] ≈ $[usd]

⚠️  WARNINGS: [low liquidity / slippage / unverified token if any]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Always end with:

Ready to execute this swap on [best route]? Say YES + any adjustments and I'll prepare the transaction.


Safety Rules

Rule Detail
🔒 No auto-execution NEVER send tx without explicit "YES"
⛽ Full disclosure Always show gas + fee breakdown before confirmation
🚨 Slippage guard >1.5% effective slippage → warn loudly, suggest splitting
💧 Liquidity guard Pool liquidity <$50k → warn, suggest smaller size
🪙 Token flag Unverified or <30d old token → flag explicitly
📓 Journal Log every run for the trading journal skill

Example

User: Optimize swap of 100 USDC to ETH on Base

Output:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔄  SWAP OPTIMIZATION REPORT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📥  Swap: 100 USDC → ETH  |  🔗 Chain: Base
⏱   2026-03-19 07:24 UTC  |  💲 ETH: $2,166.18

🏆  BEST ROUTE: WOOFi sPMM  |  Confidence: ██████████ 95%

🟢  WOOFi ADVANTAGE
  0.00% price impact (sPMM inventory model, no AMM curve degradation)
  Savings vs next-best (KyberSwap): +$0.22

📊  ROUTE COMPARISON
Route         │ ETH Out    │ Gas USD │ Slippage │ Net USD │ vs Best
──────────────┼────────────┼─────────┼──────────┼─────────┼─────────
✅ WOOFi sPMM │ 0.046425   │ $0.0031 │  0.00%   │ $100.83 │ BEST
   KyberSwap  │ 0.046377   │ $0.0064 │ −0.46%   │ $100.61 │ −$0.22
   Paraswap   │ 0.046353   │ $0.0031 │  0.00%   │ $100.41 │ −$0.42
   0x Protocol│ 0.046310   │ $0.0028 │ +0.09%   │ $100.28 │ −$0.55

💡  Market: 1 USDC = 0.00046164 ETH | WOOFi: 0.00046425 ETH
    ✅ Positive slippage: WOOFi fills against reserves at better than market.

⚙️  Protocol fee: $0.10 | Gas: ~200k @ 0.0054 gwei = $0.0031
    Net received: 0.046425 ETH ≈ $100.83
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Ready to execute on WOOFi sPMM? Say YES + any adjustments!

Changelog

Version Date Changes
1.1.0 2026-03-19 WOOFi-first bias, retry logic on 503, WOOFi Advantage box, ≥0.3% ranking threshold, graceful fallback messaging, StarchildContest tag
1.0.0 2026-03-19 Initial release