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

DeFi 策略沙盒测试与流动性配置

create-test-pool · vv0.1.0
开发 安全 A 级 作者 wpank 公开目录收录
3.4k 下载 931 安装 12k 收藏 168.5k 浏览

简介

Uniswap 本地测试工具,零代码配置极端流动性,验证 DeFi 策略在薄市场及高滑点场景下的代理行为。

原始描述

Deploy a custom Uniswap pool on the local testnet with configurable parameters. Create pools with specific conditions (thin liquidity, wide spreads, exact tick ranges) to test agent behavior under controlled scenarios. Requires a running local testnet.

通过你的 Agent 添加

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

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

或者手动安装

Claude Code~/.claude/skills/create-test-pool/
Codex CLI~/.codex/skills/create-test-pool/
DeepSeek Harness~/.agents/skills/create-test-pool/

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

中文使用说明 来自收录源

核心用法

create-test-pool 是一个面向开发者和DeFi研究者的测试基础设施工具,通过自然语言指令在本地测试网(Anvil)部署定制化的Uniswap流动性池。用户无需编写Solidity脚本或手动计算sqrtPriceX96,只需描述需求如"WETH/USDC薄流动性池,0.05%费率,ETH价格$2000",工具即可自动完成代币地址解析、价格到tick转换、池部署和流动性注入全流程。

显著优点

  1. 零Solidity门槛:传统V3池部署需要调用createAndInitializePoolIfNecessary、计算sqrtPriceX96、确定tick范围、代币授权和mint调用。本工具将所有复杂度封装为自然语言接口。
  2. 智能代币解析:自动将"WETH"、"USDC"等符号映射到标准合约地址,正确处理代币排序(token0 < token1)和精度差异。
  3. 自动资金补给:部署前自动检测并补足测试账户代币余额,通过whale impersonation解决资金问题。
  4. 边缘场景测试:支持创建极端条件的测试环境——$100浅流动性池测试滑点、极端价格测试边界条件、窄tick范围测试集中流动性行为。
  5. 即时验证:部署后自动调用get_pool_info确认池状态,确保测试环境就绪。

潜在局限

  • 环境依赖严格:必须预置运行中的本地测试网(如Anvil),无测试网时完全不可用
  • 仅限测试网:无法在主网或公共测试网部署,所有操作都是本地模拟
  • V2功能受限:V2池固定0.3%费率,不支持自定义费用层级
  • 价格精度约束:自然语言价格描述(如"$2000")可能无法表达极端精确的价格点

适合人群

  • AI代理开发者:需要可控环境测试交易算法、流动性策略或套利行为
  • DeFi协议研究员:验证价格预言机行为、滑点模型或MEV场景
  • 智能合约审计员:在隔离环境中复现特定市场条件进行漏洞验证
  • 教学场景:向新手演示Uniswap机制而无需接触真实资金

常规风险

  • T3来源风险:维护者为个人GitHub账号(wpank),非知名组织,建议审查代码后使用
  • MCP工具依赖:核心功能依赖4个Uniswap MCP工具,工具更新或配置错误会导致失败
  • 测试网数据残留:频繁部署可能积累测试状态,建议定期重置环境
  • 非生产级保障:明确设计用于测试,不保证模拟行为与主网完全一致

技能正文


name: create-test-pool description: >- Deploy a custom Uniswap pool on the local testnet with configurable parameters. Create pools with specific conditions (thin liquidity, wide spreads, exact tick ranges) to test agent behavior under controlled scenarios. Requires a running local testnet. model: sonnet allowed-tools:

  • mcp__uniswap__deploy_mock_pool
  • mcp__uniswap__fund_test_account
  • mcp__uniswap__get_pool_info
  • mcp__uniswap__search_tokens

Create Test Pool

Overview

Deploys a custom Uniswap pool on the local testnet with exact parameters you specify. This lets you create controlled test environments -- thin liquidity pools, extreme price ranges, specific fee tiers -- to test how agents behave under edge conditions.

Why this is 10x better than doing it manually:

  1. No Solidity scripting: Creating a V3 pool manually requires calling createAndInitializePoolIfNecessary, computing sqrtPriceX96, calculating tick ranges, approving tokens, and calling mint. This does it all with natural language.
  2. Token resolution: Say "WETH/USDC" and it resolves addresses, decimals, and sorts tokens correctly. No need to look up contract addresses.
  3. Automatic funding: If the deployer account doesn't have enough tokens, the tool handles whale impersonation to fund the deployment.
  4. Price-to-tick conversion: Specify a price like "2000" (USDC per WETH) and the tool computes the correct sqrtPriceX96 and tick range.
  5. Edge case testing: Create pools with $100 liquidity to test thin-market behavior, or pools at extreme prices to test boundary conditions.
  6. Verification: After deployment, you can immediately query the pool with get_pool_info to confirm state.

When to Use

