defi-state-querier 0.4.1__py3-none-any.whl → 0.4.3__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 +1 -1
- defi_services/constants/chain_constant.py +4 -1
- defi_services/constants/entities/vault_constant.py +5 -0
- defi_services/constants/entities/vault_services.py +24 -0
- defi_services/constants/query_constant.py +1 -0
- defi_services/jobs/processors/state_processor.py +4 -2
- defi_services/services/lending/aave_v2_services.py +1 -1
- defi_services/services/lending/aave_v3_services.py +1 -1
- defi_services/services/lending/apeswap_services.py +5 -2
- defi_services/services/lending/compound_service.py +7 -2
- defi_services/services/lending/compound_v3_services.py +1 -4
- defi_services/services/lending/flux_services.py +6 -5
- defi_services/services/lending/granary_services.py +1 -4
- defi_services/services/lending/iron_bank_service.py +17 -6
- defi_services/services/lending/justlend_service.py +21 -6
- defi_services/services/lending/lending_info/bsc/liqee_bsc.py +154 -106
- defi_services/services/lending/lending_info/ethereum/liqee_eth.py +160 -110
- defi_services/services/lending/liqee_service.py +7 -4
- defi_services/services/lending/morpho_aave_v2_services.py +1 -1
- defi_services/services/lending/morpho_aave_v3_services.py +1 -4
- defi_services/services/lending/morpho_compound_services.py +1 -5
- defi_services/services/lending/onyx_service.py +7 -5
- defi_services/services/lending/radiant_v2_services.py +1 -4
- defi_services/services/lending/silo_services.py +1 -1
- defi_services/services/lending/strike_service.py +7 -2
- defi_services/services/lending/trava_services.py +5 -5
- defi_services/services/lending/uwu_services.py +1 -1
- defi_services/services/lending/valas_services.py +1 -1
- defi_services/services/lending/venus_services.py +28 -16
- defi_services/services/lending/wepiggy_services.py +7 -2
- defi_services/services/protocol_services.py +34 -2
- defi_services/services/vault/__init__.py +0 -0
- defi_services/services/vault/trava_vault_services.py +196 -0
- defi_services/services/vault/vault_info/__init__.py +0 -0
- defi_services/services/vault/vault_info/bsc/__init__.py +0 -0
- defi_services/services/vault/vault_info/bsc/trava_bsc.py +41 -0
- defi_services/services/vault/vault_info/ethereum/__init__.py +0 -0
- defi_services/services/vault/vault_info/ethereum/trava_eth.py +22 -0
- defi_services/services/vault/vault_info/fantom/__init__.py +0 -0
- defi_services/services/vault/vault_info/fantom/trava_ftm.py +31 -0
- defi_services/utils/init_services.py +5 -0
- {defi_state_querier-0.4.1.dist-info → defi_state_querier-0.4.3.dist-info}/METADATA +1 -1
- {defi_state_querier-0.4.1.dist-info → defi_state_querier-0.4.3.dist-info}/RECORD +46 -37
- defi_services/jobs/queriers/cosmos_state_querier.py +0 -83
- defi_services/services/cosmos_token_services.py +0 -46
- {defi_state_querier-0.4.1.dist-info → defi_state_querier-0.4.3.dist-info}/LICENSE +0 -0
- {defi_state_querier-0.4.1.dist-info → defi_state_querier-0.4.3.dist-info}/WHEEL +0 -0
- {defi_state_querier-0.4.1.dist-info → defi_state_querier-0.4.3.dist-info}/top_level.txt +0 -0
@@ -1,46 +0,0 @@
|
|
1
|
-
from defi_services.constants.token_constant import Token
|
2
|
-
from defi_services.jobs.queriers.solana_state_querier import SolanaStateQuerier
|
3
|
-
|
4
|
-
|
5
|
-
class CosmosTokenServices:
|
6
|
-
def __init__(self, state_service: SolanaStateQuerier, chain_id: str = "solana"):
|
7
|
-
self.chain_id = chain_id
|
8
|
-
self.state_service = state_service
|
9
|
-
|
10
|
-
def get_service_info(self):
|
11
|
-
info = {
|
12
|
-
"token": {
|
13
|
-
"chain_id": self.chain_id,
|
14
|
-
"type": "token"
|
15
|
-
}
|
16
|
-
}
|
17
|
-
return info
|
18
|
-
|
19
|
-
def get_function_info(self, wallet: str, token: str):
|
20
|
-
result = self.get_function_balance_info(wallet, token)
|
21
|
-
return result
|
22
|
-
|
23
|
-
def get_function_balance_info(self, wallet, token):
|
24
|
-
key = f"balanceOf_{wallet}_{token}".lower()
|
25
|
-
if token == Token.native_token:
|
26
|
-
params = [wallet]
|
27
|
-
rpc_call = self.state_service.get_function_info('getBalance', params)
|
28
|
-
else:
|
29
|
-
params = [wallet, {"mint": token}, {"encoding": "jsonParsed"}]
|
30
|
-
rpc_call = self.state_service.get_function_info("getTokenAccountsByOwner", params)
|
31
|
-
return {key: rpc_call}
|
32
|
-
|
33
|
-
@staticmethod
|
34
|
-
def get_data(wallet, token, decoded_data, token_prices):
|
35
|
-
key = f"balanceOf_{wallet}_{token}".lower()
|
36
|
-
data = decoded_data.get(key)
|
37
|
-
token_price = token_prices.get(token, 1)
|
38
|
-
if token == Token.native_token:
|
39
|
-
balance = data.get("value", 0) * token_price / 10**9
|
40
|
-
return balance
|
41
|
-
balance = 0
|
42
|
-
for item in data.get('value'):
|
43
|
-
balance_info = item.get('account', {}).get('data', {}).get('parsed').get('info').get('tokenAmount')
|
44
|
-
balance += balance_info.get("uiAmount", 0) * token_price
|
45
|
-
|
46
|
-
return balance
|
File without changes
|
File without changes
|
File without changes
|