defi-state-querier 0.4.21__py3-none-any.whl → 0.4.23__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
defi_services/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.4.21"
1
+ __version__ = "0.4.23"
@@ -84,9 +84,8 @@ class PancakeSwapV2Services(UniswapV2Services):
84
84
  masterchef_addr = self.pool_info.get('master_chef_address')
85
85
  lp_token_info = supplied_data['lp_token_info']
86
86
  for lp_token, info in lp_token_info.items():
87
- staked_balance_query_id = f'balanceOf_{lp_token}_{masterchef_addr}_{block_number}'.lower()
88
- masterchef_balance = decoded_data.get(
89
- staked_balance_query_id) / 10 ** lp_token_info.get('decimals', 18)
87
+ staked_balance = decoded_data.get(f'balanceOf_{lp_token}_{masterchef_addr}_{block_number}'.lower())
88
+ masterchef_balance = staked_balance / 10 ** lp_token_info.get('decimals', 18) if staked_balance else 0
90
89
  result[lp_token].update({"stake_balance": masterchef_balance})
91
90
 
92
91
  return result
@@ -116,15 +115,14 @@ class PancakeSwapV2Services(UniswapV2Services):
116
115
  masterchef_addr = self.pool_info.get('master_chef_address')
117
116
  lp_token_info = supplied_data['lp_token_info']
118
117
  for lp_token, info in lp_token_info.items():
119
- staked_balance_query_id = f'balanceOf_{lp_token}_{masterchef_addr}_{block_number}'.lower()
120
- staked_balance = decoded_data.get(
121
- staked_balance_query_id) / 10 ** lp_token_info.get('decimals', 18)
122
- result[lp_token].update({"stake_balance": staked_balance})
118
+ staked_balance = decoded_data.get(f'balanceOf_{lp_token}_{masterchef_addr}_{block_number}'.lower())
119
+ staked_balance_decimals = staked_balance / 10 ** lp_token_info.get('decimals', 18) if staked_balance else 0
120
+ result[lp_token].update({"stake_balance": staked_balance_decimals})
123
121
 
124
122
  for token_key in ["token0", "token1"]:
125
123
  token_amount = result[lp_token].get(f'{token_key}_amount', 0)
126
124
  total_supply = lp_token_info.get(lp_token, {}).get('total_supply')
127
- token_stake_amount = token_amount * staked_balance / total_supply if total_supply > 0 else 0
125
+ token_stake_amount = token_amount * staked_balance_decimals / total_supply if total_supply else 0
128
126
  result[lp_token][f'{token_key}_stake_amount'] = token_stake_amount
129
127
 
130
128
  return result
@@ -286,7 +286,7 @@ class PancakeSwapV3Service(UniswapV3Services):
286
286
  user_data['all_token'] = super().decode_user_token_amount_function(user, supplied_param, decoded_data,
287
287
  block_number)
288
288
  for token_id, value in user_data['stake_token'].items():
289
- pid = value.get('pid')
289
+ pid = value.get('farming_pid')
290
290
  lp_token_address = decoded_data.get(f'poolInfo_{self.masterchef_addr}_{pid}_{block_number}'.lower())[1]
291
291
  user_data['stake_token'][token_id].update({
292
292
  'pool_address': lp_token_address
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: defi-state-querier
3
- Version: 0.4.21
3
+ Version: 0.4.23
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=HRnyuWvhHjVmMtjn-Iir0_ZbxVK3sjpTYkAqLIRVMIE,23
1
+ defi_services/__init__.py,sha256=bUxoIOr-G9-PoGmh7zAW9CCJTt17Q0QuRmIjl2A39Sw,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
@@ -270,8 +270,8 @@ defi_services/services/substrate_token_services.py,sha256=HsjceBHo0fxQIcXgDaV0OB
270
270
  defi_services/services/token_services.py,sha256=ncGdOpATIb9tGFa9cY1dQq3hFRwbhcYwIz0we9tNWNY,2766
271
271
  defi_services/services/dex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
272
272
  defi_services/services/dex/pancakeswap_service.py,sha256=MR3x5lvZrZWqrAiSwIe-0ANBhGJ9u0iWvpYDFrxW8_w,4635
273
- defi_services/services/dex/pancakeswap_v2_service.py,sha256=zb3HtLEjbgG7-LM6IHA4ORrnHKkuRGD4e_1wQU5LzEQ,13093
274
- defi_services/services/dex/pancakeswap_v3_service.py,sha256=TOO9g-Fs8AOMMlc367IVI8L-qUDAIM13XMbZzXjFJgc,19312
273
+ defi_services/services/dex/pancakeswap_v2_service.py,sha256=iEWF2u40zLj0C0zvIon40lCKU-jMeCXs63RApNmpJ1o,13096
274
+ defi_services/services/dex/pancakeswap_v3_service.py,sha256=HHLNondh7lRlcP1bmuR6eFzbDs_FPWqhMFIbK3LY2zc,19320
275
275
  defi_services/services/dex/quickswap_v2_service.py,sha256=vpjBNcPlxwOW-WqTuxYKK2coVZhXDjK39nEq8X6awQU,1155
276
276
  defi_services/services/dex/quickswap_v3_service.py,sha256=J99UjBFZgQjJRj85p7unqnLBzTea7VjIwTNXQ0OJKRA,9143
277
277
  defi_services/services/dex/spookyswap_v2_service.py,sha256=CBM0_NZTsiqBxkIHm_Ll-oTzlPZsd0TYVh4itcBNBA0,6982
@@ -392,8 +392,8 @@ defi_services/utils/market_service.py,sha256=imPtPHBkpEx5JnhqeIWYqbCjsIEm8IKBYHN
392
392
  defi_services/utils/memory_storage.py,sha256=BOT8laB0iVSCGE-oDlpWJQLbSC6X2blKX4zuQbs4inc,851
393
393
  defi_services/utils/sqrt_price_math.py,sha256=9lgUeWFT4wjl3Vq3b7-jZ2bGvvZx7dDBSfVnM3lsZ8o,5575
394
394
  defi_services/utils/thread_proxy.py,sha256=5Z8biAyEReUkh3vfJSvEv7GwMe3CsE5M8CbghkQtePw,2951
395
- defi_state_querier-0.4.21.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
396
- defi_state_querier-0.4.21.dist-info/METADATA,sha256=W4b7GuqojaT6TPiNKGlukM3HrNeJQ_NexhD-IQUgLTo,4376
397
- defi_state_querier-0.4.21.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
398
- defi_state_querier-0.4.21.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
399
- defi_state_querier-0.4.21.dist-info/RECORD,,
395
+ defi_state_querier-0.4.23.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
396
+ defi_state_querier-0.4.23.dist-info/METADATA,sha256=tVlHnbN9_5gs-tAnXAYE65SLcrQ-mShgHM-UwM2BkdQ,4376
397
+ defi_state_querier-0.4.23.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
398
+ defi_state_querier-0.4.23.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
399
+ defi_state_querier-0.4.23.dist-info/RECORD,,