Activate when the user says anything like:

  • "Create a WETH/USDC pool with thin liquidity"
  • "Deploy a test pool with 0.05% fee"
  • "Set up a DAI/USDC pool at 1:1"
  • "Create a pool with only $1000 liquidity"
  • "Deploy a V2 pair for testing"
  • "I need a pool with a narrow tick range"
  • "Create a WBTC/WETH pool at the current price"
  • "Set up a pool to test high slippage scenarios"

Do NOT use when no testnet is running (use setup-local-testnet first), or when the user wants to interact with existing mainnet pools (use analyze-pool).

Parameters

Parameter Required Default How to Extract
token0 Yes -- First token: "WETH", "USDC", or a 0x address
token1 Yes -- Second token: "USDC", "DAI", or a 0x address
version No v3 "v2" or "v3"
fee No 3000 Fee tier: 100 (0.01%), 500 (0.05%), 3000 (0.3%), 10000 (1%)
initialPrice No -- Price of token0 in token1 terms (e.g. 2000 for ETH at $2000)
liquidityUsd No 1,000,000 Dollar value of initial liquidity
tickLower No auto V3 lower tick (advanced users only)
tickUpper No auto V3 upper tick (advanced users only)

Workflow

Step 1: Verify Testnet is Running

If the tool returns TESTNET_NOT_RUNNING, tell the user:

No local testnet is running. Let me set one up first.

Then suggest using setup-local-testnet or offer to do it for them.

Step 2: Extract Parameters

Parse the user's request carefully:

  • Token pair: "WETH/USDC", "ETH/DAI", "WBTC/WETH"
    • Map "ETH" to "WETH" (Uniswap uses wrapped ETH)
  • Fee tier: "0.05% fee" → 500, "0.3%" → 3000, "1%" → 10000, "0.01%" → 100
  • Price: "at $2000" → initialPrice: 2000 (for WETH/USDC)
  • Liquidity: "thin liquidity" → liquidityUsd: 1000, "$10M" → liquidityUsd: 10000000
  • Version: "V2 pair" → version: "v2", default is "v3"

Common liquidity descriptions:

  • "thin" / "low" / "shallow" → $1,000 - $10,000
  • "moderate" / "normal" → $100,000 - $1,000,000
  • "deep" / "high" → $10,000,000+

Step 3: Fund Deployer If Needed

If the pool requires tokens the deployer might not have, call mcp__uniswap__fund_test_account first to ensure the deployer (account #1: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266) has sufficient tokens.

Step 4: Deploy the Pool

Call mcp__uniswap__deploy_mock_pool with the extracted parameters.

Step 5: Verify and Present

Present the deployed pool with full details:

Test Pool Deployed

  Pool:       WETH/USDC (V3, 0.05% fee)
  Address:    0xNEW...
  Price:      1 WETH = 2,000 USDC
  Liquidity:  ~$1,000,000
  Tick Range: -204714 to -199514 (±50% around current price)

  Token0: USDC  0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48  (6 decimals)
  Token1: WETH  0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2  (18 decimals)

  Test Scenarios This Pool Enables:
  - Swap testing: "Get a quote for 1 WETH → USDC"
  - LP testing: "Add liquidity to the WETH/USDC pool"
  - Price impact: "What's the price impact of swapping 100 WETH?"
  - Time-dependent: "Advance 7 days and check fee accumulation"

Step 6: Suggest Follow-ups

  Next Steps:
  - Query pool state: "Get info on pool 0xNEW..."
  - Test a swap against this pool
  - Create another pool with different parameters
  - Advance time to test fee accumulation: "Time travel 7 days"

Important Notes

  • Tokens are automatically sorted. Uniswap requires token0 < token1 by address. The tool handles this.
  • V3 pools need initialization. The tool calls createAndInitializePoolIfNecessary which sets the initial price.
  • Default tick range is ±50%. If no tick range is specified, liquidity is spread across a wide range around the initial price.
  • Deployer is Anvil account #1. The first Anvil default account is used for deployment.
  • Pool may already exist on fork. If you fork Ethereum and try to create a WETH/USDC 0.05% pool, it already exists. The tool will add liquidity to the existing pool.
  • V2 pools always have 0.3% fee. The fee parameter is ignored for V2.

Error Handling

Error User-Facing Message Suggested Action
TESTNET_NOT_RUNNING "No local testnet is running." Run setup-local-testnet first
TESTNET_TOKEN_NOT_FOUND "Cannot resolve token X." Use a well-known symbol or provide the 0x address
TESTNET_CONTRACT_NOT_FOUND "NonfungiblePositionManager not found on this chain." Fork Ethereum mainnet which has all V3 contracts
TESTNET_DEPLOY_POOL_FAILED "Failed to deploy pool: {reason}" Check token balances, fund deployer if needed

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

标签

blockchaindefitestingautomationdevelopment-engineeringfinance-accountingbackend

同类 Skill