defi-state-querier 0.4.2__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.
Files changed (47) hide show
  1. defi_services/__init__.py +1 -1
  2. defi_services/constants/entities/vault_constant.py +5 -0
  3. defi_services/constants/entities/vault_services.py +24 -0
  4. defi_services/constants/query_constant.py +1 -0
  5. defi_services/jobs/processors/state_processor.py +4 -2
  6. defi_services/services/lending/aave_v2_services.py +1 -1
  7. defi_services/services/lending/aave_v3_services.py +1 -1
  8. defi_services/services/lending/apeswap_services.py +1 -1
  9. defi_services/services/lending/compound_service.py +1 -1
  10. defi_services/services/lending/compound_v3_services.py +1 -4
  11. defi_services/services/lending/flux_services.py +1 -4
  12. defi_services/services/lending/granary_services.py +1 -4
  13. defi_services/services/lending/iron_bank_service.py +1 -4
  14. defi_services/services/lending/justlend_service.py +6 -6
  15. defi_services/services/lending/lending_info/bsc/liqee_bsc.py +154 -106
  16. defi_services/services/lending/lending_info/ethereum/liqee_eth.py +160 -110
  17. defi_services/services/lending/liqee_service.py +1 -1
  18. defi_services/services/lending/morpho_aave_v2_services.py +1 -1
  19. defi_services/services/lending/morpho_aave_v3_services.py +1 -4
  20. defi_services/services/lending/morpho_compound_services.py +1 -5
  21. defi_services/services/lending/onyx_service.py +1 -4
  22. defi_services/services/lending/radiant_v2_services.py +1 -4
  23. defi_services/services/lending/silo_services.py +1 -1
  24. defi_services/services/lending/strike_service.py +1 -1
  25. defi_services/services/lending/trava_services.py +5 -5
  26. defi_services/services/lending/uwu_services.py +1 -1
  27. defi_services/services/lending/valas_services.py +1 -1
  28. defi_services/services/lending/venus_services.py +6 -6
  29. defi_services/services/lending/wepiggy_services.py +1 -1
  30. defi_services/services/protocol_services.py +34 -2
  31. defi_services/services/vault/__init__.py +0 -0
  32. defi_services/services/vault/trava_vault_services.py +196 -0
  33. defi_services/services/vault/vault_info/__init__.py +0 -0
  34. defi_services/services/vault/vault_info/bsc/__init__.py +0 -0
  35. defi_services/services/vault/vault_info/bsc/trava_bsc.py +41 -0
  36. defi_services/services/vault/vault_info/ethereum/__init__.py +0 -0
  37. defi_services/services/vault/vault_info/ethereum/trava_eth.py +22 -0
  38. defi_services/services/vault/vault_info/fantom/__init__.py +0 -0
  39. defi_services/services/vault/vault_info/fantom/trava_ftm.py +31 -0
  40. defi_services/utils/init_services.py +5 -0
  41. {defi_state_querier-0.4.2.dist-info → defi_state_querier-0.4.3.dist-info}/METADATA +1 -1
  42. {defi_state_querier-0.4.2.dist-info → defi_state_querier-0.4.3.dist-info}/RECORD +45 -36
  43. defi_services/jobs/queriers/cosmos_state_querier.py +0 -82
  44. defi_services/services/cosmos_token_services.py +0 -46
  45. {defi_state_querier-0.4.2.dist-info → defi_state_querier-0.4.3.dist-info}/LICENSE +0 -0
  46. {defi_state_querier-0.4.2.dist-info → defi_state_querier-0.4.3.dist-info}/WHEEL +0 -0
  47. {defi_state_querier-0.4.2.dist-info → defi_state_querier-0.4.3.dist-info}/top_level.txt +0 -0
