defi-state-querier 0.5.27__py3-none-any.whl → 0.5.28__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.
Files changed (83) hide show
  1. defi_services/__init__.py +1 -1
  2. defi_services/constants/chain_constant.py +1 -8
  3. defi_services/constants/entities/dex_info_constant.py +2 -2
  4. defi_services/constants/entities/dex_services.py +1 -13
  5. defi_services/constants/entities/lending_constant.py +5 -11
  6. defi_services/constants/entities/lending_services.py +4 -31
  7. defi_services/constants/entities/vault_constant.py +2 -2
  8. defi_services/constants/entities/vault_services.py +1 -7
  9. defi_services/constants/network_constants.py +361 -20
  10. defi_services/constants/token_constant.py +1 -3
  11. defi_services/jobs/processors/cosmos_state_processor.py +2 -3
  12. defi_services/jobs/processors/ton_state_processor.py +4 -5
  13. defi_services/jobs/queriers/call_state_querier.py +0 -2
  14. defi_services/jobs/queriers/state_querier.py +0 -3
  15. defi_services/services/dex/dex_info/uniswap_info.py +1 -29
  16. defi_services/services/dex/uniswap_v3_service.py +2 -6
  17. defi_services/services/lending/aave_v2_services.py +29 -44
  18. defi_services/services/lending/aave_v3_services.py +20 -41
  19. defi_services/services/lending/compound_v3_services.py +5 -9
  20. defi_services/services/lending/granary_services.py +4 -6
  21. defi_services/services/lending/justlend_service.py +3 -4
  22. defi_services/services/lending/lending_info/arbitrum/aave_v3_arbitrum.py +1 -1
  23. defi_services/services/lending/lending_info/arbitrum/compound_v3_arbitrum.py +6 -96
  24. defi_services/services/lending/lending_info/ethereum/aave_v3_eth.py +140 -1
  25. defi_services/services/lending/lending_info/ethereum/compound_v3_eth.py +5 -180
  26. defi_services/services/lending/lending_info/polygon/compound_v3_polygon.py +5 -35
  27. defi_services/services/lending/morpho_aave_v2_services.py +3 -3
  28. defi_services/services/lending/morpho_aave_v3_services.py +2 -2
  29. defi_services/services/lending/radiant_v2_services.py +10 -52
  30. defi_services/services/lending/trava_services.py +2 -2
  31. defi_services/services/lending/uwu_services.py +3 -3
  32. defi_services/services/lending/valas_services.py +2 -2
  33. defi_services/services/lending/venus_services.py +3 -9
  34. defi_services/services/multicall/multicall_v2.py +317 -0
  35. {defi_state_querier-0.5.27.dist-info → defi_state_querier-0.5.28.dist-info}/METADATA +3 -2
  36. {defi_state_querier-0.5.27.dist-info → defi_state_querier-0.5.28.dist-info}/RECORD +46 -83
  37. {defi_state_querier-0.5.27.dist-info → defi_state_querier-0.5.28.dist-info}/WHEEL +1 -1
  38. defi_services/abis/lending/ionic/__init__.py +0 -0
  39. defi_services/abis/lending/ionic/ionic_ctoken_abi.py +0 -1108
  40. defi_services/abis/lending/moonwell/__init__.py +0 -0
  41. defi_services/abis/lending/moonwell/moonwell_comptroller_abi.py +0 -1500
  42. defi_services/abis/lending/moonwell/moonwell_ctoken_abi.py +0 -1431
  43. defi_services/abis/lending/radiant_v2/radiant_reward_converter.py +0 -817
  44. defi_services/abis/token/trc20_abi.py +0 -304
  45. defi_services/abis/vault/tcv_abi.py +0 -1523
  46. defi_services/jobs/tcv.py +0 -144
  47. defi_services/services/lending/ionic_service.py +0 -167
  48. defi_services/services/lending/lending_info/arbitrum/venus_arbitrum.py +0 -10
  49. defi_services/services/lending/lending_info/base/__init__.py +0 -0
  50. defi_services/services/lending/lending_info/base/aave_v3_base.py +0 -61
  51. defi_services/services/lending/lending_info/base/compound_v3_base.py +0 -116
  52. defi_services/services/lending/lending_info/base/granary_base.py +0 -62
  53. defi_services/services/lending/lending_info/base/ionic_base.py +0 -173
  54. defi_services/services/lending/lending_info/base/moonwell_base.py +0 -89
  55. defi_services/services/lending/lending_info/base/radiant_v2_base.py +0 -57
  56. defi_services/services/lending/lending_info/base/sonne_base.py +0 -53
  57. defi_services/services/lending/lending_info/base/zerolend_base.py +0 -109
  58. defi_services/services/lending/lending_info/bsc/aave_v3_bsc.py +0 -68
  59. defi_services/services/lending/lending_info/ethereum/old_aave_v3_eth.py +0 -150
  60. defi_services/services/lending/lending_info/ethereum/radiant_eth.py +0 -69
  61. defi_services/services/lending/lending_info/ethereum/venus_eth.py +0 -10
  62. defi_services/services/lending/lending_info/ethereum/zerolend_eth.py +0 -96
  63. defi_services/services/lending/lending_info/optimism/compound_v3_optimism.py +0 -116
  64. defi_services/services/lending/lending_info/optimism/moonwell_optimism.py +0 -9
  65. defi_services/services/lending/lending_info/zksync/__init__.py +0 -0
  66. defi_services/services/lending/lending_info/zksync/aave_v3_zksync.py +0 -47
  67. defi_services/services/lending/lending_info/zksync/venus_zksync.py +0 -10
  68. defi_services/services/lending/lending_info/zksync/zerolend_zksync.py +0 -138
  69. defi_services/services/lending/moonwell_service.py +0 -120
  70. defi_services/services/lending/sonne_service.py +0 -64
  71. defi_services/services/lending/zerolend_services.py +0 -36
  72. defi_services/services/vault/tcv_vault_services.py +0 -108
  73. defi_services/services/vault/vault_info/arbitrum/__init__.py +0 -0
  74. defi_services/services/vault/vault_info/arbitrum/tcv_arb.py +0 -58
  75. /defi_services/abis/lending/{aave_v2_and_forks → aave_v2_and_forlks}/__init__.py +0 -0
  76. /defi_services/abis/lending/{aave_v2_and_forks → aave_v2_and_forlks}/aave_v2_event_abi.py +0 -0
  77. /defi_services/abis/lending/{aave_v2_and_forks → aave_v2_and_forlks}/aave_v2_incentives_abi.py +0 -0
  78. /defi_services/abis/lending/{aave_v2_and_forks → aave_v2_and_forlks}/lending_pool_abi.py +0 -0
  79. /defi_services/abis/lending/{aave_v2_and_forks → aave_v2_and_forlks}/oracle_abi.py +0 -0
  80. /defi_services/abis/lending/{aave_v2_and_forks → aave_v2_and_forlks}/staked_incentives_abi.py +0 -0
  81. /defi_services/abis/lending/{aave_v2_and_forks → aave_v2_and_forlks}/uwu_incentives_abi.py +0 -0
  82. {defi_state_querier-0.5.27.dist-info → defi_state_querier-0.5.28.dist-info/licenses}/LICENSE +0 -0
  83. {defi_state_querier-0.5.27.dist-info → defi_state_querier-0.5.28.dist-info}/top_level.txt +0 -0
