uniswap-math

Computes Uniswap-style concentrated-liquidity math for Solidity contracts.

120|12|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ccashwell/evm-cortex --skill uniswap-math
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: uniswap-math
Source: https://github.com/ccashwell/evm-cortex/tree/main/skills/uniswap-math
Command: npx skills add https://github.com/ccashwell/evm-cortex --skill uniswap-math

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides precise fixed-point math and specialized libraries for Uniswap-style concentrated liquidity, enabling developers to compute prices, liquidity, and token amounts with high accuracy.

Core Features & Use Cases

  • TickMath: compute sqrt prices and ticks for given inputs.
  • SqrtPriceMath, SwapMath, FullMath: core arithmetic for swaps and liquidity.
  • TickBitmap and LiquidityAmounts: manage liquidity ranges and amounts for positions.
  • Position and related helpers: manage liquidity state and fees in a Uniswap-like system.
  • Use Case: design and simulate concentrated liquidity pools, price ranges, and liquidity provisioning with deterministic math.

Quick Start

Integrate the Uniswap math libraries into your Solidity project and run a simple example to calculate liquidity for a given token pair.

Frequently Asked Questions about uniswap-math

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate concentrated liquidity for a Uniswap pool in Solidity?

You can calculate concentrated liquidity for a Uniswap pool by integrating specialized fixed-point math libraries. This Skill provides TickMath, SqrtPriceMath, and LiquidityAmounts to compute liquidity provisioning and token amounts with deterministic precision.

What fixed-point math libraries are needed for Uniswap v4 swap calculations?

Uniswap v4 swap calculations require core arithmetic libraries including SwapMath, SqrtPriceMath, and FullMath. This Skill supplies these fixed-point math components to accurately compute prices and token amounts during swaps.

How does TickMath compute sqrt prices for decentralized exchange pools?

TickMath computes sqrt prices by converting tick inputs into fixed-point price representations. This Skill implements the TickMath logic necessary to map tick ranges to precise sqrt prices for concentrated liquidity pools.

Can I use this to manage liquidity ranges and amounts for Uniswap positions?

Yes, you can manage liquidity ranges and amounts for Uniswap positions using the included TickBitmap and LiquidityAmounts libraries. These components handle liquidity state and calculate precise token amounts for active position ranges.

Do I need v4-core and v4-periphery libraries to simulate concentrated liquidity math?

Yes, simulating concentrated liquidity math requires the v4-core and v4-periphery math libraries. This Skill depends on these specific Uniswap libraries to support integration and execute precise fixed-point calculations in Solidity contracts.

What are the limitations of using fixed-point math for concentrated liquidity calculations?

Fixed-point math for concentrated liquidity calculations requires strict deterministic precision to avoid rounding errors in swap scenarios. This Skill mitigates limitations by using Uniswap's exact arithmetic libraries like FullMath to handle maximum precision safely.