Yuzu Documentation
  • General Information
    • Introduction
    • Get MOVE Coins
  • Products
    • CLMM
      • Fee Tiers
      • Price Ranges
      • Active & Inactive Liquidity
      • LP Position NFTs
    • Glossary
  • Socials
    • Contacts
    • Brand & Logos
  • Technical
    • Smart Contracts
      • Yuzu CLMM
        • Liquidity Pool
        • Router
        • Scripts
        • Example Usage
          • Liquidity Pool
          • Position NFT Manager Module
          • Tick Math Module
      • Move.Fun
        • Smart Contracts
    • Ecosystem Participants of Yuzu
  • Legal
    • Terms of Use
    • Legal Disclaimer
Powered by GitBook
On this page
  • Sqrt Price Formula
  • Public Functions
  1. Technical
  2. Smart Contracts
  3. Yuzu CLMM
  4. Example Usage

Tick Math Module

  • Name: yuzuswap::tick_math

  • Description: This module provides functions to work with ticks and their corresponding square root prices. In YuzuSwap, the square root price is represented in a fixed-point format 48x80, using a u128 number.

Sqrt Price Formula

To compute the client-side square root price (sqrt_price_x80), use the following formula:

sqrt_price_x80 = floor(sqrt(price) * 2^80)

For example, if the price is 1.5, then:

sqrt_price_x80 = floor(sqrt(1.5) * 2^80) = 1480625697465890259337216

Public Functions

Calculate Tick from Square Root Price

Calculates the tick value corresponding to a given square root price.

public fun get_tick_at_sqrt_price(sqrt_price: u128): u32

Function Parameters

Parameter
Type
Description

sqrt_price

u128

The square root price in fixed-point format 48x80.

Return Value

Type
Description

u32

The tick value corresponding to the given sqrt_price.

PreviousPosition NFT Manager ModuleNextMove.Fun

Last updated 19 days ago