defi_services/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.5.27"
1
+ __version__ = "0.5.28"
@@ -30,12 +30,6 @@ class Chain:
30
30
  moonriver = '0x505'
31
31
  blast = '0xee'
32
32
  oasis_sapphire = '0x5afe'
33
- zetachain = '0x1b58'
34
- zksync = '0x144'
35
- oraichain = 'orai'
36
- bitcoin = 'bitcoin'
37
- cosmos = 'cosmos'
38
- ton = 'ton'
39
33
 
40
34
  native_decimals = {
41
35
  tron: 6,
@@ -54,6 +48,5 @@ class BlockTime:
54
48
  Chain.optimism: 1, # TODO: check
55
49
  Chain.avalanche: 2,
56
50
  Chain.tron: 3,
57
- Chain.cronos: 6,
58
- Chain.base: 2
51
+ Chain.cronos: 6
59
52
  }
@@ -36,8 +36,7 @@ class DexInfo:
36
36
  # Dex.sushi: SushiSwapV2Services
37
37
  # }
38
38
  arbitrum = {
39
- Dex.sushi_v2: SUSHISWAP_V2_ARBITRUM_INFO,
40
- Dex.uniswap_v3: UNISWAP_V3_ARBITRUM_INFO
39
+ Dex.sushi_v2: SUSHISWAP_V2_ARBITRUM_INFO
41
40
  }
42
41
  mapping = {
43
42
  Chain.ethereum: ethereum,
@@ -48,3 +47,4 @@ class DexInfo:
48
47
  Chain.arbitrum: arbitrum,
49
48
  # Chain.optimism: optimism,
50
49
  }
50
+
@@ -45,18 +45,8 @@ class DexServices:
45
45
  # Dex.sushi: SushiSwapV2Services
46
46
  # }
47
47
  arbitrum = {
48
- Dex.sushi_v2: SushiSwapV2Services,
49
- Dex.uniswap_v3: UniswapV3Services
50
- }
51
-
52
- zksync = {
53
- Dex.uniswap_v3: UniswapV3Services
54
- }
55
-
56
- base = {
57
- Dex.uniswap_v3: UniswapV3Services
48
+ Dex.sushi_v2: SushiSwapV2Services
58
49
  }
59
-
60
50
  mapping = {
61
51
  Chain.ethereum: ethereum,
62
52
  Chain.fantom: fantom,
@@ -65,6 +55,4 @@ class DexServices:
65
55
  Chain.polygon: polygon,
66
56
  Chain.arbitrum: arbitrum,
67
57
  # Chain.optimism: optimism,
68
- Chain.zksync: zksync,
69
- Chain.base: base
70
58
  }
@@ -25,14 +25,8 @@ class Lending:
25
25
  silo = 'silo-finance'
26
26
  compound_v3 = 'compound-v3'
27
27
  justlend = "justlend"
