defi-state-querier 0.2.6__py3-none-any.whl → 0.2.8__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
defi_services/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.6"
1
+ __version__ = "0.2.8"
@@ -117,8 +117,8 @@ class StateProcessor:
117
117
  def run(self, address: str, queries: list, block_number: int = 'latest',
118
118
  batch_size: int = 100, max_workers: int = 8, ignore_error=False, token_prices=None):
119
119
  wallet = address
120
- if self.chain_id == Chain.tron and not self.check_address(address):
121
- wallet = base58_to_hex(address)
120
+ # if self.chain_id == Chain.tron and not self.check_address(address):
121
+ # wallet = base58_to_hex(address)
122
122
  if token_prices is None:
123
123
  token_prices = {}
124
124
  all_rpc_calls = {}
@@ -145,7 +145,7 @@ class StateProcessor:
145
145
  token_prices=token_prices, reserve_info=reserves_list)
146
146
  result.append(processed_data)
147
147
 
148
- if self.chain_id == Chain.tron:
149
- result = convert_address_dict(result)
148
+ # if self.chain_id == Chain.tron:
149
+ # result = convert_address_dict(result)
150
150
 
151
151
  return result
@@ -63,3 +63,23 @@ class JustLendStateService(CompoundStateService):
63
63
  reserves_info[underlying] = {'cToken': token.lower()}
64
64
  return reserves_info
65
65
 
66
+ # REWARDS BALANCE
67
+ def get_rewards_balance_function_info(
68
+ self,
69
+ wallets: str,
70
+ reserves_info: dict = None,
71
+ block_number: int = "latest",
72
+ ):
73
+ rpc_call = self.get_comptroller_function_info("compAccrued", [wallets], block_number)
74
+ get_reward_id = f"compAccrued_{self.name}_{wallets}_{block_number}".lower()
75
+ return {get_reward_id: rpc_call}
76
+
77
+ def calculate_rewards_balance(self, decoded_data: dict, wallets: str,
78
+ block_number: int = "latest"):
79
+ get_reward_id = f"compAccrued_{self.name}_{wallets}_{block_number}".lower()
80
+ rewards = decoded_data.get(get_reward_id) / 10 ** 18
81
+ reward_token = self.pool_info.get("rewardToken")
82
+ result = {
83
+ reward_token: {"amount": rewards}
84
+ }
85
+ return result
@@ -30,19 +30,19 @@ AAVE_V2_ETH = {
30
30
  "tToken": "0x5165d24277cd063f5ac44efd447b27025e888f37",
31
31
  "dToken": "0x7ebd09022be45ad993baa1cec61166fcc8644d97",
32
32
  "sdToken": "0xca823f78c2dd38993284bb42ba9b14152082f7bd",
33
- "liquidationThreshold": 0.65
33
+ "liquidationThreshold": 0.5
34
34
  },
35
35
  "0xe41d2489571d322189246dafa5ebde1f4699f498": {
36
36
  "tToken": "0xdf7ff54aacacbff42dfe29dd6144a69b629f8c9e",
37
37
  "dToken": "0x85791d117a392097590bded3bd5abb8d5a20491a",
38
38
  "sdToken": "0x071b4323a24e73a5afeebe34118cd21b8faaf7c3",
39
- "liquidationThreshold": 0.65
39
+ "liquidationThreshold": 0.42
40
40
  },
41
41
  "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": {
42
42
  "tToken": "0xb9d7cb55f463405cdfbe4e90a6d2df01c2b92bf1",
43
43
  "dToken": "0x5bdb050a92cadccfcdcccbfc17204a1c9cc0ab73",
44
44
  "sdToken": "0xd939f7430dc8d5a427f156de1012a56c18acb6aa",
45
- "liquidationThreshold": 0.77
45
+ "liquidationThreshold": 0.7
46
46
  },
