DeFiPy 0.0.28__tar.gz → 1.0.0__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.
- {defipy-0.0.28 → defipy-1.0.0}/DeFiPy.egg-info/PKG-INFO +12 -10
- {defipy-0.0.28 → defipy-1.0.0}/DeFiPy.egg-info/SOURCES.txt +4 -0
- defipy-1.0.0/DeFiPy.egg-info/requires.txt +5 -0
- {defipy-0.0.28 → defipy-1.0.0}/PKG-INFO +12 -10
- {defipy-0.0.28 → defipy-1.0.0}/README.md +8 -6
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/__init__.py +1 -0
- defipy-1.0.0/python/prod/process/join/Join.py +43 -0
- defipy-1.0.0/python/prod/process/join/__init__.py +1 -0
- defipy-1.0.0/python/prod/process/liquidity/AddLiquidity.py +43 -0
- defipy-1.0.0/python/prod/process/liquidity/RemoveLiquidity.py +43 -0
- defipy-1.0.0/python/prod/process/liquidity/__init__.py +2 -0
- defipy-1.0.0/python/prod/process/swap/Swap.py +43 -0
- defipy-1.0.0/python/prod/process/swap/__init__.py +2 -0
- {defipy-0.0.28 → defipy-1.0.0}/setup.py +4 -4
- defipy-0.0.28/DeFiPy.egg-info/requires.txt +0 -5
- defipy-0.0.28/python/prod/process/join/__init__.py +0 -1
- defipy-0.0.28/python/prod/process/liquidity/__init__.py +0 -1
- defipy-0.0.28/python/prod/process/swap/__init__.py +0 -1
- {defipy-0.0.28 → defipy-1.0.0}/DeFiPy.egg-info/dependency_links.txt +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/DeFiPy.egg-info/not-zip-safe +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/DeFiPy.egg-info/top_level.txt +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/LICENSE.txt +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/erc/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/math/basic/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/math/interest/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/math/interest/ips/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/math/interest/ips/aggregate/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/math/model/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/math/risk/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/process/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/process/burn/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/process/deposit/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/process/mint/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/simulate/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/utils/client/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/utils/data/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/utils/interfaces/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/utils/tools/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/python/prod/utils/tools/v3/__init__.py +0 -0
- {defipy-0.0.28 → defipy-1.0.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DeFiPy
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: DeFi Analytics with Python
|
|
5
5
|
Home-page: http://github.com/defipy-devs/defipy
|
|
6
6
|
Author: icmoore
|
|
@@ -10,11 +10,11 @@ Description-Content-Type: text/markdown
|
|
|
10
10
|
License-File: LICENSE.txt
|
|
11
11
|
Requires-Dist: scipy>=1.7.3
|
|
12
12
|
Requires-Dist: bokeh==3.3.4
|
|
13
|
-
Requires-Dist: uniswappy==1.6.
|
|
14
|
-
Requires-Dist: stableswappy==0.0
|
|
15
|
-
Requires-Dist: balancerpy==
|
|
13
|
+
Requires-Dist: uniswappy==1.6.2
|
|
14
|
+
Requires-Dist: stableswappy==1.0.0
|
|
15
|
+
Requires-Dist: balancerpy==1.0.1
|
|
16
16
|
|
|
17
|
-
# DeFiPy: DeFi Analytics with Python (v 0.0
|
|
17
|
+
# DeFiPy: DeFi Analytics with Python (v 1.0.0)
|
|
18
18
|
|
|
19
19
|
Welcome to the worlds first DeFi Python package with all major protocols intergrated into one package! Implement your analytics in one package with DeFiPy. Since DeFiPy is built with a modular design in mind, your can also silo your analytics by protocol
|
|
20
20
|
using:
|
|
@@ -59,7 +59,7 @@ To setup a liquidity pool, you must first create the tokens in the pair using th
|
|
|
59
59
|
|
|
60
60
|
factory = UniswapFactory("ETH pool factory", "0x2")
|
|
61
61
|
lp = factory.deploy(exchg_data)
|
|
62
|
-
|
|
62
|
+
Join().apply(lp, "user0", eth_amount, tkn_amount)
|
|
63
63
|
lp.summary()
|
|
64
64
|
|
|
65
65
|
|
|
@@ -79,6 +79,9 @@ Uniswap V3 Example
|
|
|
79
79
|
lwr_tick = UniV3Utils.getMinTick(tick_spacing)
|
|
80
80
|
upr_tick = UniV3Utils.getMaxTick(tick_spacing)
|
|
81
81
|
init_price = UniV3Utils.encodePriceSqrt(100, 1)
|
|
82
|
+
|
|
83
|
+
eth_amount = 3162.277660168379
|
|
84
|
+
tkn_amount = 316227.7660168379
|
|
82
85
|
|
|
83
86
|
dai = ERC20("DAI", "0x09")
|
|
84
87
|
eth = ERC20("ETH", "0x111")
|
|
@@ -90,8 +93,7 @@ Uniswap V3 Example
|
|
|
90
93
|
|
|
91
94
|
factory = UniswapFactory("ETH pool factory", "0x2")
|
|
92
95
|
lp = factory.deploy(exchg_data)
|
|
93
|
-
|
|
94
|
-
out = lp.mint(user, lwr_tick, upr_tick, 31622.776601683792)
|
|
96
|
+
Join().apply(lp, "user0", eth_amount, tkn_amount, lwr_tick, upr_tick)
|
|
95
97
|
lp.summary()
|
|
96
98
|
|
|
97
99
|
Exchange ETH-DAI (LP)
|
|
@@ -126,7 +128,7 @@ Balancer Example
|
|
|
126
128
|
bfactory = BalancerFactory("WETH pool factory", "0x")
|
|
127
129
|
exchg_data = BalancerExchangeData(vault = bgrp, symbol="LP", address="0x1")
|
|
128
130
|
lp = bfactory.deploy(exchg_data)
|
|
129
|
-
|
|
131
|
+
Join().apply(lp, USER, init_pool_shares)
|
|
130
132
|
lp.summary()
|
|
131
133
|
|
|
132
134
|
|
|
@@ -171,7 +173,7 @@ StableSwap Example
|
|
|
171
173
|
sfactory = StableswapFactory("Pool factory", "0x")
|
|
172
174
|
exchg_data = StableswapExchangeData(vault = sgrp, symbol="LP", address="0x11")
|
|
173
175
|
lp = sfactory.deploy(exchg_data)
|
|
174
|
-
|
|
176
|
+
Join().apply(lp, USER, AMPL_COEFF)
|
|
175
177
|
lp.summary()
|
|
176
178
|
|
|
177
179
|
|
|
@@ -25,9 +25,13 @@ python/prod/math/risk/__init__.py
|
|
|
25
25
|
python/prod/process/__init__.py
|
|
26
26
|
python/prod/process/burn/__init__.py
|
|
27
27
|
python/prod/process/deposit/__init__.py
|
|
28
|
+
python/prod/process/join/Join.py
|
|
28
29
|
python/prod/process/join/__init__.py
|
|
30
|
+
python/prod/process/liquidity/AddLiquidity.py
|
|
31
|
+
python/prod/process/liquidity/RemoveLiquidity.py
|
|
29
32
|
python/prod/process/liquidity/__init__.py
|
|
30
33
|
python/prod/process/mint/__init__.py
|
|
34
|
+
python/prod/process/swap/Swap.py
|
|
31
35
|
python/prod/process/swap/__init__.py
|
|
32
36
|
python/prod/simulate/__init__.py
|
|
33
37
|
python/prod/utils/client/__init__.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DeFiPy
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: DeFi Analytics with Python
|
|
5
5
|
Home-page: http://github.com/defipy-devs/defipy
|
|
6
6
|
Author: icmoore
|
|
@@ -10,11 +10,11 @@ Description-Content-Type: text/markdown
|
|
|
10
10
|
License-File: LICENSE.txt
|
|
11
11
|
Requires-Dist: scipy>=1.7.3
|
|
12
12
|
Requires-Dist: bokeh==3.3.4
|
|
13
|
-
Requires-Dist: uniswappy==1.6.
|
|
14
|
-
Requires-Dist: stableswappy==0.0
|
|
15
|
-
Requires-Dist: balancerpy==
|
|
13
|
+
Requires-Dist: uniswappy==1.6.2
|
|
14
|
+
Requires-Dist: stableswappy==1.0.0
|
|
15
|
+
Requires-Dist: balancerpy==1.0.1
|
|
16
16
|
|
|
17
|
-
# DeFiPy: DeFi Analytics with Python (v 0.0
|
|
17
|
+
# DeFiPy: DeFi Analytics with Python (v 1.0.0)
|
|
18
18
|
|
|
19
19
|
Welcome to the worlds first DeFi Python package with all major protocols intergrated into one package! Implement your analytics in one package with DeFiPy. Since DeFiPy is built with a modular design in mind, your can also silo your analytics by protocol
|
|
20
20
|
using:
|
|
@@ -59,7 +59,7 @@ To setup a liquidity pool, you must first create the tokens in the pair using th
|
|
|
59
59
|
|
|
60
60
|
factory = UniswapFactory("ETH pool factory", "0x2")
|
|
61
61
|
lp = factory.deploy(exchg_data)
|
|
62
|
-
|
|
62
|
+
Join().apply(lp, "user0", eth_amount, tkn_amount)
|
|
63
63
|
lp.summary()
|
|
64
64
|
|
|
65
65
|
|
|
@@ -79,6 +79,9 @@ Uniswap V3 Example
|
|
|
79
79
|
lwr_tick = UniV3Utils.getMinTick(tick_spacing)
|
|
80
80
|
upr_tick = UniV3Utils.getMaxTick(tick_spacing)
|
|
81
81
|
init_price = UniV3Utils.encodePriceSqrt(100, 1)
|
|
82
|
+
|
|
83
|
+
eth_amount = 3162.277660168379
|
|
84
|
+
tkn_amount = 316227.7660168379
|
|
82
85
|
|
|
83
86
|
dai = ERC20("DAI", "0x09")
|
|
84
87
|
eth = ERC20("ETH", "0x111")
|
|
@@ -90,8 +93,7 @@ Uniswap V3 Example
|
|
|
90
93
|
|
|
91
94
|
factory = UniswapFactory("ETH pool factory", "0x2")
|
|
92
95
|
lp = factory.deploy(exchg_data)
|
|
93
|
-
|
|
94
|
-
out = lp.mint(user, lwr_tick, upr_tick, 31622.776601683792)
|
|
96
|
+
Join().apply(lp, "user0", eth_amount, tkn_amount, lwr_tick, upr_tick)
|
|
95
97
|
lp.summary()
|
|
96
98
|
|
|
97
99
|
Exchange ETH-DAI (LP)
|
|
@@ -126,7 +128,7 @@ Balancer Example
|
|
|
126
128
|
bfactory = BalancerFactory("WETH pool factory", "0x")
|
|
127
129
|
exchg_data = BalancerExchangeData(vault = bgrp, symbol="LP", address="0x1")
|
|
128
130
|
lp = bfactory.deploy(exchg_data)
|
|
129
|
-
|
|
131
|
+
Join().apply(lp, USER, init_pool_shares)
|
|
130
132
|
lp.summary()
|
|
131
133
|
|
|
132
134
|
|
|
@@ -171,7 +173,7 @@ StableSwap Example
|
|
|
171
173
|
sfactory = StableswapFactory("Pool factory", "0x")
|
|
172
174
|
exchg_data = StableswapExchangeData(vault = sgrp, symbol="LP", address="0x11")
|
|
173
175
|
lp = sfactory.deploy(exchg_data)
|
|
174
|
-
|
|
176
|
+
Join().apply(lp, USER, AMPL_COEFF)
|
|
175
177
|
lp.summary()
|
|
176
178
|
|
|
177
179
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# DeFiPy: DeFi Analytics with Python (v 0.0
|
|
1
|
+
# DeFiPy: DeFi Analytics with Python (v 1.0.0)
|
|
2
2
|
|
|
3
3
|
Welcome to the worlds first DeFi Python package with all major protocols intergrated into one package! Implement your analytics in one package with DeFiPy. Since DeFiPy is built with a modular design in mind, your can also silo your analytics by protocol
|
|
4
4
|
using:
|
|
@@ -43,7 +43,7 @@ To setup a liquidity pool, you must first create the tokens in the pair using th
|
|
|
43
43
|
|
|
44
44
|
factory = UniswapFactory("ETH pool factory", "0x2")
|
|
45
45
|
lp = factory.deploy(exchg_data)
|
|
46
|
-
|
|
46
|
+
Join().apply(lp, "user0", eth_amount, tkn_amount)
|
|
47
47
|
lp.summary()
|
|
48
48
|
|
|
49
49
|
|
|
@@ -63,6 +63,9 @@ Uniswap V3 Example
|
|
|
63
63
|
lwr_tick = UniV3Utils.getMinTick(tick_spacing)
|
|
64
64
|
upr_tick = UniV3Utils.getMaxTick(tick_spacing)
|
|
65
65
|
init_price = UniV3Utils.encodePriceSqrt(100, 1)
|
|
66
|
+
|
|
67
|
+
eth_amount = 3162.277660168379
|
|
68
|
+
tkn_amount = 316227.7660168379
|
|
66
69
|
|
|
67
70
|
dai = ERC20("DAI", "0x09")
|
|
68
71
|
eth = ERC20("ETH", "0x111")
|
|
@@ -74,8 +77,7 @@ Uniswap V3 Example
|
|
|
74
77
|
|
|
75
78
|
factory = UniswapFactory("ETH pool factory", "0x2")
|
|
76
79
|
lp = factory.deploy(exchg_data)
|
|
77
|
-
|
|
78
|
-
out = lp.mint(user, lwr_tick, upr_tick, 31622.776601683792)
|
|
80
|
+
Join().apply(lp, "user0", eth_amount, tkn_amount, lwr_tick, upr_tick)
|
|
79
81
|
lp.summary()
|
|
80
82
|
|
|
81
83
|
Exchange ETH-DAI (LP)
|
|
@@ -110,7 +112,7 @@ Balancer Example
|
|
|
110
112
|
bfactory = BalancerFactory("WETH pool factory", "0x")
|
|
111
113
|
exchg_data = BalancerExchangeData(vault = bgrp, symbol="LP", address="0x1")
|
|
112
114
|
lp = bfactory.deploy(exchg_data)
|
|
113
|
-
|
|
115
|
+
Join().apply(lp, USER, init_pool_shares)
|
|
114
116
|
lp.summary()
|
|
115
117
|
|
|
116
118
|
|
|
@@ -155,7 +157,7 @@ StableSwap Example
|
|
|
155
157
|
sfactory = StableswapFactory("Pool factory", "0x")
|
|
156
158
|
exchg_data = StableswapExchangeData(vault = sgrp, symbol="LP", address="0x11")
|
|
157
159
|
lp = sfactory.deploy(exchg_data)
|
|
158
|
-
|
|
160
|
+
Join().apply(lp, USER, AMPL_COEFF)
|
|
159
161
|
lp.summary()
|
|
160
162
|
|
|
161
163
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Copyright [2024] [Ian Moore]
|
|
2
|
+
# Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
|
3
|
+
# Email: defipy.devs@gmail.com
|
|
4
|
+
|
|
5
|
+
from uniswappy.process.join import Join as UniswapJoin
|
|
6
|
+
from balancerpy.process.join import Join as BalancerJoin
|
|
7
|
+
from stableswappy.process.join import Join as StableswapJoin
|
|
8
|
+
|
|
9
|
+
class Join():
|
|
10
|
+
|
|
11
|
+
""" Process to join x and y amounts to pool
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def apply(self, lp, v1 = None, v2 = None, v3 = None, v4 = None, v5 = None):
|
|
18
|
+
""" apply
|
|
19
|
+
|
|
20
|
+
Join x and y amounts to pool
|
|
21
|
+
|
|
22
|
+
UniswapJoin().apply(lp, user_nm, amount0, amount1, lwr_tick = None, upr_tick = None):
|
|
23
|
+
|
|
24
|
+
BalancerJoin().apply(lp, user_nm, shares)
|
|
25
|
+
|
|
26
|
+
StableswapJoin().apply(lp, user_nm, shares)
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
out : dictionary
|
|
31
|
+
join output
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
if type(lp).__name__ == 'UniswapExchange' or type(lp).__name__ == 'UniswapV3Exchange':
|
|
35
|
+
out = UniswapJoin().apply(lp, v1, v2, v3, v4, v5)
|
|
36
|
+
elif type(lp).__name__ == 'BalancerExchange':
|
|
37
|
+
out = BalancerJoin().apply(lp, v1, v2)
|
|
38
|
+
elif type(lp).__name__ == 'StableswapExchange':
|
|
39
|
+
out = StableswapJoin().apply(lp, v1, v2)
|
|
40
|
+
else:
|
|
41
|
+
print('DeFiPy: WRONG EXCHANGE TYPE OR VARIABLES')
|
|
42
|
+
|
|
43
|
+
return out
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .Join import Join
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Copyright [2025] [Ian Moore]
|
|
2
|
+
# Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
|
3
|
+
# Email: defipy.devs@gmail.com
|
|
4
|
+
|
|
5
|
+
from uniswappy.process.liquidity import AddLiquidity as UniswapAddLiquidity
|
|
6
|
+
from balancerpy.process.liquidity import AddLiquidity as BalancerAddLiquidity
|
|
7
|
+
from stableswappy.process.liquidity import AddLiquidity as StableswapAddLiquidity
|
|
8
|
+
|
|
9
|
+
class AddLiquidity():
|
|
10
|
+
|
|
11
|
+
""" Add liquidity process
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, global_var1 = None):
|
|
15
|
+
self.gvar = global_var1
|
|
16
|
+
|
|
17
|
+
def apply(self, lp, v1 = None, v2 = None, v3 = None, v4 = None, v5 = None):
|
|
18
|
+
""" apply
|
|
19
|
+
|
|
20
|
+
Add liquidity process
|
|
21
|
+
|
|
22
|
+
UniswapAddLiquidity().apply(lp, user_nm, amount0, amount1, lwr_tick = None, upr_tick = None):
|
|
23
|
+
|
|
24
|
+
BalancerAddLiquidity(Proc.ADDTKN).apply(lp, tkn_in, user_nm, amt_tkn_in)
|
|
25
|
+
|
|
26
|
+
StableswapAddLiquidity().apply(lp, tkn_in, user_nm, amt_tkn_in)
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
out : dictionary
|
|
31
|
+
join output
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
if type(lp).__name__ == 'UniswapExchange' or type(lp).__name__ == 'UniswapV3Exchange':
|
|
35
|
+
out = UniswapAddLiquidity().apply(lp, v1, v2, v3, v4, v5)
|
|
36
|
+
elif type(lp).__name__ == 'BalancerExchange':
|
|
37
|
+
out = BalancerAddLiquidity(self.gvar).apply(lp, v1, v2, v3)
|
|
38
|
+
elif type(lp).__name__ == 'StableswapExchange':
|
|
39
|
+
out = StableswapAddLiquidity().apply(lp, v1, v2, v3)
|
|
40
|
+
else:
|
|
41
|
+
print('DeFiPy: WRONG EXCHANGE TYPE OR VARIABLES')
|
|
42
|
+
|
|
43
|
+
return out
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Copyright [2025] [Ian Moore]
|
|
2
|
+
# Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
|
3
|
+
# Email: defipy.devs@gmail.com
|
|
4
|
+
|
|
5
|
+
from uniswappy.process.liquidity import RemoveLiquidity as UniswapRemoveLiquidity
|
|
6
|
+
from balancerpy.process.liquidity import RemoveLiquidity as BalancerRemoveLiquidity
|
|
7
|
+
from stableswappy.process.liquidity import RemoveLiquidity as StableswapRemoveLiquidity
|
|
8
|
+
|
|
9
|
+
class RemoveLiquidity():
|
|
10
|
+
|
|
11
|
+
""" Process to join x and y amounts to pool
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, global_var1 = None):
|
|
15
|
+
self.gvar = global_var1
|
|
16
|
+
|
|
17
|
+
def apply(self, lp, v1 = None, v2 = None, v3 = None, v4 = None, v5 = None):
|
|
18
|
+
""" apply
|
|
19
|
+
|
|
20
|
+
Join x and y amounts to pool
|
|
21
|
+
|
|
22
|
+
UniswapRemoveLiquidity().apply(lp, user_nm, amount0, amount1, lwr_tick = None, upr_tick = None):
|
|
23
|
+
|
|
24
|
+
BalancerRemoveLiquidity(Proc.ADDTKN).apply(lp, tkn_in, user_nm, amt_tkn_in)
|
|
25
|
+
|
|
26
|
+
StableswapRemoveLiquidity().apply(lp, tkn_in, user_nm, amt_tkn_in)
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
out : dictionary
|
|
31
|
+
join output
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
if type(lp).__name__ == 'UniswapExchange' or type(lp).__name__ == 'UniswapV3Exchange':
|
|
35
|
+
out = UniswapRemoveLiquidity().apply(lp, v1, v2, v3, v4, v5)
|
|
36
|
+
elif type(lp).__name__ == 'BalancerExchange':
|
|
37
|
+
out = BalancerRemoveLiquidity(self.gvar).apply(lp, v1, v2, v3)
|
|
38
|
+
elif type(lp).__name__ == 'StableswapExchange':
|
|
39
|
+
out = StableswapRemoveLiquidity().apply(lp, v1, v2, v3)
|
|
40
|
+
else:
|
|
41
|
+
print('DeFiPy: WRONG EXCHANGE TYPE OR VARIABLES')
|
|
42
|
+
|
|
43
|
+
return out
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Copyright [2025] [Ian Moore]
|
|
2
|
+
# Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
|
3
|
+
# Email: defipy.devs@gmail.com
|
|
4
|
+
|
|
5
|
+
from uniswappy.process.swap import Swap as UniswapSwap
|
|
6
|
+
from balancerpy.process.swap import Swap as BalancerSwap
|
|
7
|
+
from stableswappy.process.swap import Swap as StableswapSwap
|
|
8
|
+
|
|
9
|
+
class Swap():
|
|
10
|
+
|
|
11
|
+
""" Process to swap token X for token Y (and vice verse)
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, global_var1 = None):
|
|
15
|
+
self.gvar = global_var1
|
|
16
|
+
|
|
17
|
+
def apply(self, lp, v1 = None, v2 = None, v3 = None, v4 = None):
|
|
18
|
+
""" apply
|
|
19
|
+
|
|
20
|
+
Swap token X for token Y (and vice verse)
|
|
21
|
+
|
|
22
|
+
UniswapSwap().apply(lp, token_in, user_nm, amount)
|
|
23
|
+
|
|
24
|
+
BalancerSwap().apply(lp, token_in, token_out, user_nm, amount)
|
|
25
|
+
|
|
26
|
+
StableswapSwap().apply(lp, token_in, token_out, user_nm, amount)
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
out : dictionary
|
|
31
|
+
join output
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
if type(lp).__name__ == 'UniswapExchange' or type(lp).__name__ == 'UniswapV3Exchange':
|
|
35
|
+
out = UniswapSwap().apply(lp, v1, v2, v3)
|
|
36
|
+
elif type(lp).__name__ == 'BalancerExchange':
|
|
37
|
+
out = BalancerSwap(self.gvar).apply(lp, v1, v2, v3, v4)
|
|
38
|
+
elif type(lp).__name__ == 'StableswapExchange':
|
|
39
|
+
out = StableswapSwap().apply(lp, v1, v2, v3, v4)
|
|
40
|
+
else:
|
|
41
|
+
print('DeFiPy: WRONG EXCHANGE TYPE OR VARIABLES')
|
|
42
|
+
|
|
43
|
+
return out
|
|
@@ -4,7 +4,7 @@ with open('README.md') as f:
|
|
|
4
4
|
long_description = f.read()
|
|
5
5
|
|
|
6
6
|
setup(name='DeFiPy',
|
|
7
|
-
version='0.0
|
|
7
|
+
version='1.0.0',
|
|
8
8
|
description='DeFi Analytics with Python',
|
|
9
9
|
long_description=long_description,
|
|
10
10
|
long_description_content_type="text/markdown",
|
|
@@ -39,8 +39,8 @@ setup(name='DeFiPy',
|
|
|
39
39
|
install_requires=[
|
|
40
40
|
'scipy >= 1.7.3',
|
|
41
41
|
'bokeh == 3.3.4',
|
|
42
|
-
'uniswappy == 1.6.
|
|
43
|
-
'stableswappy == 0.0
|
|
44
|
-
'balancerpy ==
|
|
42
|
+
'uniswappy == 1.6.2',
|
|
43
|
+
'stableswappy == 1.0.0',
|
|
44
|
+
'balancerpy == 1.0.1'
|
|
45
45
|
],
|
|
46
46
|
zip_safe=False)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from uniswappy.process.join import *
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from uniswappy.process.liquidity import *
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from uniswappy.process.swap import *
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|