Uniswap Swap Simulation for Openclaw

A comprehensive tool for simulating Uniswap V3 swaps, calculating slippage, and determining optimal routing before executing on-chain transactions.

wpank
v0.1.0
Feb 11, 2026
0
1.7k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install uniswap-swap-simulation

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install uniswap-swap-simulation using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Uniswap Swap Simulation?

The Uniswap Swap Simulation skill provides developers with the ability to forecast the outcomes of decentralized exchange trades without risking capital. By interacting with the Uniswap QuoterV2 contract, it delivers precise data on expected output amounts, price impact, and gas costs. As a vital part of the Openclaw Skills ecosystem, it bridges the gap between raw blockchain data and actionable trading intelligence, enabling more sophisticated DeFi applications.

This skill is designed for technical users who need to evaluate the efficiency of a trade, considering factors like liquidity depth and routing complexity. It allows for the integration of professional-grade trading features into any agent-driven workflow, ensuring that users can optimize for the best execution price while maintaining a high level of security against common on-chain risks.

Uniswap Swap Simulation Use Cases

  • Analyzing the price impact of large-volume trades to prevent excessive loss.
  • Identifying the most efficient multi-hop routes for exotic token pairs.
  • Calculating minimum output amounts based on real-time slippage tolerance levels.
  • Estimating transaction gas costs to optimize gas pricing strategies.
  • Assessing MEV risks like sandwich attacks for high-value swaps.

How Uniswap Swap Simulation Works

  1. The skill connects to a blockchain node via a public client to access real-time state data.
  2. It calls the QuoterV2 contract's simulation functions to determine the potential output for a given input.
  3. The logic calculates the price impact by comparing the simulated execution price with the current market price.
  4. For complex trades, it encodes multi-hop paths to find liquidity across multiple pools.
  5. It applies user-defined slippage buffers to establish safe transaction parameters.
  6. Finally, it provides gas estimates and MEV protection recommendations based on the swap complexity.

Uniswap Swap Simulation Setup

To integrate this functionality into your environment, ensure you have the necessary libraries installed as part of your Openclaw Skills setup:

npm install viem

Initialize the client and contract constants:

import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";

const client = createPublicClient({
  chain: mainnet,
  transport: http(),
});

const quoterV2Address = "0x61fFE014bA17989E743c5F6cB21bF9697530B21e";

Uniswap Swap Simulation Data Schema & Taxonomy

This skill utilizes a structured data format to represent trade simulations and execution metrics within the Openclaw Skills framework:

Attribute Description Data Type
amountOut The forecasted amount of tokens to be received after the swap BigInt
priceImpact The percentage difference between the market price and execution price Number
slippageBps The basis points allowed for price movement (e.g., 50 for 0.5%) Integer
path The packed byte array representing the pool sequence for the swap HexString
gasEstimate The expected gas consumption for the specific swap path BigInt

Uniswap Swap Simulation Advanced Features

  • Advanced Multi-hop Routing: Automatically generates and encodes optimal paths through intermediary liquidity pools.
  • Dynamic Slippage Protection: Recommends slippage thresholds based on the volatility of the specific token pair.
  • MEV Protection Integration: Suggests the use of private RPCs like Flashbots for transactions prone to sandwich attacks.
  • Accurate Gas Buffering: Includes logic to add safety margins (15-20%) to standard gas estimates for reliable execution.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0