defi-state-querier 0.5.28__py3-none-any.whl → 0.5.30__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 (103) hide show
  1. defi_services/__init__.py +1 -1
  2. defi_services/abis/lending/ionic/__init__.py +0 -0
  3. defi_services/abis/lending/ionic/ionic_ctoken_abi.py +1108 -0
  4. defi_services/abis/lending/kinza/__init__.py +0 -0
  5. defi_services/abis/lending/kinza/kinza_incentive.py +928 -0
  6. defi_services/abis/lending/kinza/kinza_lending_pool.py +1791 -0
  7. defi_services/abis/lending/moonwell/__init__.py +0 -0
  8. defi_services/abis/lending/moonwell/moonwell_comptroller_abi.py +1500 -0
  9. defi_services/abis/lending/moonwell/moonwell_ctoken_abi.py +1431 -0
  10. defi_services/abis/lending/radiant_v2/radiant_reward_converter.py +817 -0
  11. defi_services/abis/lending/seamless/__init__.py +0 -0
  12. defi_services/abis/lending/seamless/seamless_incentive.py +1049 -0
  13. defi_services/abis/lending/seamless/seamless_lending_pool.py +1738 -0
  14. defi_services/abis/lending/seamless/seamless_oracle.py +233 -0
  15. defi_services/abis/token/trc20_abi.py +304 -0
  16. defi_services/abis/vault/tcv_abi.py +1523 -0
  17. defi_services/constants/chain_constant.py +8 -1
  18. defi_services/constants/entities/dex_info_constant.py +2 -2
  19. defi_services/constants/entities/dex_services.py +13 -1
  20. defi_services/constants/entities/lending_constant.py +14 -5
  21. defi_services/constants/entities/lending_services.py +41 -4
  22. defi_services/constants/entities/vault_constant.py +2 -2
  23. defi_services/constants/entities/vault_services.py +7 -1
  24. defi_services/constants/network_constants.py +20 -361
  25. defi_services/constants/token_constant.py +3 -1
  26. defi_services/jobs/processors/cosmos_state_processor.py +3 -2
  27. defi_services/jobs/processors/ton_state_processor.py +5 -4
  28. defi_services/jobs/queriers/call_state_querier.py +2 -0
  29. defi_services/jobs/queriers/state_querier.py +3 -0
  30. defi_services/jobs/tcv.py +144 -0
  31. defi_services/services/dex/dex_info/uniswap_info.py +29 -1
  32. defi_services/services/dex/uniswap_v3_service.py +6 -2
  33. defi_services/services/lending/aave_v2_services.py +44 -29
  34. defi_services/services/lending/aave_v3_services.py +41 -20
  35. defi_services/services/lending/avalon_services.py +34 -0
  36. defi_services/services/lending/compound_v3_services.py +9 -5
  37. defi_services/services/lending/granary_services.py +6 -4
  38. defi_services/services/lending/ionic_service.py +167 -0
  39. defi_services/services/lending/justlend_service.py +4 -3
  40. defi_services/services/lending/kinza_services.py +315 -0
  41. defi_services/services/lending/lending_info/arbitrum/aave_v3_arbitrum.py +1 -1
  42. defi_services/services/lending/lending_info/arbitrum/compound_v3_arbitrum.py +96 -6
  43. defi_services/services/lending/lending_info/arbitrum/venus_arbitrum.py +10 -0
  44. defi_services/services/lending/lending_info/base/__init__.py +0 -0
  45. defi_services/services/lending/lending_info/base/aave_v3_base.py +61 -0
  46. defi_services/services/lending/lending_info/base/compound_v3_base.py +116 -0
  47. defi_services/services/lending/lending_info/base/granary_base.py +62 -0
  48. defi_services/services/lending/lending_info/base/ionic_base.py +173 -0
  49. defi_services/services/lending/lending_info/base/moonwell_base.py +89 -0
  50. defi_services/services/lending/lending_info/base/radiant_v2_base.py +57 -0
  51. defi_services/services/lending/lending_info/base/seamless_base.py +145 -0
  52. defi_services/services/lending/lending_info/base/sonne_base.py +53 -0
  53. defi_services/services/lending/lending_info/base/xlend_base.py +91 -0
  54. defi_services/services/lending/lending_info/base/zerolend_base.py +109 -0
  55. defi_services/services/lending/lending_info/bsc/aave_v3_bsc.py +68 -0
  56. defi_services/services/lending/lending_info/bsc/apeswap_bsc.py +1 -1
  57. defi_services/services/lending/lending_info/bsc/avalon_bsc.py +75 -0
  58. defi_services/services/lending/lending_info/bsc/kinza_bsc.py +182 -0
  59. defi_services/services/lending/lending_info/ethereum/aave_v3_eth.py +1 -140
  60. defi_services/services/lending/lending_info/ethereum/compound_v3_eth.py +180 -5
  61. defi_services/services/lending/lending_info/ethereum/kinza_eth.py +119 -0
  62. defi_services/services/lending/lending_info/ethereum/old_aave_v3_eth.py +150 -0
  63. defi_services/services/lending/lending_info/ethereum/radiant_eth.py +69 -0
  64. defi_services/services/lending/lending_info/ethereum/venus_eth.py +10 -0
  65. defi_services/services/lending/lending_info/ethereum/zerolend_eth.py +96 -0
  66. defi_services/services/lending/lending_info/optimism/compound_v3_optimism.py +116 -0
  67. defi_services/services/lending/lending_info/optimism/moonwell_optimism.py +9 -0
  68. defi_services/services/lending/lending_info/optimism/xlend_optimism.py +112 -0
  69. defi_services/services/lending/lending_info/polygon/compound_v3_polygon.py +35 -5
  70. defi_services/services/lending/lending_info/zksync/__init__.py +0 -0
  71. defi_services/services/lending/lending_info/zksync/aave_v3_zksync.py +47 -0
  72. defi_services/services/lending/lending_info/zksync/venus_zksync.py +10 -0
  73. defi_services/services/lending/lending_info/zksync/zerolend_zksync.py +138 -0
  74. defi_services/services/lending/liqee_service.py +2 -2
  75. defi_services/services/lending/moonwell_service.py +120 -0
  76. defi_services/services/lending/morpho_aave_v2_services.py +3 -3
  77. defi_services/services/lending/morpho_aave_v3_services.py +2 -2
  78. defi_services/services/lending/onyx_service.py +2 -1
  79. defi_services/services/lending/radiant_v2_services.py +52 -10
  80. defi_services/services/lending/seamless_services.py +313 -0
  81. defi_services/services/lending/sonne_service.py +64 -0
  82. defi_services/services/lending/trava_services.py +2 -2
  83. defi_services/services/lending/uwu_services.py +3 -3
  84. defi_services/services/lending/valas_services.py +2 -2
  85. defi_services/services/lending/venus_services.py +9 -3
  86. defi_services/services/lending/xlend_services.py +325 -0
  87. defi_services/services/lending/zerolend_services.py +36 -0
  88. defi_services/services/multicall/multicall_v2.py +0 -317
  89. defi_services/services/vault/tcv_vault_services.py +108 -0
  90. defi_services/services/vault/vault_info/arbitrum/__init__.py +0 -0
  91. defi_services/services/vault/vault_info/arbitrum/tcv_arb.py +58 -0
  92. {defi_state_querier-0.5.28.dist-info → defi_state_querier-0.5.30.dist-info}/METADATA +1 -1
  93. {defi_state_querier-0.5.28.dist-info → defi_state_querier-0.5.30.dist-info}/RECORD +103 -49
  94. /defi_services/abis/lending/{aave_v2_and_forlks → aave_v2_and_forks}/__init__.py +0 -0
  95. /defi_services/abis/lending/{aave_v2_and_forlks → aave_v2_and_forks}/aave_v2_event_abi.py +0 -0
  96. /defi_services/abis/lending/{aave_v2_and_forlks → aave_v2_and_forks}/aave_v2_incentives_abi.py +0 -0
  97. /defi_services/abis/lending/{aave_v2_and_forlks → aave_v2_and_forks}/lending_pool_abi.py +0 -0
  98. /defi_services/abis/lending/{aave_v2_and_forlks → aave_v2_and_forks}/oracle_abi.py +0 -0
  99. /defi_services/abis/lending/{aave_v2_and_forlks → aave_v2_and_forks}/staked_incentives_abi.py +0 -0
  100. /defi_services/abis/lending/{aave_v2_and_forlks → aave_v2_and_forks}/uwu_incentives_abi.py +0 -0
  101. {defi_state_querier-0.5.28.dist-info → defi_state_querier-0.5.30.dist-info}/WHEEL +0 -0
  102. {defi_state_querier-0.5.28.dist-info → defi_state_querier-0.5.30.dist-info}/licenses/LICENSE +0 -0
  103. {defi_state_querier-0.5.28.dist-info → defi_state_querier-0.5.30.dist-info}/top_level.txt +0 -0