28
- zerolend = "zerolend"
29
- moonwell = "moonwell"
30
- ionic = "ionic-protocol"
31
- sonne = "sonne-finance"
32
-
33
- all = [
34
- strike, aave_v2, aave_v3, radiant_v2, compound, flux, onyx, granary,
35
- iron_bank, trava, valas, geist, cream, venus, liqee, strike, uwu, wepiggy,
36
- morpho_compound, morpho_aave_v2, morpho_aave_v3, spark, ape_swap, silo, compound_v3,
37
- justlend, zerolend, moonwell, ionic, sonne
38
- ]
28
+ all = [strike, aave_v2, aave_v3, radiant_v2, compound, flux, onyx, granary,
29
+ iron_bank, trava, valas, geist, cream, venus, liqee, strike, uwu, wepiggy,
30
+ morpho_compound, morpho_aave_v2, morpho_aave_v3, spark, ape_swap, silo, compound_v3,
31
+ justlend
32
+ ]
@@ -4,14 +4,11 @@ from defi_services.services.lending.aave_v2_services import AaveV2StateService
4
4
  from defi_services.services.lending.apeswap_services import ApeSwapStateService
5
5
  from defi_services.services.lending.compound_v3_services import CompoundV3StateService
6
6
  from defi_services.services.lending.granary_services import GranaryStateService
7
- from defi_services.services.lending.ionic_service import IonicStateService
8
7
  from defi_services.services.lending.justlend_service import JustLendStateService
9
- from defi_services.services.lending.moonwell_service import MoonWellStateService
10
8
  from defi_services.services.lending.morpho_aave_v2_services import MorphoAaveV2StateService
11
9
  from defi_services.services.lending.morpho_aave_v3_services import MorphoAaveV3StateService
12
10
  from defi_services.services.lending.morpho_compound_services import MorphoCompoundStateService
13
11
  from defi_services.services.lending.silo_services import SiloStateService
14
- from defi_services.services.lending.sonne_service import SonneStateService
15
12
  from defi_services.services.lending.spark_services import SparkStateService
16
13
  from defi_services.services.lending.uwu_services import UwuStateService
17
14
  from defi_services.services.lending.aave_v3_services import AaveV3StateService
@@ -28,7 +25,6 @@ from defi_services.services.lending.liqee_service import LiqeeStateService
28
25
  from defi_services.services.lending.strike_service import StrikeStateService
29
26
  from defi_services.services.lending.onyx_service import OnyxStateService
30
27
  from defi_services.services.lending.wepiggy_services import WepiggyStateService
31
- from defi_services.services.lending.zerolend_services import ZeroLendStateService
32
28
 
33
29
 
34
30
  class LendingServices:
@@ -51,9 +47,7 @@ class LendingServices:
51
47
  Lending.morpho_compound: MorphoCompoundStateService,
52
48
  Lending.spark: SparkStateService,
53
49
  Lending.silo: SiloStateService,
54
- Lending.compound_v3: CompoundV3StateService,
55
- Lending.radiant_v2: RadiantStateService,
56
- Lending.zerolend: ZeroLendStateService
50
+ Lending.compound_v3: CompoundV3StateService
57
51
  }
58
52
  fantom = {
59
53
  Lending.trava: TravaStateService,
@@ -71,8 +65,7 @@ class LendingServices:
71
65
  Lending.liqee: LiqeeStateService,
72
66
  Lending.wepiggy: WepiggyStateService,
73
67
  Lending.granary: GranaryStateService,
74
- Lending.ape_swap: ApeSwapStateService,
75
- Lending.aave_v3: AaveV3StateService
68
+ Lending.ape_swap: ApeSwapStateService
76
69
  }
77
70
 
78
71
  avalanche = {
@@ -93,8 +86,7 @@ class LendingServices:
93
86
  Lending.aave_v3: AaveV3StateService,
94
87
  Lending.granary: GranaryStateService,
95
88
  Lending.wepiggy: WepiggyStateService,
96
- Lending.iron_bank: IronBankStateService,
97
- Lending.compound_v3: CompoundV3StateService
89
+ Lending.iron_bank: IronBankStateService
98
90
  }
99
91
 
100
92
  arbitrum = {
@@ -109,23 +101,6 @@ class LendingServices:
109
101
  tron = {
110
102
  Lending.justlend: JustLendStateService
111
103
  }
112
-
113
- base = {
114
- Lending.aave_v3: AaveV3StateService,
115
- Lending.compound_v3: CompoundV3StateService,
116
- Lending.zerolend: ZeroLendStateService,
117
- Lending.moonwell: MoonWellStateService,
118
- Lending.granary: GranaryStateService,
119
- Lending.radiant_v2: RadiantStateService,
120
- Lending.ionic: IonicStateService,
121
- Lending.sonne: SonneStateService
122
- }
123
-
124
- zksync = {
125
- Lending.aave_v3: AaveV3StateService,
126
- Lending.zerolend: ZeroLendStateService
127
- }
128
-
129
104
  # mapping
130
105
  mapping = {
131
106
  Chain.ethereum: ethereum,
@@ -135,7 +110,5 @@ class LendingServices:
135
110
  Chain.polygon: polygon,
136
111
  Chain.arbitrum: arbitrum,
137
112
  Chain.optimism: optimism,
138
- Chain.tron: tron,
139
- Chain.zksync: zksync,
140
- Chain.base: base
113
+ Chain.tron: tron
141
114
  }
@@ -1,5 +1,5 @@
1
1
  class Vault:
2
2
  # service
3
3
  trava_vault = "trava-vault"
4
- tcv_vault = "tcv-vault"
5
- all = [trava_vault, tcv_vault]
4
+
5
+ all = [trava_vault]
@@ -1,6 +1,5 @@
1
1
  from defi_services.constants.chain_constant import Chain
2
2
  from defi_services.constants.entities.vault_constant import Vault
3
- from defi_services.services.vault.tcv_vault_services import TCVVaultStateService
4
3
  from defi_services.services.vault.trava_vault_services import TravaVaultStateService
5
4
 
6
5
 
@@ -18,13 +17,8 @@ class VaultServices:
18
17
  Vault.trava_vault: TravaVaultStateService
19
18
  }
20
19
 
21
- arbitrum = {
22
- Vault.tcv_vault: TCVVaultStateService
23
- }
24
-
25
20
  mapping = {
26
21
  Chain.bsc: bsc,
27
22
  Chain.ethereum: ethereum,
28
- Chain.fantom: fantom,
29
- Chain.arbitrum: arbitrum
23
+ Chain.fantom: fantom
30
24
  }
@@ -1,5 +1,8 @@
1
+ import os
1
2
 
2
- from defi_services.constants.chain_constant import Chain
3
+ import dotenv
4
+
5
+ dotenv.load_dotenv()
3
6
 
4
7
  POLYGON_AAVE_ADDRESS = '0x8dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf'
5
8
  ETHEREUM_AAVE_ADDRESS = '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9'
@@ -18,18 +21,353 @@ FTM_GEIST_ADDRESS = '0x9fad24f572045c7869117160a571b2e50b10d068'
18
21
  ETH_COMPOUND_ADDRESS = '0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b'
19
22
  ETH_CREAM_ADDRESS = ''
20
23
 
24
+
25
+ class Chains:
26
+ bsc = '0x38'
27
+ ethereum = '0x1'
28
+ fantom = '0xfa'
29
+ polygon = '0x89'
30
+ arbitrum = '0xa4b1'
31
+ optimism = '0xa'
32
+ avalanche = '0xa86a'
33
+ tron = '0x2b6653dc'
34
+ cronos = '0x19'
35
+ solana = 'solana'
36
+ polkadot = 'polkadot'
37
+ bitcoin = 'bitcoin'
38
+ cosmos = 'cosmos'
39
+ base = '0x2105'
40
+ kava = '0x8ae'
41
+ gnosis = '0x64'
42
+ klaytn = '0x2019'
43
+ mantle = '0x1388'
44
+ celo = '0xa4ec'
45
+ moonbeam = '0x504'
46
+ manta = '0xa9'
47
+ pulse = '0x171'
48
+ rootstock = '0x1e'
49
+ astar = '0x250'
50
+ metis = '0x440'
51
+ canto = '0x1e14'
52
+ heco = '0x80'
53
+ linea = '0xe708'
54
+ okc = '0x42'
55
+ aurora = '0x4e454152'
56
+ moonriver = '0x505'
57
+ oasis_sapphire = '0x5afe'
58
+ oasis_sapphire_testnet = '0x5aff'
59
+ blast = '0xee'
60
+ oraichain = 'orai'
61
+ ton = 'ton'
62
+
63
+ none_wrapped_token = [arbitrum, fantom, optimism]
64
+ all = [
65
+ bsc, ethereum, fantom, polygon, arbitrum, optimism,
66
+ avalanche, tron, cronos, solana, polkadot, bitcoin, cosmos,
67
+ oraichain, ton
68
+ ]
69
+
70
+ mapping = {
71
+ 'bsc': bsc,
72
+ 'ethereum': ethereum,
73
+ 'fantom': fantom,
74
+ 'polygon': polygon,
75
+ 'arbitrum': arbitrum,
76
+ 'optimism': optimism,
77
+ 'avalanche': avalanche,
78
+ 'tron': tron,
79
+ 'cronos': cronos,
80
+ 'solana': solana,
81
+ 'polkadot': polkadot,
82
+ 'oasis_sapphire': oasis_sapphire,
83
+ 'oasis_sapphire_testnet': oasis_sapphire_testnet,
84
+ 'ton': ton
85
+ }
86
+
87
+ names = {
88
+ bsc: 'bsc',
89
+ ethereum: "ethereum",
90
+ fantom: 'fantom',
91
+ polygon: 'polygon',
92
+ arbitrum: 'arbitrum',
93
+ optimism: 'optimism',
94
+ avalanche: 'avalanche',
95
+ tron: 'tron',
96
+ cronos: 'cronos',
97
+ solana: 'solana',
98
+ polkadot: 'polkadot',
99
+ oasis_sapphire: 'oasis_sapphire',
100
+ oasis_sapphire_testnet: 'oasis_sapphire_testnet',
101
+ ton: 'ton'
102
+ }
103
+
104
+ abi_mapping = {
105
+ bsc: 'bep20_abi',
106
+ ethereum: 'erc20_abi',
107
+ fantom: 'erc20_abi',
108
+ polygon: 'erc20_abi',
109
+ arbitrum: 'erc20_abi',
110
+ optimism: 'erc20_abi',
111
+ avalanche: 'erc20_abi',
112
+ tron: 'trc20_abi',
113
+ cronos: 'crc20_abi'
114
+ }
115
+
116
+ block_time = {
117
+ bsc: 3,
118
+ ethereum: 12,
119
+ fantom: 1,
120
+ polygon: 2,
121
+ arbitrum: 0.3,
122
+ avalanche: 2,
123
+ ton: 3
124
+ }
125
+ wrapped_native_token = {
126
+ bsc: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
127
+ ethereum: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
128
+ polygon: "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
129
+ fantom: "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
130
+ arbitrum: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
131
+ optimism: "0x4200000000000000000000000000000000000006",
132
+ avalanche: "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",
133
+ tron: "0x891cdb91d149f23b1a45d9c5ca78a88d0cb44c18",
134
+ cronos: "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23",
135
+ }
136
+
137
+ evm = {
138
+ ethereum: True, bsc: True, polygon: True, fantom: True,
139
+ arbitrum: True, optimism: True, avalanche: True, tron: True, cronos: True,
140
+ base: True, kava: True, gnosis: True, klaytn: True, mantle: True, celo: True, moonbeam: True, manta: True,
141
+ pulse: True, rootstock: True, astar: True, metis: True, canto: True, heco: True, linea: True, okc: True,
142
+ aurora: True, moonriver: True, oasis_sapphire: True, blast: True
143
+ }
144
+
145
+ def get_abi_name(self, chain_id):
146
+ """Map chain_id with the corresponding abi key
147
+ e.g.: '0x38' -> 'bep20_abi' or '0x1' -> 'erc20_abi'
148
+ """
149
+ return self.abi_mapping.get(chain_id, '')
150
+
151
+
152
+ class ChainsAnkr:
153
+ """Chain name for Ankr API"""
154
+ bsc = '0x38'
155
+ eth = '0x1'
156
+ fantom = '0xfa'
157
+ polygon = '0x89'
158
+
159
+ reversed_mapping = {
160
+ bsc: 'bsc',
161
+ eth: 'eth',
162
+ fantom: 'fantom',
163
+ polygon: 'polygon',
164
+ }
165
+
166
+ def get_chain_name(self, chain_id):
167
+ return self.reversed_mapping.get(chain_id)
168
+
169
+
170
+ class Scans:
171
+ mapping = {
172
+ 'bscscan': Chains.bsc,
173
+ 'etherscan': Chains.ethereum,
174
+ 'ftmscan': Chains.fantom,
175
+ 'polygonscan': Chains.polygon,
176
+ 'arbiscan': Chains.arbitrum,
177
+ 'optimistic': Chains.optimism,
178
+ 'snowtrace': Chains.avalanche,
179
+ 'cronoscan': Chains.cronos
180
+ }
181
+
182
+ api_keys = {
183
+ Chains.bsc: 'GKRVTEQHSGWX335P21994DKNSTJVDYYXJ1',
184
+ Chains.ethereum: 'YQVXQAJAYNS7AC48ZXS1NT45RKYRPY7P7E',
185
+ Chains.fantom: 'Y85XY5DDDN4Z7C7Z4ZX8N62M5WET7D8NYC',
186
+ Chains.polygon: 'EYADI5Q4VK4VF99KFEJURMVE9CNE54YEYW',
187
+ Chains.arbitrum: 'BU5VN8872FE119RDX898MS5EZHE11FPZSC',
188
+ Chains.optimism: '1JW9PDV2HZZI3WRFQRVGWUDD2T1RV8GWX3',
189
+ Chains.avalanche: 'JWNM6Y5UA1499PWVA2T55MEH3TZDGAKJWJ',
190
+ Chains.cronos: 'F5J6423D42PM21CDP61SUD6H7DE4FXH2DE'
191
+ }
192
+
193
+ api_bases = {
194
+ Chains.bsc: 'https://api.bscscan.com/api',
195
+ Chains.ethereum: 'https://api.etherscan.io/api',
196
+ Chains.fantom: 'https://api.ftmscan.com/api',
197
+ Chains.polygon: 'https://api.polygonscan.com/api',
198
+ Chains.arbitrum: 'https://api.arbiscan.io/api',
199
+ Chains.optimism: 'https://api-optimistic.etherscan.io/api',
200
+ Chains.avalanche: 'https://api.snowtrace.io/api',
201
+ Chains.cronos: 'https://cronoscan.com/api',
202
+ Chains.ton: 'https://toncenter.com/api/'
203
+ }
204
+
205
+ scan_base_urls = {
206
+ Chains.ethereum: 'https://etherscan.io/',
207
+ Chains.bsc: 'https://bscscan.com/',
208
+ Chains.fantom: 'https://ftmscan.com/',
209
+ Chains.polygon: 'https://polygonscan.com/',
210
+ Chains.arbitrum: 'https://arbiscan.io/',
211
+ Chains.optimism: 'https://optimistic.etherscan.io/',
212
+ Chains.avalanche: 'https://snowtrace.io/',
213
+ Chains.cronos: 'https://cronoscan.com/',
214
+ Chains.ton: 'https://toncenter.com/api/'
215
+ }
216
+
217
+ all_base_urls = {
218
+ Chains.bsc: [
219
+ 'https://bscscan.com/token',
220
+ 'https://bscscan-com.translate.goog/token'
221
+ ],
222
+ Chains.polygon: [
223
+ 'https://polygonscan.com/token',
224
+ 'https://polygonscan-com.translate.goog/token'
225
+ ],
226
+ Chains.ethereum: [
227
+ 'https://etherscan.io/token',
228
+ 'https://etherscan-io.translate.goog/token',
229
+ ],
230
+ Chains.fantom: [
231
+ 'https://ftmscan.com/token',
232
+ 'https://ftmscan-com.translate.goog/token'
233
+ ],
234
+ Chains.arbitrum: [
235
+ # 'https://arbiscan-io.translate.goog/token',
236
+ 'https://arbiscan.io/token'
237
+ ],
238
+ Chains.optimism: [
239
+ # 'https://optimistic-etherscan-io.translate.goog/token',
240
+ 'https://optimistic.etherscan.io/token'
241
+ ],
242
+ # Chains.avalanche: [
243
+ # 'https://snowtrace.io/token'
244
+ # ],
245
+ Chains.cronos: ['https://cronoscan.com/token']
246
+ }
247
+
248
+ gg_translate_suffix = '?_x_tr_sl=vi&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp'
249
+
250
+
251
+ class Networks:
252
+ bsc = 'bsc'
253
+ ethereum = 'ethereum'
254
+ fantom = 'fantom'
255
+ polygon = 'polygon'
256
+ arbitrum = 'arbitrum'
257
+ optimism = 'optimism'
258
+ avalanche = 'avalanche'
259
+ tron = 'tron'
260
+ cronos = 'cronos'
261
+ solana = 'solana'
262
+ polkadot = 'polkadot'
263
+ oasis_sapphire = 'oasis_sapphire'
264
+ oasis_sapphire_testnet = 'oasis_sapphire_testnet'
265
+ cosmos = 'cosmos'
266
+ oraichain = 'oraichain'
267
+ ton = 'ton'
268
+
269
+ providers = {
270
+ bsc: os.getenv('BSC_PROVIDER_URI', 'https://bsc-dataseed1.binance.org/'),
271
+ ethereum: os.getenv('ETHEREUM_PROVIDER_URI', 'https://rpc.ankr.com/eth'),
272
+ fantom: os.getenv('FANTOM_PROVIDER_URI', 'https://rpc.ftm.tools/'),
273
+ polygon: os.getenv('POLYGON_PROVIDER_URI', 'https://polygon-rpc.com'),
274
+ arbitrum: os.getenv('ARBITRUM_PROVIDER_URI', 'https://endpoints.omniatech.io/v1/arbitrum/one/public'),
275
+ optimism: os.getenv('OPTIMISM_PROVIDER_URI', 'https://rpc.ankr.com/optimism'),
276
+ avalanche: os.getenv('AVALANCHE_PROVIDER_URI', 'https://rpc.ankr.com/avalanche'),
277
+ tron: os.getenv('TRON_PROVIDER_URI', 'https://rpc.ankr.com/tron_jsonrpc'),
278
+ cronos: os.getenv('CRONOS_PROVIDER_URI', 'https://evm.cronos.org/'),
279
+ solana: os.getenv('SOLANA_PROVIDER_URI', 'https://crimson-multi-putty.solana-mainnet.quiknode.pro/997174ce6ab5cc9d42cb037e931d18ae1a98346a/'),
280
+ polkadot: os.getenv('POLKADOT_PROVIDER_URI', 'https://late-yolo-diagram.dot-mainnet.quiknode.pro/51a1aaf2372854dfd211fca3ab375e5451222be4/'),
281
+ oasis_sapphire: os.getenv('OASIS_SAPPHIRE_PROVIDER_URI'),
282
+ oasis_sapphire_testnet: os.getenv('OASIS_SAPPHIRE_PROVIDER_URI'),
283
+ ton: os.getenv('TON_PROVIDER_URI')
284
+ }
285
+
286
+ archive_node = {
287
+ bsc: os.getenv('BSC_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/bsc'),
288
+ ethereum: os.getenv('ETHEREUM_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/eth'),
289
+ fantom: os.getenv('FANTOM_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/fantom'),
290
+ polygon: os.getenv('POLYGON_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/polygon'),
291
+ arbitrum: os.getenv('ARBITRUM_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/arbitrum'),
292
+ optimism: os.getenv('OPTIMISM_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/optimism'),
293
+ avalanche: os.getenv('AVALANCHE_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/avalanche'),
294
+ tron: os.getenv('TRON_PROVIDER_ARCHIVE_URI', 'https://rpc.ankr.com/tron_jsonrpc'),
295
+ cronos: os.getenv('CRONOS_PROVIDER_ARCHIVE_URI'),
296
+ solana: os.getenv('SOLANA_PROVIDER_ARCHIVE_URI'),
297
+ polkadot: os.getenv('POLKADOT_PROVIDER_ARCHIVE_URI'),
298
+ oasis_sapphire: os.getenv('OASIS_SAPPHIRE_PROVIDER_ARCHIVE_URI'),
299
+ oasis_sapphire_testnet: os.getenv('OASIS_SAPPHIRE_PROVIDER_ARCHIVE_URI'),
300
+ ton: os.getenv('TON_PROVIDER_ARCHIVE_URI', 'https://toncenter.com/api/')
301
+ }
302
+
303
+
304
+ class DefiLlama:
305
+ chains = {
306
+ 'Binance': Chains.bsc,
307
+ 'Ethereum': Chains.ethereum,
308
+ 'Fantom': Chains.fantom,
309
+ 'Polygon': Chains.polygon,
310
+ 'Arbitrum': Chains.arbitrum,
311
+ 'Optimism': Chains.optimism,
312
+ 'Avalanche': Chains.avalanche,
313
+ 'Tron': Chains.tron,
314
+ 'Cronos': Chains.cronos,
315
+ 'Solana': Chains.solana,
316
+ 'Polkadot': Chains.polkadot,
317
+ 'Base': Chains.base,
318
+ 'Kava': Chains.kava,
319
+ 'xDai': Chains.gnosis,
320
+ 'Klaytn': Chains.klaytn,
321
+ 'Mantle': Chains.mantle,
322
+ 'Celo': Chains.celo,
323
+ 'Moonbeam': Chains.moonbeam,
324
+ 'Manta': Chains.manta,
325
+ 'Pulse': Chains.pulse,
326
+ 'RSK': Chains.rootstock,
327
+ 'Astar': Chains.astar,
328
+ 'Metis': Chains.metis,
329
+ 'Canto': Chains.canto,
330
+ 'Heco': Chains.heco,
331
+ 'Linea': Chains.linea,
332
+ 'OKExChain': Chains.okc,
333
+ 'Aurora': Chains.aurora,
334
+ 'Moonriver': Chains.moonriver,
335
+ 'Oasis Sapphire': Chains.oasis_sapphire,
336
+ 'Blast': Chains.blast,
337
+ 'Oraichain': Chains.oraichain,
338
+ 'Ton': Chains.ton
339
+ }
340
+
341
+
342
+ class Opensea:
343
+ chains = {
344
+ Chains.bsc: 'BSC',
345
+ Chains.ethereum: 'ETHEREUM',
346
+ Chains.polygon: 'MATIC',
347
+ Chains.fantom: 'FANTOM',
348
+ Chains.arbitrum: 'ARBITRUM',
349
+ Chains.optimism: 'OPTIMISM',
350
+ Chains.avalanche: 'AVALANCHE',
351
+ Chains.tron: 'TRON',
352
+ Chains.solana: 'SOLANA',
353
+ Chains.base: 'BASE',
354
+ Chains.klaytn: 'KLAYTN',
355
+ Chains.ton: 'TON'
356
+ }
357
+
358
+
21
359
  NATIVE_TOKEN = '0x0000000000000000000000000000000000000000'
