@gearbox-protocol/sdk 2.1.33 → 2.1.35

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 (77) hide show
  1. package/contracts/index.sol +8 -0
  2. package/lib/contracts/protocols.d.ts +0 -5
  3. package/lib/contracts/protocols.js +1 -43
  4. package/lib/core/creditManager.d.ts +4 -1
  5. package/lib/core/creditManager.js +26 -4
  6. package/lib/core/pool/index.d.ts +0 -1
  7. package/lib/core/pool/index.js +0 -1
  8. package/lib/core/trade.d.ts +29 -16
  9. package/lib/core/trade.js +67 -10
  10. package/lib/index.d.ts +0 -11
  11. package/lib/index.js +1 -14
  12. package/lib/parsers/creditFacadeParser.js +2 -2
  13. package/lib/parsers/creditFacadeParser.spec.js +1 -2
  14. package/lib/parsers/txParser.js +1 -1
  15. package/lib/tokens/aave.d.ts +0 -3
  16. package/lib/tokens/aave.js +0 -57
  17. package/lib/tokens/balancer.d.ts +0 -10
  18. package/lib/tokens/balancer.js +0 -29
  19. package/lib/tokens/compound.d.ts +0 -2
  20. package/lib/tokens/compound.js +0 -36
  21. package/lib/tokens/convex.d.ts +2 -2
  22. package/lib/tokens/convex.js +9 -322
  23. package/lib/tokens/curveLP.d.ts +3 -4
  24. package/lib/tokens/curveLP.js +17 -240
  25. package/lib/tokens/gear.d.ts +0 -2
  26. package/lib/tokens/normal.d.ts +0 -3
  27. package/lib/tokens/normal.js +0 -718
  28. package/lib/tokens/yearn.d.ts +0 -4
  29. package/lib/tokens/yearn.js +0 -43
  30. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/BalanceOps.d.ts +27 -0
  31. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/index.d.ts +1 -0
  32. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/index.js +2 -0
  33. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacade.d.ts +147 -80
  34. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents.d.ts +35 -0
  35. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExtended.d.ts +7 -7
  36. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeV2.d.ts +66 -0
  37. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeV2.js +2 -0
  38. package/lib/types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/index.d.ts +1 -0
  39. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/BalanceOps__factory.d.ts +28 -0
  40. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/BalanceOps__factory.js +53 -0
  41. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/index.d.ts +1 -0
  42. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/index.js +8 -0
  43. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeEvents__factory.js +45 -0
  44. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExceptions__factory.js +10 -0
  45. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeExtended__factory.js +0 -5
  46. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeV2__factory.d.ts +18 -0
  47. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeV2__factory.js +42 -0
  48. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacade__factory.js +198 -46
  49. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/index.d.ts +1 -0
  50. package/lib/types/factories/@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/index.js +3 -1
  51. package/package.json +7 -2
  52. package/lib/core/adapter.d.ts +0 -20
  53. package/lib/core/adapter.js +0 -20
  54. package/lib/core/creditOperation.d.ts +0 -9
  55. package/lib/core/operations.d.ts +0 -22
  56. package/lib/core/operations.js +0 -26
  57. package/lib/core/pool/operation.d.ts +0 -28
  58. package/lib/core/pool/operation.js +0 -36
  59. package/lib/pathfinder/tradeTypes.d.ts +0 -113
  60. package/lib/pathfinder/tradeTypes.js +0 -28
  61. package/lib/strategies/convex.d.ts +0 -57
  62. package/lib/strategies/convex.js +0 -220
  63. package/lib/strategies/creditFacade.d.ts +0 -21
  64. package/lib/strategies/creditFacade.js +0 -71
  65. package/lib/strategies/curve.d.ts +0 -45
  66. package/lib/strategies/curve.js +0 -207
  67. package/lib/strategies/lido.d.ts +0 -18
  68. package/lib/strategies/lido.js +0 -51
  69. package/lib/strategies/uniswapV2.d.ts +0 -15
  70. package/lib/strategies/uniswapV2.js +0 -44
  71. package/lib/strategies/uniswapV3.d.ts +0 -21
  72. package/lib/strategies/uniswapV3.js +0 -71
  73. package/lib/strategies/yearn.d.ts +0 -20
  74. package/lib/strategies/yearn.js +0 -128
  75. package/lib/utils/extracter.d.ts +0 -11
  76. package/lib/utils/extracter.js +0 -19
  77. /package/lib/{core/creditOperation.js → types/@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/BalanceOps.js} +0 -0
