@gearbox-protocol/sdk 1.5.12 → 1.5.15

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.
@@ -1,8 +1,5 @@
1
- import { Signer } from "ethers";
2
1
  import { AdapterInterface } from "../contracts/adapters";
3
2
  import { SupportedContract } from "../contracts/contracts";
4
- import { EVMTx } from "./eventOrTx";
5
- import { TradePath } from "./trade";
6
3
  interface BaseAdapterProps {
7
4
  name: string;
8
5
  adapterInterface: AdapterInterface;
@@ -11,11 +8,6 @@ interface BaseAdapterProps {
11
8
  contractSymbol: SupportedContract;
12
9
  creditManager: string;
13
10
  }
14
- interface ExecuteProps {
15
- tradePath: TradePath;
16
- slippage: number;
17
- signer: Signer;
18
- }
19
11
  export declare class BaseAdapter {
20
12
  readonly name: string;
21
13
  readonly adapterInterface: AdapterInterface;
@@ -24,6 +16,5 @@ export declare class BaseAdapter {
24
16
  readonly contractSymbol: SupportedContract;
25
17
  readonly creditManager: string;
26
18
  constructor(props: BaseAdapterProps);
27
- execute(props: ExecuteProps): Promise<EVMTx>;
28
19
  }
29
20
  export {};
@@ -1,40 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.BaseAdapter = void 0;
40
4
  var BaseAdapter = /** @class */ (function () {
@@ -46,14 +10,6 @@ var BaseAdapter = /** @class */ (function () {
46
10
  this.contractSymbol = props.contractSymbol;
47
11
  this.creditManager = props.creditManager;
48
12
  }
49
- BaseAdapter.prototype.execute = function (props) {
50
- return __awaiter(this, void 0, void 0, function () {
51
- return __generator(this, function (_a) {
52
- console.debug(props);
53
- return [2 /*return*/, {}];
54
- });
55
- });
56
- };
57
13
  return BaseAdapter;
58
14
  }());
59
15
  exports.BaseAdapter = BaseAdapter;
@@ -1,13 +1,14 @@
1
1
  import { BigNumber, ethers, Signer } from "ethers";
2
+ import { MultiCall } from "../pathfinder/core";
2
3
  import { CreditManagerDataPayload, CreditManagerStatPayload } from "../payload/creditManager";
3
4
  import { TokenData } from "../tokens/tokenData";
4
5
  import { ICreditManager } from "../types";
5
6
  import { Asset } from "./assets";
6
- import { MultiCall } from "./multicall";
7
7
  export declare class CreditManagerData {
8
8
  readonly id: string;
9
9
  readonly address: string;
10
10
  readonly underlyingToken: string;
11
+ readonly pool: string;
11
12
  readonly isWETH: boolean;
12
13
  readonly canBorrow: boolean;
13
14
  readonly borrowRate: number;
@@ -39,28 +39,27 @@ var CreditManagerData = /** @class */ (function () {
39
39
  this.isPaused = false;
40
40
  this.id = payload.addr.toLowerCase();
41
41
  this.address = payload.addr.toLowerCase();
42
- this.underlyingToken = (payload.underlying || "").toLowerCase();
43
- this.isWETH = payload.isWETH || false;
44
- this.canBorrow = payload.canBorrow || false;
42
+ this.underlyingToken = payload.underlying.toLowerCase();
43
+ this.pool = payload.pool.toLowerCase();
44
+ this.isWETH = payload.isWETH;
45
+ this.canBorrow = payload.canBorrow;
45
46
  this.borrowRate =
46
- ethers_1.BigNumber.from(payload.borrowRate || 0)
47
+ ethers_1.BigNumber.from(payload.borrowRate)
47
48
  .mul(ethers_1.BigNumber.from(payload.feeInterest).add(constants_1.PERCENTAGE_FACTOR))
48
49
  .mul(constants_1.PERCENTAGE_DECIMALS)
49
50
  .div(constants_1.RAY)
50
51
  .toNumber() / constants_1.PERCENTAGE_FACTOR;
51
- this.minAmount = ethers_1.BigNumber.from(payload.minAmount || 0);
52
- this.maxAmount = ethers_1.BigNumber.from(payload.maxAmount || 0);
53
- this.maxLeverageFactor = ethers_1.BigNumber.from(payload.maxLeverageFactor || 0).toNumber();
54
- this.availableLiquidity = ethers_1.BigNumber.from(payload.availableLiquidity || 0);
55
- this.collateralTokens = (payload.collateralTokens || []).map(function (t) {
56
- return t.toLowerCase();
57
- });
58
- this.adapters = (payload.adapters || []).reduce(function (acc, _a) {
52
+ this.minAmount = ethers_1.BigNumber.from(payload.minAmount);
53
+ this.maxAmount = ethers_1.BigNumber.from(payload.maxAmount);
54
+ this.maxLeverageFactor = ethers_1.BigNumber.from(payload.maxLeverageFactor).toNumber();
55
+ this.availableLiquidity = ethers_1.BigNumber.from(payload.availableLiquidity);
56
+ this.collateralTokens = payload.collateralTokens.map(function (t) { return t.toLowerCase(); });
57
+ this.adapters = payload.adapters.reduce(function (acc, _a) {
59
58
  var _b;
60
59
  var allowedContract = _a.allowedContract, adapter = _a.adapter;
61
60
  return (__assign(__assign({}, acc), (_b = {}, _b[allowedContract.toLowerCase()] = adapter.toLowerCase(), _b)));
62
61
  }, {});
63
- this.liquidationThresholds = (payload.liquidationThresholds || []).reduce(function (acc, threshold, index) {
62
+ this.liquidationThresholds = payload.liquidationThresholds.reduce(function (acc, threshold, index) {
64
63
  var address = payload.collateralTokens[index];
65
64
  if (address)
66
65
  acc[address.toLowerCase()] = ethers_1.BigNumber.from(threshold);
@@ -1,32 +1,29 @@
1
1
  import { BigNumber } from "ethers";
2
2
  import { AdapterInterface } from "../contracts/adapters";
3
- import { SwapType } from "../pathfinder/tradeTypes";
3
+ import { PathFinderResult, SwapOperation } from "../pathfinder/core";
4
4
  import { ICreditFacade } from "../types";
5
- import { PathFinderResultStruct, PathFinderResultStructOutput } from "../types/contracts/pathfinder/interfaces/IPathFinder";
6
5
  import { BaseAdapter } from "./adapter";
7
6
  import { EVMTx } from "./eventOrTx";
8
7
  import { TXSwap } from "./transactions";
9
- export declare type TradePath = Pick<PathFinderResultStructOutput, keyof PathFinderResultStruct>;
10
- export interface BaseTradeInterface {
11
- swapType: SwapType;
8
+ interface BaseTradeInterface {
9
+ swapType: SwapOperation;
12
10
  sourceAmount: BigNumber;
13
11
  expectedAmount: BigNumber;
14
- rate: BigNumber;
15
12
  tokenFrom: string;
16
13
  tokenTo: string;
17
14
  operationName: TradeOperations;
18
15
  }
19
16
  export interface TradeProps extends BaseTradeInterface {
20
17
  adapter: BaseAdapter;
21
- tradePath: TradePath;
18
+ tradePath: PathFinderResult;
22
19
  creditFacade: ICreditFacade;
23
20
  }
24
21
  export declare type TradeOperations = "farmWithdraw" | "farmDeposit" | "swap" | "unknownOperation";
25
22
  export declare class Trade implements BaseTradeInterface {
26
23
  protected helper: BaseAdapter;
27
- protected tradePath: TradePath;
24
+ protected tradePath: PathFinderResult;
28
25
  protected creditFacade: ICreditFacade;
29
- readonly swapType: SwapType;
26
+ readonly swapType: SwapOperation;
30
27
  readonly sourceAmount: BigNumber;
31
28
  readonly expectedAmount: BigNumber;
32
29
  readonly rate: BigNumber;
@@ -45,3 +42,4 @@ export declare class Trade implements BaseTradeInterface {
45
42
  getToAmount(slippage: number): BigNumber;
46
43
  static getOperationName(tokenInAddress: string, tokenOutAddress: string): TradeOperations;
47
44
  }
45
+ export {};
package/lib/core/trade.js CHANGED
@@ -56,7 +56,7 @@ var Trade = /** @class */ (function () {
56
56
  this.swapType = props.swapType;
57
57
  this.sourceAmount = props.sourceAmount;
58
58
  this.expectedAmount = props.expectedAmount;
59
- this.rate = props.rate;
59
+ this.rate = constants_1.WAD.mul(props.expectedAmount).div(props.sourceAmount);
60
60
  this.tokenFrom = props.tokenFrom;
61
61
  this.tokenTo = props.tokenTo;
62
62
  this.operationName = props.operationName;
@@ -15,7 +15,7 @@ export interface TxInfo {
15
15
  amountTo?: BigNumber;
16
16
  functionFragment: FunctionFragment;
17
17
  }
18
- export declare class SwapOperation {
18
+ export declare class WcSwapOperation {
19
19
  readonly id: number;
20
20
  operation?: string;
21
21
  from?: string;
@@ -39,7 +39,7 @@ export declare class SwapOperation {
39
39
  amountFrom: BigNumber;
40
40
  amountTo: BigNumber;
41
41
  raw: RawTransaction;
42
- }): SwapOperation;
42
+ }): WcSwapOperation;
43
43
  static NewLPOperation(params: {
44
44
  adapter: string;
45
45
  operation: string;
@@ -48,7 +48,7 @@ export declare class SwapOperation {
48
48
  farm: string;
49
49
  type: LpOperationType;
50
50
  raw: RawTransaction;
51
- }): SwapOperation;
52
- static NewUnsupportedOperation(raw: RawTransaction): SwapOperation;
53
- static NewApproveOperation(creditManager: string, raw: RawTransaction, token: string): SwapOperation;
51
+ }): WcSwapOperation;
52
+ static NewUnsupportedOperation(raw: RawTransaction): WcSwapOperation;
53
+ static NewApproveOperation(creditManager: string, raw: RawTransaction, token: string): WcSwapOperation;
54
54
  }
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapOperation = void 0;
3
+ exports.WcSwapOperation = void 0;
4
4
  var types_1 = require("../types");
5
- var SwapOperation = /** @class */ (function () {
6
- function SwapOperation(raw, kind) {
5
+ var WcSwapOperation = /** @class */ (function () {
6
+ function WcSwapOperation(raw, kind) {
7
7
  this.id = raw.id;
8
8
  this.raw = raw;
9
9
  this.kind = kind;
10
10
  this.isPending = false;
11
11
  }
12
- SwapOperation.NewSwapOperation = function (params) {
12
+ WcSwapOperation.NewSwapOperation = function (params) {
13
13
  var _a, _b;
14
- var newOperation = new SwapOperation(params.raw, "swap");
14
+ var newOperation = new WcSwapOperation(params.raw, "swap");
15
15
  newOperation.operation = params.operation;
16
16
  newOperation.from = params.from;
17
17
  newOperation.to = params.to;
@@ -25,9 +25,9 @@ var SwapOperation = /** @class */ (function () {
25
25
  };
26
26
  return newOperation;
27
27
  };
28
- SwapOperation.NewLPOperation = function (params) {
28
+ WcSwapOperation.NewLPOperation = function (params) {
29
29
  var _a, _b;
30
- var newOperation = new SwapOperation(params.raw, "lp");
30
+ var newOperation = new WcSwapOperation(params.raw, "lp");
31
31
  newOperation.operation = params.operation;
32
32
  newOperation.from = params.from;
33
33
  newOperation.amountFrom = params.amountFrom;
@@ -41,12 +41,12 @@ var SwapOperation = /** @class */ (function () {
41
41
  newOperation.lpOperationType = params.type;
42
42
  return newOperation;
43
43
  };
44
- SwapOperation.NewUnsupportedOperation = function (raw) {
45
- return new SwapOperation(raw, "unsupported");
44
+ WcSwapOperation.NewUnsupportedOperation = function (raw) {
45
+ return new WcSwapOperation(raw, "unsupported");
46
46
  };
47
- SwapOperation.NewApproveOperation = function (creditManager, raw, token) {
47
+ WcSwapOperation.NewApproveOperation = function (creditManager, raw, token) {
48
48
  var _a, _b;
49
- var operation = new SwapOperation(raw, "approve");
49
+ var operation = new WcSwapOperation(raw, "approve");
50
50
  operation.to = token;
51
51
  operation.calldata = (_a = raw === null || raw === void 0 ? void 0 : raw.params[0]) === null || _a === void 0 ? void 0 : _a.data;
52
52
  var tokenI = types_1.IERC20__factory.createInterface();
@@ -67,10 +67,10 @@ var SwapOperation = /** @class */ (function () {
67
67
  }
68
68
  catch (e) {
69
69
  console.error(e);
70
- return SwapOperation.NewUnsupportedOperation(raw);
70
+ return WcSwapOperation.NewUnsupportedOperation(raw);
71
71
  }
72
72
  };
73
- SwapOperation.tokens = {};
74
- return SwapOperation;
73
+ WcSwapOperation.tokens = {};
74
+ return WcSwapOperation;
75
75
  }());
76
- exports.SwapOperation = SwapOperation;
76
+ exports.WcSwapOperation = WcSwapOperation;
package/lib/index.d.ts CHANGED
@@ -34,6 +34,8 @@ export { AdapterInterface } from "./contracts/adapters";
34
34
  export { getContractName } from "./contracts/contractsRegister";
35
35
  export * from "./core/history";
36
36
  export * from "./parsers/txParser";
37
+ export * from "./pathfinder/core";
38
+ export * from "./pathfinder/pathfinder";
37
39
  export * from "./pathfinder/tradeTypes";
38
40
  export * from "./strategies/convex";
39
41
  export * from "./strategies/creditFacade";
package/lib/index.js CHANGED
@@ -54,6 +54,8 @@ var contractsRegister_1 = require("./contracts/contractsRegister");
54
54
  Object.defineProperty(exports, "getContractName", { enumerable: true, get: function () { return contractsRegister_1.getContractName; } });
55
55
  __exportStar(require("./core/history"), exports);
56
56
  __exportStar(require("./parsers/txParser"), exports);
57
+ __exportStar(require("./pathfinder/core"), exports);
58
+ __exportStar(require("./pathfinder/pathfinder"), exports);
57
59
  __exportStar(require("./pathfinder/tradeTypes"), exports);
58
60
  __exportStar(require("./strategies/convex"), exports);
59
61
  __exportStar(require("./strategies/creditFacade"), exports);
@@ -77,7 +77,3 @@ export declare type TradeAction = {
77
77
  contract: ConvexPoolContract;
78
78
  tokenOut: CurveLPToken;
79
79
  };
80
- export declare enum SwapType {
81
- ExactInput = 1,
82
- ExactOutput = 2
83
- }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapType = exports.TradeType = void 0;
3
+ exports.TradeType = void 0;
4
4
  var TradeType;
5
5
  (function (TradeType) {
6
6
  TradeType[TradeType["UniswapV2Swap"] = 0] = "UniswapV2Swap";
@@ -19,8 +19,3 @@ var TradeType;
19
19
  TradeType[TradeType["ConvexWithdraw"] = 13] = "ConvexWithdraw";
20
20
  TradeType[TradeType["ConvexWithdrawAndUnwrap"] = 14] = "ConvexWithdrawAndUnwrap";
21
21
  })(TradeType = exports.TradeType || (exports.TradeType = {}));
22
- var SwapType;
23
- (function (SwapType) {
24
- SwapType[SwapType["ExactInput"] = 1] = "ExactInput";
25
- SwapType[SwapType["ExactOutput"] = 2] = "ExactOutput";
26
- })(SwapType = exports.SwapType || (exports.SwapType = {}));
@@ -87,6 +87,7 @@ export declare type ContractAdapterStructOutput = [string, string] & {
87
87
  export declare type CreditManagerDataStruct = {
88
88
  addr: string;
89
89
  underlying: string;
90
+ pool: string;
90
91
  isWETH: boolean;
91
92
  canBorrow: boolean;
92
93
  borrowRate: BigNumberish;
@@ -111,6 +112,7 @@ export declare type CreditManagerDataStruct = {
111
112
  liquidationDiscountExpired: BigNumberish;
112
113
  };
113
114
  export declare type CreditManagerDataStructOutput = [
115
+ string,
114
116
  string,
115
117
  string,
116
118
  boolean,
@@ -138,6 +140,7 @@ export declare type CreditManagerDataStructOutput = [
138
140
  ] & {
139
141
  addr: string;
140
142
  underlying: string;
143
+ pool: string;
141
144
  isWETH: boolean;
142
145
  canBorrow: boolean;
143
146
  borrowRate: BigNumber;
@@ -343,6 +343,11 @@ var _abi = [
343
343
  name: "underlying",
344
344
  type: "address",
345
345
  },
346
+ {
347
+ internalType: "address",
348
+ name: "pool",
349
+ type: "address",
350
+ },
346
351
  {
347
352
  internalType: "bool",
348
353
  name: "isWETH",
@@ -490,6 +495,11 @@ var _abi = [
490
495
  name: "underlying",
491
496
  type: "address",
492
497
  },
498
+ {
499
+ internalType: "address",
500
+ name: "pool",
501
+ type: "address",
502
+ },
493
503
  {
494
504
  internalType: "bool",
495
505
  name: "isWETH",
@@ -12,7 +12,7 @@ export declare class Multicall2__factory extends ContractFactory {
12
12
  }): TransactionRequest;
13
13
  attach(address: string): Multicall2;
14
14
  connect(signer: Signer): Multicall2__factory;
15
- static readonly bytecode = "0x608060405234801561001057600080fd5b50610b51806100206000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806372425d9d11610081578063bce38bd71161005b578063bce38bd714610181578063c3077fa9146101a1578063ee82ac5e146101b457600080fd5b806372425d9d1461016757806386d516e81461016d578063a8b0574e1461017357600080fd5b8063399542e9116100b2578063399542e91461011757806342cbb15c146101395780634d2301cc1461013f57600080fd5b80630f28c97d146100d9578063252dba42146100ee57806327e86d6e1461010f575b600080fd5b425b6040519081526020015b60405180910390f35b6101016100fc3660046107df565b6101c6565b6040516100e5929190610896565b6100db610373565b61012a61012536600461091e565b610386565b6040516100e5939291906109db565b436100db565b6100db61014d366004610a03565b73ffffffffffffffffffffffffffffffffffffffff163190565b446100db565b456100db565b6040514181526020016100e5565b61019461018f36600461091e565b61039e565b6040516100e59190610a25565b61012a6101af3660046107df565b610599565b6100db6101c2366004610a38565b4090565b8051439060609067ffffffffffffffff8111156101e5576101e56105b6565b60405190808252806020026020018201604052801561021857816020015b60608152602001906001900390816102035790505b50905060005b835181101561036d5760008085838151811061023c5761023c610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061027057610270610a51565b6020026020010151602001516040516102899190610a80565b6000604051808303816000865af19150503d80600081146102c6576040519150601f19603f3d011682016040523d82523d6000602084013e6102cb565b606091505b50915091508161033c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d756c746963616c6c206167677265676174653a2063616c6c206661696c656460448201526064015b60405180910390fd5b8084848151811061034f5761034f610a51565b602002602001018190525050508061036690610acb565b905061021e565b50915091565b6000610380600143610b04565b40905090565b4380406060610395858561039e565b90509250925092565b6060815167ffffffffffffffff8111156103ba576103ba6105b6565b60405190808252806020026020018201604052801561040057816020015b6040805180820190915260008152606060208201528152602001906001900390816103d85790505b50905060005b82518110156105925760008084838151811061042457610424610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1685848151811061045857610458610a51565b6020026020010151602001516040516104719190610a80565b6000604051808303816000865af19150503d80600081146104ae576040519150601f19603f3d011682016040523d82523d6000602084013e6104b3565b606091505b5091509150851561054b578161054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610333565b604051806040016040528083151581526020018281525084848151811061057457610574610a51565b602002602001018190525050508061058b90610acb565b9050610406565b5092915050565b60008060606105a9600185610386565b9196909550909350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610608576106086105b6565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610655576106556105b6565b604052919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461068157600080fd5b919050565b6000601f838184011261069857600080fd5b8235602067ffffffffffffffff808311156106b5576106b56105b6565b8260051b6106c483820161060e565b93845286810183019383810190898611156106de57600080fd5b84890192505b858310156107d2578235848111156106fc5760008081fd5b890160407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d0381018213156107335760008081fd5b61073b6105e5565b61074689850161065d565b8152828401358881111561075a5760008081fd5b8085019450508d603f8501126107705760008081fd5b8884013588811115610784576107846105b6565b6107938a848e8401160161060e565b92508083528e848287010111156107aa5760008081fd5b808486018b85013760009083018a0152808901919091528452505091840191908401906106e4565b9998505050505050505050565b6000602082840312156107f157600080fd5b813567ffffffffffffffff81111561080857600080fd5b61081484828501610686565b949350505050565b60005b8381101561083757818101518382015260200161081f565b83811115610846576000848401525b50505050565b6000815180845261086481602086016020860161081c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610910577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526108fe86835161084c565b955092840192908401906001016108c4565b509398975050505050505050565b6000806040838503121561093157600080fd5b8235801515811461094157600080fd5b9150602083013567ffffffffffffffff81111561095d57600080fd5b61096985828601610686565b9150509250929050565b6000815180845260208085019450848260051b860182860160005b858110156109ce578383038952815180511515845285015160408685018190526109ba8186018361084c565b9a87019a945050509084019060010161098e565b5090979650505050505050565b8381528260208201526060604082015260006109fa6060830184610973565b95945050505050565b600060208284031215610a1557600080fd5b610a1e8261065d565b9392505050565b602081526000610a1e6020830184610973565b600060208284031215610a4a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a9281846020870161081c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610afd57610afd610a9c565b5060010190565b600082821015610b1657610b16610a9c565b50039056fea26469706673582212202c69e970f479545d7be246c48610ba0d642f18252c98dea6e14ebbeeb819c8f864736f6c634300080a0033";
15
+ static readonly bytecode = "0x608060405234801561001057600080fd5b50610b51806100206000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806372425d9d11610081578063bce38bd71161005b578063bce38bd714610181578063c3077fa9146101a1578063ee82ac5e146101b457600080fd5b806372425d9d1461016757806386d516e81461016d578063a8b0574e1461017357600080fd5b8063399542e9116100b2578063399542e91461011757806342cbb15c146101395780634d2301cc1461013f57600080fd5b80630f28c97d146100d9578063252dba42146100ee57806327e86d6e1461010f575b600080fd5b425b6040519081526020015b60405180910390f35b6101016100fc3660046107df565b6101c6565b6040516100e5929190610896565b6100db610373565b61012a61012536600461091e565b610386565b6040516100e5939291906109db565b436100db565b6100db61014d366004610a03565b73ffffffffffffffffffffffffffffffffffffffff163190565b446100db565b456100db565b6040514181526020016100e5565b61019461018f36600461091e565b61039e565b6040516100e59190610a25565b61012a6101af3660046107df565b610599565b6100db6101c2366004610a38565b4090565b8051439060609067ffffffffffffffff8111156101e5576101e56105b6565b60405190808252806020026020018201604052801561021857816020015b60608152602001906001900390816102035790505b50905060005b835181101561036d5760008085838151811061023c5761023c610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061027057610270610a51565b6020026020010151602001516040516102899190610a80565b6000604051808303816000865af19150503d80600081146102c6576040519150601f19603f3d011682016040523d82523d6000602084013e6102cb565b606091505b50915091508161033c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d756c746963616c6c206167677265676174653a2063616c6c206661696c656460448201526064015b60405180910390fd5b8084848151811061034f5761034f610a51565b602002602001018190525050508061036690610acb565b905061021e565b50915091565b6000610380600143610b04565b40905090565b4380406060610395858561039e565b90509250925092565b6060815167ffffffffffffffff8111156103ba576103ba6105b6565b60405190808252806020026020018201604052801561040057816020015b6040805180820190915260008152606060208201528152602001906001900390816103d85790505b50905060005b82518110156105925760008084838151811061042457610424610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1685848151811061045857610458610a51565b6020026020010151602001516040516104719190610a80565b6000604051808303816000865af19150503d80600081146104ae576040519150601f19603f3d011682016040523d82523d6000602084013e6104b3565b606091505b5091509150851561054b578161054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610333565b604051806040016040528083151581526020018281525084848151811061057457610574610a51565b602002602001018190525050508061058b90610acb565b9050610406565b5092915050565b60008060606105a9600185610386565b9196909550909350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610608576106086105b6565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610655576106556105b6565b604052919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461068157600080fd5b919050565b6000601f838184011261069857600080fd5b8235602067ffffffffffffffff808311156106b5576106b56105b6565b8260051b6106c483820161060e565b93845286810183019383810190898611156106de57600080fd5b84890192505b858310156107d2578235848111156106fc5760008081fd5b890160407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d0381018213156107335760008081fd5b61073b6105e5565b61074689850161065d565b8152828401358881111561075a5760008081fd5b8085019450508d603f8501126107705760008081fd5b8884013588811115610784576107846105b6565b6107938a848e8401160161060e565b92508083528e848287010111156107aa5760008081fd5b808486018b85013760009083018a0152808901919091528452505091840191908401906106e4565b9998505050505050505050565b6000602082840312156107f157600080fd5b813567ffffffffffffffff81111561080857600080fd5b61081484828501610686565b949350505050565b60005b8381101561083757818101518382015260200161081f565b83811115610846576000848401525b50505050565b6000815180845261086481602086016020860161081c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610910577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526108fe86835161084c565b955092840192908401906001016108c4565b509398975050505050505050565b6000806040838503121561093157600080fd5b8235801515811461094157600080fd5b9150602083013567ffffffffffffffff81111561095d57600080fd5b61096985828601610686565b9150509250929050565b6000815180845260208085019450848260051b860182860160005b858110156109ce578383038952815180511515845285015160408685018190526109ba8186018361084c565b9a87019a945050509084019060010161098e565b5090979650505050505050565b8381528260208201526060604082015260006109fa6060830184610973565b95945050505050565b600060208284031215610a1557600080fd5b610a1e8261065d565b9392505050565b602081526000610a1e6020830184610973565b600060208284031215610a4a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a9281846020870161081c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610afd57610afd610a9c565b5060010190565b600082821015610b1657610b16610a9c565b50039056fea2646970667358221220125df3e1e21b5f72a198b151923a51a6f30c33ef274b23d8593ad64b95e7c91f64736f6c634300080a0033";
16
16
  static readonly abi: {
17
17
  inputs: ({
18
18
  internalType: string;
@@ -333,7 +333,7 @@ var _abi = [
333
333
  type: "function",
334
334
  },
335
335
  ];
336
- var _bytecode = "0x608060405234801561001057600080fd5b50610b51806100206000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806372425d9d11610081578063bce38bd71161005b578063bce38bd714610181578063c3077fa9146101a1578063ee82ac5e146101b457600080fd5b806372425d9d1461016757806386d516e81461016d578063a8b0574e1461017357600080fd5b8063399542e9116100b2578063399542e91461011757806342cbb15c146101395780634d2301cc1461013f57600080fd5b80630f28c97d146100d9578063252dba42146100ee57806327e86d6e1461010f575b600080fd5b425b6040519081526020015b60405180910390f35b6101016100fc3660046107df565b6101c6565b6040516100e5929190610896565b6100db610373565b61012a61012536600461091e565b610386565b6040516100e5939291906109db565b436100db565b6100db61014d366004610a03565b73ffffffffffffffffffffffffffffffffffffffff163190565b446100db565b456100db565b6040514181526020016100e5565b61019461018f36600461091e565b61039e565b6040516100e59190610a25565b61012a6101af3660046107df565b610599565b6100db6101c2366004610a38565b4090565b8051439060609067ffffffffffffffff8111156101e5576101e56105b6565b60405190808252806020026020018201604052801561021857816020015b60608152602001906001900390816102035790505b50905060005b835181101561036d5760008085838151811061023c5761023c610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061027057610270610a51565b6020026020010151602001516040516102899190610a80565b6000604051808303816000865af19150503d80600081146102c6576040519150601f19603f3d011682016040523d82523d6000602084013e6102cb565b606091505b50915091508161033c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d756c746963616c6c206167677265676174653a2063616c6c206661696c656460448201526064015b60405180910390fd5b8084848151811061034f5761034f610a51565b602002602001018190525050508061036690610acb565b905061021e565b50915091565b6000610380600143610b04565b40905090565b4380406060610395858561039e565b90509250925092565b6060815167ffffffffffffffff8111156103ba576103ba6105b6565b60405190808252806020026020018201604052801561040057816020015b6040805180820190915260008152606060208201528152602001906001900390816103d85790505b50905060005b82518110156105925760008084838151811061042457610424610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1685848151811061045857610458610a51565b6020026020010151602001516040516104719190610a80565b6000604051808303816000865af19150503d80600081146104ae576040519150601f19603f3d011682016040523d82523d6000602084013e6104b3565b606091505b5091509150851561054b578161054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610333565b604051806040016040528083151581526020018281525084848151811061057457610574610a51565b602002602001018190525050508061058b90610acb565b9050610406565b5092915050565b60008060606105a9600185610386565b9196909550909350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610608576106086105b6565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610655576106556105b6565b604052919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461068157600080fd5b919050565b6000601f838184011261069857600080fd5b8235602067ffffffffffffffff808311156106b5576106b56105b6565b8260051b6106c483820161060e565b93845286810183019383810190898611156106de57600080fd5b84890192505b858310156107d2578235848111156106fc5760008081fd5b890160407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d0381018213156107335760008081fd5b61073b6105e5565b61074689850161065d565b8152828401358881111561075a5760008081fd5b8085019450508d603f8501126107705760008081fd5b8884013588811115610784576107846105b6565b6107938a848e8401160161060e565b92508083528e848287010111156107aa5760008081fd5b808486018b85013760009083018a0152808901919091528452505091840191908401906106e4565b9998505050505050505050565b6000602082840312156107f157600080fd5b813567ffffffffffffffff81111561080857600080fd5b61081484828501610686565b949350505050565b60005b8381101561083757818101518382015260200161081f565b83811115610846576000848401525b50505050565b6000815180845261086481602086016020860161081c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610910577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526108fe86835161084c565b955092840192908401906001016108c4565b509398975050505050505050565b6000806040838503121561093157600080fd5b8235801515811461094157600080fd5b9150602083013567ffffffffffffffff81111561095d57600080fd5b61096985828601610686565b9150509250929050565b6000815180845260208085019450848260051b860182860160005b858110156109ce578383038952815180511515845285015160408685018190526109ba8186018361084c565b9a87019a945050509084019060010161098e565b5090979650505050505050565b8381528260208201526060604082015260006109fa6060830184610973565b95945050505050565b600060208284031215610a1557600080fd5b610a1e8261065d565b9392505050565b602081526000610a1e6020830184610973565b600060208284031215610a4a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a9281846020870161081c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610afd57610afd610a9c565b5060010190565b600082821015610b1657610b16610a9c565b50039056fea26469706673582212202c69e970f479545d7be246c48610ba0d642f18252c98dea6e14ebbeeb819c8f864736f6c634300080a0033";
336
+ var _bytecode = "0x608060405234801561001057600080fd5b50610b51806100206000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806372425d9d11610081578063bce38bd71161005b578063bce38bd714610181578063c3077fa9146101a1578063ee82ac5e146101b457600080fd5b806372425d9d1461016757806386d516e81461016d578063a8b0574e1461017357600080fd5b8063399542e9116100b2578063399542e91461011757806342cbb15c146101395780634d2301cc1461013f57600080fd5b80630f28c97d146100d9578063252dba42146100ee57806327e86d6e1461010f575b600080fd5b425b6040519081526020015b60405180910390f35b6101016100fc3660046107df565b6101c6565b6040516100e5929190610896565b6100db610373565b61012a61012536600461091e565b610386565b6040516100e5939291906109db565b436100db565b6100db61014d366004610a03565b73ffffffffffffffffffffffffffffffffffffffff163190565b446100db565b456100db565b6040514181526020016100e5565b61019461018f36600461091e565b61039e565b6040516100e59190610a25565b61012a6101af3660046107df565b610599565b6100db6101c2366004610a38565b4090565b8051439060609067ffffffffffffffff8111156101e5576101e56105b6565b60405190808252806020026020018201604052801561021857816020015b60608152602001906001900390816102035790505b50905060005b835181101561036d5760008085838151811061023c5761023c610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1686848151811061027057610270610a51565b6020026020010151602001516040516102899190610a80565b6000604051808303816000865af19150503d80600081146102c6576040519150601f19603f3d011682016040523d82523d6000602084013e6102cb565b606091505b50915091508161033c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4d756c746963616c6c206167677265676174653a2063616c6c206661696c656460448201526064015b60405180910390fd5b8084848151811061034f5761034f610a51565b602002602001018190525050508061036690610acb565b905061021e565b50915091565b6000610380600143610b04565b40905090565b4380406060610395858561039e565b90509250925092565b6060815167ffffffffffffffff8111156103ba576103ba6105b6565b60405190808252806020026020018201604052801561040057816020015b6040805180820190915260008152606060208201528152602001906001900390816103d85790505b50905060005b82518110156105925760008084838151811061042457610424610a51565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1685848151811061045857610458610a51565b6020026020010151602001516040516104719190610a80565b6000604051808303816000865af19150503d80600081146104ae576040519150601f19603f3d011682016040523d82523d6000602084013e6104b3565b606091505b5091509150851561054b578161054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4d756c746963616c6c32206167677265676174653a2063616c6c206661696c6560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610333565b604051806040016040528083151581526020018281525084848151811061057457610574610a51565b602002602001018190525050508061058b90610acb565b9050610406565b5092915050565b60008060606105a9600185610386565b9196909550909350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610608576106086105b6565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610655576106556105b6565b604052919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461068157600080fd5b919050565b6000601f838184011261069857600080fd5b8235602067ffffffffffffffff808311156106b5576106b56105b6565b8260051b6106c483820161060e565b93845286810183019383810190898611156106de57600080fd5b84890192505b858310156107d2578235848111156106fc5760008081fd5b890160407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0828d0381018213156107335760008081fd5b61073b6105e5565b61074689850161065d565b8152828401358881111561075a5760008081fd5b8085019450508d603f8501126107705760008081fd5b8884013588811115610784576107846105b6565b6107938a848e8401160161060e565b92508083528e848287010111156107aa5760008081fd5b808486018b85013760009083018a0152808901919091528452505091840191908401906106e4565b9998505050505050505050565b6000602082840312156107f157600080fd5b813567ffffffffffffffff81111561080857600080fd5b61081484828501610686565b949350505050565b60005b8381101561083757818101518382015260200161081f565b83811115610846576000848401525b50505050565b6000815180845261086481602086016020860161081c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015610910577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa08887030184526108fe86835161084c565b955092840192908401906001016108c4565b509398975050505050505050565b6000806040838503121561093157600080fd5b8235801515811461094157600080fd5b9150602083013567ffffffffffffffff81111561095d57600080fd5b61096985828601610686565b9150509250929050565b6000815180845260208085019450848260051b860182860160005b858110156109ce578383038952815180511515845285015160408685018190526109ba8186018361084c565b9a87019a945050509084019060010161098e565b5090979650505050505050565b8381528260208201526060604082015260006109fa6060830184610973565b95945050505050565b600060208284031215610a1557600080fd5b610a1e8261065d565b9392505050565b602081526000610a1e6020830184610973565b600060208284031215610a4a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008251610a9281846020870161081c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610afd57610afd610a9c565b5060010190565b600082821015610b1657610b16610a9c565b50039056fea2646970667358221220125df3e1e21b5f72a198b151923a51a6f30c33ef274b23d8593ad64b95e7c91f64736f6c634300080a0033";
337
337
  var isSuperArgs = function (xs) { return xs.length > 1; };
338
338
  var Multicall2__factory = /** @class */ (function (_super) {
339
339
  __extends(Multicall2__factory, _super);
@@ -10,7 +10,7 @@ export interface MCall<T extends ethers.utils.Interface> {
10
10
  method: keyof T["functions"];
11
11
  params?: any;
12
12
  }
13
- export declare function multicall<R extends Array<any>>(calls: Array<MCall<any>>, p: ethers.providers.Provider): Promise<R>;
13
+ export declare function multicall<R extends Array<any>>(calls: Array<MCall<any>>, p: Signer | ethers.providers.Provider): Promise<R>;
14
14
  export declare class MultiCallContract<T extends ethers.utils.Interface> {
15
15
  private readonly _address;
16
16
  private readonly _interface;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.5.12",
3
+ "version": "1.5.15",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -1,5 +0,0 @@
1
- import { BytesLike } from "ethers";
2
- export interface MultiCall {
3
- target: string;
4
- callData: BytesLike;
5
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });