Skip to main content

Add your description here

Project description

UV4

test GitHub repo size GitHub last commit PyPI - Version PyPI - Downloads GitHub top language X (formerly Twitter) Follow

Math utils for Uniswap v4.

Install

pip install uv4

Fixed Point

  • Q64.96 convertion utils
    • Convert decimal to Q64.96
    • Convert Q64.96 to decimal

TickMath & Sqrt Prices

>>> from uv4 import TickMath
>>> tick = 10
>>> tick_spacing = 1
>>> t = TickMath(tick, tick_spacing)
>>> t.to_price()
Decimal('1.0010004501200210025202100120004500100001')
>>> t.to_sqrt_price()
Decimal('1.00050010001000050001')
>>> t.to_sqrt_price_x96()
79267784519130042428790663799
>>>
  • get price at tick
  • get tick at price
  • get Q64.96 price at tick
  • get tick at Q64.96 price
  • get Q64.96 price from price
  • get price from Q64.96 price

Hooks

>>> from uv4 import Hook
>>> address = 0x00000000000000000000000000000000000000b5
>>> h = Hook(address)
>>> h.has_after_swap_flag()
False
>>> h.has_before_swap_flag()
True

🧪 Run Tests

Dependencies:

  • pytest
  • pytest-watcher

Run command

ptw .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uv4-0.1.0.tar.gz (56.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uv4-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file uv4-0.1.0.tar.gz.

File metadata

  • Download URL: uv4-0.1.0.tar.gz
  • Upload date:
  • Size: 56.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for uv4-0.1.0.tar.gz
Algorithm Hash digest
SHA256 79cea70c911f01932b013bf79be5f7464820b564c3bc4b6cb776433256247679
MD5 08a2b21d8c4f17f36e771f2fd28bb8d7
BLAKE2b-256 a06e6af867fac5d219b94057c4b7d1e6d04e9a3c1f62c012628145597d4bd48c

See more details on using hashes here.

File details

Details for the file uv4-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uv4-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for uv4-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dba6d892a6cc209bd2952e541871a13f3429bcd63da4c99e449ba6047a7857d3
MD5 059bbf92ba40d9f40458931127e6b989
BLAKE2b-256 9e87a1b134db29e7f21a90d02d023ad629f67cd6b021dfb119beb5e120f790e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page