@@ -102,6 +102,16 @@ const _abi = [
102
102
  name: "IncreaseDebtForbiddenException",
103
103
  type: "error",
104
104
  },
105
+ {
106
+ inputs: [],
107
+ name: "LiquiditySanityCheckException",
108
+ type: "error",
109
+ },
110
+ {
111
+ inputs: [],
112
+ name: "NotAllowedForBlacklistedAddressException",
113
+ type: "error",
114
+ },
105
115
  {
106
116
  inputs: [],
107
117
  name: "NotAllowedInWhitelistedMode",
@@ -187,6 +197,19 @@ const _abi = [
187
197
  name: "AddCollateral",
188
198
  type: "event",
189
199
  },
200
+ {
201
+ anonymous: false,
202
+ inputs: [
203
+ {
204
+ indexed: true,
205
+ internalType: "address",
206
+ name: "blacklistHelper",
207
+ type: "address",
208
+ },
209
+ ],
210
+ name: "BlacklistHelperSet",
211
+ type: "event",
212
+ },
190
213
  {
191
214
  anonymous: false,
192
215
  inputs: [
@@ -244,6 +267,19 @@ const _abi = [
244
267
  name: "IncreaseBorrowedAmount",
245
268
  type: "event",
246
269
  },
270
+ {
271
+ anonymous: false,
272
+ inputs: [
273
+ {
274
+ indexed: false,
275
+ internalType: "uint256",
276
+ name: "loss",
277
+ type: "uint256",
278
+ },
279
+ ],
280
+ name: "IncurLossOnLiquidation",
281
+ type: "event",
282
+ },
247
283
  {
248
284
  anonymous: false,
249
285
  inputs: [
@@ -439,33 +475,29 @@ const _abi = [
439
475
  type: "event",
440
476
  },
441
477
  {
478
+ anonymous: false,
442
479
  inputs: [
443
480
  {
481
+ indexed: true,
444
482
  internalType: "address",
445
- name: "onBehalfOf",
446
- type: "address",
447
- },
448
- {
449
- internalType: "address",
450
- name: "token",
483
+ name: "borrower",
451
484
  type: "address",
452
485
  },
453
486
  {
487
+ indexed: false,
454
488
  internalType: "uint256",
455
489
  name: "amount",
456
490
  type: "uint256",
457
491
  },
458
492
  ],
459
- name: "addCollateral",
460
- outputs: [],
461
- stateMutability: "payable",
462
- type: "function",
493
+ name: "UnderlyingSentToBlacklistHelper",
494
+ type: "event",
463
495
  },
464
496
  {
465
497
  inputs: [
466
498
  {
467
499
  internalType: "address",
468
- name: "targetContract",
500
+ name: "onBehalfOf",
469
501
  type: "address",
470
502
  },
471
503
  {
@@ -479,9 +511,9 @@ const _abi = [
479
511
  type: "uint256",
480
512
  },
481
513
  ],
482
- name: "approve",
514
+ name: "addCollateral",
483
515
  outputs: [],
484
- stateMutability: "nonpayable",
516
+ stateMutability: "payable",
485
517
  type: "function",
486
518
  },
487
519
  {
@@ -502,6 +534,19 @@ const _abi = [
502
534
  stateMutability: "nonpayable",
503
535
  type: "function",
504
536
  },
537
+ {
538
+ inputs: [],
539
+ name: "blacklistHelper",
540
+ outputs: [
541
+ {
542
+ internalType: "address",
543
+ name: "",
544
+ type: "address",
545
+ },
546
+ ],
547
+ stateMutability: "view",
548
+ type: "function",
549
+ },
505
550
  {
506
551
  inputs: [
507
552
  {
@@ -557,11 +602,6 @@ const _abi = [
557
602
  name: "skipTokenMask",
558
603
  type: "uint256",
559
604
  },
560
- {
561
- internalType: "bool",
562
- name: "convertWETH",
563
- type: "bool",
564
- },
565
605
  {
566
606
  components: [
567
607
  {
@@ -586,37 +626,51 @@ const _abi = [
586
626
  type: "function",
587
627
  },
588
628
  {
589
- inputs: [],
590
- name: "creditManager",
591
- outputs: [
629
+ inputs: [
592
630
  {
593
- internalType: "contract ICreditManagerV2",
594
- name: "",
631
+ internalType: "address",
632
+ name: "to",
595
633
  type: "address",
596
634
  },
597
- ],
598
- stateMutability: "view",
599
- type: "function",
600
- },
601
- {
602
- inputs: [
603
635
  {
604
636
  internalType: "uint256",
605
- name: "amount",
637
+ name: "skipTokenMask",
606
638
  type: "uint256",
607
639
  },
640
+ {
641
+ internalType: "bool",
642
+ name: "convertWETH",
643
+ type: "bool",
644
+ },
645
+ {
646
+ components: [
647
+ {
648
+ internalType: "address",
649
+ name: "target",
650
+ type: "address",
651
+ },
652
+ {
653
+ internalType: "bytes",
654
+ name: "callData",
655
+ type: "bytes",
656
+ },
657
+ ],
658
+ internalType: "struct MultiCall[]",
659
+ name: "calls",
660
+ type: "tuple[]",
661
+ },
608
662
  ],
609
- name: "decreaseDebt",
663
+ name: "closeCreditAccount",
610
664
  outputs: [],
611
- stateMutability: "nonpayable",
665
+ stateMutability: "payable",
612
666
  type: "function",
613
667
  },
614
668
  {
615
669
  inputs: [],
616
- name: "degenNFT",
670
+ name: "creditManager",
617
671
  outputs: [
618
672
  {
619
- internalType: "address",
673
+ internalType: "contract ICreditManagerV2",
620
674
  name: "",
621
675
  type: "address",
622
676
  },
@@ -625,16 +679,16 @@ const _abi = [
625
679
  type: "function",
626
680
  },
627
681
  {
628
- inputs: [
682
+ inputs: [],
683
+ name: "degenNFT",
684
+ outputs: [
629
685
  {
630
686
  internalType: "address",
631
- name: "token",
687
+ name: "",
632
688
  type: "address",
633
689
  },
634
690
  ],
635
- name: "enableToken",
636
- outputs: [],
637
- stateMutability: "nonpayable",
691
+ stateMutability: "view",
638
692
  type: "function",
639
693
  },
640
694
  {
@@ -657,16 +711,16 @@ const _abi = [
657
711
  type: "function",
658
712
  },
659
713
  {
660
- inputs: [
714
+ inputs: [],
715
+ name: "isBlacklistableUnderlying",
716
+ outputs: [
661
717
  {
662
- internalType: "uint256",
663
- name: "amount",
664
- type: "uint256",
718
+ internalType: "bool",
719
+ name: "",
720
+ type: "bool",
665
721
  },
666
722
  ],
667
- name: "increaseDebt",
668
- outputs: [],
669
- stateMutability: "nonpayable",
723
+ stateMutability: "view",
670
724
  type: "function",
671
725
  },
672
726
  {
@@ -706,6 +760,46 @@ const _abi = [
706
760
  stateMutability: "view",
707
761
  type: "function",
708
762
  },
763
+ {
764
+ inputs: [
765
+ {
766
+ internalType: "address",
767
+ name: "borrower",
768
+ type: "address",
769
+ },
770
+ {
771
+ internalType: "address",
772
+ name: "to",
773
+ type: "address",
774
+ },
775
+ {
776
+ internalType: "uint256",
777
+ name: "skipTokenMask",
778
+ type: "uint256",
779
+ },
780
+ {
781
+ components: [
782
+ {
783
+ internalType: "address",
784
+ name: "target",
785
+ type: "address",
786
+ },
787
+ {
788
+ internalType: "bytes",
789
+ name: "callData",
790
+ type: "bytes",
791
+ },
792
+ ],
793
+ internalType: "struct MultiCall[]",
794
+ name: "calls",
795
+ type: "tuple[]",
796
+ },
797
+ ],
798
+ name: "liquidateCreditAccount",
799
+ outputs: [],
800
+ stateMutability: "payable",
801
+ type: "function",
802
+ },
709
803
  {
710
804
  inputs: [
711
805
  {
@@ -751,6 +845,46 @@ const _abi = [
751
845
  stateMutability: "payable",
752
846
  type: "function",
753
847
  },
848
+ {
849
+ inputs: [
850
+ {
851
+ internalType: "address",
852
+ name: "borrower",
853
+ type: "address",
854
+ },
855
+ {
856
+ internalType: "address",
857
+ name: "to",
858
+ type: "address",
859
+ },
860
+ {
861
+ internalType: "uint256",
862
+ name: "skipTokenMask",
863
+ type: "uint256",
864
+ },
865
+ {
866
+ components: [
867
+ {
868
+ internalType: "address",
869
+ name: "target",
870
+ type: "address",
871
+ },
872
+ {
873
+ internalType: "bytes",
874
+ name: "callData",
875
+ type: "bytes",
876
+ },
877
+ ],
878
+ internalType: "struct MultiCall[]",
879
+ name: "calls",
880
+ type: "tuple[]",
881
+ },
882
+ ],
883
+ name: "liquidateExpiredCreditAccount",
884
+ outputs: [],
885
+ stateMutability: "payable",
886
+ type: "function",
887
+ },
754
888
  {
755
889
  inputs: [
756
890
  {
@@ -796,6 +930,24 @@ const _abi = [
796
930
  stateMutability: "payable",
797
931
  type: "function",
798
932
  },
933
+ {
934
+ inputs: [],
935
+ name: "lossParams",
936
+ outputs: [
937
+ {
938
+ internalType: "uint128",
939
+ name: "currentCumulativeLoss",
940
+ type: "uint128",
941
+ },
942
+ {
943
+ internalType: "uint128",
944
+ name: "maxCumulativeLoss",
945
+ type: "uint128",
946
+ },
947
+ ],
948
+ stateMutability: "view",
949
+ type: "function",
950
+ },
799
951
  {
800
952
  inputs: [
801
953
  {
@@ -2,3 +2,4 @@ export { ICreditFacade__factory } from "./ICreditFacade__factory";
2
2
  export { ICreditFacadeEvents__factory } from "./ICreditFacadeEvents__factory";
3
3
  export { ICreditFacadeExceptions__factory } from "./ICreditFacadeExceptions__factory";
4
4
  export { ICreditFacadeExtended__factory } from "./ICreditFacadeExtended__factory";
5
+ export { ICreditFacadeV2__factory } from "./ICreditFacadeV2__factory";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ICreditFacadeExtended__factory = exports.ICreditFacadeExceptions__factory = exports.ICreditFacadeEvents__factory = exports.ICreditFacade__factory = void 0;
3
+ exports.ICreditFacadeV2__factory = exports.ICreditFacadeExtended__factory = exports.ICreditFacadeExceptions__factory = exports.ICreditFacadeEvents__factory = exports.ICreditFacade__factory = void 0;
4
4
  /* Autogenerated file. Do not edit manually. */
5
5
  /* tslint:disable */
6
6
  /* eslint-disable */
@@ -12,3 +12,5 @@ var ICreditFacadeExceptions__factory_1 = require("./ICreditFacadeExceptions__fac
12
12
  Object.defineProperty(exports, "ICreditFacadeExceptions__factory", { enumerable: true, get: function () { return ICreditFacadeExceptions__factory_1.ICreditFacadeExceptions__factory; } });
13
13
  var ICreditFacadeExtended__factory_1 = require("./ICreditFacadeExtended__factory");
14
14
  Object.defineProperty(exports, "ICreditFacadeExtended__factory", { enumerable: true, get: function () { return ICreditFacadeExtended__factory_1.ICreditFacadeExtended__factory; } });
15
+ var ICreditFacadeV2__factory_1 = require("./ICreditFacadeV2__factory");
16
+ Object.defineProperty(exports, "ICreditFacadeV2__factory", { enumerable: true, get: function () { return ICreditFacadeV2__factory_1.ICreditFacadeV2__factory; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "2.1.33",
3
+ "version": "2.1.35",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -24,7 +24,11 @@
24
24
  "lint": "eslint \"**/*.ts\" --fix",
25
25
  "lint:ci": "eslint \"**/*.ts\"",
26
26
  "typecheck:ci": "tsc --noEmit",
27
- "test": "npx mocha -r ts-node/register -r dotenv/config src/**/*.spec.ts"
27
+ "test": "npx mocha -r ts-node/register -r dotenv/config src/**/*.spec.ts",
28
+ "types:clean": "rm -rf forge-out src/types-extra",
29
+ "types:build": "forge build",
30
+ "types:generate": "typechain --target ethers-v5 --out-dir src/types-extra ./forge-out/**/*.json",
31
+ "types": "yarn types:clean && yarn types:build && yarn types:generate"
28
32
  },
29
33
  "dependencies": {
30
34
  "@types/deep-eql": "^4.0.0",
@@ -36,6 +40,7 @@
36
40
  "devDependencies": {
37
41
  "@commitlint/cli": "^17.0.3",
38
42
  "@commitlint/config-conventional": "^17.0.3",
43
+ "@gearbox-protocol/core-v2": "^1.21.1",
39
44
  "@gearbox-protocol/eslint-config": "^1.4.1",
40
45
  "@gearbox-protocol/prettier-config": "^1.4.1",
41
46
  "@typechain/ethers-v5": "10.0.0",
@@ -1,20 +0,0 @@
1
- import { AdapterInterface } from "../contracts/adapters";
2
- import { SupportedContract } from "../contracts/contracts";
3
- interface BaseAdapterProps {
4
- name: string;
5
- adapterInterface: AdapterInterface;
6
- contractAddress: string;
7
- adapterAddress: string;
8
- contractSymbol: SupportedContract;
9
- creditManager: string;
10
- }
11
- export declare class BaseAdapter {
12
- readonly name: string;
13
- readonly adapterInterface: AdapterInterface;
14
- readonly contractAddress: string;
15
- readonly adapterAddress: string;
16
- readonly contractSymbol: SupportedContract;
17
- readonly creditManager: string;
18
- constructor(props: BaseAdapterProps);
19
- }
20
- export {};
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseAdapter = void 0;
4
- class BaseAdapter {
5
- name;
6
- adapterInterface;
7
- contractAddress;
8
- adapterAddress;
9
- contractSymbol;
10
- creditManager;
11
- constructor(props) {
12
- this.name = props.name;
13
- this.adapterInterface = props.adapterInterface;
14
- this.adapterAddress = props.adapterAddress;
15
- this.contractAddress = props.contractAddress;
16
- this.contractSymbol = props.contractSymbol;
17
- this.creditManager = props.creditManager;
18
- }
19
- }
20
- exports.BaseAdapter = BaseAdapter;
@@ -1,9 +0,0 @@
1
- export interface CreditOperation {
2
- id: number;
3
- txHash: string;
4
- blockNum: number;
5
- protocol: string;
6
- operation: string;
7
- timestamp: number;
8
- date: string;
9
- }
@@ -1,22 +0,0 @@
1
- export declare class OperationData {
2
- readonly id: number;
3
- readonly address: string;
4
- readonly txHash: string;
5
- readonly blockNum: number;
6
- readonly operation: string;
7
- readonly timestamp: number;
8
- readonly date: string;
9
- constructor(payload: OperationDataPayload);
10
- }
11
- export interface OperationDataPayload {
12
- id: number;
13
- address: string;
14
- txHash: string;
15
- blockNum: number;
16
- operation: string;
17
- timestamp: number;
18
- }
19
- export interface OperationsList {
20
- id: string;
21
- data: Array<OperationData>;
22
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.OperationData = void 0;
7
- const moment_1 = __importDefault(require("moment"));
8
- class OperationData {
9
- id;
10
- address;
11
- txHash;
12
- blockNum;
13
- operation;
14
- timestamp;
15
- date;
16
- constructor(payload) {
17
- this.id = payload.id;
18
- this.address = payload.address;
19
- this.txHash = payload.txHash;
20
- this.blockNum = payload.blockNum;
21
- this.operation = payload.operation;
22
- this.timestamp = payload.timestamp;
23
- this.date = (0, moment_1.default)(payload.timestamp * 1000).format("Do MMM YYYY");
24
- }
25
- }
26
- exports.OperationData = OperationData;
@@ -1,28 +0,0 @@
1
- import { TokenData } from "../../tokens/tokenData";
2
- export interface BasePoolOperation {
3
- amount: string;
4
- pool: string;
5
- session_id: string;
6
- timestamp: number;
7
- tx_hash: string;
8
- user: string;
9
- }
10
- export declare abstract class AbstractPoolOperation {
11
- readonly txHash: string;
12
- readonly date: string;
13
- readonly timestamp: number;
14
- readonly user: string;
15
- readonly sessionId: string;
16
- readonly pool: string;
17
- readonly amount: bigint;
18
- constructor(opts: BasePoolOperation);
19
- abstract toString(token: TokenData): string;
20
- }
21
- export type PoolOperationResponse = BasePoolOperation & {
22
- event: string;
23
- };
24
- export declare class PoolOperation extends AbstractPoolOperation {
25
- readonly event: string;
26
- constructor(ops: PoolOperationResponse);
27
- toString(token: TokenData): string;
28
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PoolOperation = exports.AbstractPoolOperation = void 0;
4
- const moment_1 = require("moment");
5
- const contractsRegister_1 = require("../../contracts/contractsRegister");
6
- const formatter_1 = require("../../utils/formatter");
7
- class AbstractPoolOperation {
8
- txHash;
9
- date;
10
- timestamp;
11
- user;
12
- sessionId;
13
- pool;
14
- amount;
15
- constructor(opts) {
16
- this.txHash = opts.tx_hash;
17
- this.amount = BigInt(opts.amount);
18
- this.pool = opts.pool;
19
- this.sessionId = opts.session_id;
20
- this.user = opts.user;
21
- this.timestamp = opts.timestamp;
22
- this.date = (0, moment_1.unix)(opts.timestamp).format("Do MMM YYYY");
23
- }
24
- }
25
- exports.AbstractPoolOperation = AbstractPoolOperation;
26
- class PoolOperation extends AbstractPoolOperation {
27
- event;
28
- constructor(ops) {
29
- super(ops);
30
- this.event = ops.event;
31
- }
32
- toString(token) {
33
- return `${this.event} ${(0, formatter_1.formatBN)(this.amount, token.decimals)} ${(0, contractsRegister_1.getContractName)(this.pool)}`;
34
- }
35
- }
36
- exports.PoolOperation = PoolOperation;