22
360
 
23
361
  NATIVE_TOKENS = {
24
- Chain.bsc: '0x0000000000000000000000000000000000000000',
25
- Chain.ethereum: '0x0000000000000000000000000000000000000000',
26
- Chain.fantom: '0x0000000000000000000000000000000000000000',
27
- Chain.polygon: '0x0000000000000000000000000000000000000000',
28
- Chain.arbitrum: '0x0000000000000000000000000000000000000000',
29
- Chain.optimism: '0x0000000000000000000000000000000000000000',
30
- Chain.avalanche: '0x0000000000000000000000000000000000000000',
31
- Chain.tron: '0x0000000000000000000000000000000000000000',
32
- Chain.ton: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'
362
+ Chains.bsc: '0x0000000000000000000000000000000000000000',
363
+ Chains.ethereum: '0x0000000000000000000000000000000000000000',
364
+ Chains.fantom: '0x0000000000000000000000000000000000000000',
365
+ Chains.polygon: '0x0000000000000000000000000000000000000000',
366
+ Chains.arbitrum: '0x0000000000000000000000000000000000000000',
367
+ Chains.optimism: '0x0000000000000000000000000000000000000000',
368
+ Chains.avalanche: '0x0000000000000000000000000000000000000000',
369
+ Chains.tron: '0x0000000000000000000000000000000000000000',
370
+ Chains.ton: 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c'
33
371
  }
