defi-state-querier 0.4.9__py3-none-any.whl → 0.4.11__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.9"
1
+ __version__ = "0.4.11"
@@ -10,6 +10,24 @@ class Chain:
10
10
  tron = "0x2b6653dc"
11
11
  cronos = "0x19"
12
12
  polkadot = "polkadot"
13
+ base = '0x2105'
14
+ kava = '0x8ae'
15
+ gnosis = '0x64'
16
+ klaytn = '0x2019'
17
+ mantle = '0x1388'
18
+ celo = '0xa4ec'
19
+ moonbeam = '0x504'
20
+ manta = '0xa9'
21
+ pulse = '0x171'
22
+ rootstock = '0x1e'
23
+ astar = '0x250'
24
+ metis = '0x440'
25
+ canto = '0x1e14'
26
+ heco = '0x80'
27
+ linea = '0xe708'
28
+ okc = '0x42'
29
+ aurora = '0x4e454152'
30
+ moonriver = '0x505'
13
31
 
14
32
  native_decimals = {
15
33
  tron: 6,
@@ -25,7 +25,25 @@ class Token:
25
25
  Chain.arbitrum: wrapped_eth_arbitrum,
26
26
  Chain.polygon: wrapped_matic,
27
27
  Chain.tron: wrapped_tron,
28
- Chain.cronos: wrapped_cro
28
+ Chain.cronos: wrapped_cro,
29
+ Chain.base: '0x4200000000000000000000000000000000000006',
30
+ Chain.kava: '0xc86c7c0efbd6a49b35e8714c5f59d99de09a225b',
31
+ Chain.gnosis: '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d',
32
+ Chain.klaytn: '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432',
33
+ Chain.mantle: '0x78c1b0c915c4faa5fffa6cabf0219da63d7f4cb8',
34
+ Chain.celo: '0x3ad443d769a07f287806874f8e5405ce3ac902b9',
35
+ Chain.moonbeam: '0xacc15dc74880c9944775448304b263d191c6077f',
36
+ Chain.manta: '0x0dc808adce2099a9f62aa87d9670745aba741746',
37
+ Chain.pulse: '0xa1077a294dde1b09bb078844df40758a5d0f9a27',
38
+ Chain.rootstock: '0x967f8799af07df1534d48a95a5c9febe92c53ae0',
39
+ Chain.astar: '0xaeaaf0e2c81af264101b9129c00f4440ccf0f720',
40
+ Chain.metis: '0x75cb093e4d61d2a2e65d8e0bbb01de8d89b53481',
41
+ Chain.canto: '0x826551890dc65655a0aceca109ab11abdbd7a07b',
42
+ Chain.heco: '0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f',
43
+ Chain.linea: '0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f',
44
+ Chain.okc: '0x8f8526dbfd6e38e3d8307702ca8469bae6c56c15',
45
+ Chain.aurora: '0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb',
46
+ Chain.moonriver: '0x98878b06940ae243284ca214f92bb71a2b032b8a'
29
47
  }
30
48
 
31
49
 
@@ -1,6 +1,5 @@
1
1
  import logging
2
2
 
3
- from defi_services.abis.dex.pancakeswap.masterchef_v0_abi import PANCAKESWAP_MASTERCHEF_V0_ABI
4
3
  from defi_services.abis.dex.pancakeswap.pancakeswap_factory_abi import PANCAKESWAP_FACTORY_ABI
5
4
  from defi_services.abis.dex.pancakeswap.pancakeswap_lp_token_abi import LP_TOKEN_ABI
6
5
  from defi_services.abis.dex.pancakeswap.pancakeswap_masterchef_v2_abi import PANCAKESWAP_MASTERCHEF_V2_ABI
@@ -112,10 +111,12 @@ class PancakeSwapV2Services(UniswapV2Services):
112
111
  lp_token_info = supplied_data['lp_token_info']
113
112
  for lp_token, info in lp_token_info.items():
114
113
  lp_info = result.get(lp_token, {})
115
- if not lp_info:
116
- continue
117
114
 
118
115
  staked_balance_query_id = f'balanceOf_{lp_token}_{masterchef_addr}_{block_number}'.lower()
116
+
117
+ if (not lp_info) or (decoded_data.get(staked_balance_query_id) is None):
118
+ continue
119
+
119
120
  masterchef_balance = decoded_data.get(
120
121
  staked_balance_query_id) / 10 ** lp_info.get('decimals', 18)
121
122
  lp_info.update({"stake_balance": masterchef_balance})
