eth-protocols-py 0.1.5.dev1__tar.gz → 0.1.6.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/PKG-INFO +1 -1
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/helpers/dex_pairs.py +119 -56
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols_py.egg-info/PKG-INFO +1 -1
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/pyproject.toml +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/setup.cfg +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/setup.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/camelot_v3/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/camelot_v3/pool.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/helpers/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/helpers/multicall.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/helpers/price_tracker.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/logger.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/tokens/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/tokens/erc20/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/tokens/erc20/events.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/types/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/types/dex_pair.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/factory.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/pair.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/price.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v3/__init__.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v3/liquidity.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v3/pool.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/utils/lookup_dict.py +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols_py.egg-info/SOURCES.txt +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols_py.egg-info/dependency_links.txt +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols_py.egg-info/requires.txt +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols_py.egg-info/top_level.txt +0 -0
- {eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/tests/test_create2_address.py +0 -0
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/helpers/dex_pairs.py
RENAMED
|
@@ -5,6 +5,7 @@ from eth_protocols.uniswap_v2 import V2Pair
|
|
|
5
5
|
from eth_protocols.uniswap_v3 import V3Pool
|
|
6
6
|
from eth_rpc.types.primitives import uint24
|
|
7
7
|
from eth_typeshed.camelot_v3 import CamelotV3Factory
|
|
8
|
+
from eth_typeshed.camelot_v3 import CamelotV3Pool as CamelotV3PoolContract
|
|
8
9
|
from eth_typeshed.camelot_v3 import GetPoolRequest as CamelotGetPoolRequest
|
|
9
10
|
from eth_typeshed.constants import Factories, Tokens
|
|
10
11
|
from eth_typeshed.erc20 import OwnerRequest
|
|
@@ -24,79 +25,88 @@ class DexPairHelper(BaseModel):
|
|
|
24
25
|
addr: HexAddress,
|
|
25
26
|
paired_with: HexAddress,
|
|
26
27
|
fee_tiers: list[int],
|
|
27
|
-
|
|
28
|
-
uniswap_v3_factory_address: HexAddress,
|
|
28
|
+
factories: list[HexAddress],
|
|
29
29
|
):
|
|
30
30
|
addr = to_checksum_address(addr)
|
|
31
31
|
paired_with = to_checksum_address(paired_with)
|
|
32
|
-
calls_list = [
|
|
33
|
-
(
|
|
34
|
-
UniswapV2Factory(address=uniswap_v2_factory_address).get_pair(
|
|
35
|
-
GetPairRequest(token_a=addr, token_b=paired_with)
|
|
36
|
-
),
|
|
37
|
-
lambda result, addr=addr, paired_with=paired_with: (
|
|
38
|
-
data.setdefault(addr, []).append(
|
|
39
|
-
V2Pair.load_static(
|
|
40
|
-
pair_address=result,
|
|
41
|
-
tokena=addr,
|
|
42
|
-
tokenb=paired_with,
|
|
43
|
-
)
|
|
44
|
-
)
|
|
45
|
-
),
|
|
46
|
-
),
|
|
47
|
-
]
|
|
48
32
|
|
|
49
|
-
for
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
for factory in factories:
|
|
34
|
+
if (
|
|
35
|
+
factory == Factories.for_network().UniswapV2
|
|
36
|
+
or factory == Factories.for_network().pod_factory
|
|
37
|
+
):
|
|
38
|
+
calls_list = [
|
|
52
39
|
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
token_a=addr,
|
|
56
|
-
token_b=paired_with,
|
|
57
|
-
fee=uint24(fee),
|
|
58
|
-
)
|
|
40
|
+
UniswapV2Factory(address=factory).get_pair(
|
|
41
|
+
GetPairRequest(token_a=addr, token_b=paired_with)
|
|
59
42
|
),
|
|
60
|
-
lambda result, addr=addr, paired_with=paired_with
|
|
43
|
+
lambda result, addr=addr, paired_with=paired_with: (
|
|
61
44
|
data.setdefault(addr, []).append(
|
|
62
|
-
|
|
45
|
+
V2Pair.load_static(
|
|
46
|
+
pair_address=result,
|
|
63
47
|
tokena=addr,
|
|
64
48
|
tokenb=paired_with,
|
|
65
|
-
pair_address=result,
|
|
66
|
-
fee=fee,
|
|
67
49
|
)
|
|
68
50
|
)
|
|
69
51
|
),
|
|
70
52
|
),
|
|
71
53
|
]
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
54
|
+
|
|
55
|
+
if factory == Factories.for_network().UniswapV3:
|
|
56
|
+
for fee in fee_tiers:
|
|
57
|
+
calls_list.extend(
|
|
58
|
+
[
|
|
59
|
+
(
|
|
60
|
+
UniswapV3Factory(
|
|
61
|
+
address=uniswap_v3_factory_address
|
|
62
|
+
).get_pool(
|
|
63
|
+
GetPoolRequest(
|
|
64
|
+
token_a=addr,
|
|
65
|
+
token_b=paired_with,
|
|
66
|
+
fee=uint24(fee),
|
|
67
|
+
)
|
|
68
|
+
),
|
|
69
|
+
lambda result, addr=addr, paired_with=paired_with, fee=fee: ( # type: ignore
|
|
70
|
+
data.setdefault(addr, []).append(
|
|
71
|
+
V3Pool.load_static(
|
|
72
|
+
tokena=addr,
|
|
73
|
+
tokenb=paired_with,
|
|
74
|
+
pair_address=result,
|
|
75
|
+
fee=fee,
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
),
|
|
79
|
+
),
|
|
80
|
+
]
|
|
81
|
+
)
|
|
82
|
+
if factories == Factories.Arbitrum.Camelot_V3:
|
|
83
|
+
calls_list.extend(
|
|
84
|
+
[
|
|
85
|
+
(
|
|
86
|
+
CamelotV3Factory(
|
|
87
|
+
address=uniswap_v3_factory_address
|
|
88
|
+
).pool_by_pair(
|
|
89
|
+
CamelotGetPoolRequest(token_a=addr, token_b=paired_with)
|
|
90
|
+
),
|
|
91
|
+
lambda result, addr=addr, paired_with=paired_with: ( # type: ignore
|
|
92
|
+
data.setdefault(addr, []).append(
|
|
93
|
+
CamelotV3Pool.load_static(
|
|
94
|
+
tokena=addr,
|
|
95
|
+
tokenb=paired_with,
|
|
96
|
+
pair_address=result,
|
|
97
|
+
)
|
|
86
98
|
)
|
|
87
|
-
)
|
|
99
|
+
),
|
|
88
100
|
),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
)
|
|
101
|
+
]
|
|
102
|
+
)
|
|
92
103
|
return calls_list
|
|
93
104
|
|
|
94
105
|
@staticmethod
|
|
95
106
|
async def find_all_pairs(
|
|
96
107
|
addresses: list[HexAddress],
|
|
97
108
|
find_pairs: list[HexAddress] = Tokens.for_network().main,
|
|
98
|
-
|
|
99
|
-
uniswap_v3_factory_address: HexAddress = Factories.for_network().UniswapV3,
|
|
109
|
+
factories: list[HexAddress] = Factories.for_network().all_factories,
|
|
100
110
|
fee_tiers: list[int] = [500, 3000, 10000],
|
|
101
111
|
block_number: int | None = None,
|
|
102
112
|
) -> dict[HexAddress, list[V2Pair | V3Pool]]:
|
|
@@ -112,8 +122,7 @@ class DexPairHelper(BaseModel):
|
|
|
112
122
|
addr,
|
|
113
123
|
paired_with,
|
|
114
124
|
fee_tiers,
|
|
115
|
-
|
|
116
|
-
uniswap_v3_factory_address,
|
|
125
|
+
factories,
|
|
117
126
|
)
|
|
118
127
|
)
|
|
119
128
|
await try_execute_with_setters(
|
|
@@ -125,8 +134,7 @@ class DexPairHelper(BaseModel):
|
|
|
125
134
|
@staticmethod
|
|
126
135
|
async def find_all_stables_pairs(
|
|
127
136
|
find_pairs: list[HexAddress] = Tokens.for_network().main,
|
|
128
|
-
|
|
129
|
-
uniswap_v3_factory_address: HexAddress = Factories.for_network().UniswapV3,
|
|
137
|
+
factories=Factories.for_network().all_factories,
|
|
130
138
|
fee_tiers: list[int] = [500, 3000, 10000],
|
|
131
139
|
block_number: int | None = None,
|
|
132
140
|
) -> dict[HexAddress, list[V2Pair | V3Pool]]:
|
|
@@ -166,7 +174,7 @@ class DexPairHelper(BaseModel):
|
|
|
166
174
|
(
|
|
167
175
|
UniswapV2Pair(address=pair.pair_address).get_reserves(),
|
|
168
176
|
lambda result, pair=pair: (
|
|
169
|
-
pair.set_reserves(result
|
|
177
|
+
pair.set_reserves(result.reserve0, result.reserve1)
|
|
170
178
|
),
|
|
171
179
|
)
|
|
172
180
|
)
|
|
@@ -249,6 +257,61 @@ class DexPairHelper(BaseModel):
|
|
|
249
257
|
lambda result, pair=pair: (pair.token1.set_symbol(result)),
|
|
250
258
|
)
|
|
251
259
|
)
|
|
260
|
+
|
|
261
|
+
elif isinstance(pair, CamelotV3Pool):
|
|
262
|
+
calls_with_setters.append(
|
|
263
|
+
(
|
|
264
|
+
CamelotV3PoolContract(
|
|
265
|
+
address=pair.pair_address
|
|
266
|
+
).global_state(),
|
|
267
|
+
lambda result, pair=pair: (pair.set_global_state(result)),
|
|
268
|
+
)
|
|
269
|
+
)
|
|
270
|
+
calls_with_setters.append(
|
|
271
|
+
(
|
|
272
|
+
pair.token0.raw.balance_of(
|
|
273
|
+
OwnerRequest(owner=pair.pair_address)
|
|
274
|
+
),
|
|
275
|
+
lambda result, pair=pair: (pair.set_reserve0(result)),
|
|
276
|
+
)
|
|
277
|
+
)
|
|
278
|
+
calls_with_setters.append(
|
|
279
|
+
(
|
|
280
|
+
pair.token1.raw.balance_of(
|
|
281
|
+
OwnerRequest(owner=pair.pair_address)
|
|
282
|
+
),
|
|
283
|
+
lambda result, pair=pair: (pair.set_reserve1(result)),
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
calls_with_setters.append(
|
|
287
|
+
(
|
|
288
|
+
pair.token0.raw.decimals(),
|
|
289
|
+
lambda result, pair=pair: (
|
|
290
|
+
pair.token0.set_decimals(result)
|
|
291
|
+
),
|
|
292
|
+
)
|
|
293
|
+
)
|
|
294
|
+
calls_with_setters.append(
|
|
295
|
+
(
|
|
296
|
+
pair.token0.raw.symbol(),
|
|
297
|
+
lambda result, pair=pair: (pair.token0.set_symbol(result)),
|
|
298
|
+
)
|
|
299
|
+
)
|
|
300
|
+
calls_with_setters.append(
|
|
301
|
+
(
|
|
302
|
+
pair.token1.raw.decimals(),
|
|
303
|
+
lambda result, pair=pair: (
|
|
304
|
+
pair.token1.set_decimals(result)
|
|
305
|
+
),
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
calls_with_setters.append(
|
|
309
|
+
(
|
|
310
|
+
pair.token1.raw.symbol(),
|
|
311
|
+
lambda result, pair=pair: (pair.token1.set_symbol(result)),
|
|
312
|
+
)
|
|
313
|
+
)
|
|
314
|
+
|
|
252
315
|
await try_execute_with_setters(
|
|
253
316
|
calls_with_setters, block_number=block_number or "latest"
|
|
254
317
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/camelot_v3/__init__.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/camelot_v3/pool.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/helpers/__init__.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/helpers/multicall.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/tokens/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/tokens/erc20/events.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/types/__init__.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/types/dex_pair.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/__init__.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/factory.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/pair.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v2/price.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v3/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/uniswap_v3/pool.py
RENAMED
|
File without changes
|
{eth_protocols_py-0.1.5.dev1 → eth_protocols_py-0.1.6.dev1}/src/eth_protocols/utils/lookup_dict.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|