47
47
  "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9": {
48
48
  "tToken": "0xffc97d72e13e01096502cb8eb52dee56f74dad7b",
@@ -54,7 +54,7 @@ AAVE_V2_ETH = {
54
54
  "tToken": "0x05ec93c0365baaeabf7aeffb0972ea7ecdd39cf1",
55
55
  "dToken": "0xfc218a6dfe6901cb34b1a5281fc6f1b8e7e56877",
56
56
  "sdToken": "0x277f8676facf4daa5a6ea38ba511b7f65aa02f9f",
57
- "liquidationThreshold": 0.7
57
+ "liquidationThreshold": 0.4
58
58
  },
59
59
  "0x4fabb145d64652a948d72533023f6e7a623c7c53": {
60
60
  "tToken": "0xa361718326c15715591c299427c62086f69923d9",
@@ -72,13 +72,13 @@ AAVE_V2_ETH = {
72
72
  "tToken": "0xac6df26a590f08dcc95d5a4705ae8abbc88509ef",
73
73
  "dToken": "0x38995f292a6e31b78203254fe1cdd5ca1010a446",
74
74
  "sdToken": "0x943dcca156b5312aa24c1a08769d67fece4ac14c",
75
- "liquidationThreshold": 0.67
75
+ "liquidationThreshold": 0.52
76
76
  },
77
77
  "0xdd974d5c2e2928dea5f71b9825b8b646686bd200": {
78
78
  "tToken": "0x39c6b3e42d6a679d7d776778fe880bc9487c2eda",
79
79
  "dToken": "0x6b05d1c608015ccb8e205a690cb86773a96f39f1",
80
80
  "sdToken": "0x9915dfb872778b2890a117da1f35f335eb06b54f",
81
- "liquidationThreshold": 0.7
81
+ "liquidationThreshold": 0.01
82
82
  },
83
83
  "0x514910771af9ca656af840dff83e8264ecf986ca": {
84
84
  "tToken": "0xa06bc25b5805d5f8d82847d191cb4af5a3e873e0",
@@ -90,25 +90,25 @@ AAVE_V2_ETH = {
90
90
  "tToken": "0xa685a61171bb30d4072b338c80cb7b2c865c873e",
91
91
  "dToken": "0x0a68976301e46ca6ce7410db28883e309ea0d352",
92
92
  "sdToken": "0xd86c74ea2224f4b8591560652b50035e4e5c0a3b",
93
- "liquidationThreshold": 0.75
93
+ "liquidationThreshold": 0.54
94
94
  },
95
95
  "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2": {
96
96
  "tToken": "0xc713e5e149d5d0715dcd1c156a020976e7e56b88",
97
97
  "dToken": "0xba728ead5e496be00dcf66f650b6d7758ecb50f8",
98
98
  "sdToken": "0xc01c8e4b12a89456a9fd4e4e75b72546bf53f0b5",
99
- "liquidationThreshold": 0.64
99
+ "liquidationThreshold": 0.5
100
100
  },
101
101
  "0x408e41876cccdc0f92210600ef50372656052a38": {
102
102
  "tToken": "0xcc12abe4ff81c9378d670de1b57f8e0dd228d77a",
103
103
  "dToken": "0xcd9d82d33bd737de215cdac57fe2f7f04df77fe0",
104
104
  "sdToken": "0x3356ec1efa75d9d150da1ec7d944d9edf73703b7",
105
- "liquidationThreshold": 0.6
105
+ "liquidationThreshold": 0.32
106
106
  },
107
107
  "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f": {
108
108
  "tToken": "0x35f6b052c598d933d69a4eec4d04c73a191fe6c2",
109
109
  "dToken": "0x267eb8cf715455517f9bd5834aeae3cea1ebdbd8",
110
110
  "sdToken": "0x8575c8ae70bdb71606a53aea1c6789cb0fbf3166",
111
- "liquidationThreshold": 0.62
111
+ "liquidationThreshold": 0.49
112
112
  },
113
113
  "0x57ab1ec28d129707052df4df418d58a2d46d5f51": {
114
114
  "tToken": "0x6c5024cd4f8a59110119c56f8933403a539555eb",
@@ -120,7 +120,7 @@ AAVE_V2_ETH = {
120
120
  "tToken": "0x101cc05f4a51c0319f570d5e146a8c625198e636",
121
121
  "dToken": "0x01c0eb1f8c6f1c1bf74ae028697ce7aa2a8b0e92",
122
122
  "sdToken": "0x7f38d60d94652072b2c44a18c0e14a481ec3c0dd",
123
- "liquidationThreshold": 0.825
123
+ "liquidationThreshold": 0.75
124
124
  },
125
125
  "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
126
126
  "tToken": "0xbcca60bb61934080951369a648fb03df4f96263c",
@@ -132,7 +132,7 @@ AAVE_V2_ETH = {
132
132
  "tToken": "0x8dae6cb04688c62d939ed9b68d32bc62e49970b1",
133
133
  "dToken": "0x00ad8ebf64f141f1c81e9f8f792d3d1631c6c684",
134
134
  "sdToken": "0x9288059a74f589c919c7cf1db433251cdfeb874b",
135
- "liquidationThreshold": 0.58
135
+ "liquidationThreshold": 0.45
136
136
  },
137
137
  "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd": {
138
138
  "tToken": "0xd37ee7e4f452c6638c96536e68090de8cbcdb583",
@@ -144,13 +144,13 @@ AAVE_V2_ETH = {
144
144
  "tToken": "0x272f97b7a56a387ae942350bbc7df5700f8a4576",
145
145
  "dToken": "0x13210d4fe0d5402bd7ecbc4b5bc5cfca3b71adb0",
146
146
  "sdToken": "0xe569d31590307d05da3812964f1edd551d665a0b",
147
- "liquidationThreshold": 0.7
147
+ "liquidationThreshold": 0.35
148
148
  },
149
149
  "0x8798249c2e607446efb7ad49ec89dd1865ff4272": {
150
150
  "tToken": "0xf256cc7847e919fac9b808cc216cac87ccf2f47a",
151
151
  "dToken": "0xfafedf95e21184e3d880bd56d4806c4b8d31c69a",
152
152
  "sdToken": "0x73bfb81d7dba75c904f430ea8bae82db0d41187b",
153
- "liquidationThreshold": 0.65
153
+ "liquidationThreshold": 0.57
154
154
  },
155
155
  "0xd5147bc8e386d91cc5dbe72099dac6c9b99276f5": {
156
156
  "tToken": "0x514cd6756ccbe28772d4cb81bc3156ba9d1744aa",
@@ -180,7 +180,7 @@ AAVE_V2_ETH = {
180
180
  "tToken": "0x6f634c6135d2ebd550000ac92f494f9cb8183dae",
181
181
  "dToken": "0x4ddff5885a67e4effec55875a3977d7e60f82ae0",
182
182
  "sdToken": "0xa3953f07f389d719f99fc378ebdb9276177d8a6e",
183
- "liquidationThreshold": 0.7
183
+ "liquidationThreshold": 0.42
184
184
  },
185
185
  "0x853d955acef822db058eb8505911ed77f175b99e": {
186
186
  "tToken": "0xd4937682df3c8aef4fe912a96a74121c0829e664",
@@ -192,7 +192,7 @@ AAVE_V2_ETH = {
192
192
  "tToken": "0x683923db55fead99a79fa01a27eec3cb19679cc3",
193
193
  "dToken": "0xc2e10006accab7b45d9184fcf5b7ec7763f5baae",
194
194
  "sdToken": "0xd89cf9e8a858f8b4b31faf793505e112d6c17449",
195
- "liquidationThreshold": 0.75
195
+ "liquidationThreshold": 0.01
196
196
  },
197
197
  "0xae7ab96520de3a18e5e111b5eaab095312d7fe84": {
198
198
  "tToken": "0x1982b2f5814301d4e9a8b0201555376e62f82428",
@@ -204,7 +204,7 @@ AAVE_V2_ETH = {
204
204
  "tToken": "0x9a14e23a58edf4efdcb360f68cd1b95ce2081a2f",
205
205
  "dToken": "0x176808047cc9b7a2c9ae202c593ed42ddd7c0d13",
206
206
  "sdToken": "0x34441ffd1948e49dc7a607882d0c38efd0083815",
207
- "liquidationThreshold": 0.57
207
+ "liquidationThreshold": 0.52
208
208
  },
209
209
  "0xa693b19d2931d498c5b318df961919bb4aee87a5": {
210
210
  "tToken": "0xc2e2152647f4c26028482efaf64b2aa28779efc4",
@@ -216,13 +216,13 @@ AAVE_V2_ETH = {
216
216
  "tToken": "0x952749e07d7157bb9644a894dfaf3bad5ef6d918",
217
217
  "dToken": "0x4ae5e4409c6dbc84a00f9f89e4ba096603fb7d50",
218
218
  "sdToken": "0xb01eb1ce1da06179136d561766fc2d609c5f55eb",
219
- "liquidationThreshold": 0.45
219
+ "liquidationThreshold": 0.35
220
220
  },
221
221
  "0x111111111117dc0aa78b770fa6a738034120c302": {
222
222
  "tToken": "0xb29130cbcc3f791f077eade0266168e808e5151e",
223
223
  "dToken": "0xd7896c1b9b4455aff31473908eb15796ad2295da",
224
224
  "sdToken": "0x1278d6ed804d59d2d18a5aa5638dfd591a79af0a",
225
- "liquidationThreshold": 0.5
225
+ "liquidationThreshold": 0.4
226
226
  },
227
227
  "0x5f98805a4e8be255a32880fdec7f6728c6568ba0": {
228
228
  "tToken": "0xce1871f791548600cb59efbeffc9c38719142079",
@@ -8,7 +8,6 @@ COMPOUND_V3_ETH = {
8
8
  "forked": "compound-v3",
9
9
  "reservesList": {
10
10
  "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": {
11
- "cometExt": "0xe2c1f54aff6b38fd9df7a69f22cb5fd3ba09f030",
12
11
  "comet": "0xa17581a9e3356d9a858b789d68b4d866e593ae94",
13
12
  "assets": {
14
13
  "0xbe9895146f7af43049ca1c1ae358b0541ea49704": {
@@ -24,7 +23,6 @@ COMPOUND_V3_ETH = {
24
23
  }
25
24
  },
26
25
  "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
27
- "cometExt": "0x285617313887d43256f852cae0ee4de4b68d45b0",
28
26
  "comet": "0xc3d688b66703497daa19211eedff47f25384cdc3",
29
27
  "assets": {
30
28
  "0xc00e94cb662c3520282e6f5717214004a7f26888": {
@@ -7,11 +7,17 @@ MORPHO_AAVE_V2_ETH = {
7
7
  "type": "LENDING_POOL",
8
8
  "forked": "morpho",
9
9
  "reservesList": {
10
- "0x6b175474e89094c44da98b954eedeac495271d0f": {
11
- "tToken": "0x028171bca77440897b824ca71d1c56cac55b68a3",
12
- "dToken": "0x6c3c78838c761c6ac7be9f59fe808ea2a6e4379d",
13
- "sdToken": "0x778a13d3eeb110a4f7bb6529f99c000119a08e92",
14
- "liquidationThreshold": 0.87
10
+ "0xdac17f958d2ee523a2206206994597c13d831ec7": {
11
+ "tToken": "0x3ed3b47dd13ec9a98b44e6204a523e766b225811",
12
+ "dToken": "0x531842cebbdd378f8ee36d171d6cc9c4fcf475ec",
13
+ "sdToken": "0xe91d55ab2240594855abd11b3faae801fd4c4687",
14
+ "liquidationThreshold": 0.0
15
+ },
16
+ "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
17
+ "tToken": "0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656",
18
+ "dToken": "0x9c39809dec7f95f5e0713634a4d0701329b3b4d2",
19
+ "sdToken": "0x51b039b9afe64b78758f8ef091211b5387ea717c",
20
+ "liquidationThreshold": 0.82
15
21
  },
16
22
  "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": {
17
23
  "tToken": "0x030ba81f1c18d280636f32af80b9aad02cf0854e",
@@ -19,35 +25,29 @@ MORPHO_AAVE_V2_ETH = {
19
25
  "sdToken": "0x4e977830ba4bd783c0bb7f15d3e243f73ff57121",
20
26
  "liquidationThreshold": 0.86
21
27
  },
28
+ "0x6b175474e89094c44da98b954eedeac495271d0f": {
29
+ "tToken": "0x028171bca77440897b824ca71d1c56cac55b68a3",
30
+ "dToken": "0x6c3c78838c761c6ac7be9f59fe808ea2a6e4379d",
31
+ "sdToken": "0x778a13d3eeb110a4f7bb6529f99c000119a08e92",
32
+ "liquidationThreshold": 0.87
33
+ },
22
34
  "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
23
35
  "tToken": "0xbcca60bb61934080951369a648fb03df4f96263c",
24
36
  "dToken": "0x619beb58998ed2278e08620f97007e1116d5d25b",
25
37
  "sdToken": "0xe4922afab0bbadd8ab2a88e0c79d884ad337fca6",
26
38
  "liquidationThreshold": 0.875
27
39
  },
28
- "0xdac17f958d2ee523a2206206994597c13d831ec7": {
29
- "tToken": "0x3ed3b47dd13ec9a98b44e6204a523e766b225811",
30
- "dToken": "0x531842cebbdd378f8ee36d171d6cc9c4fcf475ec",
31
- "sdToken": "0xe91d55ab2240594855abd11b3faae801fd4c4687",
32
- "liquidationThreshold": 0.0
33
- },
34
- "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
35
- "tToken": "0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656",
36
- "dToken": "0x9c39809dec7f95f5e0713634a4d0701329b3b4d2",
37
- "sdToken": "0x51b039b9afe64b78758f8ef091211b5387ea717c",
38
- "liquidationThreshold": 0.82
40
+ "0xd533a949740bb3306d119cc777fa900ba034cd52": {
41
+ "tToken": "0x8dae6cb04688c62d939ed9b68d32bc62e49970b1",
42
+ "dToken": "0x00ad8ebf64f141f1c81e9f8f792d3d1631c6c684",
43
+ "sdToken": "0x9288059a74f589c919c7cf1db433251cdfeb874b",
44
+ "liquidationThreshold": 0.45
39
45
  },
40
46
  "0xae7ab96520de3a18e5e111b5eaab095312d7fe84": {
41
47
  "tToken": "0x1982b2f5814301d4e9a8b0201555376e62f82428",
42
48
  "dToken": "0xa9deac9f00dc4310c35603fcd9d34d1a750f81db",
43
49
  "sdToken": "0x66457616dd8489df5d0afd8678f4a260088aaf55",
44
50
  "liquidationThreshold": 0.83
45
- },
46
- "0xd533a949740bb3306d119cc777fa900ba034cd52": {
47
- "tToken": "0x8dae6cb04688c62d939ed9b68d32bc62e49970b1",
48
- "dToken": "0x00ad8ebf64f141f1c81e9f8f792d3d1631c6c684",
49
- "sdToken": "0x9288059a74f589c919c7cf1db433251cdfeb874b",
50
- "liquidationThreshold": 0.58
51
- },
51
+ }
52
52
  }
53
53
  }
@@ -7,45 +7,57 @@ MORPHO_AAVE_V3_ETH = {
7
7
  "reservesList": {
8
8
  "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": {
9
9
  "tToken": "0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8",
10
- "sdToken": "0x102633152313c81cd80419b6ecf66d14ad68949a",
11
- "dToken": "0xea51d7853eefb32b6ee06b1c12e6dcca88be0ffe",
10
+ "dToken": "0x102633152313c81cd80419b6ecf66d14ad68949a",
11
+ "sdToken": "0xea51d7853eefb32b6ee06b1c12e6dcca88be0ffe",
12
12
  "liquidationThreshold": 0.83
13
13
  },
14
14
  "0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0": {
15
15
  "tToken": "0x0b925ed163218f6662a35e0f0371ac234f9e9371",
16
- "sdToken": "0x39739943199c0fbfe9e5f1b5b160cd73a64cb85d",
17
- "dToken": "0xc96113eed8cab59cd8a66813bcb0ceb29f06d2e4",
16
+ "dToken": "0x39739943199c0fbfe9e5f1b5b160cd73a64cb85d",
17
+ "sdToken": "0xc96113eed8cab59cd8a66813bcb0ceb29f06d2e4",
18
+ "liquidationThreshold": 0.81
19
+ },
20
+ "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
21
+ "tToken": "0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8",
22
+ "dToken": "0xa1773f1ccf6db192ad8fe826d15fe1d328b03284",
23
+ "sdToken": "0x40aabef1aa8f0eec637e0e7d92fbffb2f26a8b7b",
24
+ "liquidationThreshold": 0.78
25
+ },
26
+ "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
27
+ "tToken": "0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c",
28
+ "dToken": "0xb0fe3d292f4bd50de902ba5bdf120ad66e9d7a39",
29
+ "sdToken": "0x72e95b8931767c79ba4eee721354d6e99a61d004",
18
30
  "liquidationThreshold": 0.8
19
31
  },
20
32
  "0x6b175474e89094c44da98b954eedeac495271d0f": {
21
33
  "tToken": "0x018008bfb33d285247a21d44e50697654f754e63",
22
- "sdToken": "0x413adac9e2ef8683adf5ddaece8f19613d60d1bb",
23
- "dToken": "0xcf8d0c70c850859266f5c338b38f9d663181c314",
34
+ "dToken": "0x413adac9e2ef8683adf5ddaece8f19613d60d1bb",
35
+ "sdToken": "0xcf8d0c70c850859266f5c338b38f9d663181c314",
24
36
  "liquidationThreshold": 0.8
25
37
  },
26
- "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
27
- "tToken": "0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c",
28
- "sdToken": "0xb0fe3d292f4bd50de902ba5bdf120ad66e9d7a39",
29
- "dToken": "0x72e95b8931767c79ba4eee721354d6e99a61d004",
30
- "liquidationThreshold": 0.8
38
+ "0xbe9895146f7af43049ca1c1ae358b0541ea49704": {
39
+ "tToken": "0x977b6fc5de62598b08c85ac8cf2b745874e8b78c",
40
+ "dToken": "0x82be6012cea6d147b968ebaea5ceecf6a5b4f493",
41
+ "sdToken": "0x0c91bca95b5fe69164ce583a2ec9429a569798ed",
42
+ "liquidationThreshold": 0.77
31
43
  },
32
- "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
33
- "tToken": "0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8",
34
- "sdToken": "0xa1773f1ccf6db192ad8fe826d15fe1d328b03284",
35
- "dToken": "0x40aabef1aa8f0eec637e0e7d92fbffb2f26a8b7b",
36
- "liquidationThreshold": 0.78
44
+ "0xdac17f958d2ee523a2206206994597c13d831ec7": {
45
+ "tToken": "0x23878914efe38d27c4d67ab83ed1b93a74d4086a",
46
+ "dToken": "0x822fa72df1f229c3900f5ad6c3fa2c424d691622",
47
+ "sdToken": "0x6df1c1e379bc5a00a7b4c6e67a203333772f45a8",
48
+ "liquidationThreshold": 0.76
37
49
  },
38
50
  "0xae78736cd615f374d3085123a210448e74fc6393": {
39
51
  "tToken": "0xcc9ee9483f662091a1de4795249e24ac0ac2630f",
40
- "sdToken": "0x1d1906f909cae494c7441604dafdddbd0485a925",
41
- "dToken": "0xae8593dd575fe29a9745056aa91c4b746eee62c8",
42
- "liquidationThreshold": 0.74
43
- },
44
- "0xbe9895146f7af43049ca1c1ae358b0541ea49704": {
45
- "tToken": "0x977b6fc5de62598b08c85ac8cf2b745874e8b78c",
46
- "sdToken": "0x82be6012cea6d147b968ebaea5ceecf6a5b4f493",
47
- "dToken": "0x0c91bca95b5fe69164ce583a2ec9429a569798ed",
48
- "liquidationThreshold": 0.74
52
+ "dToken": "0x1d1906f909cae494c7441604dafdddbd0485a925",
53
+ "sdToken": "0xae8593dd575fe29a9745056aa91c4b746eee62c8",
54
+ "liquidationThreshold": 0.77
49
55
  },
56
+ "0x83f20f44975d03b1b09e64809b757c47f942beea": {
57
+ "tToken": "0x4c612e3b15b96ff9a6faed838f8d07d479a8dd4c",
58
+ "dToken": "0x48bc45f084988bc01933ea93eeffebc0416534f6",
59
+ "sdToken": "0x8db9d35e117d8b93c6ca9b644b25bad5d9908141",
60
+ "liquidationThreshold": 0.8
61
+ }
50
62
  }
51
63
  }
@@ -39,6 +39,6 @@ MORPHO_COMPOUND_ETH = {
39
39
  "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
40
40
  "cToken": "0xccf4429db6322d5c611ee964527d42e5d685dd6a",
41
41
  "liquidationThreshold": 0.7
42
- },
42
+ }
43
43
  }
44
44
  }
@@ -57,13 +57,11 @@ ONYX_ETH = {
57
57
  },
58
58
  "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d": {
59
59
  "cToken": "0x3f2dd7adbcd464d5b0a766f7eb367bd20a249691",
60
- "liquidationThreshold": 0.6,
61
- "decimals": 1,
60
+ "liquidationThreshold": 0.6
62
61
  },
63
62
  "0xb7f7f6c52f2e2fdb1963eab30438024864c313f6": {
64
63
  "cToken": "0x7ab16ed27ab8b22cb625db55c0e58521969cb091",
65
- "liquidationThreshold": 0.6,
66
- "decimals": 1
64
+ "liquidationThreshold": 0.6
67
65
  },
68
66
  "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce": {
69
67
  "cToken": "0x307269cf921213bd2e16b22dcd4401aec21d00bf",
@@ -75,8 +73,7 @@ ONYX_ETH = {
75
73
  },
76
74
  "0x60e4d786628fea6478f785a6d7e704777c86a7c6": {
77
75
  "cToken": "0x5bcc74bd3cf4e2665674cd79a68f87d2d3fd6df0",
78
- "liquidationThreshold": 0.6,
79
- "decimals": 1
76
+ "liquidationThreshold": 0.6
80
77
  }
81
78
  }
82
79
  }
@@ -29,7 +29,7 @@ class MorphoAaveV2StateService(MorphoCompoundStateService):
29
29
  super().__init__(state_service, chain_id)
30
30
  self.name = f"{chain_id}_{Lending.morpho_aave_v2}"
31
31
  self.chain_id = chain_id
32
- self.compound_info = AaveInfo.mapping.get(chain_id)
32
+ self.aave_info = AaveInfo.mapping.get(chain_id)
33
33
  self.pool_info = MorphoAaveV2Info.mapping.get(chain_id)
34
34
  self.state_service = state_service
35
35
  self.lending_abi = LENDING_POOL_ABI
@@ -55,11 +55,11 @@ class MorphoAaveV2StateService(MorphoCompoundStateService):
55
55
  block_number: int = "latest"):
56
56
  begin = time.time()
57
57
  _w3 = self.state_service.get_w3()
58
- pool_address = Web3.toChecksumAddress(self.pool_info['address'])
58
+ pool_address = Web3.toChecksumAddress(self.aave_info['address'])
59
59
  contract = _w3.eth.contract(address=pool_address, abi=self.lending_abi)
60
60
  comptroller_contract = _w3.eth.contract(
61
61
  address=_w3.toChecksumAddress(self.pool_info.get("comptrollerAddress")), abi=self.comptroller_abi)
62
- markets = comptroller_contract.functions.getAllMarkets().call(block_identifier=block_number)
62
+ markets = comptroller_contract.functions.getMarketsCreated().call(block_identifier=block_number)
63
63
  reserves_list = contract.functions.getReservesList().call(block_identifier=block_number)
64
64
  reserves_info = {}
65
65
  for token in reserves_list:
@@ -4,8 +4,8 @@ import time
4
4
  from web3 import Web3
5
5
 
6
6
  from defi_services.abis.lending.aave_v2_and_forlks.aave_v2_incentives_abi import AAVE_V2_INCENTIVES_ABI
7
- from defi_services.abis.lending.aave_v2_and_forlks.lending_pool_abi import LENDING_POOL_ABI
8
7
  from defi_services.abis.lending.aave_v2_and_forlks.oracle_abi import ORACLE_ABI
8
+ from defi_services.abis.lending.aave_v3.aave_v3_lending_pool_abi import AAVE_V3_LENDING_POOL_ABI
9
9
  from defi_services.abis.lending.morpho.morpho_aave_v3_comptroller_abi import MORPHO_AAVE_V3_COMPTROLLER_ABI
10
10
  from defi_services.abis.token.erc20_abi import ERC20_ABI
11
11
  from defi_services.constants.chain_constant import Chain
@@ -33,7 +33,7 @@ class MorphoAaveV3StateService(MorphoCompoundStateService):
33
33
  self.aave_info = AaveV3Info.mapping.get(chain_id)
34
34
  self.pool_info = MorphoAaveV3Info.mapping.get(chain_id)
35
35
  self.state_service = state_service
36
- self.lending_abi = LENDING_POOL_ABI
36
+ self.lending_abi = AAVE_V3_LENDING_POOL_ABI
37
37
  self.incentive_abi = AAVE_V2_INCENTIVES_ABI
38
38
  self.oracle_abi = ORACLE_ABI
39
39
  self.comptroller_abi = MORPHO_AAVE_V3_COMPTROLLER_ABI
@@ -59,14 +59,14 @@ class MorphoAaveV3StateService(MorphoCompoundStateService):
59
59
  contract = _w3.eth.contract(address=pool_address, abi=self.lending_abi)
60
60
  comptroller_contract = _w3.eth.contract(
61
61
  address=_w3.toChecksumAddress(self.pool_info.get("comptrollerAddress")), abi=self.comptroller_abi)
62
- markets = comptroller_contract.functions.getAllMarkets().call(block_identifier=block_number)
62
+ markets = comptroller_contract.functions.marketsCreated().call(block_identifier=block_number)
63
63
  markets = [i.lower() for i in markets]
64
64
  reserves_list = contract.functions.getReservesList().call(block_identifier=block_number)
65
65
  reserves_info = {}
66
66
  for token in reserves_list:
67
67
  value = contract.functions.getReserveData(token).call(block_identifier=block_number)
68
68
  key = token.lower()
69
- if token in markets:
69
+ if key in markets:
70
70
  reserves_info[key] = {}
71
71
  reserves_info[key]["tToken"] = value[8].lower()
72
72
  reserves_info[key]["dToken"] = value[9].lower()
@@ -160,8 +160,12 @@ class OnyxStateService(ProtocolServices):
160
160
 
161
161
  get_decimals_id = f"decimals_{underlying}_{block_number}".lower()
162
162
  decimals = decoded_data.get(get_decimals_id, 0)
163
- deposit_amount = ctoken_balance[ctoken]["supply"] / 10 ** decimals
164
- borrow_amount = ctoken_balance[ctoken]["borrow"] / 10 ** decimals
163
+ if decimals:
164
+ deposit_amount = ctoken_balance[ctoken]["supply"] / 10 ** decimals
165
+ borrow_amount = ctoken_balance[ctoken]["borrow"] / 10 ** decimals
166
+ else:
167
+ deposit_amount = ctoken_balance[ctoken]["supply"]
168
+ borrow_amount = ctoken_balance[ctoken]["borrow"]
165
169
  data[token] = {
166
170
  "borrow_amount": borrow_amount,
167
171
  "deposit_amount": deposit_amount,
@@ -66,15 +66,18 @@ class SiloStateService(ProtocolServices):
66
66
  repository_contract = _w3.eth.contract(
67
67
  address=_w3.toChecksumAddress(self.pool_info.get("repositoryAddress")), abi=self.repository_abi)
68
68
  result = {}
69
+ if not tokens:
70
+ tokens = self.pool_info.get("reservesList").keys()
69
71
  for token in tokens:
70
- silo_token = repository_contract.functions.getSilo().call(block_identifier=block_number)
71
- if not silo_token: continue
72
+ silo_token = repository_contract.functions.getSilo(_w3.toChecksumAddress(token)).call(block_identifier=block_number)
73
+ if not silo_token:
74
+ continue
72
75
  contract = _w3.eth.contract(address=_w3.toChecksumAddress(silo_token), abi=self.silo_abi)
73
76
  assets = contract.functions.getAssets().call()
74
77
  main_asset = contract.functions.siloAsset().call()
75
78
  all_assets = [i.lower() for i in assets]
76
79
  result[main_asset.lower()] = {
77
- 'pool': token.lower(),
80
+ 'pool': silo_token.lower(),
78
81
  'assets': all_assets
79
82
  }
80
83
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: defi-state-querier
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: Calculate apy, apr, and wallet information,... in decentralized applications.
5
5
  Home-page: https://github.com/Centic-io/defi-state-querier
6
6
  Author: Viet-Bang Pham
@@ -1,4 +1,4 @@
1
- defi_services/__init__.py,sha256=Oz5HbwHMyE87nmwV80AZzpkJPf-wBg7eDuJr_BXZkhU,22
1
+ defi_services/__init__.py,sha256=G6Dbxq2ws-1ZAXwDD8q0KWueYtso_Y6Uyvtj8sRWsPI,22
2
2
  defi_services/abis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  defi_services/abis/dex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  defi_services/abis/dex/biswap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -113,7 +113,7 @@ defi_services/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
113
113
  defi_services/jobs/processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
114
  defi_services/jobs/processors/multi_state_processor.py,sha256=20pYx-vpOvJwYNM4NvRrc149V4DM_RZGhJ6EQDQ0oJw,4749
115
115
  defi_services/jobs/processors/solana_state_processor.py,sha256=Nf8IRFfs3KdRFXY_ziOnwQpthJJUE-bpZhsxdql31Ko,3973
116
- defi_services/jobs/processors/state_processor.py,sha256=xBEqWa5mj8FZHo4ymMbxa3H-wcUtTuHTsvSeGHthHdQ,6447
116
+ defi_services/jobs/processors/state_processor.py,sha256=fZEA5bAuMgxj1QYpWOszOKxJIJ6APfc9LY-oopXDAQc,6455
117
117
  defi_services/jobs/processors/substrate_state_processor.py,sha256=LFKFYdAzarZ_uBKaYSelPg6cppy5ovFP2UI3gAcG7zY,3639
118
118
  defi_services/jobs/queriers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  defi_services/jobs/queriers/solana_state_querier.py,sha256=TQELYo6GUoF8s-LfetqYbclNaH8bakQqC7y2ifACIb8,3239
@@ -136,14 +136,14 @@ defi_services/services/lending/flux_services.py,sha256=cRxZFxaH8PZE5tabY4CLZlQVH
136
136
  defi_services/services/lending/geist_services.py,sha256=UI5D-MbMqplrt7D4krSFdpaREKOT81k8boD_XhGGpUQ,1035
137
137
  defi_services/services/lending/granary_services.py,sha256=PnQYXw44gWUi9CHEDas7e9bBTmEddgejJt1gES1Q7kc,12301
138
138
  defi_services/services/lending/iron_bank_service.py,sha256=6Wis93qxyyadc-HWlKEgeAGsPZhsr_3_yNt1IUOHNzo,14294
139
- defi_services/services/lending/justlend_service.py,sha256=4Fa0cJlBqf0riwJqpypy2_S86ORhrYxO-WAfwhEJUo0,2392
139
+ defi_services/services/lending/justlend_service.py,sha256=WRnRZO1lmou0cfT4TdguYFu1ryAZc_ALfBIgSyBN9HM,3247
140
140
  defi_services/services/lending/liqee_service.py,sha256=mNPQ-bx_aoQ3oT9Hm3YM0bkYZnykudlQ36PfGCmSLag,13520
141
- defi_services/services/lending/morpho_aave_v2_services.py,sha256=OGG65dMP2tf1ZFN8lRKHPKn58Y2AB08oQdjUL6RLEUQ,3896
142
- defi_services/services/lending/morpho_aave_v3_services.py,sha256=I7b6uOR3UCHvooOzNGQfUS0iDTj_c-NmO3jvsUigG7Y,7111
141
+ defi_services/services/lending/morpho_aave_v2_services.py,sha256=Lq3PYLDhKNRTIX6zL6faw5Shlq4HBhslqdj6A-oL13g,3896
142
+ defi_services/services/lending/morpho_aave_v3_services.py,sha256=yS0dcibfOmKWDrWxbVkJSEVBxrMLa0ZS-XwTm84mFhk,7123
143
143
  defi_services/services/lending/morpho_compound_services.py,sha256=PVGjyrGKxkmudSD0eyBRVAJ20kmiQUXBTeFpheYvXBo,9951
144
- defi_services/services/lending/onyx_service.py,sha256=3IrQbV3gzC-j0uaZf5iTQUICxPVGy9CX5ElHBkUPa4Y,12589
144
+ defi_services/services/lending/onyx_service.py,sha256=lWH1mXRZhGvGI7L-FetcukO3KltNv3IqB7OP5BgNRls,12771
145
145
  defi_services/services/lending/radiant_v2_services.py,sha256=-CQq3_Ap5zV0QIRR6H_pMehtYsFZG8ZjLjs0vL3_eZc,2210
146
- defi_services/services/lending/silo_services.py,sha256=0fJxkBerQpeN93w-8RoDHTj1arkcVRGHtGd8N_4mb9s,11168
146
+ defi_services/services/lending/silo_services.py,sha256=7e9r_Zqs83ntI9Ulk-NjOzZiFmXW6xmxjqu1Aiv7fDg,11303
147
147
  defi_services/services/lending/spark_services.py,sha256=68_egY0yOT7YIOVbd8rbHJBJEsL0sOr0zSsTSdw0BUY,1042
148
148
  defi_services/services/lending/strike_service.py,sha256=VMVf7noamZD4hPHJjKIWANOrPIeYAv_cR7hkZLVJZag,12611
149
149
  defi_services/services/lending/trava_services.py,sha256=EKPytfCb6hgeKQKG8d9RhQQPBcv8z4USiHwMsNiapkk,16762
@@ -174,18 +174,18 @@ defi_services/services/lending/lending_info/bsc/valas_bsc.py,sha256=Fg6RwssuVflW
174
174
  defi_services/services/lending/lending_info/bsc/venus_bsc.py,sha256=9B9wRuHkrPM4-gLh2yAKW10OTmusbbhfaiRRH_AMURY,4832
175
175
  defi_services/services/lending/lending_info/bsc/wepiggy_bsc.py,sha256=2Db98_o42B8TSsmcmbLL5OwjV3Y56PLWTBNjRssXNrg,3273
176
176
  defi_services/services/lending/lending_info/ethereum/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
177
- defi_services/services/lending/lending_info/ethereum/aave_v2_eth.py,sha256=HkI4ed-_27oZvGs6rdpFcIyJeqGcRsObDoCnMEApeuA,12032
177
+ defi_services/services/lending/lending_info/ethereum/aave_v2_eth.py,sha256=4Zsn42p7lLaKNJz9eahPky5uCax-pV4qchuzDaf7yww,12032
178
178
  defi_services/services/lending/lending_info/ethereum/aave_v3_eth.py,sha256=tXe5QlEvQzQHgAJjug0MNo1m5bIyThiM7OavhQMsmok,7620
179
179
  defi_services/services/lending/lending_info/ethereum/compound_eth.py,sha256=9gMWKs9RUsV4bIWb4bJ9rF6L-LNUOQQAzE15UVLS3lE,3740
180
- defi_services/services/lending/lending_info/ethereum/compound_v3_eth.py,sha256=l3mVlB2MkKkNmr2Op9WocPFB1QaPJ0R9SLbO1fYNkw8,2653
180
+ defi_services/services/lending/lending_info/ethereum/compound_v3_eth.py,sha256=mw8s9C1p2-VPyZk0DgM5AGwc3UUW7BqG-3khSmj1bb8,2513
181
181
  defi_services/services/lending/lending_info/ethereum/flux_eth.py,sha256=Iw-hvmFc5g9_--drvZCWxtoscvMIkr1mna4pTStrA-g,1270
182
182
  defi_services/services/lending/lending_info/ethereum/granary_eth.py,sha256=AAW4fzyFAUrdaJ86cUk6OJFQnbRghgun70ScWVUXAUM,2059
183
183
  defi_services/services/lending/lending_info/ethereum/iron_bank_eth.py,sha256=PfubpeLx1_qePdXcxUS8o6oN7SdB433eDSX3Njxyoa4,4606
184
184
  defi_services/services/lending/lending_info/ethereum/liqee_eth.py,sha256=1AqVijItk8yeSIbOwKje8jDrlL4GOF06SE_gzIYtwHo,4839
185
- defi_services/services/lending/lending_info/ethereum/morpho_aave_v2_eth.py,sha256=mFZVEc2VWPYT4MjYza_Bx8CENbZNklSKO6sFzfSHBQo,2596
186
- defi_services/services/lending/lending_info/ethereum/morpho_aave_v3_eth.py,sha256=4fqgPw1vxKUGmeniZpwUQp5kd_y2f8maiTx4M20NY-c,2471
187
- defi_services/services/lending/lending_info/ethereum/morpho_compound_eth.py,sha256=tv01BNoxp_Y3pcEC6x64NOA7S05_3BE-cAtLAhIDzmI,1880
188
- defi_services/services/lending/lending_info/ethereum/onyx_eth.py,sha256=N2pu-jrDX17R40hvvXWvcSj98w-S2tIAjjW7IcGYJMw,3451
185
+ defi_services/services/lending/lending_info/ethereum/morpho_aave_v2_eth.py,sha256=WDIoK0HtEOVDVGdQ6ok22W-aTapTmQt3C5wvVnM2iC8,2595
186
+ defi_services/services/lending/lending_info/ethereum/morpho_aave_v3_eth.py,sha256=v9wSuuuKEMWRKsvHf3V9CtvDusoxiv22cCHH4YShVe8,3096
187
+ defi_services/services/lending/lending_info/ethereum/morpho_compound_eth.py,sha256=q9ZpCb0qLi5amKtL7EL27NDxJ6FBkF14iXYEPhMebfo,1879
188
+ defi_services/services/lending/lending_info/ethereum/onyx_eth.py,sha256=3KzLJKNENtnNhk5LjLqgxiIxHwv6BCOcEwqNVR87r8w,3369
189
189
  defi_services/services/lending/lending_info/ethereum/silo_eth.py,sha256=XQHpo37RS7DJ4Xjc8n0YK6WeGj5xn5ZOPRIlgTiSkH4,16770
190
190
  defi_services/services/lending/lending_info/ethereum/silo_llama_eth.py,sha256=w9iqoaZgMMO7_v6FKYN7vHLGcliBWcQLRKVDA9dYG_g,3696
191
191
  defi_services/services/lending/lending_info/ethereum/spark_eth.py,sha256=dTN7fELeehD8VkCRAoM71u523G3rwATAnCRXu3nbVtM,2933
@@ -217,8 +217,8 @@ defi_services/utils/logger_utils.py,sha256=KxDlmaK9aoMOI1gdroRYjMm383myvFiWqW0iK
217
217
  defi_services/utils/market_service.py,sha256=imPtPHBkpEx5JnhqeIWYqbCjsIEm8IKBYHNEy6rKjdU,723
218
218
  defi_services/utils/memory_storage.py,sha256=BOT8laB0iVSCGE-oDlpWJQLbSC6X2blKX4zuQbs4inc,851
219
219
  defi_services/utils/thread_proxy.py,sha256=5Z8biAyEReUkh3vfJSvEv7GwMe3CsE5M8CbghkQtePw,2951
220
- defi_state_querier-0.2.6.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
221
- defi_state_querier-0.2.6.dist-info/METADATA,sha256=z6Z1FidIi1zIsr7lBjA9SxqPlMTTednAVXWZm_iZKFM,3932
222
- defi_state_querier-0.2.6.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
223
- defi_state_querier-0.2.6.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
224
- defi_state_querier-0.2.6.dist-info/RECORD,,
220
+ defi_state_querier-0.2.8.dist-info/LICENSE,sha256=6jmfxa8nUIwfKnzZUxAHJSJ_IS7h7mpbJq26cWjoo-o,1063
221
+ defi_state_querier-0.2.8.dist-info/METADATA,sha256=KRH7YkElpYceF1bnYAElqWKhFcB_D5mS_mCb_oNjB-o,3932
222
+ defi_state_querier-0.2.8.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
223
+ defi_state_querier-0.2.8.dist-info/top_level.txt,sha256=C-OTxHK6MknKK-nAbEzCPDUl1M6pktRhgJrmsozdf6g,14
224
+ defi_state_querier-0.2.8.dist-info/RECORD,,