@@ -164,6 +165,10 @@ class PancakeSwapV2Services(UniswapV2Services):
164
165
  lp_info = result.get(lp_token, {})
165
166
 
166
167
  staked_balance_query_id = f'balanceOf_{lp_token}_{masterchef_addr}_{block_number}'.lower()
168
+
169
+ if (not lp_info) or (decoded_data.get(staked_balance_query_id) is None):
170
+ continue
171
+
167
172
  staked_balance = decoded_data.get(
168
173
  staked_balance_query_id) / 10 ** lp_info.get('decimals', 18)
169
174
  lp_info.update({"stake_balance": staked_balance})
@@ -178,9 +178,10 @@ class UniswapV2Services(DexProtocolServices):
178
178
 
179
179
  for token_key in ["token0", "token1"]:
180
180
  token_address = info.get(token_key, None)
181
- if token_address is not None:
182
- query_id = f'balanceOf_{token_address}_{lp_token}_{block_number}'.lower()
183
- token_decimals = decoded_data.get(f'decimals_{token_address}_{block_number}'.lower())
181
+ query_id = f'balanceOf_{token_address}_{lp_token}_{block_number}'.lower()
182
+
183
+ if (token_address is not None) and (decoded_data.get(query_id) is not None):
184
+ token_decimals = decoded_data.get(f'decimals_{token_address}_{block_number}'.lower()) or 18
184
185
  result[lp_token][f'{token_key}_amount'] = decoded_data.get(query_id) / 10 ** token_decimals
185
186
 
186
187
  return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: defi-state-querier
3
- Version: 0.4.9
3
+ Version: 0.4.11
4
4
  Summary: Calculate apy, apr, and wallet information,... in decentralized applications.
5
5
  Home-page: https://github.com/Centic-io/defi-state-querier
6
6
  Author: Viet-Bang Pham
@@ -1,4 +1,4 @@
1
- defi_services/__init__.py,sha256=LdxLMJM_JXsCQBeSvnxCNyGWmINE0yWfna3DQaT41Vs,22
1
+ defi_services/__init__.py,sha256=xIphSmmFF5C8ZjsK5bpruTtbjrTL9bI6TjdjgsELGCw,23
2
2
  defi_services/abis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  defi_services/abis/dex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  defi_services/abis/dex/biswap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -228,12 +228,12 @@ defi_services/abis/vault/trava_vault_abi.py,sha256=eiAc8ImfAQ1lSkN0gRN4T4YlxCxmA
228
228
  defi_services/abis/vault/valuator_abi.py,sha256=j44uj0hqmKj7lY0ajfUaY4N3xjVEaSBYaWilploBlDI,598
229
229
  defi_services/abis/vault/ve_abi.py,sha256=uoc08LyW9_Y7xxDVIgXOzLjo_kOy1YGP3cUAOZhyizw,38341
230
230
  defi_services/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
231
- defi_services/constants/chain_constant.py,sha256=mufCUn3cyDEEFk2Z2x2okBsjQM5AvMwESrVEmdgXLkI,643
231
+ defi_services/constants/chain_constant.py,sha256=aU7xLaQYLro-7sI5Jpyi0tEHhEQcchyxlxEEJaotFMM,1018
232
232
  defi_services/constants/db_constant.py,sha256=gDMFFjhPOgQHuS9sPOTFbsfSdIfdWQEE4tGlxHQhNsE,2566
233
233
  defi_services/constants/mongo_constant.py,sha256=qsDIq2Gg5MkBGaEOh4Fd9y6fOOidF4gGPnQwtaPon3E,398
234
234
  defi_services/constants/query_constant.py,sha256=9yQm6IHWBGQXVbYsQOCt2xCCwHme5a65SoeR95g5LV8,1035
235
235
  defi_services/constants/time_constant.py,sha256=bC-0pYnfIFFR_0iVvkxhfyHfOclWNw9O3DbdO_nh258,181
236
- defi_services/constants/token_constant.py,sha256=5GV7s2GVyWNmx6y3K72yjgi4BuX7g32xua5yCCg0rCo,3607
236
+ defi_services/constants/token_constant.py,sha256=4iDWis589XF4_OIcBOqA7_qIfCde-nV6fDaV__5c2D4,4822
237
237
  defi_services/constants/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
238
238
  defi_services/constants/entities/dex_constant.py,sha256=oCt8RS-0KjFW5zR5IU1Ys49nYCCAraY8pTivOpXoyvs,343
239
239
  defi_services/constants/entities/dex_services.py,sha256=zP1JIuiwVuDF74RrEwejwfwvjDf67ia63ZKe1hb5RuA,1788