@@ -1,113 +1,163 @@
1
1
  LIQEE_ETH = {
2
- "name": "Liqee Lending Pool",
3
- "rewardToken": "0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0",
4
- "comptrollerAddress": "",
5
- "lensAddress": "",
6
- "controllerAddress": "0x8b53ab2c0df3230ea327017c91eb909f815ad113",
7
- "lendingDataAddress": "0x4b30c26d61be2f76bc7d9f2c5edbacba84982358",
8
- "poolToken": "0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0",
9
- "type": "LENDING_POOL",
10
- "forked": "compound",
11
- "reservesList": {
12
- "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
13
- "cToken": "0x5812fcf91adc502a765e5707ebb3f36a07f63c02",
14
- "liquidationThreshold": 0.8
15
- },
16
- "0x0000000000000000000000000000000000000000": {
17
- "cToken": "0x5acd75f21659a59ffab9aebaf350351a8bfaabc0",
18
- "liquidationThreshold": 0.85
19
- },
20
- "0xdac17f958d2ee523a2206206994597c13d831ec7": {
21
- "cToken": "0x1180c114f7fadcb6957670432a3cf8ef08ab5354",
22
- "liquidationThreshold": 0.85
23
- },
24
- "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
25
- "cToken": "0x2f956b2f801c6dad74e87e7f45c94f6283bf0f45",
26
- "liquidationThreshold": 0.85
27
- },
28
- "0x6b175474e89094c44da98b954eedeac495271d0f": {
29
- "cToken": "0x298f243ad592b6027d4717fbe9decda668e3c3a8",
30
- "liquidationThreshold": 0.85
31
- },
32
- "0x4fabb145d64652a948d72533023f6e7a623c7c53": {
33
- "cToken": "0x24677e213dec0ea53a430404cf4a11a6dc889fce",
34
- "liquidationThreshold": 0.75
35
- },
36
- "0x0316eb71485b0ab14103307bf65a021042c6d380": {
37
- "cToken": "0x47566acd7af49d2a192132314826ed3c3c5f3698",
38
- "liquidationThreshold": 0.8
39
- },
40
- "0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0": {
41
- "cToken": "0xb3dc7425e63e1855eb41107134d471dd34d7b239",
42
- "liquidationThreshold": 0.6
43
- },
44
- "0x355c665e101b9da58704a8fddb5feef210ef20c0": {
45
- "cToken": "0x164315ea59169d46359baa4bcc6479bb421764b6",
46
- "liquidationThreshold": 0.8
47
- },
48
- "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": {
49
- "cToken": "0xbec9a824d6da8d0f923fd9fbec4faa949d396320",
50
- "liquidationThreshold": 0.7
51
- },
52
- "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8": {
53
- "cToken": "0xd1254d280e7504836e1b0e36535ebff248483cee",
54
- "liquidationThreshold": 0.7
55
- },
56
- "0xb986f3a2d91d3704dc974a24fb735dcc5e3c1e70": {
57
- "cToken": "0x591595bfae3f5d51a820ecd20a1e3fbb6638f34b",
58
- "liquidationThreshold": 0.7
59
- },
60
- "0x527ec46ac094b399265d1d71eff7b31700aa655d": {
61
- "cToken": "0xfa2e831c674b61475c175b2206e81a5938b298dd",
62
- "liquidationThreshold": 0.7
63
- },
64
- "0x8d2cb35893c01fa8b564c84bd540c5109d9d278e": {
65
- "cToken": "0x028db7a9d133301bd49f27b5e41f83f56ab0faa6",
66
- "liquidationThreshold": 0.7
67
- },
68
- "0x514910771af9ca656af840dff83e8264ecf986ca": {
69
- "cToken": "0xa3068aa78611ed29d381e640bb2c02abcf3ca7de",
70
- "liquidationThreshold": 0.7
71
- },
72
- "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2": {
73
- "cToken": "0x039e7ef6a674f3ec1d88829b8215ed45385c24bc",
74
- "liquidationThreshold": 0.7
75
- },
76
- "0x0000000000085d4780b73119b644ae5ecd22b376": {
77
- "cToken": "0x6e6a689a5964083dff9fd7a0f788baf620ea2dbe",
78
- "liquidationThreshold": 0.8
79
- },
80
- "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0": {
81
- "cToken": "0xbfd291da8a403daaf7e5e9dc1ec0aceacd4848b9",
82
- "liquidationThreshold": 0.825
83
- },
84
- "0x853d955acef822db058eb8505911ed77f175b99e": {
85
- "cToken": "0x71173e3c6999c2c72ccf363f4ae7b67bcc7e8f63",
86
- "liquidationThreshold": 0.0
87
- },
88
- "0x956f47f50a910163d8bf957cf5846d573e7f87ca": {
89
- "cToken": "0x47c19a2ab52da26551a22e2b2aeed5d19ef4022f",
90
- "liquidationThreshold": 0.0
91
- },
92
- "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9": {
93
- "cToken": "0x3e5cb932d7a1c0ca096b71cc486b2ad7e0dc3d0e",
94
- "liquidationThreshold": 0.7
95
- },
96
- "0xd533a949740bb3306d119cc777fa900ba034cd52": {
97
- "cToken": "0xe39672dfa87c824bcb3b38aa480ef684687cbc09",
98
- "liquidationThreshold": 0.65
99
- },
100
- "0xd5147bc8e386d91cc5dbe72099dac6c9b99276f5": {
101
- "cToken": "0x59055220e00da46c891283ea1d79363c769158b9",
102
- "liquidationThreshold": 0.0
103
- },
104
- "0x83f20f44975d03b1b09e64809b757c47f942beea": {
105
- "cToken": "0x5f02fb5f1203a502c701a12fd409548993f795ba",
106
- "liquidationThreshold": 0.85
107
- },
108
- "0xae78736cd615f374d3085123a210448e74fc6393": {
109
- "cToken": "0x33b5edc15e05d3dac27fccad77cf550c5f3f02aa",
110
- "liquidationThreshold": 0.7
111
- }
2
+ "comptrollerAddress": "",
3
+ "controllerAddress": "0x8b53ab2c0df3230ea327017c91eb909f815ad113",
4
+ "forked": "compound",
5
+ "lendingDataAddress": "0x4b30c26d61be2f76bc7d9f2c5edbacba84982358",
6
+ "lensAddress": "",
7
+ "name": "Liqee Lending Pool",
8
+ "poolToken": "0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0",
9
+ "reservesList": {
10
+ "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
11
+ "cToken": "0x5812fcf91adc502a765e5707ebb3f36a07f63c02",
12
+ "exchangeRate": 1.000012067974307,
13
+ "liquidationThreshold": 0.8,
14
+ "loanToValue": 0.8
15
+ },
16
+ "0x0000000000000000000000000000000000000000": {
17
+ "cToken": "0x5acd75f21659a59ffab9aebaf350351a8bfaabc0",
18
+ "exchangeRate": 1.0092559004684867,
19
+ "liquidationThreshold": 0.85,
20
+ "loanToValue": 0.85
21
+ },
22
+ "0xdac17f958d2ee523a2206206994597c13d831ec7": {
23
+ "cToken": "0x1180c114f7fadcb6957670432a3cf8ef08ab5354",
24
+ "exchangeRate": 1.0653006831932572,
25
+ "liquidationThreshold": 0.85,
26
+ "loanToValue": 0.85
27
+ },
28
+ "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
29
+ "cToken": "0x2f956b2f801c6dad74e87e7f45c94f6283bf0f45",
30
+ "exchangeRate": 1.0618162566733447,
31
+ "liquidationThreshold": 0.85,
32
+ "loanToValue": 0.85
33
+ },
34
+ "0x6b175474e89094c44da98b954eedeac495271d0f": {
35
+ "cToken": "0x298f243ad592b6027d4717fbe9decda668e3c3a8",
36
+ "exchangeRate": 1.0671526314936417,
37
+ "liquidationThreshold": 0.85,
38
+ "loanToValue": 0.85
39
+ },
40
+ "0x4fabb145d64652a948d72533023f6e7a623c7c53": {
41
+ "cToken": "0x24677e213dec0ea53a430404cf4a11a6dc889fce",
42
+ "exchangeRate": 1.000000000000008,
43
+ "liquidationThreshold": 0.75,
44
+ "loanToValue": 0.75
45
+ },
46
+ "0x0316eb71485b0ab14103307bf65a021042c6d380": {
47
+ "cToken": "0x47566acd7af49d2a192132314826ed3c3c5f3698",
48
+ "exchangeRate": 1,
49
+ "liquidationThreshold": 0.8,
50
+ "loanToValue": 0.8
51
+ },
52
+ "0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0": {
53
+ "cToken": "0xb3dc7425e63e1855eb41107134d471dd34d7b239",
54
+ "exchangeRate": 1.0001004296452365,
55
+ "liquidationThreshold": 0.6,
56
+ "loanToValue": 0.6
57
+ },
58
+ "0x355c665e101b9da58704a8fddb5feef210ef20c0": {
59
+ "cToken": "0x164315ea59169d46359baa4bcc6479bb421764b6",
60
+ "exchangeRate": 1,
61
+ "liquidationThreshold": 0.8,
62
+ "loanToValue": 0.8
63
+ },
64
+ "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": {
65
+ "cToken": "0xbec9a824d6da8d0f923fd9fbec4faa949d396320",
66
+ "exchangeRate": 1,
67
+ "liquidationThreshold": 0.7,
68
+ "loanToValue": 0.7
69
+ },
70
+ "0x0a5e677a6a24b2f1a2bf4f3bffc443231d2fdec8": {
71
+ "cToken": "0xd1254d280e7504836e1b0e36535ebff248483cee",
72
+ "exchangeRate": 1,
73
+ "liquidationThreshold": 0.7,
74
+ "loanToValue": 0.7
75
+ },
76
+ "0xb986f3a2d91d3704dc974a24fb735dcc5e3c1e70": {
77
+ "cToken": "0x591595bfae3f5d51a820ecd20a1e3fbb6638f34b",
78
+ "exchangeRate": 1,
79
+ "liquidationThreshold": 0.7,
80
+ "loanToValue": 0.7
81
+ },
82
+ "0x527ec46ac094b399265d1d71eff7b31700aa655d": {
83
+ "cToken": "0xfa2e831c674b61475c175b2206e81a5938b298dd",
84
+ "exchangeRate": 1,
85
+ "liquidationThreshold": 0.7,
86
+ "loanToValue": 0.7
87
+ },
88
+ "0x8d2cb35893c01fa8b564c84bd540c5109d9d278e": {
89
+ "cToken": "0x028db7a9d133301bd49f27b5e41f83f56ab0faa6",
90
+ "exchangeRate": 1,
91
+ "liquidationThreshold": 0.7,
92
+ "loanToValue": 0.7
93
+ },
94
+ "0x514910771af9ca656af840dff83e8264ecf986ca": {
95
+ "cToken": "0xa3068aa78611ed29d381e640bb2c02abcf3ca7de",
96
+ "exchangeRate": 1,
97
+ "liquidationThreshold": 0.7,
98
+ "loanToValue": 0.7
99
+ },
100
+ "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2": {
101
+ "cToken": "0x039e7ef6a674f3ec1d88829b8215ed45385c24bc",
102
+ "exchangeRate": 1,
103
+ "liquidationThreshold": 0.7,
104
+ "loanToValue": 0.7
105
+ },
106
+ "0x0000000000085d4780b73119b644ae5ecd22b376": {
107
+ "cToken": "0x6e6a689a5964083dff9fd7a0f788baf620ea2dbe",
108
+ "exchangeRate": 1,
109
+ "liquidationThreshold": 0,
110
+ "loanToValue": 0
111
+ },
112
+ "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0": {
113
+ "cToken": "0xbfd291da8a403daaf7e5e9dc1ec0aceacd4848b9",
114
+ "exchangeRate": 1,
115
+ "liquidationThreshold": 0.825,
116
+ "loanToValue": 0.825
117
+ },
118
+ "0x853d955acef822db058eb8505911ed77f175b99e": {
119
+ "cToken": "0x71173e3c6999c2c72ccf363f4ae7b67bcc7e8f63",
120
+ "exchangeRate": 1.000056097645922,
121
+ "liquidationThreshold": 0,
122
+ "loanToValue": 0
123
+ },
124
+ "0x956f47f50a910163d8bf957cf5846d573e7f87ca": {
125
+ "cToken": "0x47c19a2ab52da26551a22e2b2aeed5d19ef4022f",
126
+ "exchangeRate": 1,
127
+ "liquidationThreshold": 0,
128
+ "loanToValue": 0
129
+ },
130
+ "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9": {
131
+ "cToken": "0x3e5cb932d7a1c0ca096b71cc486b2ad7e0dc3d0e",
132
+ "exchangeRate": 1,
133
+ "liquidationThreshold": 0.7,
134
+ "loanToValue": 0.7
135
+ },
136
+ "0xd533a949740bb3306d119cc777fa900ba034cd52": {
137
+ "cToken": "0xe39672dfa87c824bcb3b38aa480ef684687cbc09",
138
+ "exchangeRate": 1,
139
+ "liquidationThreshold": 0.65,
140
+ "loanToValue": 0.65
141
+ },
142
+ "0xd5147bc8e386d91cc5dbe72099dac6c9b99276f5": {
143
+ "cToken": "0x59055220e00da46c891283ea1d79363c769158b9",
144
+ "exchangeRate": 1,
145
+ "liquidationThreshold": 0,
146
+ "loanToValue": 0
147
+ },
148
+ "0x83f20f44975d03b1b09e64809b757c47f942beea": {
149
+ "cToken": "0x5f02fb5f1203a502c701a12fd409548993f795ba",
150
+ "exchangeRate": 1,
151
+ "liquidationThreshold": 0.85,
152
+ "loanToValue": 0.85
153
+ },
154
+ "0xae78736cd615f374d3085123a210448e74fc6393": {
155
+ "cToken": "0x33b5edc15e05d3dac27fccad77cf550c5f3f02aa",
156
+ "exchangeRate": 1,
157
+ "liquidationThreshold": 0.7,
158
+ "loanToValue": 0.7
112
159
  }