34
372
 
35
373
 
@@ -39,16 +377,16 @@ class MulticallContract:
39
377
  """
40
378
 
41
379
  on_chains_v3 = {
42
- Chain.ethereum: '0xca11bde05977b3631167028862be2a173976ca11',
43
- Chain.bsc: '0xca11bde05977b3631167028862be2a173976ca11',
44
- Chain.polygon: '0xca11bde05977b3631167028862be2a173976ca11',
45
- Chain.avalanche: '0xca11bde05977b3631167028862be2a173976ca11',
46
- Chain.fantom: '0xca11bde05977b3631167028862be2a173976ca11',
47
- Chain.arbitrum: '0xca11bde05977b3631167028862be2a173976ca11',
48
- Chain.optimism: '0xca11bde05977b3631167028862be2a173976ca11',
49
- Chain.tron: '0x32a4f47a74a6810bd0bf861cabab99656a75de9e',
50
- Chain.oasis_sapphire: '0xca11bde05977b3631167028862be2a173976ca11',
51
- Chain.zksync: '0xf9cda624fbc7e059355ce98a31693d299facd963'
380
+ Chains.ethereum: '0xca11bde05977b3631167028862be2a173976ca11',
381
+ Chains.bsc: '0xca11bde05977b3631167028862be2a173976ca11',
382
+ Chains.polygon: '0xca11bde05977b3631167028862be2a173976ca11',
383
+ Chains.avalanche: '0xca11bde05977b3631167028862be2a173976ca11',
384
+ Chains.fantom: '0xca11bde05977b3631167028862be2a173976ca11',
385
+ Chains.arbitrum: '0xca11bde05977b3631167028862be2a173976ca11',
386
+ Chains.optimism: '0xca11bde05977b3631167028862be2a173976ca11',
387
+ Chains.tron: '0x32a4f47a74a6810bd0bf861cabab99656a75de9e',
388
+ Chains.oasis_sapphire: '0xca11bde05977b3631167028862be2a173976ca11',
389
+ Chains.oasis_sapphire_testnet: '0xca11bde05977b3631167028862be2a173976ca11'
52
390
  }
53
391
 
54
392
  default_address = '0xca11bde05977b3631167028862be2a173976ca11'
@@ -56,3 +394,6 @@ class MulticallContract:
56
394
  @classmethod
57
395
  def get_multicall_contract(cls, chain_id):
58
396
  return cls.on_chains_v3.get(chain_id, cls.default_address)
397
+
398
+
399
+ EMPTY_TOKEN_IMG = 'https://firebasestorage.googleapis.com/v0/b/token-c515a.appspot.com/o/tokens_v2%2Fempty-token.png?alt=media&token=2f9dfcc1-88a0-472c-a51f-4babc0c583f0'
@@ -45,9 +45,7 @@ class Token:
45
45
  Chain.aurora: '0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb',
46
46
  Chain.moonriver: '0x98878b06940ae243284ca214f92bb71a2b032b8a',
47
47
  Chain.blast: '0x4300000000000000000000000000000000000004',
48
- Chain.oasis_sapphire: '0x8bc2b030b299964eefb5e1e0b36991352e56d2d3',
49
- Chain.zetachain: '0x5f0b1a82749cb4e2278ec87f8bf6b618dc71a8bf',
50
- Chain.zksync: '0xf00dad97284d0c6f06dc4db3c32454d4292c6813'
48
+ Chain.oasis_sapphire: '0x8bc2b030b299964eefb5e1e0b36991352e56d2d3'
51
49
  }
52
50
 
53
51
 
@@ -1,14 +1,13 @@
1
1
  import logging
2
2
 
3
- from defi_services.constants.chain_constant import Chain
4
3
  from defi_services.constants.cosmos_decimals_constant import Denoms, MulticallContract
4
+ from defi_services.constants.network_constants import Chains
5
5
  from defi_services.services.cosmos_token_services import CosmosTokenServices
6
6
 
7
7
  logger = logging.getLogger("CosmosStateProcessor")
8
8
 
9
-
10
9
  class CosmosStateProcessor:
11
- def __init__(self, lcd: str, rest_uri: str = None, chain_id: str = Chain.oraichain):
10
+ def __init__(self, lcd: str, rest_uri: str = None, chain_id: str = Chains.oraichain):
12
11
  self.chain_id = chain_id
13
12
  self.lcd = lcd
14
13
  self.rest_uri = rest_uri
@@ -1,19 +1,18 @@
1
1
  import logging
2
2
 
3
- from defi_services.constants.chain_constant import Chain
4
- from defi_services.constants.ton_decimals_constant import TonTokens
5
- from defi_services.constants.network_constants import NATIVE_TOKENS
3
+ from src.defi_services.constants.ton_decimals_constant import TonTokens
4
+ from defi_services.constants.network_constants import Chains, NATIVE_TOKEN, NATIVE_TOKENS
6
5
  from defi_services.jobs.queriers.ton_state_querier import TonStateQuerier
7
6
 
8
7
  logger = logging.getLogger("CosmosStateProcessor")
9
8
 
10
-
11
9
  class TonStateProcessor:
12
- def __init__(self, provider_uri: str, chain_id: str = Chain.ton):
10
+ def __init__(self, provider_uri: str, chain_id: str = Chains.ton):
13
11
  self.chain_id = chain_id
14
12
  self.provider_uri = provider_uri
15
13
  self.state_querier = TonStateQuerier(self.provider_uri)
16
14
 
15
+
17
16
  def get_token_balance(self, address, tokens):
18
17
  result = {}
19
18
  if NATIVE_TOKENS[self.chain_id] in tokens:
@@ -94,8 +94,6 @@ class CallStateQuerier(StateQuerier):
94
94
  results = {}
95
95
  for block_number, batch_calls in w3_multicall.batch_calls_iterator(batch_size=batch_size):
96
96
  multicall_data = decoded_data.get(f'{batch_idx}_{block_number}')
97
- if not multicall_data:
98
- continue
99
97
  decode_multicall_data = w3_multicall.decode(multicall_data, calls=batch_calls, ignore_error=ignore_error)
100
98
  results.update(decode_multicall_data)
101
99
  batch_idx += 1