@@ -30,6 +30,12 @@ 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'
33
39
 
34
40
  native_decimals = {
35
41
  tron: 6,
@@ -48,5 +54,6 @@ class BlockTime:
48
54
  Chain.optimism: 1, # TODO: check
49
55
  Chain.avalanche: 2,
50
56
  Chain.tron: 3,
51
- Chain.cronos: 6
57
+ Chain.cronos: 6,
58
+ Chain.base: 2
52
59
  }
@@ -36,7 +36,8 @@ class DexInfo:
36
36
  # Dex.sushi: SushiSwapV2Services
37
37
  # }
38
38
  arbitrum = {
39
- Dex.sushi_v2: SUSHISWAP_V2_ARBITRUM_INFO
39
+ Dex.sushi_v2: SUSHISWAP_V2_ARBITRUM_INFO,
40
+ Dex.uniswap_v3: UNISWAP_V3_ARBITRUM_INFO
40
41
  }
41
42
  mapping = {
42
43
  Chain.ethereum: ethereum,
@@ -47,4 +48,3 @@ class DexInfo:
47
48
  Chain.arbitrum: arbitrum,
48
49
  # Chain.optimism: optimism,
49
50
  }
50
-
@@ -45,8 +45,18 @@ class DexServices:
45
45
  # Dex.sushi: SushiSwapV2Services
