defi-state-querier 0.0.9__py3-none-any.whl → 0.1.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. defi_services/__init__.py +1 -1
  2. defi_services/abis/lending/apeswape/__init__.py +0 -0
  3. defi_services/abis/lending/apeswape/apeswap_comptroller_abi.py +2235 -0
  4. defi_services/abis/lending/apeswape/apeswap_lens_abi.py +747 -0
  5. defi_services/abis/lending/apeswape/apswap_ctoken_abi.py +1485 -0
  6. defi_services/abis/lending/wepiggy/wepiggy_comptroller_abi.py +1684 -0
  7. defi_services/abis/lending/wepiggy/wepiggy_distribution_abi.py +959 -1041
  8. defi_services/abis/lending/wepiggy/wepiggy_lens_abi.py +1098 -0
  9. defi_services/constants/entities/lending_constant.py +3 -1
  10. defi_services/constants/entities/lending_services.py +28 -13
  11. defi_services/services/lending/apeswap_services.py +88 -0
  12. defi_services/services/lending/compound_service.py +1 -0
  13. defi_services/services/lending/{granary_v1_services.py → granary_services.py} +38 -18
  14. defi_services/services/lending/iron_bank_service.py +5 -1
  15. defi_services/services/lending/lending_info/arbitrum/granary_arbitrum.py +67 -0
  16. defi_services/services/lending/lending_info/arbitrum/wepiggy_arbitrum.py +36 -0
  17. defi_services/services/lending/lending_info/avalanche/granary_avalanche.py +55 -0
  18. defi_services/services/lending/lending_info/avalanche/iron_bank_avalanche.py +55 -0
  19. defi_services/services/lending/lending_info/bsc/apeswap_bsc.py +52 -0
  20. defi_services/services/lending/lending_info/bsc/granary_bsc.py +49 -0
  21. defi_services/services/lending/lending_info/bsc/liqee_bsc.py +85 -0
  22. defi_services/services/lending/lending_info/bsc/wepiggy_bsc.py +76 -0
  23. defi_services/services/lending/lending_info/ethereum/{granary_v1_eth.py → granary_eth.py} +1 -1
  24. defi_services/services/lending/lending_info/ethereum/iron_bank_eth.py +0 -1
  25. defi_services/services/lending/lending_info/ethereum/spark_eth.py +41 -94
  26. defi_services/services/lending/lending_info/ethereum/wepiggy_eth.py +18 -7
  27. defi_services/services/lending/lending_info/fantom/granary_ftm.py +67 -0
  28. defi_services/services/lending/lending_info/optimism/granary_optimism.py +84 -0
  29. defi_services/services/lending/lending_info/optimism/iron_bank_optimism.py +43 -0
  30. defi_services/services/lending/lending_info/optimism/wepiggy_optimism.py +40 -0
  31. defi_services/services/lending/lending_info/polygon/wepiggy_polygon.py +52 -0
  32. defi_services/services/lending/liqee_service.py +5 -3
  33. defi_services/services/lending/morpho_aave_v2_services.py +2 -2
  34. defi_services/services/lending/morpho_aave_v3_services.py +2 -2
  35. defi_services/services/lending/morpho_compound_services.py +1 -1
  36. defi_services/services/lending/spark_services.py +32 -0
  37. defi_services/services/lending/wepiggy_services.py +26 -237
  38. {defi_state_querier-0.0.9.dist-info → defi_state_querier-0.1.1.dist-info}/METADATA +1 -1
  39. {defi_state_querier-0.0.9.dist-info → defi_state_querier-0.1.1.dist-info}/RECORD +42 -21
  40. {defi_state_querier-0.0.9.dist-info → defi_state_querier-0.1.1.dist-info}/LICENSE +0 -0
  41. {defi_state_querier-0.0.9.dist-info → defi_state_querier-0.1.1.dist-info}/WHEEL +0 -0
  42. {defi_state_querier-0.0.9.dist-info → defi_state_querier-0.1.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,747 @@
1
+ import json
2
+
3
+ APESWAP_LENS_ABI = json.loads('''
4
+ [
5
+ {
6
+ "constant": true,
7
+ "inputs": [
8
+ {
9
+ "internalType": "address payable",
10
+ "name": "account",
11
+ "type": "address"
12
+ }
13
+ ],
14
+ "name": "accountBalance",
15
+ "outputs": [
16
+ {
17
+ "internalType": "uint256",
18
+ "name": "balance",
19
+ "type": "uint256"
20
+ }
21
+ ],
22
+ "payable": false,
23
+ "stateMutability": "view",
24
+ "type": "function"
25
+ },
26
+ {
27
+ "constant": false,
28
+ "inputs": [
29
+ {
30
+ "internalType": "contract CToken",
31
+ "name": "cToken",
32
+ "type": "address"
33
+ },
34
+ {
35
+ "internalType": "address payable",
36
+ "name": "account",
37
+ "type": "address"
38
+ }
39
+ ],
40
+ "name": "cTokenBalances",
41
+ "outputs": [
42
+ {
43
+ "components": [
44
+ {
45
+ "internalType": "address",
46
+ "name": "cToken",
47
+ "type": "address"
48
+ },
49
+ {
50
+ "internalType": "uint256",
51
+ "name": "balanceOf",
52
+ "type": "uint256"
53
+ },
54
+ {
55
+ "internalType": "uint256",
56
+ "name": "borrowBalanceCurrent",
57
+ "type": "uint256"
58
+ },
59
+ {
60
+ "internalType": "uint256",
61
+ "name": "balanceOfUnderlying",
62
+ "type": "uint256"
63
+ },
64
+ {
65
+ "internalType": "uint256",
66
+ "name": "tokenBalance",
67
+ "type": "uint256"
68
+ },
69
+ {
70
+ "internalType": "uint256",
71
+ "name": "tokenAllowance",
72
+ "type": "uint256"
73
+ }
74
+ ],
75
+ "internalType": "struct CompoundLens.CTokenBalances",
76
+ "name": "",
77
+ "type": "tuple"
78
+ }
79
+ ],
80
+ "payable": false,
81
+ "stateMutability": "nonpayable",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "constant": false,
86
+ "inputs": [
87
+ {
88
+ "internalType": "contract CToken[]",
89
+ "name": "cTokens",
90
+ "type": "address[]"
91
+ },
92
+ {
93
+ "internalType": "address payable",
94
+ "name": "account",
95
+ "type": "address"
96
+ }
97
+ ],
98
+ "name": "cTokenBalancesAll",
99
+ "outputs": [
100
+ {
101
+ "components": [
102
+ {
103
+ "internalType": "address",
104
+ "name": "cToken",
105
+ "type": "address"
106
+ },
107
+ {
108
+ "internalType": "uint256",
109
+ "name": "balanceOf",
110
+ "type": "uint256"
111
+ },
112
+ {
113
+ "internalType": "uint256",
114
+ "name": "borrowBalanceCurrent",
115
+ "type": "uint256"
116
+ },
117
+ {
118
+ "internalType": "uint256",
119
+ "name": "balanceOfUnderlying",
120
+ "type": "uint256"
121
+ },
122
+ {
123
+ "internalType": "uint256",
124
+ "name": "tokenBalance",
125
+ "type": "uint256"
126
+ },
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "tokenAllowance",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "internalType": "struct CompoundLens.CTokenBalances[]",
134
+ "name": "",
135
+ "type": "tuple[]"
136
+ }
137
+ ],
138
+ "payable": false,
139
+ "stateMutability": "nonpayable",
140
+ "type": "function"
141
+ },
142
+ {
143
+ "constant": false,
144
+ "inputs": [
145
+ {
146
+ "internalType": "contract CToken",
147
+ "name": "cToken",
148
+ "type": "address"
149
+ }
150
+ ],
151
+ "name": "cTokenMetadata",
152
+ "outputs": [
153
+ {
154
+ "components": [
155
+ {
156
+ "internalType": "address",
157
+ "name": "cToken",
158
+ "type": "address"
159
+ },
160
+ {
161
+ "internalType": "uint256",
162
+ "name": "exchangeRateCurrent",
163
+ "type": "uint256"
164
+ },
165
+ {
166
+ "internalType": "uint256",
167
+ "name": "supplyRatePerBlock",
168
+ "type": "uint256"
169
+ },
170
+ {
171
+ "internalType": "uint256",
172
+ "name": "borrowRatePerBlock",
173
+ "type": "uint256"
174
+ },
175
+ {
176
+ "internalType": "uint256",
177
+ "name": "reserveFactorMantissa",
178
+ "type": "uint256"
179
+ },
180
+ {
181
+ "internalType": "uint256",
182
+ "name": "totalBorrows",
183
+ "type": "uint256"
184
+ },
185
+ {
186
+ "internalType": "uint256",
187
+ "name": "totalReserves",
188
+ "type": "uint256"
189
+ },
190
+ {
191
+ "internalType": "uint256",
192
+ "name": "totalSupply",
193
+ "type": "uint256"
194
+ },
195
+ {
196
+ "internalType": "uint256",
197
+ "name": "totalCash",
198
+ "type": "uint256"
199
+ },
200
+ {
201
+ "internalType": "bool",
202
+ "name": "isListed",
203
+ "type": "bool"
204
+ },
205
+ {
206
+ "internalType": "uint256",
207
+ "name": "collateralFactorMantissa",
208
+ "type": "uint256"
209
+ },
210
+ {
211
+ "internalType": "uint256",
212
+ "name": "liquidationFactorMantissa",
213
+ "type": "uint256"
214
+ },
215
+ {
216
+ "internalType": "uint256",
217
+ "name": "liquidationIncentiveMantissa",
218
+ "type": "uint256"
219
+ },
220
+ {
221
+ "internalType": "address",
222
+ "name": "underlyingAssetAddress",
223
+ "type": "address"
224
+ },
225
+ {
226
+ "internalType": "uint256",
227
+ "name": "cTokenDecimals",
228
+ "type": "uint256"
229
+ },
230
+ {
231
+ "internalType": "uint256",
232
+ "name": "underlyingDecimals",
233
+ "type": "uint256"
234
+ },
235
+ {
236
+ "internalType": "uint256",
237
+ "name": "incentiveSpeed",
238
+ "type": "uint256"
239
+ },
240
+ {
241
+ "internalType": "uint256",
242
+ "name": "incentiveSupplySpeed",
243
+ "type": "uint256"
244
+ },
245
+ {
246
+ "internalType": "uint256",
247
+ "name": "incentiveBorrowSpeed",
248
+ "type": "uint256"
249
+ }
250
+ ],
251
+ "internalType": "struct CompoundLens.CTokenMetadata",
252
+ "name": "",
253
+ "type": "tuple"
254
+ }
255
+ ],
256
+ "payable": false,
257
+ "stateMutability": "nonpayable",
258
+ "type": "function"
259
+ },
260
+ {
261
+ "constant": false,
262
+ "inputs": [
263
+ {
264
+ "internalType": "contract CToken[]",
265
+ "name": "cTokens",
266
+ "type": "address[]"
267
+ }
268
+ ],
269
+ "name": "cTokenMetadataAll",
270
+ "outputs": [
271
+ {
272
+ "components": [
273
+ {
274
+ "internalType": "address",
275
+ "name": "cToken",
276
+ "type": "address"
277
+ },
278
+ {
279
+ "internalType": "uint256",
280
+ "name": "exchangeRateCurrent",
281
+ "type": "uint256"
282
+ },
283
+ {
284
+ "internalType": "uint256",
285
+ "name": "supplyRatePerBlock",
286
+ "type": "uint256"
287
+ },
288
+ {
289
+ "internalType": "uint256",
290
+ "name": "borrowRatePerBlock",
291
+ "type": "uint256"
292
+ },
293
+ {
294
+ "internalType": "uint256",
295
+ "name": "reserveFactorMantissa",
296
+ "type": "uint256"
297
+ },
298
+ {
299
+ "internalType": "uint256",
300
+ "name": "totalBorrows",
301
+ "type": "uint256"
302
+ },
303
+ {
304
+ "internalType": "uint256",
305
+ "name": "totalReserves",
306
+ "type": "uint256"
307
+ },
308
+ {
309
+ "internalType": "uint256",
310
+ "name": "totalSupply",
311
+ "type": "uint256"
312
+ },
313
+ {
314
+ "internalType": "uint256",
315
+ "name": "totalCash",
316
+ "type": "uint256"
317
+ },
318
+ {
319
+ "internalType": "bool",
320
+ "name": "isListed",
321
+ "type": "bool"
322
+ },
323
+ {
324
+ "internalType": "uint256",
325
+ "name": "collateralFactorMantissa",
326
+ "type": "uint256"
327
+ },
328
+ {
329
+ "internalType": "uint256",
330
+ "name": "liquidationFactorMantissa",
331
+ "type": "uint256"
332
+ },
333
+ {
334
+ "internalType": "uint256",
335
+ "name": "liquidationIncentiveMantissa",
336
+ "type": "uint256"
337
+ },
338
+ {
339
+ "internalType": "address",
340
+ "name": "underlyingAssetAddress",
341
+ "type": "address"
342
+ },
343
+ {
344
+ "internalType": "uint256",
345
+ "name": "cTokenDecimals",
346
+ "type": "uint256"
347
+ },
348
+ {
349
+ "internalType": "uint256",
350
+ "name": "underlyingDecimals",
351
+ "type": "uint256"
352
+ },
353
+ {
354
+ "internalType": "uint256",
355
+ "name": "incentiveSpeed",
356
+ "type": "uint256"
357
+ },
358
+ {
359
+ "internalType": "uint256",
360
+ "name": "incentiveSupplySpeed",
361
+ "type": "uint256"
362
+ },
363
+ {
364
+ "internalType": "uint256",
365
+ "name": "incentiveBorrowSpeed",
366
+ "type": "uint256"
367
+ }
368
+ ],
369
+ "internalType": "struct CompoundLens.CTokenMetadata[]",
370
+ "name": "",
371
+ "type": "tuple[]"
372
+ }
373
+ ],
374
+ "payable": false,
375
+ "stateMutability": "nonpayable",
376
+ "type": "function"
377
+ },
378
+ {
379
+ "constant": true,
380
+ "inputs": [
381
+ {
382
+ "internalType": "contract CToken",
383
+ "name": "cToken",
384
+ "type": "address"
385
+ }
386
+ ],
387
+ "name": "cTokenUnderlyingPrice",
388
+ "outputs": [
389
+ {
390
+ "components": [
391
+ {
392
+ "internalType": "address",
393
+ "name": "cToken",
394
+ "type": "address"
395
+ },
396
+ {
397
+ "internalType": "uint256",
398
+ "name": "underlyingPrice",
399
+ "type": "uint256"
400
+ }
401
+ ],
402
+ "internalType": "struct CompoundLens.CTokenUnderlyingPrice",
403
+ "name": "",
404
+ "type": "tuple"
405
+ }
406
+ ],
407
+ "payable": false,
408
+ "stateMutability": "view",
409
+ "type": "function"
410
+ },
411
+ {
412
+ "constant": true,
413
+ "inputs": [
414
+ {
415
+ "internalType": "contract CToken[]",
416
+ "name": "cTokens",
417
+ "type": "address[]"
418
+ }
419
+ ],
420
+ "name": "cTokenUnderlyingPriceAll",
421
+ "outputs": [
422
+ {
423
+ "components": [
424
+ {
425
+ "internalType": "address",
426
+ "name": "cToken",
427
+ "type": "address"
428
+ },
429
+ {
430
+ "internalType": "uint256",
431
+ "name": "underlyingPrice",
432
+ "type": "uint256"
433
+ }
434
+ ],
435
+ "internalType": "struct CompoundLens.CTokenUnderlyingPrice[]",
436
+ "name": "",
437
+ "type": "tuple[]"
438
+ }
439
+ ],
440
+ "payable": false,
441
+ "stateMutability": "view",
442
+ "type": "function"
443
+ },
444
+ {
445
+ "constant": true,
446
+ "inputs": [
447
+ {
448
+ "internalType": "contract ComptrollerLensInterface",
449
+ "name": "comptroller",
450
+ "type": "address"
451
+ },
452
+ {
453
+ "internalType": "address",
454
+ "name": "account",
455
+ "type": "address"
456
+ }
457
+ ],
458
+ "name": "getAccountLimits",
459
+ "outputs": [
460
+ {
461
+ "components": [
462
+ {
463
+ "internalType": "contract CToken[]",
464
+ "name": "markets",
465
+ "type": "address[]"
466
+ },
467
+ {
468
+ "internalType": "uint256",
469
+ "name": "liquidity",
470
+ "type": "uint256"
471
+ },
472
+ {
473
+ "internalType": "uint256",
474
+ "name": "shortfall",
475
+ "type": "uint256"
476
+ },
477
+ {
478
+ "internalType": "uint256",
479
+ "name": "liqFactorLiquidity",
480
+ "type": "uint256"
481
+ },
482
+ {
483
+ "internalType": "uint256",
484
+ "name": "liqFactorShortfall",
485
+ "type": "uint256"
486
+ }
487
+ ],
488
+ "internalType": "struct CompoundLens.AccountLimits",
489
+ "name": "",
490
+ "type": "tuple"
491
+ }
492
+ ],
493
+ "payable": false,
494
+ "stateMutability": "view",
495
+ "type": "function"
496
+ },
497
+ {
498
+ "constant": false,
499
+ "inputs": [
500
+ {
501
+ "internalType": "contract ComptrollerLensInterface",
502
+ "name": "comptroller",
503
+ "type": "address"
504
+ },
505
+ {
506
+ "internalType": "address",
507
+ "name": "account",
508
+ "type": "address"
509
+ }
510
+ ],
511
+ "name": "getAccountLimitsAfterInterest",
512
+ "outputs": [
513
+ {
514
+ "components": [
515
+ {
516
+ "internalType": "contract CToken[]",
517
+ "name": "markets",
518
+ "type": "address[]"
519
+ },
520
+ {
521
+ "internalType": "uint256",
522
+ "name": "liquidity",
523
+ "type": "uint256"
524
+ },
525
+ {
526
+ "internalType": "uint256",
527
+ "name": "shortfall",
528
+ "type": "uint256"
529
+ },
530
+ {
531
+ "internalType": "uint256",
532
+ "name": "liqFactorLiquidity",
533
+ "type": "uint256"
534
+ },
535
+ {
536
+ "internalType": "uint256",
537
+ "name": "liqFactorShortfall",
538
+ "type": "uint256"
539
+ }
540
+ ],
541
+ "internalType": "struct CompoundLens.AccountLimits",
542
+ "name": "",
543
+ "type": "tuple"
544
+ }
545
+ ],
546
+ "payable": false,
547
+ "stateMutability": "nonpayable",
548
+ "type": "function"
549
+ },
550
+ {
551
+ "constant": true,
552
+ "inputs": [
553
+ {
554
+ "internalType": "contract ComptrollerLensInterface",
555
+ "name": "comptroller",
556
+ "type": "address"
557
+ },
558
+ {
559
+ "internalType": "address[]",
560
+ "name": "accounts",
561
+ "type": "address[]"
562
+ }
563
+ ],
564
+ "name": "getAccountLimitsAll",
565
+ "outputs": [
566
+ {
567
+ "components": [
568
+ {
569
+ "internalType": "contract CToken[]",
570
+ "name": "markets",
571
+ "type": "address[]"
572
+ },
573
+ {
574
+ "internalType": "uint256",
575
+ "name": "liquidity",
576
+ "type": "uint256"
577
+ },
578
+ {
579
+ "internalType": "uint256",
580
+ "name": "shortfall",
581
+ "type": "uint256"
582
+ },
583
+ {
584
+ "internalType": "uint256",
585
+ "name": "liqFactorLiquidity",
586
+ "type": "uint256"
587
+ },
588
+ {
589
+ "internalType": "uint256",
590
+ "name": "liqFactorShortfall",
591
+ "type": "uint256"
592
+ }
593
+ ],
594
+ "internalType": "struct CompoundLens.AccountLimits[]",
595
+ "name": "",
596
+ "type": "tuple[]"
597
+ }
598
+ ],
599
+ "payable": false,
600
+ "stateMutability": "view",
601
+ "type": "function"
602
+ },
603
+ {
604
+ "constant": true,
605
+ "inputs": [
606
+ {
607
+ "internalType": "contract EIP20Interface",
608
+ "name": "comp",
609
+ "type": "address"
610
+ },
611
+ {
612
+ "internalType": "address",
613
+ "name": "account",
614
+ "type": "address"
615
+ }
616
+ ],
617
+ "name": "getCompBalanceMetadata",
618
+ "outputs": [
619
+ {
620
+ "components": [
621
+ {
622
+ "internalType": "uint256",
623
+ "name": "balance",
624
+ "type": "uint256"
625
+ },
626
+ {
627
+ "internalType": "uint256",
628
+ "name": "votes",
629
+ "type": "uint256"
630
+ },
631
+ {
632
+ "internalType": "address",
633
+ "name": "delegate",
634
+ "type": "address"
635
+ }
636
+ ],
637
+ "internalType": "struct CompoundLens.CompBalanceMetadata",
638
+ "name": "",
639
+ "type": "tuple"
640
+ }
641
+ ],
642
+ "payable": false,
643
+ "stateMutability": "view",
644
+ "type": "function"
645
+ },
646
+ {
647
+ "constant": false,
648
+ "inputs": [
649
+ {
650
+ "internalType": "contract EIP20Interface",
651
+ "name": "comp",
652
+ "type": "address"
653
+ },
654
+ {
655
+ "internalType": "contract ComptrollerLensInterface",
656
+ "name": "comptroller",
657
+ "type": "address"
658
+ },
659
+ {
660
+ "internalType": "address",
661
+ "name": "account",
662
+ "type": "address"
663
+ }
664
+ ],
665
+ "name": "getCompBalanceMetadataExt",
666
+ "outputs": [
667
+ {
668
+ "components": [
669
+ {
670
+ "internalType": "uint256",
671
+ "name": "balance",
672
+ "type": "uint256"
673
+ },
674
+ {
675
+ "internalType": "uint256",
676
+ "name": "votes",
677
+ "type": "uint256"
678
+ },
679
+ {
680
+ "internalType": "address",
681
+ "name": "delegate",
682
+ "type": "address"
683
+ },
684
+ {
685
+ "internalType": "uint256",
686
+ "name": "allocated",
687
+ "type": "uint256"
688
+ }
689
+ ],
690
+ "internalType": "struct CompoundLens.CompBalanceMetadataExt",
691
+ "name": "",
692
+ "type": "tuple"
693
+ }
694
+ ],
695
+ "payable": false,
696
+ "stateMutability": "nonpayable",
697
+ "type": "function"
698
+ },
699
+ {
700
+ "constant": true,
701
+ "inputs": [
702
+ {
703
+ "internalType": "address",
704
+ "name": "len",
705
+ "type": "address"
706
+ },
707
+ {
708
+ "internalType": "address",
709
+ "name": "asset",
710
+ "type": "address"
711
+ }
712
+ ],
713
+ "name": "getPriceForAsset",
714
+ "outputs": [
715
+ {
716
+ "internalType": "uint256",
717
+ "name": "",
718
+ "type": "uint256"
719
+ }
720
+ ],
721
+ "payable": false,
722
+ "stateMutability": "view",
723
+ "type": "function"
724
+ },
725
+ {
726
+ "constant": true,
727
+ "inputs": [
728
+ {
729
+ "internalType": "contract CToken",
730
+ "name": "cToken",
731
+ "type": "address"
732
+ }
733
+ ],
734
+ "name": "isCTokenForNative",
735
+ "outputs": [
736
+ {
737
+ "internalType": "bool",
738
+ "name": "",
739
+ "type": "bool"
740
+ }
741
+ ],
742
+ "payable": false,
743
+ "stateMutability": "view",
744
+ "type": "function"
745
+ }
746
+ ]
747
+ ''')