160
+ },
161
+ "rewardToken": "0x431ad2ff6a9c365805ebad47ee021148d6f7dbe0",
162
+ "type": "LENDING_POOL"
113
163
  }
@@ -187,7 +187,7 @@ class LiqeeStateService(CompoundStateService):
187
187
  get_reward_id = f"getAccountRewardAmount_{self.name}_{wallet}_{block_number}".lower()
188
188
  return {get_reward_id: rpc_call}
189
189
 
190
- def calculate_rewards_balance(self, decoded_data: dict, wallet: str, block_number: int = "latest"):
190
+ def calculate_rewards_balance(self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
191
191
  get_reward_id = f"getAccountRewardAmount_{self.name}_{wallet}_{block_number}".lower()
192
192
  rewards = decoded_data.get(get_reward_id) / 10 ** 18
193
193
  reward_token = self.pool_info.get("rewardToken")
@@ -180,7 +180,7 @@ class MorphoAaveV2StateService(MorphoCompoundStateService):
180
180
  ):
181
181
  return {}
182
182
 
183
- def calculate_rewards_balance(self, decoded_data: dict, wallet: str, block_number: int = "latest"):
183
+ def calculate_rewards_balance(self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
184
184
  return {}
185
185
 
186
186
  def get_function_lending_pool_info(self, fn_name: str, fn_paras=None, block_number: int = 'latest'):
@@ -111,10 +111,7 @@ class MorphoAaveV3StateService(MorphoCompoundStateService):
111
111
  return {}
112
112
 
113
113
  def calculate_rewards_balance(
114
- self,
115
- decoded_data: dict,
116
- wallet: str,
117
- block_number: int = "latest"):
114
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
118
115
  return {}
119
116
 
120
117
  # WALLET DEPOSIT BORROW BALANCE
@@ -204,11 +204,7 @@ class MorphoCompoundStateService(ProtocolServices):
204
204
  return {get_reward_id: rpc_call}
205
205
 
206
206
  def calculate_rewards_balance(
207
- self,
208
- decoded_data: dict,
209
- wallet: str,
210
- block_number: int = "latest"
211
- ):
207
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
212
208
  get_reward_id = f"getUserUnclaimedRewards_{self.name}_{wallet}_{block_number}".lower()
213
209
  rewards = decoded_data.get(get_reward_id) / 10 ** 18
214
210
  reward_token = self.pool_info.get("rewardToken")
@@ -161,10 +161,7 @@ class OnyxStateService(CompoundStateService):
161
161
  return {get_reward_id: rpc_call}
162
162
 
163
163
  def calculate_rewards_balance(
164
- self,
165
- decoded_data: dict,
166
- wallet: str,
167
- block_number: int = "latest"):
164
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
168
165
  get_reward_id = f"xcnAccrued_{self.name}_{wallet}_{block_number}".lower()
169
166
  rewards = decoded_data.get(get_reward_id) / 10 ** 18
170
167
  reward_token = self.pool_info.get("rewardToken")
@@ -72,10 +72,7 @@ class RadiantStateService(ValasStateService):
72
72
  return rpc_calls
73
73
 
74
74
  def calculate_rewards_balance(
75
- self,
76
- decoded_data: dict,
77
- wallet: str,
78
- block_number: int = "latest"):
75
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
79
76
  reward_token = self.pool_info['rewardToken']
80
77
  key = f"allPendingRewards_{self.name}_{wallet}_{block_number}".lower()
81
78
  rewards = decoded_data.get(key) / 10 ** 18
@@ -240,7 +240,7 @@ class SiloStateService(ProtocolServices):
240
240
  decimals_id = f"decimals_{self.name}_{reward_token}_{block_number}".lower()
241
241
  return {get_reward_id: rpc_call, decimals_id: decimals_call}
242
242
 
243
- def calculate_rewards_balance(self, decoded_data: dict, wallet: str, block_number: int = "latest"):
243
+ def calculate_rewards_balance(self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
244
244
  reward_token = self.pool_info.get("rewardToken")
245
245
  get_reward_id = f"getUserUnclaimedRewards_{self.name}_{wallet}_{block_number}".lower()
246
246
  decimals_id = f"decimals_{self.name}_{reward_token}_{block_number}".lower()
@@ -123,7 +123,7 @@ class StrikeStateService(CompoundStateService):
123
123
  return {get_reward_id: rpc_call}
124
124
 
125
125
  def calculate_rewards_balance(
126
- self, decoded_data: dict, wallet: str, block_number: int = "latest"):
126
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
127
127
  get_reward_id = f"strikeAccrued_{self.name}_{wallet}_{block_number}".lower()
128
128
  rewards = decoded_data.get(get_reward_id) / 10 ** 18
129
129
  reward_token = self.pool_info.get("rewardToken")
@@ -388,7 +388,7 @@ class TravaStateService(ProtocolServices):
388
388
  # REWARDS BALANCE
389
389
  def get_rewards_balance_function_info(
390
390
  self,
391
- wallet_address,
391
+ wallet,
392
392
  reserves_info: dict = None,
393
393
  block_number: int = "latest"
394
394
  ):
@@ -397,16 +397,16 @@ class TravaStateService(ProtocolServices):
397
397
  for token, value in reserves_info.items():
398
398
  atoken, debt_token = Web3.toChecksumAddress(value['tToken']), Web3.toChecksumAddress(value['dToken'])
399
399
  tokens += [atoken, debt_token]
400
- key = f"getRewardsBalance_{self.name}_{wallet_address}_{block_number}".lower()
400
+ key = f"getRewardsBalance_{self.name}_{wallet}_{block_number}".lower()
401
401
  rpc_calls[key] = self.get_function_incentive_info(
402
- "getRewardsBalance", [tokens, wallet_address], block_number)
402
+ "getRewardsBalance", [tokens, wallet], block_number)
403
403
 
404
404
  return rpc_calls
405
405
 
406
406
  def calculate_rewards_balance(
407
- self, decoded_data: dict, wallet_address: str, block_number: int = "latest"):
407
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
408
408
  reward_token = self.pool_info['rewardToken']
409
- key = f"getRewardsBalance_{self.name}_{wallet_address}_{block_number}".lower()
409
+ key = f"getRewardsBalance_{self.name}_{wallet}_{block_number}".lower()
410
410
  rewards = decoded_data.get(key) / 10 ** 18
411
411
  result = {
412
412
  reward_token: {"amount": rewards}
@@ -295,7 +295,7 @@ class UwuStateService(ProtocolServices):
295
295
  return rpc_calls
296
296
 
297
297
  def calculate_rewards_balance(
298
- self, decoded_data: dict, wallet: str, block_number: int = "latest"):
298
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
299
299
  reward_token = self.pool_info['rewardToken']
300
300
  key = f"claimableReward_{self.name}_{wallet}_{block_number}".lower()
301
301
  rewards = sum(decoded_data.get(key)) / 10 ** 18
@@ -443,7 +443,7 @@ class ValasStateService(ProtocolServices):
443
443
  return rpc_calls
444
444
 
445
445
  def calculate_rewards_balance(
446
- self, decoded_data: dict, wallet: str, block_number: int = "latest"):
446
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
447
447
  reward_token = self.pool_info['rewardToken']
448
448
  key = f"earnedBalances_{self.name}_{wallet}_{block_number}".lower()
449
449
  rewards = decoded_data.get(key)[0] / 10 ** 18
@@ -140,17 +140,17 @@ class VenusStateService(CompoundStateService):
140
140
  # REWARDS BALANCE
141
141
  def get_rewards_balance_function_info(
142
142
  self,
143
- wallets: str,
143
+ wallet: str,
144
144
  reserves_info: dict = None,
145
145
  block_number: int = "latest",
146
146
  ):
147
- rpc_call = self.get_comptroller_function_info("venusAccrued", [wallets], block_number)
148
- get_reward_id = f"venusAccrued_{self.name}_{wallets}_{block_number}".lower()
147
+ rpc_call = self.get_comptroller_function_info("venusAccrued", [wallet], block_number)
148
+ get_reward_id = f"venusAccrued_{self.name}_{wallet}_{block_number}".lower()
149
149
  return {get_reward_id: rpc_call}
150
150
 
151
- def calculate_rewards_balance(self, decoded_data: dict, wallets: str,
152
- block_number: int = "latest"):
153
- get_reward_id = f"venusAccrued_{self.name}_{wallets}_{block_number}".lower()
151
+ def calculate_rewards_balance(
152
+ self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
153
+ get_reward_id = f"venusAccrued_{self.name}_{wallet}_{block_number}".lower()
154
154
  rewards = decoded_data.get(get_reward_id) / 10 ** 18
155
155
  reward_token = self.pool_info.get("rewardToken")
156
156
  result = {
@@ -140,7 +140,7 @@ class WepiggyStateService(CompoundStateService):
140
140
  get_reward_id = f"wpcAccrued_{self.name}_{wallet}_{block_number}".lower()
141
141
  return {get_reward_id: rpc_call}
142
142
 
143
- def calculate_rewards_balance(self, decoded_data: dict, wallet: str, block_number: int = "latest"):
143
+ def calculate_rewards_balance(self, wallet: str, reserves_info: dict, decoded_data: dict, block_number: int = "latest"):
144
144
  get_reward_id = f"wpcAccrued_{self.name}_{wallet}_{block_number}".lower()
145
145
  rewards = decoded_data.get(get_reward_id) / 10 ** 18
146
146
  reward_token = self.pool_info.get("rewardToken")
@@ -67,6 +67,11 @@ class ProtocolServices:
67
67
  if Query.protocol_apy in query_types:
68
68
  rpc_calls.update(self.get_apy_lending_pool_function_info(reserves_info, block_number))
69
69
 
70
+ if Query.staking_reward in query_types and wallet and wallet != Token.native_token:
71
+ rpc_calls.update(self.get_wallet_staking_balance_function_info(
72
+ wallet, reserves_info, block_number, return_reward=True
73
+ ))
74
+
70
75
  logger.info(f"Get encoded rpc calls in {time.time() - begin}s")
71
76
  return rpc_calls
72
77
 
@@ -92,7 +97,7 @@ class ProtocolServices:
92
97
 
93
98
  if Query.protocol_reward in query_types and wallet and wallet != Token.native_token:
94
99
  result.update(self.calculate_rewards_balance(
95
- decoded_data, wallet, block_number
100
+ wallet, reserves_info, decoded_data, block_number
96
101
  ))
97
102
 
98
103
  if Query.health_factor in query_types:
@@ -109,6 +114,11 @@ class ProtocolServices:
109
114
  result.update(self.calculate_apy_lending_pool_function_call(
110
115
  reserves_info, decoded_data, token_prices, pool_token_price, pool_decimals, block_number))
111
116
 
117
+ if Query.staking_reward in query_types and wallet and wallet != Token.native_token:
118
+ result.update(self.calculate_wallet_staking_balance(
119
+ wallet, reserves_info, decoded_data, token_prices, block_number, return_reward=True
120
+ ))
121
+
112
122
  logger.info(f"Process protocol data in {time.time() - begin}")
113
123
  return result
114
124
 
@@ -123,8 +133,9 @@ class ProtocolServices:
123
133
 
124
134
  def calculate_rewards_balance(
125
135
  self,
126
- decoded_data: dict,
127
136
  wallet: str,
137
+ reserves_info: dict,
138
+ decoded_data: dict,
128
139
  block_number: int = "latest"
129
140
  ) -> dict:
130
141
  return {}
@@ -189,3 +200,24 @@ class ProtocolServices:
189
200
  block_number: int = 'latest',
190
201
  ) -> dict:
191
202
  ...
203
+
204
+ # CALCULATE WALLET STAKING BALANCE
205
+ def get_wallet_staking_balance_function_info(
206
+ self,
207
+ wallet: str,
208
+ reserves_info: dict,
209
+ block_number: int = "latest",
210
+ return_reward: bool = False
211
+ ) -> dict:
212
+ ...
213
+
214
+ def calculate_wallet_staking_balance(
215
+ self,
216
+ wallet: str,
217
+ reserves_info: dict,
218
+ decoded_data: dict,
219
+ token_prices: dict,
220
+ block_number: int = 'latest',
221
+ return_reward: bool = False
222
+ ) -> dict:
223
+ ...
File without changes