defi-state-querier 0.5.25__py3-none-any.whl → 0.5.27__py3-none-any.whl
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.
- defi_services/__init__.py +1 -1
- defi_services/abis/token/trc20_abi.py +304 -0
- defi_services/services/lending/compound_v3_services.py +2 -2
- defi_services/services/lending/justlend_service.py +4 -3
- {defi_state_querier-0.5.25.dist-info → defi_state_querier-0.5.27.dist-info}/METADATA +1 -1
- {defi_state_querier-0.5.25.dist-info → defi_state_querier-0.5.27.dist-info}/RECORD +9 -8
- {defi_state_querier-0.5.25.dist-info → defi_state_querier-0.5.27.dist-info}/WHEEL +1 -1
- {defi_state_querier-0.5.25.dist-info → defi_state_querier-0.5.27.dist-info}/LICENSE +0 -0
- {defi_state_querier-0.5.25.dist-info → defi_state_querier-0.5.27.dist-info}/top_level.txt +0 -0
defi_services/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.5.
|
1
|
+
__version__ = "0.5.27"
|
@@ -0,0 +1,304 @@
|
|
1
|
+
import json
|
2
|
+
|
3
|
+
TRC20_ABI = json.loads('''
|
4
|
+
[
|
5
|
+
{
|
6
|
+
"constant": false,
|
7
|
+
"inputs": [
|
8
|
+
{
|
9
|
+
"name": "spender",
|
10
|
+
"type": "address"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"name": "value",
|
14
|
+
"type": "uint256"
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"name": "approve",
|
18
|
+
"outputs": [
|
19
|
+
{
|
20
|
+
"name": "",
|
21
|
+
"type": "bool"
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"payable": false,
|
25
|
+
"stateMutability": "nonpayable",
|
26
|
+
"type": "function",
|
27
|
+
"signature": "0x095ea7b3"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"constant": true,
|
31
|
+
"inputs": [],
|
32
|
+
"name": "totalSupply",
|
33
|
+
"outputs": [
|
34
|
+
{
|
35
|
+
"name": "",
|
36
|
+
"type": "uint256"
|
37
|
+
}
|
38
|
+
],
|
39
|
+
"payable": false,
|
40
|
+
"stateMutability": "view",
|
41
|
+
"type": "function",
|
42
|
+
"signature": "0x18160ddd"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"constant": false,
|
46
|
+
"inputs": [
|
47
|
+
{
|
48
|
+
"name": "from",
|
49
|
+
"type": "address"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"name": "to",
|
53
|
+
"type": "address"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"name": "value",
|
57
|
+
"type": "uint256"
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"name": "transferFrom",
|
61
|
+
"outputs": [
|
62
|
+
{
|
63
|
+
"name": "",
|
64
|
+
"type": "bool"
|
65
|
+
}
|
66
|
+
],
|
67
|
+
"payable": false,
|
68
|
+
"stateMutability": "nonpayable",
|
69
|
+
"type": "function",
|
70
|
+
"signature": "0x23b872dd"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"constant": false,
|
74
|
+
"inputs": [
|
75
|
+
{
|
76
|
+
"name": "spender",
|
77
|
+
"type": "address"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"name": "addedValue",
|
81
|
+
"type": "uint256"
|
82
|
+
}
|
83
|
+
],
|
84
|
+
"name": "increaseAllowance",
|
85
|
+
"outputs": [
|
86
|
+
{
|
87
|
+
"name": "",
|
88
|
+
"type": "bool"
|
89
|
+
}
|
90
|
+
],
|
91
|
+
"payable": false,
|
92
|
+
"stateMutability": "nonpayable",
|
93
|
+
"type": "function",
|
94
|
+
"signature": "0x39509351"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"constant": true,
|
98
|
+
"inputs": [
|
99
|
+
{
|
100
|
+
"name": "owner",
|
101
|
+
"type": "address"
|
102
|
+
}
|
103
|
+
],
|
104
|
+
"name": "balanceOf",
|
105
|
+
"outputs": [
|
106
|
+
{
|
107
|
+
"name": "",
|
108
|
+
"type": "uint256"
|
109
|
+
}
|
110
|
+
],
|
111
|
+
"payable": false,
|
112
|
+
"stateMutability": "view",
|
113
|
+
"type": "function",
|
114
|
+
"signature": "0x70a08231"
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"constant": false,
|
118
|
+
"inputs": [
|
119
|
+
{
|
120
|
+
"name": "spender",
|
121
|
+
"type": "address"
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"name": "subtractedValue",
|
125
|
+
"type": "uint256"
|
126
|
+
}
|
127
|
+
],
|
128
|
+
"name": "decreaseAllowance",
|
129
|
+
"outputs": [
|
130
|
+
{
|
131
|
+
"name": "",
|
132
|
+
"type": "bool"
|
133
|
+
}
|
134
|
+
],
|
135
|
+
"payable": false,
|
136
|
+
"stateMutability": "nonpayable",
|
137
|
+
"type": "function",
|
138
|
+
"signature": "0xa457c2d7"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"constant": false,
|
142
|
+
"inputs": [
|
143
|
+
{
|
144
|
+
"name": "to",
|
145
|
+
"type": "address"
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"name": "value",
|
149
|
+
"type": "uint256"
|
150
|
+
}
|
151
|
+
],
|
152
|
+
"name": "transfer",
|
153
|
+
"outputs": [
|
154
|
+
{
|
155
|
+
"name": "",
|
156
|
+
"type": "bool"
|
157
|
+
}
|
158
|
+
],
|
159
|
+
"payable": false,
|
160
|
+
"stateMutability": "nonpayable",
|
161
|
+
"type": "function",
|
162
|
+
"signature": "0xa9059cbb"
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"constant": true,
|
166
|
+
"inputs": [
|
167
|
+
{
|
168
|
+
"name": "owner",
|
169
|
+
"type": "address"
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"name": "spender",
|
173
|
+
"type": "address"
|
174
|
+
}
|
175
|
+
],
|
176
|
+
"name": "allowance",
|
177
|
+
"outputs": [
|
178
|
+
{
|
179
|
+
"name": "",
|
180
|
+
"type": "uint256"
|
181
|
+
}
|
182
|
+
],
|
183
|
+
"payable": false,
|
184
|
+
"stateMutability": "view",
|
185
|
+
"type": "function",
|
186
|
+
"signature": "0xdd62ed3e"
|
187
|
+
},
|
188
|
+
{
|
189
|
+
"inputs": [
|
190
|
+
{
|
191
|
+
"name": "name",
|
192
|
+
"type": "string"
|
193
|
+
},
|
194
|
+
{
|
195
|
+
"name": "symbol",
|
196
|
+
"type": "string"
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"name": "decimals",
|
200
|
+
"type": "uint8"
|
201
|
+
},
|
202
|
+
{
|
203
|
+
"name": "cap",
|
204
|
+
"type": "uint256"
|
205
|
+
}
|
206
|
+
],
|
207
|
+
"payable": false,
|
208
|
+
"stateMutability": "nonpayable",
|
209
|
+
"type": "constructor",
|
210
|
+
"signature": "constructor"
|
211
|
+
},
|
212
|
+
{
|
213
|
+
"anonymous": false,
|
214
|
+
"inputs": [
|
215
|
+
{
|
216
|
+
"indexed": true,
|
217
|
+
"name": "from",
|
218
|
+
"type": "address"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
"indexed": true,
|
222
|
+
"name": "to",
|
223
|
+
"type": "address"
|
224
|
+
},
|
225
|
+
{
|
226
|
+
"indexed": false,
|
227
|
+
"name": "value",
|
228
|
+
"type": "uint256"
|
229
|
+
}
|
230
|
+
],
|
231
|
+
"name": "Transfer",
|
232
|
+
"type": "event",
|
233
|
+
"signature": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
|
234
|
+
},
|
235
|
+
{
|
236
|
+
"anonymous": false,
|
237
|
+
"inputs": [
|
238
|
+
{
|
239
|
+
"indexed": true,
|
240
|
+
"name": "owner",
|
241
|
+
"type": "address"
|
242
|
+
},
|
243
|
+
{
|
244
|
+
"indexed": true,
|
245
|
+
"name": "spender",
|
246
|
+
"type": "address"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
"indexed": false,
|
250
|
+
"name": "value",
|
251
|
+
"type": "uint256"
|
252
|
+
}
|
253
|
+
],
|
254
|
+
"name": "Approval",
|
255
|
+
"type": "event",
|
256
|
+
"signature": "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"
|
257
|
+
},
|
258
|
+
{
|
259
|
+
"constant": true,
|
260
|
+
"inputs": [],
|
261
|
+
"name": "name",
|
262
|
+
"outputs": [
|
263
|
+
{
|
264
|
+
"name": "",
|
265
|
+
"type": "string"
|
266
|
+
}
|
267
|
+
],
|
268
|
+
"payable": false,
|
269
|
+
"stateMutability": "view",
|
270
|
+
"type": "function",
|
271
|
+
"signature": "0x06fdde03"
|
272
|
+
},
|
273
|
+
{
|
274
|
+
"constant": true,
|
275
|
+
"inputs": [],
|
276
|
+
"name": "symbol",
|
277
|
+
"outputs": [
|
278
|
+
{
|
279
|
+
"name": "",
|
280
|
+
"type": "string"
|
281
|
+
}
|
282
|
+
],
|
283
|
+
"payable": false,
|
284
|
+
"stateMutability": "view",
|
285
|
+
"type": "function",
|
286
|
+
"signature": "0x95d89b41"
|
287
|
+
},
|
288
|
+
{
|
289
|
+
"constant": true,
|
290
|
+
"inputs": [],
|
291
|
+
"name": "decimals",
|
292
|
+
"outputs": [
|
293
|
+
{
|
294
|
+
"name": "",
|
295
|
+
"type": "uint8"
|
296
|
+
}
|
297
|
+
],
|
298
|
+
"payable": false,
|
299
|
+
"stateMutability": "view",
|
300
|
+
"type": "function",
|
301
|
+
"signature": "0x313ce567"
|
302
|
+
}
|
303
|
+
]
|
304
|
+
''')
|
@@ -189,7 +189,7 @@ class CompoundV3StateService(CompoundStateService):
|
|
189
189
|
|
190
190
|
assets = {
|
191
191
|
underlying_token: {
|
192
|
-
'deposit_apy':
|
192
|
+
'deposit_apy': asset_info['deposit_apy'],
|
193
193
|
'borrow_apy': asset_info['borrow_apy'],
|
194
194
|
'total_deposit': 0,
|
195
195
|
'total_borrow': asset_info['total_borrow'],
|
@@ -207,7 +207,7 @@ class CompoundV3StateService(CompoundStateService):
|
|
207
207
|
'is_base': False
|
208
208
|
}
|
209
209
|
assets[collateral_address]['total_deposit'] += total_supply
|
210
|
-
assets[collateral_address]['deposit_apy'] = asset_info['deposit_apy']
|
210
|
+
# assets[collateral_address]['deposit_apy'] = asset_info['deposit_apy']
|
211
211
|
|
212
212
|
comet = token_info['token']
|
213
213
|
data[comet] = assets
|
@@ -2,7 +2,7 @@ from web3 import Web3
|
|
2
2
|
|
3
3
|
from defi_services.abis.lending.justlend.just_token_abi import JUST_TOKEN_ABI
|
4
4
|
from defi_services.abis.lending.justlend.justlend_comptroller_abi import JUSTLEND_COMPTROLLER_ABI
|
5
|
-
from defi_services.abis.token.
|
5
|
+
from defi_services.abis.token.trc20_abi import TRC20_ABI
|
6
6
|
from defi_services.constants.chain_constant import Chain
|
7
7
|
from defi_services.constants.entities.lending_constant import Lending
|
8
8
|
from defi_services.constants.token_constant import Token
|
@@ -74,8 +74,9 @@ class JustLendStateService(CompoundStateService):
|
|
74
74
|
liquidation_threshold = decoded_data.get(markets)[1] / 10 ** 18
|
75
75
|
|
76
76
|
if underlying != Token.native_token:
|
77
|
-
underlying_contract = _w3.eth.contract(address=Web3.to_checksum_address(underlying), abi=
|
77
|
+
underlying_contract = _w3.eth.contract(address=Web3.to_checksum_address(underlying), abi=TRC20_ABI)
|
78
78
|
underlying_decimal = underlying_contract.functions.decimals().call()
|
79
|
+
|
79
80
|
else:
|
80
81
|
underlying_decimal = Chain.native_decimals.get(self.chain_id, 18)
|
81
82
|
exchange_rate_query_id = f'exchangeRateStored_{token}_{block_number}'
|
@@ -139,7 +140,7 @@ class JustLendStateService(CompoundStateService):
|
|
139
140
|
rpc_calls[underlying_balance_key] = self.get_ctoken_function_info(
|
140
141
|
ctoken, "balanceOfUnderlying", [wallet])
|
141
142
|
rpc_calls[underlying_decimals_key] = self.state_service.get_function_info(
|
142
|
-
underlying,
|
143
|
+
underlying, TRC20_ABI, "decimals", []
|
143
144
|
)
|
144
145
|
|
145
146
|
return rpc_calls
|
@@ -1,4 +1,4 @@
|
|
1
|
-
defi_services/__init__.py,sha256=
|
1
|
+
defi_services/__init__.py,sha256=qfAKd_qHWkTvkHuiZfbG0sqB4Fby886RjzP1HpIeVAI,23
|
2
2
|
defi_services/abis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
defi_services/abis/multicall_v3_abi.py,sha256=0aPxjrJJFU17fODjvYFRDn5Y5J1yi_AJKc8v1uohNGY,12352
|
4
4
|
defi_services/abis/dex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -235,6 +235,7 @@ defi_services/abis/token/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
235
235
|
defi_services/abis/token/ctoken_abi.py,sha256=rEyzs_TttNG56CPM-M_F_HfaPPRvLL1E9HR0EdV4Lyc,23605
|
236
236
|
defi_services/abis/token/erc20_abi.py,sha256=BQKzaRjwCdc7Pt1X0GqHlnXTmec6f67wIpWbiYOe6c8,5636
|
237
237
|
defi_services/abis/token/erc721_abi.py,sha256=VXopcqKiof1ZH05WsKmDH7YA9RaPGzCYGts7XxxSnY4,6354
|
238
|
+
defi_services/abis/token/trc20_abi.py,sha256=PZVSIHi3NnEkgQvMdHGtPamquFFc4GTsFo_6UsGQ-yM,6932
|
238
239
|
defi_services/abis/vault/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
239
240
|
defi_services/abis/vault/incentive_abi.py,sha256=dstg33YRuAtqdM4r77fOhP15Cda-tQexL8U9i1fph68,12332
|
240
241
|
defi_services/abis/vault/tcv_abi.py,sha256=uyqQ5b_EAVCnXP5PBMzYxb_5jsPRRiuziDrCD7Ov0j8,34157
|
@@ -368,14 +369,14 @@ defi_services/services/lending/aave_v2_services.py,sha256=I3Z0FH8OLCiMmODzpu63F1
|
|
368
369
|
defi_services/services/lending/aave_v3_services.py,sha256=aGXhVSrQM2Eui5DH1Ghf-XDNcUAxHISDECZ99FPDuhA,17077
|
369
370
|
defi_services/services/lending/apeswap_services.py,sha256=UrLhXVzGvim_xfs54hSJ1qeTH6ber4xh01j5PWFl4C8,4737
|
370
371
|
defi_services/services/lending/compound_service.py,sha256=8r7pAs8KaaakDuHg4BUICW4zLD-ihm_DQETYwnAFc98,21917
|
371
|
-
defi_services/services/lending/compound_v3_services.py,sha256=
|
372
|
+
defi_services/services/lending/compound_v3_services.py,sha256=iLxaP0YpRAKrVw2dQLACTNS6oIfCvQ_-ZPKSiC3Q8bE,17448
|
372
373
|
defi_services/services/lending/cream_services.py,sha256=vtah0kMHAxztenWbJp4CxEcBMF0XUBglGRk6p9d-oiU,1644
|
373
374
|
defi_services/services/lending/flux_services.py,sha256=C9WJ2MIBK4xTaXIHF3yBVu52xGCNzO4Ed5DWyxWTTeE,12617
|
374
375
|
defi_services/services/lending/geist_services.py,sha256=UI5D-MbMqplrt7D4krSFdpaREKOT81k8boD_XhGGpUQ,1035
|
375
376
|
defi_services/services/lending/granary_services.py,sha256=n9ovzFXzMa26ZbGxARJiAiWhMdvuuuMF3iSfWgAg4E0,16581
|
376
377
|
defi_services/services/lending/ionic_service.py,sha256=gwGySZzs3-FVF1ct6zJOY4AHelaSpWL9AVABSyB0wJg,7529
|
377
378
|
defi_services/services/lending/iron_bank_service.py,sha256=GuXoXEbR4gkkNYfAyFkDtVeI3-knq3kFnLBeWVuUvv8,15585
|
378
|
-
defi_services/services/lending/justlend_service.py,sha256=
|
379
|
+
defi_services/services/lending/justlend_service.py,sha256=p1iHiMxZest5YmXwUZ-69g5LW30IG-F9_z1TiPBO2gU,8875
|
379
380
|
defi_services/services/lending/liqee_service.py,sha256=dBMlQpREqSzZY2_JCpJDxnWl9A8fWxa56KhsDNd--as,17140
|
380
381
|
defi_services/services/lending/moonwell_service.py,sha256=V8UCQPN8jv_QwvXLsTUpbpgYk4_JmdhNhyckvNONErI,5468
|
381
382
|
defi_services/services/lending/morpho_aave_v2_services.py,sha256=C8mfClb_KVbSr08YReVjhPzP4FTurGsitE9a4isEMn8,8471
|
@@ -504,8 +505,8 @@ defi_services/utils/memory_storage.py,sha256=BOT8laB0iVSCGE-oDlpWJQLbSC6X2blKX4z
|
|
504
505
|
defi_services/utils/sqrt_price_math.py,sha256=9lgUeWFT4wjl3Vq3b7-jZ2bGvvZx7dDBSfVnM3lsZ8o,5575
|
505
506
|
defi_services/utils/thread_proxy.py,sha256=5Z8biAyEReUkh3vfJSvEv7GwMe3CsE5M8CbghkQtePw,2951
|
506
507
|
defi_services/utils/ton_decode_address.py,sha256=EWKwmC7KtbXpdKgiNK-5j-5lX7fCr17I4EWYs9b43eU,443
|
507
|
-
defi_state_querier-0.5.
|
508
|
-
defi_state_querier-0.5.
|
509
|
-
defi_state_querier-0.5.
|
510
|
-
defi_state_querier-0.5.
|
511
|
-
defi_state_querier-0.5.
|
508
|
+
defi_state_querier-0.5.27.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
|
509
|
+
defi_state_querier-0.5.27.dist-info/METADATA,sha256=fs72EdCUPteoXg5DnOE373yvp-9f6WJ3aegb2xPvqAI,4631
|
510
|
+
defi_state_querier-0.5.27.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
|
511
|
+
defi_state_querier-0.5.27.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
|
512
|
+
defi_state_querier-0.5.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|