@gearbox-protocol/sdk 1.5.14 → 1.5.17

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;
@@ -3,18 +3,22 @@ import { LpTokensAPY } from "../apy";
3
3
  import { CreditAccountDataExtendedPayload, CreditAccountDataPayload } from "../payload/creditAccount";
4
4
  import { TokenData } from "../tokens/tokenData";
5
5
  import { Asset, LpAsset } from "./assets";
6
+ import { CreditManagerData } from "./creditManager";
7
+ import { PriceOracleData } from "./priceOracle";
6
8
  export declare class CreditAccountData {
7
- readonly id: string;
8
9
  readonly addr: string;
9
10
  readonly borrower: string;
10
11
  readonly inUse: boolean;
11
12
  readonly creditManager: string;
12
13
  readonly underlyingToken: string;
14
+ readonly since: number;
15
+ readonly cumulativeIndexAtOpen: BigNumber;
16
+ readonly borrowedAmount: BigNumber;
13
17
  borrowedAmountPlusInterest: BigNumber;
14
18
  totalValue: BigNumber;
15
19
  healthFactor: number;
16
20
  borrowRate: number;
17
- readonly allowedTokens: Array<string>;
21
+ readonly collateralTokens: Array<string>;
18
22
  readonly allTokens: Array<string>;
19
23
  balances: Record<string, BigNumber>;
20
24
  allBalances: Record<string, BigNumber>;
@@ -22,6 +26,11 @@ export declare class CreditAccountData {
22
26
  readonly version: number;
23
27
  constructor(payload: CreditAccountDataPayload);
24
28
  balancesSorted(prices: Record<string, BigNumber>, tokens: Record<string, TokenData>): Array<Asset>;
29
+ calcBorrowAmountPlusInterestRate(currentCumulativeIndex: BigNumber): BigNumber;
30
+ updateHealthFactor(creditManager: CreditManagerData, currentCumulativeIndex: BigNumber, priceOracle: PriceOracleData): void;
31
+ get id(): string;
32
+ protected hash(): string;
33
+ protected static hash(creditManager: string, borrower: string): string;
25
34
  }
26
35
  export declare function sortBalances(balances: Record<string, BigNumber>, prices: Record<string, BigNumber>, tokens: Record<string, TokenData>): Array<[string, BigNumber]>;
27
36
  export declare function tokensAbcComparator(t1?: TokenData, t2?: TokenData): 1 | -1;
@@ -23,17 +23,19 @@ var constants_1 = require("./constants");
23
23
  var CreditAccountData = /** @class */ (function () {
24
24
  function CreditAccountData(payload) {
25
25
  var _this = this;
26
- this.allowedTokens = [];
26
+ this.collateralTokens = [];
27
27
  this.allTokens = [];
28
28
  this.balances = {};
29
29
  this.allBalances = {};
30
30
  this.version = 1;
31
- this.id = payload.creditManager.toLowerCase();
32
31
  this.addr = payload.addr.toLowerCase();
33
32
  this.borrower = payload.borrower.toLowerCase();
34
33
  this.inUse = payload.inUse;
35
34
  this.creditManager = payload.creditManager.toLowerCase();
36
35
  this.underlyingToken = payload.underlying.toLowerCase();
36
+ this.since = ethers_1.BigNumber.from(payload.since).toNumber();
37
+ this.cumulativeIndexAtOpen = ethers_1.BigNumber.from(payload.cumulativeIndexAtOpen);
38
+ this.borrowedAmount = ethers_1.BigNumber.from(payload.borrowedAmount);
37
39
  this.borrowedAmountPlusInterest = ethers_1.BigNumber.from(payload.borrowedAmountPlusInterest);
38
40
  this.totalValue = ethers_1.BigNumber.from(payload.totalValue);
39
41
  this.healthFactor =
@@ -48,7 +50,7 @@ var CreditAccountData = /** @class */ (function () {
48
50
  var tokenLC = b.token.toLowerCase();
49
51
  if (b.isAllowed) {
50
52
  _this.balances[tokenLC] = ethers_1.BigNumber.from(b.balance);
51
- _this.allowedTokens.push(tokenLC);
53
+ _this.collateralTokens.push(tokenLC);
52
54
  }
53
55
  _this.allBalances[tokenLC] = ethers_1.BigNumber.from(b.balance);
54
56
  _this.allTokens.push(tokenLC);
@@ -62,6 +64,39 @@ var CreditAccountData = /** @class */ (function () {
62
64
  return ({ token: token, balance: balance });
63
65
  });
64
66
  };
67
+ CreditAccountData.prototype.calcBorrowAmountPlusInterestRate = function (currentCumulativeIndex) {
68
+ return this.borrowedAmount
69
+ .mul(currentCumulativeIndex)
70
+ .div(this.cumulativeIndexAtOpen);
71
+ };
72
+ CreditAccountData.prototype.updateHealthFactor = function (creditManager, currentCumulativeIndex, priceOracle) {
73
+ var _this = this;
74
+ var twvUSDValue = this.collateralTokens
75
+ .map(function (token) {
76
+ return priceOracle
77
+ .convertToUSD(_this.balances[token], token)
78
+ .mul(creditManager.liquidationThresholds[token]);
79
+ })
80
+ .reduce(function (a, b) { return a.add(b); });
81
+ this.healthFactor =
82
+ priceOracle
83
+ .convertFromUSD(twvUSDValue, this.underlyingToken)
84
+ .div(this.calcBorrowAmountPlusInterestRate(currentCumulativeIndex))
85
+ .toNumber() / constants_1.PERCENTAGE_FACTOR;
86
+ };
87
+ Object.defineProperty(CreditAccountData.prototype, "id", {
88
+ get: function () {
89
+ return this.creditManager;
90
+ },
91
+ enumerable: false,
92
+ configurable: true
93
+ });
94
+ CreditAccountData.prototype.hash = function () {
95
+ return CreditAccountData.hash(this.creditManager, this.borrower);
96
+ };
97
+ CreditAccountData.hash = function (creditManager, borrower) {
98
+ return "".concat(creditManager.toLowerCase(), ":").concat(borrower.toLowerCase());
99
+ };
65
100
  return CreditAccountData;
66
101
  }());
67
102
  exports.CreditAccountData = CreditAccountData;
@@ -1,9 +1,9 @@
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;
@@ -0,0 +1,14 @@
1
+ import { BigNumber, BigNumberish } from "ethers";
2
+ export interface PriceUpdate {
3
+ token: string;
4
+ price: BigNumberish;
5
+ }
6
+ export declare class PriceOracleData {
7
+ protected _prices: Record<string, BigNumber>;
8
+ constructor(prices: Array<PriceUpdate>);
9
+ updatePrices(prices: Array<PriceUpdate>): void;
10
+ convert(amount: BigNumber, from: string, to: string): BigNumber;
11
+ convertFromUSD(amount: BigNumber, token: string): BigNumber;
12
+ convertToUSD(amount: BigNumber, token: string): BigNumber;
13
+ getPrice(token: string): BigNumber;
14
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PriceOracleData = void 0;
4
+ var ethers_1 = require("ethers");
5
+ var token_1 = require("../tokens/token");
6
+ var PriceOracleData = /** @class */ (function () {
7
+ function PriceOracleData(prices) {
8
+ this._prices = {};
9
+ this.updatePrices(prices);
10
+ }
11
+ PriceOracleData.prototype.updatePrices = function (prices) {
12
+ var _this = this;
13
+ prices.forEach(function (p) {
14
+ _this._prices[p.token.toLowerCase()] = ethers_1.BigNumber.from(p.price);
15
+ });
16
+ };
17
+ PriceOracleData.prototype.convert = function (amount, from, to) {
18
+ return this.convertFromUSD(this.convertToUSD(amount, from), to);
19
+ };
20
+ PriceOracleData.prototype.convertFromUSD = function (amount, token) {
21
+ return amount
22
+ .mul(ethers_1.BigNumber.from(10).pow((0, token_1.getDecimals)(token)))
23
+ .div(this.getPrice(token));
24
+ };
25
+ PriceOracleData.prototype.convertToUSD = function (amount, token) {
26
+ return amount
27
+ .mul(this.getPrice(token))
28
+ .div(ethers_1.BigNumber.from(10).pow((0, token_1.getDecimals)(token)));
29
+ };
30
+ PriceOracleData.prototype.getPrice = function (token) {
31
+ var price = this._prices[token.toLowerCase()];
32
+ if (!price)
33
+ throw new Error("Price for ".concat(token, " not found"));
34
+ return price;
35
+ };
36
+ return PriceOracleData;
37
+ }());
38
+ exports.PriceOracleData = PriceOracleData;
@@ -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 = {}));
@@ -124,7 +124,7 @@ export declare type AddCollateralEvent = TypedEvent<[
124
124
  ], AddCollateralEventObject>;
125
125
  export declare type AddCollateralEventFilter = TypedEventFilter<AddCollateralEvent>;
126
126
  export interface CloseCreditAccountEventObject {
127
- owner: string;
127
+ borrower: string;
128
128
  to: string;
129
129
  }
130
130
  export declare type CloseCreditAccountEvent = TypedEvent<[
@@ -151,7 +151,7 @@ export declare type IncreaseBorrowedAmountEvent = TypedEvent<[
151
151
  ], IncreaseBorrowedAmountEventObject>;
152
152
  export declare type IncreaseBorrowedAmountEventFilter = TypedEventFilter<IncreaseBorrowedAmountEvent>;
153
153
  export interface LiquidateCreditAccountEventObject {
154
- owner: string;
154
+ borrower: string;
155
155
  liquidator: string;
156
156
  to: string;
157
157
  remainingFunds: BigNumber;
@@ -164,7 +164,7 @@ export declare type LiquidateCreditAccountEvent = TypedEvent<[
164
164
  ], LiquidateCreditAccountEventObject>;
165
165
  export declare type LiquidateCreditAccountEventFilter = TypedEventFilter<LiquidateCreditAccountEvent>;
166
166
  export interface LiquidateExpiredCreditAccountEventObject {
167
- owner: string;
167
+ borrower: string;
168
168
  liquidator: string;
169
169
  to: string;
170
170
  remainingFunds: BigNumber;
@@ -202,7 +202,7 @@ export declare type OpenCreditAccountEvent = TypedEvent<[
202
202
  ], OpenCreditAccountEventObject>;
203
203
  export declare type OpenCreditAccountEventFilter = TypedEventFilter<OpenCreditAccountEvent>;
204
204
  export interface TokenDisabledEventObject {
205
- creditAccount: string;
205
+ borrower: string;
206
206
  token: string;
207
207
  }
208
208
  export declare type TokenDisabledEvent = TypedEvent<[
@@ -211,7 +211,7 @@ export declare type TokenDisabledEvent = TypedEvent<[
211
211
  ], TokenDisabledEventObject>;
212
212
  export declare type TokenDisabledEventFilter = TypedEventFilter<TokenDisabledEvent>;
213
213
  export interface TokenEnabledEventObject {
214
- creditAccount: string;
214
+ borrower: string;
215
215
  token: string;
216
216
  }
217
217
  export declare type TokenEnabledEvent = TypedEvent<[
@@ -434,26 +434,26 @@ export interface ICreditFacade extends BaseContract {
434
434
  filters: {
435
435
  "AddCollateral(address,address,uint256)"(onBehalfOf?: string | null, token?: string | null, value?: null): AddCollateralEventFilter;
436
436
  AddCollateral(onBehalfOf?: string | null, token?: string | null, value?: null): AddCollateralEventFilter;
437
- "CloseCreditAccount(address,address)"(owner?: string | null, to?: string | null): CloseCreditAccountEventFilter;
438
- CloseCreditAccount(owner?: string | null, to?: string | null): CloseCreditAccountEventFilter;
437
+ "CloseCreditAccount(address,address)"(borrower?: string | null, to?: string | null): CloseCreditAccountEventFilter;
438
+ CloseCreditAccount(borrower?: string | null, to?: string | null): CloseCreditAccountEventFilter;
439
439
  "DecreaseBorrowedAmount(address,uint256)"(borrower?: string | null, amount?: null): DecreaseBorrowedAmountEventFilter;
440
440
  DecreaseBorrowedAmount(borrower?: string | null, amount?: null): DecreaseBorrowedAmountEventFilter;
441
441
  "IncreaseBorrowedAmount(address,uint256)"(borrower?: string | null, amount?: null): IncreaseBorrowedAmountEventFilter;
442
442
  IncreaseBorrowedAmount(borrower?: string | null, amount?: null): IncreaseBorrowedAmountEventFilter;
443
- "LiquidateCreditAccount(address,address,address,uint256)"(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
444
- LiquidateCreditAccount(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
445
- "LiquidateExpiredCreditAccount(address,address,address,uint256)"(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
446
- LiquidateExpiredCreditAccount(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
443
+ "LiquidateCreditAccount(address,address,address,uint256)"(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
444
+ LiquidateCreditAccount(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
445
+ "LiquidateExpiredCreditAccount(address,address,address,uint256)"(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
446
+ LiquidateExpiredCreditAccount(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
447
447
  "MultiCallFinished()"(): MultiCallFinishedEventFilter;
448
448
  MultiCallFinished(): MultiCallFinishedEventFilter;
449
449
  "MultiCallStarted(address)"(borrower?: string | null): MultiCallStartedEventFilter;
450
450
  MultiCallStarted(borrower?: string | null): MultiCallStartedEventFilter;
451
451
  "OpenCreditAccount(address,address,uint256,uint16)"(onBehalfOf?: string | null, creditAccount?: string | null, borrowAmount?: null, referralCode?: null): OpenCreditAccountEventFilter;
452
452
  OpenCreditAccount(onBehalfOf?: string | null, creditAccount?: string | null, borrowAmount?: null, referralCode?: null): OpenCreditAccountEventFilter;
453
- "TokenDisabled(address,address)"(creditAccount?: null, token?: null): TokenDisabledEventFilter;
454
- TokenDisabled(creditAccount?: null, token?: null): TokenDisabledEventFilter;
455
- "TokenEnabled(address,address)"(creditAccount?: null, token?: null): TokenEnabledEventFilter;
456
- TokenEnabled(creditAccount?: null, token?: null): TokenEnabledEventFilter;
453
+ "TokenDisabled(address,address)"(borrower?: null, token?: null): TokenDisabledEventFilter;
454
+ TokenDisabled(borrower?: null, token?: null): TokenDisabledEventFilter;
455
+ "TokenEnabled(address,address)"(borrower?: null, token?: null): TokenEnabledEventFilter;
456
+ TokenEnabled(borrower?: null, token?: null): TokenEnabledEventFilter;
457
457
  "TransferAccount(address,address)"(oldOwner?: string | null, newOwner?: string | null): TransferAccountEventFilter;
458
458
  TransferAccount(oldOwner?: string | null, newOwner?: string | null): TransferAccountEventFilter;
459
459
  "TransferAccountAllowed(address,address,bool)"(from?: string | null, to?: string | null, state?: null): TransferAccountAllowedEventFilter;
@@ -45,7 +45,7 @@ export declare type AddCollateralEvent = TypedEvent<[
45
45
  ], AddCollateralEventObject>;
46
46
  export declare type AddCollateralEventFilter = TypedEventFilter<AddCollateralEvent>;
47
47
  export interface CloseCreditAccountEventObject {
48
- owner: string;
48
+ borrower: string;
49
49
  to: string;
50
50
  }
51
51
  export declare type CloseCreditAccountEvent = TypedEvent<[
@@ -72,7 +72,7 @@ export declare type IncreaseBorrowedAmountEvent = TypedEvent<[
72
72
  ], IncreaseBorrowedAmountEventObject>;
73
73
  export declare type IncreaseBorrowedAmountEventFilter = TypedEventFilter<IncreaseBorrowedAmountEvent>;
74
74
  export interface LiquidateCreditAccountEventObject {
75
- owner: string;
75
+ borrower: string;
76
76
  liquidator: string;
77
77
  to: string;
78
78
  remainingFunds: BigNumber;
@@ -85,7 +85,7 @@ export declare type LiquidateCreditAccountEvent = TypedEvent<[
85
85
  ], LiquidateCreditAccountEventObject>;
86
86
  export declare type LiquidateCreditAccountEventFilter = TypedEventFilter<LiquidateCreditAccountEvent>;
87
87
  export interface LiquidateExpiredCreditAccountEventObject {
88
- owner: string;
88
+ borrower: string;
89
89
  liquidator: string;
90
90
  to: string;
91
91
  remainingFunds: BigNumber;
@@ -123,7 +123,7 @@ export declare type OpenCreditAccountEvent = TypedEvent<[
123
123
  ], OpenCreditAccountEventObject>;
124
124
  export declare type OpenCreditAccountEventFilter = TypedEventFilter<OpenCreditAccountEvent>;
125
125
  export interface TokenDisabledEventObject {
126
- creditAccount: string;
126
+ borrower: string;
127
127
  token: string;
128
128
  }
129
129
  export declare type TokenDisabledEvent = TypedEvent<[
@@ -132,7 +132,7 @@ export declare type TokenDisabledEvent = TypedEvent<[
132
132
  ], TokenDisabledEventObject>;
133
133
  export declare type TokenDisabledEventFilter = TypedEventFilter<TokenDisabledEvent>;
134
134
  export interface TokenEnabledEventObject {
135
- creditAccount: string;
135
+ borrower: string;
136
136
  token: string;
137
137
  }
138
138
  export declare type TokenEnabledEvent = TypedEvent<[
@@ -179,26 +179,26 @@ export interface ICreditFacadeEvents extends BaseContract {
179
179
  filters: {
180
180
  "AddCollateral(address,address,uint256)"(onBehalfOf?: string | null, token?: string | null, value?: null): AddCollateralEventFilter;
181
181
  AddCollateral(onBehalfOf?: string | null, token?: string | null, value?: null): AddCollateralEventFilter;
182
- "CloseCreditAccount(address,address)"(owner?: string | null, to?: string | null): CloseCreditAccountEventFilter;
183
- CloseCreditAccount(owner?: string | null, to?: string | null): CloseCreditAccountEventFilter;
182
+ "CloseCreditAccount(address,address)"(borrower?: string | null, to?: string | null): CloseCreditAccountEventFilter;
183
+ CloseCreditAccount(borrower?: string | null, to?: string | null): CloseCreditAccountEventFilter;
184
184
  "DecreaseBorrowedAmount(address,uint256)"(borrower?: string | null, amount?: null): DecreaseBorrowedAmountEventFilter;
185
185
  DecreaseBorrowedAmount(borrower?: string | null, amount?: null): DecreaseBorrowedAmountEventFilter;
186
186
  "IncreaseBorrowedAmount(address,uint256)"(borrower?: string | null, amount?: null): IncreaseBorrowedAmountEventFilter;
187
187
  IncreaseBorrowedAmount(borrower?: string | null, amount?: null): IncreaseBorrowedAmountEventFilter;
188
- "LiquidateCreditAccount(address,address,address,uint256)"(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
189
- LiquidateCreditAccount(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
190
- "LiquidateExpiredCreditAccount(address,address,address,uint256)"(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
191
- LiquidateExpiredCreditAccount(owner?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
188
+ "LiquidateCreditAccount(address,address,address,uint256)"(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
189
+ LiquidateCreditAccount(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateCreditAccountEventFilter;
190
+ "LiquidateExpiredCreditAccount(address,address,address,uint256)"(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
191
+ LiquidateExpiredCreditAccount(borrower?: string | null, liquidator?: string | null, to?: string | null, remainingFunds?: null): LiquidateExpiredCreditAccountEventFilter;
192
192
  "MultiCallFinished()"(): MultiCallFinishedEventFilter;
193
193
  MultiCallFinished(): MultiCallFinishedEventFilter;
194
194
  "MultiCallStarted(address)"(borrower?: string | null): MultiCallStartedEventFilter;
195
195
  MultiCallStarted(borrower?: string | null): MultiCallStartedEventFilter;
196
196
  "OpenCreditAccount(address,address,uint256,uint16)"(onBehalfOf?: string | null, creditAccount?: string | null, borrowAmount?: null, referralCode?: null): OpenCreditAccountEventFilter;
197
197
  OpenCreditAccount(onBehalfOf?: string | null, creditAccount?: string | null, borrowAmount?: null, referralCode?: null): OpenCreditAccountEventFilter;
198
- "TokenDisabled(address,address)"(creditAccount?: null, token?: null): TokenDisabledEventFilter;
199
- TokenDisabled(creditAccount?: null, token?: null): TokenDisabledEventFilter;
200
- "TokenEnabled(address,address)"(creditAccount?: null, token?: null): TokenEnabledEventFilter;
201
- TokenEnabled(creditAccount?: null, token?: null): TokenEnabledEventFilter;
198
+ "TokenDisabled(address,address)"(borrower?: null, token?: null): TokenDisabledEventFilter;
199
+ TokenDisabled(borrower?: null, token?: null): TokenDisabledEventFilter;
200
+ "TokenEnabled(address,address)"(borrower?: null, token?: null): TokenEnabledEventFilter;
201
+ TokenEnabled(borrower?: null, token?: null): TokenEnabledEventFilter;
202
202
  "TransferAccount(address,address)"(oldOwner?: string | null, newOwner?: string | null): TransferAccountEventFilter;
203
203
  TransferAccount(oldOwner?: string | null, newOwner?: string | null): TransferAccountEventFilter;
204
204
  "TransferAccountAllowed(address,address,bool)"(from?: string | null, to?: string | null, state?: null): TransferAccountAllowedEventFilter;
@@ -37,7 +37,7 @@ var _abi = [
37
37
  {
38
38
  indexed: true,
39
39
  internalType: "address",
40
- name: "owner",
40
+ name: "borrower",
41
41
  type: "address",
42
42
  },
43
43
  {
@@ -94,7 +94,7 @@ var _abi = [
94
94
  {
95
95
  indexed: true,
96
96
  internalType: "address",
97
- name: "owner",
97
+ name: "borrower",
98
98
  type: "address",
99
99
  },
100
100
  {
@@ -125,7 +125,7 @@ var _abi = [
125
125
  {
126
126
  indexed: true,
127
127
  internalType: "address",
128
- name: "owner",
128
+ name: "borrower",
129
129
  type: "address",
130
130
  },
131
131
  {
@@ -206,7 +206,7 @@ var _abi = [
206
206
  {
207
207
  indexed: false,
208
208
  internalType: "address",
209
- name: "creditAccount",
209
+ name: "borrower",
210
210
  type: "address",
211
211
  },
212
212
  {
@@ -225,7 +225,7 @@ var _abi = [
225
225
  {
226
226
  indexed: false,
227
227
  internalType: "address",
228
- name: "creditAccount",
228
+ name: "borrower",
229
229
  type: "address",
230
230
  },
231
231
  {
@@ -193,7 +193,7 @@ var _abi = [
193
193
  {
194
194
  indexed: true,
195
195
  internalType: "address",
196
- name: "owner",
196
+ name: "borrower",
197
197
  type: "address",
198
198
  },
199
199
  {
@@ -250,7 +250,7 @@ var _abi = [
250
250
  {
251
251
  indexed: true,
252
252
  internalType: "address",
253
- name: "owner",
253
+ name: "borrower",
254
254
  type: "address",
255
255
  },
256
256
  {
@@ -281,7 +281,7 @@ var _abi = [
281
281
  {
282
282
  indexed: true,
283
283
  internalType: "address",
284
- name: "owner",
284
+ name: "borrower",
285
285
  type: "address",
286
286
  },
287
287
  {
@@ -362,7 +362,7 @@ var _abi = [
362
362
  {
363
363
  indexed: false,
364
364
  internalType: "address",
365
- name: "creditAccount",
365
+ name: "borrower",
366
366
  type: "address",
367
367
  },
368
368
  {
@@ -381,7 +381,7 @@ var _abi = [
381
381
  {
382
382
  indexed: false,
383
383
  internalType: "address",
384
- name: "creditAccount",
384
+ name: "borrower",
385
385
  type: "address",
386
386
  },
387
387
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "1.5.14",
3
+ "version": "1.5.17",
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 });