432/meta-dex-aggregator/SKILL.md
Meta DEX Aggregator - aggregator of aggregators. Compares quotes across ParaSwap, Odos, KyberSwap, CowSwap, Matcha/0x, and 1inch to find the best swap price. Includes safety layer: price impact detection, gas-adjusted ranking, MEV protection flagging, slippage warnings, outlier quote rejection, built-in execution with verification, CowSwap order polling, historical quote logging, winner analytics, market orders, auto-verify, and retry logic.
npx skillsauth add starchild-ai-agent/community-skills @432/meta-dex-aggregatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Aggregator of aggregators. Queries 5 DEX aggregators in parallel (ParaSwap, Odos, KyberSwap, Matcha/0x, CowSwap), plus 1inch via agent tool call. Ranks by gas-adjusted net output with per-chain live gas prices, and runs safety checks before execution.
Do these steps ONCE before your first swap:
wallet_info()
# Returns: { wallet_address: "0x...", chain_type: "ethereum" }
# Save this - you'll need it as --wallet parameter for all commands
wallet_balance(chain="arbitrum") # or whichever chain you're swapping on
# Confirm you have the source token AND enough ETH/native for gas
The wallet needs permission to send transactions. Use wallet_propose_policy:
wallet_propose_policy(
chain_type="ethereum",
title="Allow DEX Swaps",
description="Allow the meta-dex-aggregator to execute swaps and token approvals on EVM chains.",
rules=[
{"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
{"name": "Allow all operations", "method": "*", "conditions": [], "action": "ALLOW"}
]
)
⚠️ Do NOT use "method": "eth_sendTransaction" with empty conditions - Privy rejects this with a 400 error. Always use "method": "*" for broad access.
The user must approve this in the UI before any swaps will work.
Now follow the Quote → Approve → Execute → Verify workflow below.
--market-order)--auto-verify)netOut = amountUsd - gasUsd. Best route ≠ most tokens.isMEVSafe.
Recommends MEV-safe route when within 0.5% of best price.| Adapter | API Key | Status | Notes |
|---------|---------|--------|-------|
| ParaSwap | None needed | ✅ | |
| Odos | None needed | ✅ | |
| KyberSwap | None needed | ✅ | |
| CowSwap | None needed | ⚠️ Rate limited | Batch auction - MEV protected, may skip when rate limited |
| 1inch | Native tool (platform-proxied) | ✅ | Call oneinch_quote() separately, merge manually |
| Matcha/0x | OX_API_KEY in .env | ✅ | |
MEV Protection: CowSwap uses off-chain batch auctions (solvers compete, no mempool exposure). The safety layer flags it when available. All aggregators are safe - CowSwap just has extra protection.
Note: CowSwap's public API is rate limited. The script gracefully skips it when rate limited (429). 1inch requires an API key, so the agent calls the platform's oneinch_quote tool (proxied, no user key needed) and merges the result into the comparison table.
CowSwap specifics: Gasless for the user (solvers pay gas). Supported on Ethereum, Arbitrum, Gnosis, Base. Uses wrapped native tokens (WETH) internally - raw ETH is auto-converted. Execution is order-based (EIP-712 signed intent), not raw transaction.
See Getting Started → Step 3 above. Policy must be approved by the user before any swap can execute.
Step 1 & 2 run in PARALLEL (no dependency between them):
# 1. Get 4 aggregator quotes (ParaSwap, Odos, KyberSwap, Matcha/0x + safety)
cd skills/meta-dex-aggregator/scripts && \
python3 meta_dex.py quote --chain base --from ETH --to USDC --amount 0.5 --slippage 0.5
# 2. Get 1inch quote via native tool (proxied, no API key needed)
oneinch_quote(chain="base", src="<from_addr>", dst="<to_addr>", amount="<amount_in_wei>")
# Returns: { "dstAmount": "<raw_amount>" }
# Convert: dstAmount / 10^decimals = human amount
Step 3 - Merge & present:
aggregator, amountOutHuman, amountUsd, gasUsd, netOut, vsbestPctdstAmount (raw wei) - convert to human amount using token decimalsvsbestPct if 1inch is the new winnersafety block (priceImpact, slippageWarnings, recommendation) applies to all quotespriceImpact.severity is "high"/"critical" - WARN and block the swaponeinch_swap if 1inch wins, or wallet_transfer with tx data for others (see Execution section below for exact param mapping)Before executing ANY swap where the source token is an ERC-20 (not native ETH), you MUST check and approve the token allowance.
Native ETH (0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) does NOT need approval. All other tokens do.
# Step 1: Check if the 1inch router has allowance to spend your source token
oneinch_check_allowance(chain="arbitrum", token_address="0xaf88d065e77c8cC2239327C5EDb3A432268e5831")
# Returns: { "allowance": "0", "needs_approval": true }
# Step 2: If needs_approval is true, approve the token
oneinch_approve(chain="arbitrum", token_address="0xaf88d065e77c8cC2239327C5EDb3A432268e5831")
# Returns: { "tx_hash": "0x..." }
# Step 3: Now proceed with the swap
When to check:
For non-1inch aggregators (ParaSwap, Odos, KyberSwap, etc.): Some aggregators handle approval internally in the tx calldata. However, if the swap tx reverts, check allowance for the aggregator's router address (returned as tokenApprovalAddress in the quote). Only 1inch market orders via oneinch_swap use the explicit oneinch_check_allowance / oneinch_approve flow above.
--market-order flag for instant 1inch execution (no limit order failures)--auto-verify flag for automatic balance fetching (no manual args)# Instant execution via 1inch market order
cd skills/meta-dex-aggregator/scripts && \
python3 meta_dex.py execute --chain arbitrum --from ETH --to USDC --amount 0.005 \
--market-order --wallet 0x... --slippage 2.0
# Response:
# {
# "step": "market_order_ready",
# "mode": "market_order",
# "instruction": "Execute via oneinch_swap(chain='arbitrum', src='0x...', dst='0x...', amount='...', slippage=2.0)"
# }
# Agent executes:
oneinch_swap(chain="arbitrum", src="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", dst="0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", amount="5000000000000000", slippage=2.0)
# Auto-verify after execution:
python3 meta_dex.py execute --chain arbitrum --from ETH --to USDC --amount 0.005 \
--market-order --wallet 0x... --auto-verify --expected-out <actual_received_wei>
# Get quote and execute
python3 meta_dex.py execute --chain arbitrum --from ETH --to USDC --amount 0.005 \
--aggregator kyberswap --wallet 0x... --slippage 1.0
# Execute tx via wallet_transfer...
# Auto-verify (no manual balance args needed):
python3 meta_dex.py execute --chain arbitrum --from ETH --to USDC --amount 0.005 \
--aggregator kyberswap --wallet 0x... --verify --auto-verify --expected-out 10770000
Option B: Manual swap (legacy)
# Get swap tx data
python3 meta_dex.py swap --chain base --from ETH --to USDC --amount 0.5 \
--aggregator odos --wallet 0x... --slippage 0.5
# Execute and verify manually (see Post-Swap Verification section)
The execute command returns a tx object. Map it to wallet_transfer like this:
# Script returns:
# { "tx": { "to": "0xRouterAddr", "data": "0xCalldata...", "value": "500000000000000", "gas": "300000" }, "chainId": 42161 }
# Agent calls:
wallet_transfer(
to="0xRouterAddr", # tx.to
amount="500000000000000", # tx.value (in wei - "0" if selling ERC-20, not native)
data="0xCalldata...", # tx.data (the swap calldata)
chain_id=42161, # chainId from the result
gas_limit="300000" # tx.gas (optional but recommended)
)
Chain ID reference: ethereum=1, arbitrum=42161, base=8453, optimism=10, polygon=137, bsc=56, avalanche=43114, gnosis=100
CowSwap is order-based, not transaction-based. When the execute command returns orderType: "cowswap_order":
eip712Data with the order to signwallet_sign_typed_data(domain=..., types=..., primaryType=..., message=...)curlcowswap_poll_order function or check the pollEndpoint URLIf CowSwap seems complex, prefer --market-order for simplicity - it uses 1inch and executes instantly.
Use the execute --verify command for automatic verification.
Manual verification workflow (if not using execute command):
# 1. Record balances BEFORE the swap
wallet_balance(chain="base", asset="eth") → pre_from_balance
wallet_balance(chain="base", asset="usdc") → pre_to_balance
# 2. Execute the swap (wallet_transfer or oneinch_swap)
# 3. For CowSwap: poll until fulfilled
# Use cowswap_poll_order(chain, order_uid) function
# Poll every 5s for up to 180s
# 4. Verify balances AFTER the swap
wallet_balance(chain="base", asset="eth") → post_from_balance
wallet_balance(chain="base", asset="usdc") → post_to_balance
# 5. Verify with CLI
python3 meta_dex.py execute --verify \
--chain base --from ETH --to USDC --amount 0.5 --aggregator kyberswap \
--wallet 0x... \
--pre-from-balance <pre_eth> --pre-to-balance <pre_usdc> \
--post-from-balance <post_eth> --post-to-balance <post_usdc> \
--expected-out <expected_out_wei>
# Returns: {"verification": "PASSED"|"FAILED", "deviationPct": 0.5, ...}
Rules:
cowswap_poll_order(chain, order_uid) to poll until status == "fulfilled".When src_chain ≠ dst_chain, use xquote to compare cross-chain routes:
python3 skills/meta-dex-aggregator/scripts/meta_dex.py xquote \
--src-chain arbitrum --dst-chain polygon \
--from ETH --to USDC --amount 0.5 \
--wallet $WALLET --slippage 3
Cross-chain sources:
wallet_transfer(to, amount=value, data, chain_id, gas_limit). Track status with curl -s "https://li.quest/v1/status?txHash={hash}&fromChain={src_id}&toChain={dst_id}".needsToolCall: true marker. Complete with oneinch_cross_chain_quote tool for the quote, then oneinch_cross_chain_swap for execution.Cross-chain workflow:
xquote → get LI.FI routes + 1inch Fusion+ markeroneinch_cross_chain_quote tool to fill in the 1inch quotewallet_transfer with tx data; 1inch → oneinch_cross_chain_swapSafety notes for cross-chain:
DONE/PARTIAL means bridge delivered but not the final token - may need a manual swapEvery quote is automatically logged to skills/meta-dex-aggregator/logs/{chain}_{FROM}_{TO}.jsonl.
What's logged:
Log retention: Unlimited (append-only JSONL). Manually prune old logs if needed.
python3 meta_dex.py stats --chain arbitrum --from ETH --to USDC --days 7
Shows which aggregator wins most often, win rates, and average net output per aggregator.
python3 meta_dex.py trend --chain arbitrum --from ETH --to USDC --days 7 --bucket-hours 4
Shows net output over time in 4-hour buckets (avg, min, max, count).
python3 meta_dex.py slippage --chain arbitrum --from ETH --to USDC --days 7
Analyzes competitive spreads between top 2 aggregators. Low spread = highly competitive.
python3 meta_dex.py export --chain arbitrum --from ETH --to USDC --days 30 --output /tmp/quotes.csv
Exports all quotes to CSV for external analysis (Excel, Python, etc.).
Monitor for a target net output and alert when reached:
python3 meta_dex.py monitor --chain arbitrum --from ETH --to USDC --amount 1.0 \
--target-net-out 2050 --interval 60 --max-runs 10
Use case: "Alert me when ETH→USDC on Arbitrum nets >$2050 after gas"
Run this as a background task with sessions_spawn for non-blocking monitoring.
Token resolution is tiered to avoid bothering the user for obvious tokens while protecting against picking the wrong contract for ambiguous ones.
resolve_token:| Confidence | Meaning | Action |
|-----------|---------|--------|
| trusted | Hardcoded canonical address (USDC, WETH, WBTC, etc.) | ✅ Auto-use, no confirmation |
| exact | User provided a 0x address directly | ✅ Auto-use, no confirmation |
| single | Only one token matches the symbol on this chain | ✅ Auto-use, no confirmation |
| high | Multiple matches but top has >10x volume of runner-up | ✅ Auto-use, no confirmation |
| ambiguous | Multiple plausible matches, none dominant | ⚠️ MUST confirm with user |
confidence == "ambiguous":The result includes a candidates list. Present them to the user:
I found multiple tokens matching "XYZ" on Arbitrum:
1. XYZ (XYZ Protocol) - 0x1234...5678 - $2.3M 24h vol
2. XYZ (XYZ Finance) - 0xabcd...ef01 - $180K 24h vol
3. XYZ (Old XYZ) - 0x9876...5432 - $12K 24h vol
Which one did you mean? (or paste the contract address directly)
Once the user picks, re-call with the address directly to bypass resolution.
Ethereum, Arbitrum, Base, Optimism, Polygon, BSC, Avalanche, Gnosis - all major tokens (WETH, USDC, USDT, DAI, WBTC, LINK, UNI, AAVE, stETH, plus chain-specific tokens like ARB, OP, AERO, GMX, etc.)
ethereum, bsc, polygon, optimism, arbitrum, avalanche, gnosis, fantom, zksync, base, linea, scroll, sonic, unichain
The quote command returns a safety block:
{
"recommendation": "✅ All checks passed. Best route looks safe.",
"priceImpact": {"value": 0.02, "severity": "ok"},
"slippageWarnings": [],
"marketPrices": {"gas_token_price": 2170, "from_token_price": 2170, "to_token_price": 1.0}
}
Severity levels: ok | warning (3%) | high (5%) | critical (10%)
CRITICAL: If severity is "high" or "critical", BLOCK the swap and warn the user explicitly.
development
--- name: "@5326/fvg-delta-forex-engine" version: 6.0.0 --- # FVG-Delta Forex Signal Engine v6.0 A production FastAPI service that scans the global forex market on **15-minute candles**, runs a strict lock-forward Smart-Money-Concept (SMC) staged state machine, and alerts on the late stages. It is the forex evolution of the FVG-Delta crypto engine — **identical strategy**, refined for forex speed and mechanics. ## What it scans A curated, liquidity-screened universe (no illiquid exotics, no
development
--- name: "@5322/fvg-engine" version: 1.0.0 --- # FVG-Delta Crypto Signal Engine v6.0 A production FastAPI service that scans MEXC UST-M perpetual futures on **closed 15-minute candles**, runs a strict lock-forward Smart-Money-Concept (SMC) staged state machine, draws annotated chart screenshots, sends per-trade Telegram alerts, and serves a live dashboard with an in-memory Trade History. Everything lives in `assets/app.py`; the rest is config, docs, and entrypoints. ## The strategy — five lo
development
Builds and app/bot to print Crypto Futures Signals based on a Strategy.
development
--- name: "@5312/delta-strategy" version: 1.0.0 --- # FVG-Delta Crypto Signal Engine — Agent / Maintainer Guide (v5.5) This is the single source of truth for any AI agent or engineer taking over this project. Read it fully before touching `app.py`. It explains the strategy, the code workflow, every bug that was fixed in this revision, the current state, and the rules for updating the app and its docs safely. --- ## 1. What the app is A production-style FastAPI service that scans **MEXC UST-