46
46
  # }
47
47
  arbitrum = {
48
- Dex.sushi_v2: SushiSwapV2Services
48
+ Dex.sushi_v2: SushiSwapV2Services,
49
+ Dex.uniswap_v3: UniswapV3Services
50
+ }
51
+
52
+ zksync = {
53
+ Dex.uniswap_v3: UniswapV3Services
49
54
  }
55
+
56
+ base = {
57
+ Dex.uniswap_v3: UniswapV3Services
58
+ }
59
+
50
60
  mapping = {
51
61
  Chain.ethereum: ethereum,
52
62
  Chain.fantom: fantom,
@@ -55,4 +65,6 @@ class DexServices:
55
65
  Chain.polygon: polygon,
56
66
  Chain.arbitrum: arbitrum,
57
67
  # Chain.optimism: optimism,
68
+ Chain.zksync: zksync,
69
+ Chain.base: base
58
70
  }
@@ -25,8 +25,17 @@ class Lending:
25
25
  silo = 'silo-finance'
26
26
  compound_v3 = 'compound-v3'
27
27
  justlend = "justlend"
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
- ]
28
+ zerolend = "zerolend"
29
+ moonwell = "moonwell"
30
+ ionic = "ionic-protocol"
31
+ sonne = "sonne-finance"
32
+ kinza = "kinza-finance"
33
+ seamless = "seamless-protocol"
34
+ avalon = 'avalon-finance'
35
+ xlend = "extra-finance-xlend"
36
+ all = [
37
+ strike, aave_v2, aave_v3, radiant_v2, compound, flux, onyx, granary,
38
+ iron_bank, trava, valas, geist, cream, venus, liqee, strike, uwu, wepiggy,
39
+ morpho_compound, morpho_aave_v2, morpho_aave_v3, spark, ape_swap, silo, compound_v3,
40
+ justlend, zerolend, moonwell, ionic, sonne, kinza, seamless, avalon, xlend
41
+ ]
@@ -2,13 +2,19 @@ from defi_services.constants.chain_constant import Chain
2
2
  from defi_services.constants.entities.lending_constant import Lending
3
3
  from defi_services.services.lending.aave_v2_services import AaveV2StateService
4
4
  from defi_services.services.lending.apeswap_services import ApeSwapStateService
5
+ from defi_services.services.lending.avalon_services import AvalonStateService
5
6
  from defi_services.services.lending.compound_v3_services import CompoundV3StateService
6
7
  from defi_services.services.lending.granary_services import GranaryStateService
8
+ from defi_services.services.lending.ionic_service import IonicStateService
7
9
  from defi_services.services.lending.justlend_service import JustLendStateService
10
+ from defi_services.services.lending.kinza_services import KinzaStateService
11
+ from defi_services.services.lending.moonwell_service import MoonWellStateService
8
12
  from defi_services.services.lending.morpho_aave_v2_services import MorphoAaveV2StateService
9
13
  from defi_services.services.lending.morpho_aave_v3_services import MorphoAaveV3StateService
10
14
  from defi_services.services.lending.morpho_compound_services import MorphoCompoundStateService
15
+ from defi_services.services.lending.seamless_services import SeamlessStateService
11
16
  from defi_services.services.lending.silo_services import SiloStateService
17
+ from defi_services.services.lending.sonne_service import SonneStateService
12
18
  from defi_services.services.lending.spark_services import SparkStateService
13
19
  from defi_services.services.lending.uwu_services import UwuStateService
14
20
  from defi_services.services.lending.aave_v3_services import AaveV3StateService
@@ -25,6 +31,8 @@ from defi_services.services.lending.liqee_service import LiqeeStateService
25
31
  from defi_services.services.lending.strike_service import StrikeStateService
26
32
  from defi_services.services.lending.onyx_service import OnyxStateService
27
33
  from defi_services.services.lending.wepiggy_services import WepiggyStateService
34
+ from defi_services.services.lending.xlend_services import XlendStateService
35
+ from defi_services.services.lending.zerolend_services import ZeroLendStateService
28
36
 
29
37
 
30
38
  class LendingServices:
@@ -47,7 +55,10 @@ class LendingServices:
47
55
  Lending.morpho_compound: MorphoCompoundStateService,
48
56
  Lending.spark: SparkStateService,
49
57
  Lending.silo: SiloStateService,
50
- Lending.compound_v3: CompoundV3StateService
58
+ Lending.compound_v3: CompoundV3StateService,
59
+ Lending.radiant_v2: RadiantStateService,
60
+ Lending.zerolend: ZeroLendStateService,
61
+ Lending.kinza: KinzaStateService
51
62
  }
52
63
  fantom = {
53
64
  Lending.trava: TravaStateService,
@@ -65,7 +76,10 @@ class LendingServices:
65
76
  Lending.liqee: LiqeeStateService,
66
77
  Lending.wepiggy: WepiggyStateService,
67
78
  Lending.granary: GranaryStateService,
68
- Lending.ape_swap: ApeSwapStateService
79
+ Lending.ape_swap: ApeSwapStateService,
80
+ Lending.aave_v3: AaveV3StateService,
81
+ Lending.kinza: KinzaStateService,
82
+ Lending.avalon: AvalonStateService
69
83
  }
70
84
 
71
85
  avalanche = {
@@ -86,7 +100,9 @@ class LendingServices:
86
100
  Lending.aave_v3: AaveV3StateService,
87
101
  Lending.granary: GranaryStateService,
88
102
  Lending.wepiggy: WepiggyStateService,
89
- Lending.iron_bank: IronBankStateService
103
+ Lending.iron_bank: IronBankStateService,
104
+ Lending.compound_v3: CompoundV3StateService,
105
+ Lending.xlend: XlendStateService
90
106
  }
91
107
 
92
108
  arbitrum = {
@@ -101,6 +117,25 @@ class LendingServices:
101
117
  tron = {
102
118
  Lending.justlend: JustLendStateService
103
119
  }
120
+
121
+ base = {
122
+ Lending.aave_v3: AaveV3StateService,
123
+ Lending.compound_v3: CompoundV3StateService,
124
+ Lending.zerolend: ZeroLendStateService,
125
+ Lending.moonwell: MoonWellStateService,
126
+ Lending.granary: GranaryStateService,
127
+ Lending.radiant_v2: RadiantStateService,
128
+ Lending.ionic: IonicStateService,
129
+ Lending.sonne: SonneStateService,
130
+ Lending.seamless: SeamlessStateService,
131
+ Lending.xlend: XlendStateService
132
+ }
133
+
134
+ zksync = {
135
+ Lending.aave_v3: AaveV3StateService,
136
+ Lending.zerolend: ZeroLendStateService
137
+ }
138
+
104
139
  # mapping
105
140
  mapping = {
106
141
  Chain.ethereum: ethereum,
@@ -110,5 +145,7 @@ class LendingServices:
110
145
  Chain.polygon: polygon,
111
146
  Chain.arbitrum: arbitrum,
112
147
  Chain.optimism: optimism,
113
- Chain.tron: tron
148
+ Chain.tron: tron,
149
+ Chain.zksync: zksync,
150
+ Chain.base: base
114
151
  }
@@ -1,5 +1,5 @@
1
1
  class Vault:
2
2
  # service
3
3
  trava_vault = "trava-vault"
4
-
5
- all = [trava_vault]
4
+ tcv_vault = "tcv-vault"
5
+ all = [trava_vault, tcv_vault]
@@ -1,5 +1,6 @@
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
3
4
  from defi_services.services.vault.trava_vault_services import TravaVaultStateService
4
5
 
5
6
 
@@ -17,8 +18,13 @@ class VaultServices:
17
18
  Vault.trava_vault: TravaVaultStateService
18
19
  }
