Skip to content

Commit dbe104f

Browse files
authored
Merge pull request #365 from liquid-8/dev
UniswapV4 alpha
2 parents 7f7cbe9 + 2f9e012 commit dbe104f

5 files changed

Lines changed: 296 additions & 51 deletions

File tree

‎uniswap/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
from . import exceptions
22
from .uniswap import Uniswap, _str_to_addr
3-
from .uniswap4 import Uniswap4
3+
from .uniswap4 import Uniswap4Core
44
from .cli import main

‎uniswap/assets/uniswap-v4/poolmanager.abi‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,17 @@
635635
{
636636
"inputs": [
637637
{
638-
"internalType": "uint256",
639-
"name": "id",
640-
"type": "uint256"
638+
"internalType": "address",
639+
"name": "locker",
640+
"type": "address"
641641
},
642642
{
643643
"internalType": "Currency",
644644
"name": "currency",
645645
"type": "address"
646646
}
647647
],
648-
"name": "getCurrencyDelta",
648+
"name": "currencyDelta",
649649
"outputs": [
650650
{
651651
"internalType": "int256",

‎uniswap/constants.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
137: "polygon",
3030
100: "xdai",
3131
250: "fantom",
32+
17000: "holesky",
3233
42161: "arbitrum",
3334
421611: "arbitrum_testnet",
35+
11155111: "sepolia",
3436
1666600000: "harmony_mainnet",
3537
1666700000: "harmony_testnet",
3638
}

‎uniswap/types.py‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
from typing import Union
2+
from dataclasses import dataclass
23
from eth_typing.evm import Address, ChecksumAddress
34

45

56
AddressLike = Union[Address, ChecksumAddress]
7+
8+
@dataclass
9+
class UniswapV4_slot0:
10+
sqrtPriceX96: int
11+
tick: int
12+
protocolFee: int
13+
14+
def __repr__(self) -> str:
15+
return f"Slot0 value (sqrtPriceX96: {self.sqrtPriceX96}; tick: {self.tick}; protocolFee: {self.protocolFee!r})"
16+
17+
@dataclass
18+
class UniswapV4_position_info:
19+
liquidity: int
20+
feeGrowthInside0LastX128: int
21+
feeGrowthInside1LastX128: int
22+
23+
def __repr__(self) -> str:
24+
return f"Position info (liquidity: {self.liquidity}; feeGrowthInside0LastX128: {self.feeGrowthInside0LastX128}; feeGrowthInside1LastX128: {self.feeGrowthInside1LastX128!r})"
25+
26+
@dataclass
27+
class UniswapV4_tick_info:
28+
liquidityGross : int
29+
liquidityNet : int
30+
feeGrowthOutside0X128 : int
31+
feeGrowthOutside1X128 : int
32+
33+
def __repr__(self) -> str:
34+
return f"Tick info (liquidityGross: {self.liquidityGross}; liquidityNet: {self.liquidityNet}; feeGrowthOutside0X128: {self.feeGrowthOutside0X128}; feeGrowthOutside1X128: {self.feeGrowthOutside1X128!r})"

0 commit comments

Comments
 (0)