@@ -260,7 +260,7 @@ defi_services/services/substrate_token_services.py,sha256=HsjceBHo0fxQIcXgDaV0OB
260
260
  defi_services/services/token_services.py,sha256=ncGdOpATIb9tGFa9cY1dQq3hFRwbhcYwIz0we9tNWNY,2766
261
261
  defi_services/services/dex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
262
262
  defi_services/services/dex/pancakeswap_service.py,sha256=A4-wXkZnLiiCtiTMkRUUYqoA2tK5frKbhoyA3S2jcvc,6603
263
- defi_services/services/dex/pancakeswap_v2_service.py,sha256=0O7Fq6-wwYkgHPfilasc2_3BJL7bLYBShYdP2tU5rwA,17343
263
+ defi_services/services/dex/pancakeswap_v2_service.py,sha256=HOLzHcBrIjQ22N6UxZAzxRwzK6wjOltRHEw88kkq1b8,17419
264
264
  defi_services/services/dex/pancakeswap_v3_service.py,sha256=bSw2R2hIz5B88VSXUPVzb_-tbWHm2LatSut862MMByA,14807
265
265
  defi_services/services/dex/quickswap_v2_service.py,sha256=VTNj_G0EaViBJjAIFD5WqRLAE1ermHh9ATtRWAVaDxI,1159
266
266
  defi_services/services/dex/quickswap_v3_service.py,sha256=8vl6eYE4u3VQ7aS3iqTaARP2TPMgAdFvx4JGzv4U3Y4,18
@@ -268,7 +268,7 @@ defi_services/services/dex/spookyswap_v2_service.py,sha256=VxhDButlDT7eMvn_z20V6
268
268
  defi_services/services/dex/sushiswap_service.py,sha256=HXUIcNFcnONFI0W9Pn0odyo-MqcLUMs22JL4yiuxFSA,3093
269
269
  defi_services/services/dex/sushiswap_v2_service.py,sha256=tv6HuHbG78jvRQR7DgbSJAV-Aes_1XeWMwPG5RjJMbI,3819
270
270
  defi_services/services/dex/sushiswap_v3_service.py,sha256=6ub2Dv8GksOA6fVK7_mSkU7ub0GhtQMN__EKm8aNJbo,18
271
- defi_services/services/dex/uniswap_v2_service.py,sha256=EnMXmy-WtI8QNQCADx3YeG1HkpjFA0DMbKb92KOVAzg,13047
271
+ defi_services/services/dex/uniswap_v2_service.py,sha256=BCOxnsTVy8EJk9lkk2J-dhSoyIvO_pBt3YYLo30sksA,13097
272
272
  defi_services/services/dex/uniswap_v3_service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
273
273
  defi_services/services/dex/dex_info/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
274
274
  defi_services/services/dex/dex_info/pancakeswap_info.py,sha256=hjshS8LOTIBEmz1Ygon3f1ttnuRhBj1KCSll_BpNQkE,964
@@ -381,8 +381,8 @@ defi_services/utils/logger_utils.py,sha256=KxDlmaK9aoMOI1gdroRYjMm383myvFiWqW0iK
381
381
  defi_services/utils/market_service.py,sha256=imPtPHBkpEx5JnhqeIWYqbCjsIEm8IKBYHNEy6rKjdU,723
382
382
  defi_services/utils/memory_storage.py,sha256=BOT8laB0iVSCGE-oDlpWJQLbSC6X2blKX4zuQbs4inc,851
383
383
  defi_services/utils/thread_proxy.py,sha256=5Z8biAyEReUkh3vfJSvEv7GwMe3CsE5M8CbghkQtePw,2951
384
- defi_state_querier-0.4.9.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
385
- defi_state_querier-0.4.9.dist-info/METADATA,sha256=Goz5xlLgZs4k-6zSmfM2AITiKgkhHyUqi4p-Iy2S5LQ,4375
386
- defi_state_querier-0.4.9.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
387
- defi_state_querier-0.4.9.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
388
- defi_state_querier-0.4.9.dist-info/RECORD,,
384
+ defi_state_querier-0.4.11.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
385
+ defi_state_querier-0.4.11.dist-info/METADATA,sha256=ny8Y_49Bnv8tJxeDJbZieb6CLRpiWuwtlF1Sc2u1v88,4376
386
+ defi_state_querier-0.4.11.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
387
+ defi_state_querier-0.4.11.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
388
+ defi_state_querier-0.4.11.dist-info/RECORD,,