@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
@@ -12,7 +12,7 @@ export type BalanceStructOutput = [string, BigNumber] & {
12
12
  };
13
13
  export interface ICreditFacadeExtendedInterface extends utils.Interface {
14
14
  functions: {
15
- "addCollateral(address,address,uint256)": FunctionFragment;
15
+ "addCollateral(address,uint256)": FunctionFragment;
16
16
  "decreaseDebt(uint256)": FunctionFragment;
17
17
  "disableToken(address)": FunctionFragment;
18
18
  "enableToken(address)": FunctionFragment;
@@ -20,7 +20,7 @@ export interface ICreditFacadeExtendedInterface extends utils.Interface {
20
20
  "revertIfReceivedLessThan((address,uint256)[])": FunctionFragment;
21
21
  };
22
22
  getFunction(nameOrSignatureOrTopic: "addCollateral" | "decreaseDebt" | "disableToken" | "enableToken" | "increaseDebt" | "revertIfReceivedLessThan"): FunctionFragment;
23
- encodeFunctionData(functionFragment: "addCollateral", values: [string, string, BigNumberish]): string;
23
+ encodeFunctionData(functionFragment: "addCollateral", values: [string, BigNumberish]): string;
24
24
  encodeFunctionData(functionFragment: "decreaseDebt", values: [BigNumberish]): string;
25
25
  encodeFunctionData(functionFragment: "disableToken", values: [string]): string;
26
26
  encodeFunctionData(functionFragment: "enableToken", values: [string]): string;
@@ -49,7 +49,7 @@ export interface ICreditFacadeExtended extends BaseContract {
49
49
  once: OnEvent<this>;
50
50
  removeListener: OnEvent<this>;
51
51
  functions: {
52
- addCollateral(onBehalfOf: string, token: string, amount: BigNumberish, overrides?: PayableOverrides & {
52
+ addCollateral(token: string, amount: BigNumberish, overrides?: PayableOverrides & {
53
53
  from?: string | Promise<string>;
54
54
  }): Promise<ContractTransaction>;
55
55
  decreaseDebt(amount: BigNumberish, overrides?: Overrides & {
@@ -68,7 +68,7 @@ export interface ICreditFacadeExtended extends BaseContract {
68
68
  from?: string | Promise<string>;
69
69
  }): Promise<ContractTransaction>;
70
70
  };
71
- addCollateral(onBehalfOf: string, token: string, amount: BigNumberish, overrides?: PayableOverrides & {
71
+ addCollateral(token: string, amount: BigNumberish, overrides?: PayableOverrides & {
72
72
  from?: string | Promise<string>;
73
73
  }): Promise<ContractTransaction>;
74
74
  decreaseDebt(amount: BigNumberish, overrides?: Overrides & {
@@ -87,7 +87,7 @@ export interface ICreditFacadeExtended extends BaseContract {
87
87
  from?: string | Promise<string>;
88
88
  }): Promise<ContractTransaction>;
89
89
  callStatic: {
90
- addCollateral(onBehalfOf: string, token: string, amount: BigNumberish, overrides?: CallOverrides): Promise<void>;
90
+ addCollateral(token: string, amount: BigNumberish, overrides?: CallOverrides): Promise<void>;
91
91
  decreaseDebt(amount: BigNumberish, overrides?: CallOverrides): Promise<void>;
92
92
  disableToken(token: string, overrides?: CallOverrides): Promise<void>;
93
93
  enableToken(token: string, overrides?: CallOverrides): Promise<void>;
@@ -96,7 +96,7 @@ export interface ICreditFacadeExtended extends BaseContract {
96
96
  };
97
97
  filters: {};
98
98
  estimateGas: {
99
- addCollateral(onBehalfOf: string, token: string, amount: BigNumberish, overrides?: PayableOverrides & {
99
+ addCollateral(token: string, amount: BigNumberish, overrides?: PayableOverrides & {
100
100
  from?: string | Promise<string>;
101
101
  }): Promise<BigNumber>;
102
102
  decreaseDebt(amount: BigNumberish, overrides?: Overrides & {
@@ -116,7 +116,7 @@ export interface ICreditFacadeExtended extends BaseContract {
116
116
  }): Promise<BigNumber>;
117
117
  };
118
118
  populateTransaction: {
119
- addCollateral(onBehalfOf: string, token: string, amount: BigNumberish, overrides?: PayableOverrides & {
119
+ addCollateral(token: string, amount: BigNumberish, overrides?: PayableOverrides & {
120
120
  from?: string | Promise<string>;
121
121
  }): Promise<PopulatedTransaction>;
122
122
  decreaseDebt(amount: BigNumberish, overrides?: Overrides & {
@@ -0,0 +1,66 @@
1
+ import type { BaseContract, BigNumber, BytesLike, CallOverrides, PopulatedTransaction, Signer, utils } from "ethers";
2
+ import type { FunctionFragment, Result } from "@ethersproject/abi";
3
+ import type { Listener, Provider } from "@ethersproject/providers";
4
+ import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent } from "../../../../../common";
5
+ export interface ICreditFacadeV2Interface extends utils.Interface {
6
+ functions: {
7
+ "params()": FunctionFragment;
8
+ };
9
+ getFunction(nameOrSignatureOrTopic: "params"): FunctionFragment;
10
+ encodeFunctionData(functionFragment: "params", values?: undefined): string;
11
+ decodeFunctionResult(functionFragment: "params", data: BytesLike): Result;
12
+ events: {};
13
+ }
14
+ export interface ICreditFacadeV2 extends BaseContract {
15
+ connect(signerOrProvider: Signer | Provider | string): this;
16
+ attach(addressOrName: string): this;
17
+ deployed(): Promise<this>;
18
+ interface: ICreditFacadeV2Interface;
19
+ queryFilter<TEvent extends TypedEvent>(event: TypedEventFilter<TEvent>, fromBlockOrBlockhash?: string | number | undefined, toBlock?: string | number | undefined): Promise<Array<TEvent>>;
20
+ listeners<TEvent extends TypedEvent>(eventFilter?: TypedEventFilter<TEvent>): Array<TypedListener<TEvent>>;
21
+ listeners(eventName?: string): Array<Listener>;
22
+ removeAllListeners<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>): this;
23
+ removeAllListeners(eventName?: string): this;
24
+ off: OnEvent<this>;
25
+ on: OnEvent<this>;
26
+ once: OnEvent<this>;
27
+ removeListener: OnEvent<this>;
28
+ functions: {
29
+ params(overrides?: CallOverrides): Promise<[
30
+ BigNumber,
31
+ boolean,
32
+ number
33
+ ] & {
34
+ maxBorrowedAmountPerBlock: BigNumber;
35
+ isIncreaseDebtForbidden: boolean;
36
+ expirationDate: number;
37
+ }>;
38
+ };
39
+ params(overrides?: CallOverrides): Promise<[
40
+ BigNumber,
41
+ boolean,
42
+ number
43
+ ] & {
44
+ maxBorrowedAmountPerBlock: BigNumber;
45
+ isIncreaseDebtForbidden: boolean;
46
+ expirationDate: number;
47
+ }>;
48
+ callStatic: {
49
+ params(overrides?: CallOverrides): Promise<[
50
+ BigNumber,
51
+ boolean,
52
+ number
53
+ ] & {
54
+ maxBorrowedAmountPerBlock: BigNumber;
55
+ isIncreaseDebtForbidden: boolean;
56
+ expirationDate: number;
57
+ }>;
58
+ };
59
+ filters: {};
60
+ estimateGas: {
61
+ params(overrides?: CallOverrides): Promise<BigNumber>;
62
+ };
63
+ populateTransaction: {
64
+ params(overrides?: CallOverrides): Promise<PopulatedTransaction>;
65
+ };
66
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,3 +2,4 @@ export type { ICreditFacade } from "./ICreditFacade";
2
2
  export type { ICreditFacadeEvents } from "./ICreditFacadeEvents";
3
3
  export type { ICreditFacadeExceptions } from "./ICreditFacadeExceptions";
4
4
  export type { ICreditFacadeExtended } from "./ICreditFacadeExtended";
5
+ export type { ICreditFacadeV2 } from "./ICreditFacadeV2";
@@ -0,0 +1,28 @@
1
+ import { Signer, ContractFactory, Overrides } from "ethers";
2
+ import type { Provider, TransactionRequest } from "@ethersproject/providers";
3
+ import type { BalanceOps, BalanceOpsInterface } from "../../../../../../@gearbox-protocol/core-v2/contracts/interfaces/Balances.sol/BalanceOps";
4
+ type BalanceOpsConstructorParams = [signer?: Signer] | ConstructorParameters<typeof ContractFactory>;
5
+ export declare class BalanceOps__factory extends ContractFactory {
6
+ constructor(...args: BalanceOpsConstructorParams);
7
+ deploy(overrides?: Overrides & {
8
+ from?: string | Promise<string>;
9
+ }): Promise<BalanceOps>;
10
+ getDeployTransaction(overrides?: Overrides & {
11
+ from?: string | Promise<string>;
12
+ }): TransactionRequest;
13
+ attach(address: string): BalanceOps;
14
+ connect(signer: Signer): BalanceOps__factory;
15
+ static readonly bytecode = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203896f0feb976c3978602f767892b7c60b5b3c2ecdcb9f3490e1693d1dccea23c64736f6c63430008110033";
16
+ static readonly abi: {
17
+ inputs: {
18
+ internalType: string;
19
+ name: string;
20
+ type: string;
21
+ }[];
22
+ name: string;
23
+ type: string;
24
+ }[];
25
+ static createInterface(): BalanceOpsInterface;
26
+ static connect(address: string, signerOrProvider: Signer | Provider): BalanceOps;
27
+ }
28
+ export {};
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BalanceOps__factory = void 0;
4
+ /* Autogenerated file. Do not edit manually. */
5
+ /* tslint:disable */
6
+ /* eslint-disable */
7
+ const ethers_1 = require("ethers");
8
+ const _abi = [
9
+ {
10
+ inputs: [
11
+ {
12
+ internalType: "address",
13
+ name: "",
14
+ type: "address",
15
+ },
16
+ ],
17
+ name: "UnknownToken",
18
+ type: "error",
19
+ },
20
+ ];
21
+ const _bytecode = "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203896f0feb976c3978602f767892b7c60b5b3c2ecdcb9f3490e1693d1dccea23c64736f6c63430008110033";
22
+ const isSuperArgs = (xs) => xs.length > 1;
23
+ class BalanceOps__factory extends ethers_1.ContractFactory {
24
+ constructor(...args) {
25
+ if (isSuperArgs(args)) {
26
+ super(...args);
27
+ }
28
+ else {
29
+ super(_abi, _bytecode, args[0]);
30
+ }
31
+ }
32
+ deploy(overrides) {
33
+ return super.deploy(overrides || {});
34
+ }
35
+ getDeployTransaction(overrides) {
36
+ return super.getDeployTransaction(overrides || {});
37
+ }
38
+ attach(address) {
39
+ return super.attach(address);
40
+ }
41
+ connect(signer) {
42
+ return super.connect(signer);
43
+ }
44
+ static bytecode = _bytecode;
45
+ static abi = _abi;
46
+ static createInterface() {
47
+ return new ethers_1.utils.Interface(_abi);
48
+ }
49
+ static connect(address, signerOrProvider) {
50
+ return new ethers_1.Contract(address, _abi, signerOrProvider);
51
+ }
52
+ }
53
+ exports.BalanceOps__factory = BalanceOps__factory;
@@ -0,0 +1 @@
1
+ export { BalanceOps__factory } from "./BalanceOps__factory";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BalanceOps__factory = void 0;
4
+ /* Autogenerated file. Do not edit manually. */
5
+ /* tslint:disable */
6
+ /* eslint-disable */
7
+ var BalanceOps__factory_1 = require("./BalanceOps__factory");
8
+ Object.defineProperty(exports, "BalanceOps__factory", { enumerable: true, get: function () { return BalanceOps__factory_1.BalanceOps__factory; } });
@@ -31,6 +31,19 @@ const _abi = [
31
31
  name: "AddCollateral",
32
32
  type: "event",
33
33
  },
34
+ {
35
+ anonymous: false,
36
+ inputs: [
37
+ {
38
+ indexed: true,
39
+ internalType: "address",
40
+ name: "blacklistHelper",
41
+ type: "address",
42
+ },
43
+ ],
44
+ name: "BlacklistHelperSet",
45
+ type: "event",
46
+ },
34
47
  {
35
48
  anonymous: false,
36
49
  inputs: [
@@ -88,6 +101,19 @@ const _abi = [
88
101
  name: "IncreaseBorrowedAmount",
89
102
  type: "event",
90
103
  },
104
+ {
105
+ anonymous: false,
106
+ inputs: [
107
+ {
108
+ indexed: false,
109
+ internalType: "uint256",
110
+ name: "loss",
111
+ type: "uint256",
112
+ },
113
+ ],
114
+ name: "IncurLossOnLiquidation",
115
+ type: "event",
116
+ },
91
117
  {
92
118
  anonymous: false,
93
119
  inputs: [
@@ -282,6 +308,25 @@ const _abi = [
282
308
  name: "TransferAccountAllowed",
283
309
  type: "event",
284
310
  },
311
+ {
312
+ anonymous: false,
313
+ inputs: [
314
+ {
315
+ indexed: true,
316
+ internalType: "address",
317
+ name: "borrower",
318
+ type: "address",
319
+ },
320
+ {
321
+ indexed: false,
322
+ internalType: "uint256",
323
+ name: "amount",
324
+ type: "uint256",
325
+ },
326
+ ],
327
+ name: "UnderlyingSentToBlacklistHelper",
328
+ type: "event",
329
+ },
285
330
  ];
286
331
  class ICreditFacadeEvents__factory {
287
332
  static abi = _abi;
@@ -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",
@@ -8,11 +8,6 @@ const ethers_1 = require("ethers");
8
8
  const _abi = [
9
9
  {
10
10
  inputs: [
11
- {
12
- internalType: "address",
13
- name: "onBehalfOf",
14
- type: "address",
15
- },
16
11
  {
17
12
  internalType: "address",
18
13
  name: "token",
@@ -0,0 +1,18 @@
1
+ import { Signer } from "ethers";
2
+ import type { Provider } from "@ethersproject/providers";
3
+ import type { ICreditFacadeV2, ICreditFacadeV2Interface } from "../../../../../../@gearbox-protocol/core-v2/contracts/interfaces/ICreditFacade.sol/ICreditFacadeV2";
4
+ export declare class ICreditFacadeV2__factory {
5
+ static readonly abi: {
6
+ inputs: never[];
7
+ name: string;
8
+ outputs: {
9
+ internalType: string;
10
+ name: string;
11
+ type: string;
12
+ }[];
13
+ stateMutability: string;
14
+ type: string;
15
+ }[];
16
+ static createInterface(): ICreditFacadeV2Interface;
17
+ static connect(address: string, signerOrProvider: Signer | Provider): ICreditFacadeV2;
18
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /* Autogenerated file. Do not edit manually. */
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ICreditFacadeV2__factory = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const _abi = [
9
+ {
10
+ inputs: [],
11
+ name: "params",
12
+ outputs: [
13
+ {
14
+ internalType: "uint128",
15
+ name: "maxBorrowedAmountPerBlock",
16
+ type: "uint128",
17
+ },
18
+ {
19
+ internalType: "bool",
20
+ name: "isIncreaseDebtForbidden",
21
+ type: "bool",
22
+ },
23
+ {
24
+ internalType: "uint40",
25
+ name: "expirationDate",
26
+ type: "uint40",
27
+ },
28
+ ],
29
+ stateMutability: "view",
30
+ type: "function",
31
+ },
32
+ ];
33
+ class ICreditFacadeV2__factory {
34
+ static abi = _abi;
35
+ static createInterface() {
36
+ return new ethers_1.utils.Interface(_abi);
37
+ }
38
+ static connect(address, signerOrProvider) {
39
+ return new ethers_1.Contract(address, _abi, signerOrProvider);
40
+ }
41
+ }
42
+ exports.ICreditFacadeV2__factory = ICreditFacadeV2__factory;