19
20
 
21
+ arbitrum = {
22
+ Vault.tcv_vault: TCVVaultStateService
23
+ }
24
+
20
25
  mapping = {
21
26
  Chain.bsc: bsc,
22
27
  Chain.ethereum: ethereum,
23
- Chain.fantom: fantom
28
+ Chain.fantom: fantom,
29
+ Chain.arbitrum: arbitrum
24
30
  }
@@ -1,8 +1,5 @@
1
- import os
2
1
 
3
- import dotenv
4
-
5
- dotenv.load_dotenv()
2
+ from defi_services.constants.chain_constant import Chain
6
3
 
7
4
  POLYGON_AAVE_ADDRESS = '0x8dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf'
8
5
  ETHEREUM_AAVE_ADDRESS = '0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9'
@@ -21,353 +18,18 @@ FTM_GEIST_ADDRESS = '0x9fad24f572045c7869117160a571b2e50b10d068'
21
18
  ETH_COMPOUND_ADDRESS = '0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b'
22
19
  ETH_CREAM_ADDRESS = ''
23
20
 
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
-
359
21
  NATIVE_TOKEN = '0x0000000000000000000000000000000000000000'
360
22
 
361
23
  NATIVE_TOKENS = {
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'
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'
371
33
  }
372
34
 
373
35
 
@@ -377,16 +39,16 @@ class MulticallContract:
377
39
  """
378
40
 
379
41
  on_chains_v3 = {
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'
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'
390
52
  }
391
53
 
392
54
  default_address = '0xca11bde05977b3631167028862be2a173976ca11'
@@ -394,6 +56,3 @@ class MulticallContract:
394
56
  @classmethod
395
57
  def get_multicall_contract(cls, chain_id):
396
58
  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,7 +45,9 @@ class Token:
45
45
  Chain.aurora: '0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb',
46
46
  Chain.moonriver: '0x98878b06940ae243284ca214f92bb71a2b032b8a',
47
47
  Chain.blast: '0x4300000000000000000000000000000000000004',
48
- Chain.oasis_sapphire: '0x8bc2b030b299964eefb5e1e0b36991352e56d2d3'
48
+ Chain.oasis_sapphire: '0x8bc2b030b299964eefb5e1e0b36991352e56d2d3',
49
+ Chain.zetachain: '0x5f0b1a82749cb4e2278ec87f8bf6b618dc71a8bf',
50
+ Chain.zksync: '0xf00dad97284d0c6f06dc4db3c32454d4292c6813'
49
51
  }
50
52
 
51
53
 
@@ -1,13 +1,14 @@
1
1
  import logging
2
2
 
3
+ from defi_services.constants.chain_constant import Chain
3
4
  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
+
9
10
  class CosmosStateProcessor:
10
- def __init__(self, lcd: str, rest_uri: str = None, chain_id: str = Chains.oraichain):
11
+ def __init__(self, lcd: str, rest_uri: str = None, chain_id: str = Chain.oraichain):
11
12
  self.chain_id = chain_id
12
13
  self.lcd = lcd
13
14
  self.rest_uri = rest_uri
@@ -1,18 +1,19 @@
1
1
  import logging
2
2
 
3
- from src.defi_services.constants.ton_decimals_constant import TonTokens
4
- from defi_services.constants.network_constants import Chains, NATIVE_TOKEN, NATIVE_TOKENS
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
5
6
  from defi_services.jobs.queriers.ton_state_querier import TonStateQuerier
6
7
 
7
8
  logger = logging.getLogger("CosmosStateProcessor")
8
9
 
10
+
9
11
  class TonStateProcessor:
10
- def __init__(self, provider_uri: str, chain_id: str = Chains.ton):
12
+ def __init__(self, provider_uri: str, chain_id: str = Chain.ton):
11
13
  self.chain_id = chain_id
12
14
  self.provider_uri = provider_uri
13
15
  self.state_querier = TonStateQuerier(self.provider_uri)
14
16
 
15
-
16
17
  def get_token_balance(self, address, tokens):
17
18
  result = {}
18
19
  if NATIVE_TOKENS[self.chain_id] in tokens: