@gearbox-protocol/sdk 0.0.102 → 0.0.103

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 (119) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.js +52 -0
  3. package/.husky/pre-push +4 -0
  4. package/lib/apy/convexAPY.js +3 -5
  5. package/lib/apy/lidoAPY.js +8 -9
  6. package/lib/contracts/contracts.d.ts +3 -3
  7. package/lib/contracts/contracts.js +2 -2
  8. package/lib/core/constants.d.ts +1 -1
  9. package/lib/core/constants.js +2 -2
  10. package/lib/core/creditAccount.js +7 -5
  11. package/lib/core/creditManager.d.ts +1 -1
  12. package/lib/core/creditManager.js +1 -7
  13. package/lib/core/creditSession.js +14 -3
  14. package/lib/core/eventOrTx.d.ts +1 -1
  15. package/lib/core/events.d.ts +19 -19
  16. package/lib/core/events.js +23 -21
  17. package/lib/core/pool.d.ts +1 -1
  18. package/lib/core/pool.js +1 -7
  19. package/lib/core/price.js +6 -1
  20. package/lib/core/strategy.d.ts +1 -3
  21. package/lib/core/strategy.js +14 -13
  22. package/lib/core/tokenDistributor.js +1 -1
  23. package/lib/core/transactions.d.ts +18 -3
  24. package/lib/core/transactions.js +39 -3
  25. package/lib/index.d.ts +1 -2
  26. package/lib/index.js +1 -1
  27. package/lib/oracles/priceFeeds.js +1 -1
  28. package/lib/pathfinder/convexLP.d.ts +1 -1
  29. package/lib/pathfinder/convexLP.js +26 -29
  30. package/lib/pathfinder/curveLP.d.ts +1 -1
  31. package/lib/pathfinder/curveLP.js +5 -7
  32. package/lib/pathfinder/path.d.ts +1 -1
  33. package/lib/pathfinder/path.js +38 -42
  34. package/lib/pathfinder/trade.d.ts +1 -2
  35. package/lib/pathfinder/tradeTypes.d.ts +5 -5
  36. package/lib/pathfinder/yVault.d.ts +2 -2
  37. package/lib/pathfinder/yVault.js +18 -15
  38. package/lib/strategies/curve.d.ts +6 -60
  39. package/lib/strategies/curve.js +6 -0
  40. package/lib/strategies/uniswapV2.js +3 -19
  41. package/lib/strategies/uniswapV3.js +1 -1
  42. package/lib/strategies/yearn.js +15 -11
  43. package/lib/tokens/convex.d.ts +3 -3
  44. package/lib/tokens/curveLP.d.ts +2 -2
  45. package/lib/tokens/curveLP.js +1 -1
  46. package/lib/tokens/gear.d.ts +2 -2
  47. package/lib/tokens/gear.js +1 -1
  48. package/lib/tokens/normal.d.ts +1 -1
  49. package/lib/tokens/token.js +4 -4
  50. package/lib/tokens/tokenData.d.ts +3 -1
  51. package/lib/tokens/tokenData.js +10 -8
  52. package/lib/tokens/yearn.d.ts +3 -3
  53. package/lib/utils/errors.d.ts +6 -0
  54. package/lib/utils/errors.js +13 -0
  55. package/lib/utils/formatter.d.ts +1 -1
  56. package/lib/utils/formatter.js +17 -14
  57. package/lib/utils/loading.d.ts +2 -1
  58. package/lib/utils/loading.js +9 -13
  59. package/lib/utils/mappers.js +2 -2
  60. package/lib/utils/network.js +2 -2
  61. package/lib/utils/repeater.js +12 -24
  62. package/lib/utils/validate.js +1 -1
  63. package/package.json +26 -8
  64. package/src/apy/convexAPY.ts +6 -6
  65. package/src/apy/lidoAPY.ts +12 -11
  66. package/src/contracts/contracts.ts +8 -7
  67. package/src/core/constants.ts +1 -1
  68. package/src/core/creditAccount.ts +28 -5
  69. package/src/core/creditManager.ts +29 -4
  70. package/src/core/creditOperation.ts +7 -7
  71. package/src/core/creditSession.ts +25 -5
  72. package/src/core/errors.ts +1 -0
  73. package/src/core/eventOrTx.ts +8 -5
  74. package/src/core/events.ts +85 -24
  75. package/src/core/history.ts +46 -46
  76. package/src/core/operations.ts +6 -0
  77. package/src/core/pool.ts +16 -4
  78. package/src/core/price.ts +7 -3
  79. package/src/core/strategy.ts +27 -23
  80. package/src/core/tokenDistributor.ts +2 -2
  81. package/src/core/transactions.ts +427 -350
  82. package/src/index.ts +1 -3
  83. package/src/oracles/priceFeeds.ts +523 -523
  84. package/src/pathfinder/contracts.ts +15 -13
  85. package/src/pathfinder/convexLP.ts +29 -25
  86. package/src/pathfinder/curveLP.ts +57 -53
  87. package/src/pathfinder/path.ts +17 -9
  88. package/src/pathfinder/priority.ts +11 -11
  89. package/src/pathfinder/trade.ts +84 -77
  90. package/src/pathfinder/tradeTypes.ts +98 -94
  91. package/src/pathfinder/yVault.ts +26 -11
  92. package/src/payload/token.ts +3 -3
  93. package/src/strategies/convex.ts +217 -210
  94. package/src/strategies/creditFacade.ts +70 -53
  95. package/src/strategies/curve.ts +263 -194
  96. package/src/strategies/lido.ts +33 -37
  97. package/src/strategies/uniswapV2.ts +90 -112
  98. package/src/strategies/uniswapV3.ts +114 -91
  99. package/src/strategies/yearn.ts +58 -62
  100. package/src/tokens/connectors.ts +6 -6
  101. package/src/tokens/convex.ts +297 -296
  102. package/src/tokens/curveLP.ts +170 -165
  103. package/src/tokens/gear.ts +47 -45
  104. package/src/tokens/normal.ts +801 -802
  105. package/src/tokens/token.ts +9 -5
  106. package/src/tokens/tokenData.ts +19 -9
  107. package/src/tokens/tokenType.ts +11 -11
  108. package/src/tokens/yearn.ts +126 -124
  109. package/src/utils/errors.ts +11 -0
  110. package/src/utils/formatter.ts +22 -18
  111. package/src/utils/loading.ts +14 -6
  112. package/src/utils/mappers.ts +8 -6
  113. package/src/utils/multicall.ts +2 -0
  114. package/src/utils/network.ts +21 -21
  115. package/src/utils/repeater.ts +2 -2
  116. package/src/utils/validate.ts +1 -1
  117. package/lib/utils/events.d.ts +0 -2
  118. package/lib/utils/events.js +0 -13
  119. package/src/utils/events.ts +0 -10
package/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ src/types
3
+ .eslintrc.js
4
+ *.d.ts
package/.eslintrc.js ADDED
@@ -0,0 +1,52 @@
1
+ module.exports = {
2
+ root: true,
3
+ parser: "@typescript-eslint/parser",
4
+ parserOptions: {
5
+ project: ["./tsconfig.json"],
6
+ tsconfigRootDir: __dirname
7
+ },
8
+ plugins: ["@typescript-eslint", "prettier"],
9
+ extends: [
10
+ "airbnb-base",
11
+ "airbnb-typescript/base",
12
+ "plugin:import/recommended",
13
+ "prettier"
14
+ ],
15
+ settings: {
16
+ "import/resolver": {
17
+ typescript: {},
18
+ node: {
19
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
20
+ moduleDirectory: ["node_modules", "./"]
21
+ }
22
+ },
23
+ react: {
24
+ version: "detect"
25
+ }
26
+ },
27
+ rules: {
28
+ "prettier/prettier": "error",
29
+ "import/no-extraneous-dependencies": ["error", { devDependencies: true }],
30
+ "@typescript-eslint/no-use-before-define": [
31
+ "error",
32
+ {
33
+ functions: false,
34
+ classes: false
35
+ }
36
+ ],
37
+ "no-console": ["error", { allow: ["warn", "error", "debug"] }],
38
+ "@typescript-eslint/default-param-last": ["warn"],
39
+
40
+ "no-nested-ternary": ["warn"],
41
+ "@typescript-eslint/no-unused-vars": ["warn"],
42
+ "no-underscore-dangle": ["error", { allowAfterThis: true }],
43
+
44
+ "react/no-unused-prop-types": ["off"], // switch on when necessary
45
+ "max-classes-per-file": ["off"],
46
+ "react/jsx-props-no-spreading": ["off"],
47
+ "react/no-array-index-key": ["off"],
48
+ "react/require-default-props": ["off"],
49
+ "import/prefer-default-export": ["off"],
50
+ "react/jsx-no-useless-fragment": ["off"]
51
+ }
52
+ };
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ yarn prepush
@@ -79,14 +79,12 @@ function getConvexApy(pool, provider, networkType, getTokenPrice) {
79
79
  basePoolAddress = contractsList[pool];
80
80
  swapPoolAddress = contractsList[curveSwapByPool[pool]];
81
81
  cvxAddress = tokenList.CVX;
82
- extraPoolAddresses = poolParams.extraRewards.map(function (d) {
83
- return d.poolAddress[networkType];
84
- });
82
+ extraPoolAddresses = poolParams.extraRewards.map(function (d) { return d.poolAddress[networkType]; });
85
83
  return [4 /*yield*/, getPoolData(basePoolAddress, swapPoolAddress, cvxAddress, extraPoolAddresses, provider)];
86
84
  case 1:
87
85
  _a = _b.sent(), basePoolRate = _a[0], basePoolSupply = _a[1], vPrice = _a[2], cvxSupply = _a[3], extra = _a.slice(4);
88
- cvxPrice = getTokenPrice(tokenList["CVX"]);
89
- crvPrice = getTokenPrice(tokenList["CRV"]);
86
+ cvxPrice = getTokenPrice(tokenList.CVX);
87
+ crvPrice = getTokenPrice(tokenList.CRV);
90
88
  crvPerSecond = basePoolRate;
91
89
  virtualSupply = basePoolSupply.mul(vPrice).div(constants_1.WAD);
92
90
  crvPerUnderlying = crvPerSecond.mul(constants_1.WAD).div(virtualSupply);
@@ -42,9 +42,8 @@ var contracts_1 = require("../contracts/contracts");
42
42
  var token_1 = require("../tokens/token");
43
43
  var constants_1 = require("../core/constants");
44
44
  var types_1 = require("../types");
45
- var lidoOracleAddress = contracts_1.contractParams.LIDO_STETH_GATEWAY
46
- .oracle;
47
- var lidoStEthAddress = {
45
+ var lidoOracles = contracts_1.contractParams.LIDO_STETH_GATEWAY.oracle;
46
+ var lidoStEth = {
48
47
  Mainnet: token_1.tokenDataByNetwork.Mainnet.STETH,
49
48
  Kovan: token_1.tokenDataByNetwork.Kovan.STETH
50
49
  };
@@ -54,13 +53,13 @@ function getLidoApy(provider, networkType) {
54
53
  return __generator(this, function (_c) {
55
54
  switch (_c.label) {
56
55
  case 0:
57
- if (!lidoOracleAddress[networkType]) {
58
- throw "No Lido APR oracle found on current network: ".concat(networkType);
56
+ if (!lidoOracles[networkType]) {
57
+ throw new Error("No Lido APR oracle found on current network: ".concat(networkType));
59
58
  }
60
- if (!lidoStEthAddress[networkType]) {
61
- throw "No Lido stETH found on current network: ".concat(networkType);
59
+ if (!lidoStEth[networkType]) {
60
+ throw new Error("No Lido stETH found on current network: ".concat(networkType));
62
61
  }
63
- return [4 /*yield*/, geLidoData(lidoOracleAddress[networkType], lidoStEthAddress[networkType], provider, networkType)];
62
+ return [4 /*yield*/, geLidoData(lidoOracles[networkType], lidoStEth[networkType], provider, networkType)];
64
63
  case 1:
65
64
  _a = _c.sent(), _b = _a[0], postTotalPooledEther = _b.postTotalPooledEther, preTotalPooledEther = _b.preTotalPooledEther, timeElapsed = _b.timeElapsed, fee = _a[1];
66
65
  lidoAPRRay = postTotalPooledEther
@@ -74,6 +73,7 @@ function getLidoApy(provider, networkType) {
74
73
  });
75
74
  }
76
75
  exports.getLidoApy = getLidoApy;
76
+ exports.LIDO_FEE_DECIMALS = 10000;
77
77
  function geLidoData(lidoOracleAddress, stETHAddress, provider, network) {
78
78
  return __awaiter(this, void 0, void 0, function () {
79
79
  var calls, _a, stats, _b, fee;
@@ -101,4 +101,3 @@ function geLidoData(lidoOracleAddress, stETHAddress, provider, network) {
101
101
  });
102
102
  });
103
103
  }
104
- exports.LIDO_FEE_DECIMALS = 10000;
@@ -1,9 +1,9 @@
1
1
  import { AdapterInterface } from "./adapters";
2
2
  import { NetworkType } from "../core/constants";
3
3
  import { Protocols } from "./protocols";
4
- import { ConvexStakedPhantomToken } from "../tokens/convex";
5
- import { CurveLPToken } from "../tokens/curveLP";
6
- import { NormalToken } from "../tokens/normal";
4
+ import type { ConvexStakedPhantomToken } from "../tokens/convex";
5
+ import type { CurveLPToken } from "../tokens/curveLP";
6
+ import type { NormalToken } from "../tokens/normal";
7
7
  export declare type UniswapV2Contract = "UNISWAP_V2_ROUTER" | "SUSHISWAP_ROUTER";
8
8
  export declare type CurvePoolContract = "CURVE_3CRV_POOL" | "CURVE_STETH_GATEWAY" | "CURVE_FRAX_POOL" | "CURVE_LUSD_POOL" | "CURVE_GUSD_POOL" | "CURVE_SUSD_POOL" | "CURVE_SUSD_DEPOSIT";
9
9
  export declare type YearnVaultContract = "YEARN_DAI_VAULT" | "YEARN_USDC_VAULT" | "YEARN_WETH_VAULT" | "YEARN_WBTC_VAULT" | "YEARN_CURVE_FRAX_VAULT" | "YEARN_CURVE_STETH_VAULT";
@@ -288,6 +288,6 @@ exports.contractParams = {
288
288
  }
289
289
  };
290
290
  exports.contractsByAddress = (0, mappers_1.objectEntries)(exports.contractsByNetwork).reduce(function (acc, _a) {
291
- var _ = _a[0], contracts = _a[1];
292
- return __assign(__assign({}, acc), (0, mappers_1.filterEmptyKeys)((0, mappers_1.keyToLowercase)((0, mappers_1.swapKeyValue)(contracts))));
291
+ var contracts = _a[1];
292
+ return (__assign(__assign({}, acc), (0, mappers_1.filterEmptyKeys)((0, mappers_1.keyToLowercase)((0, mappers_1.swapKeyValue)(contracts)))));
293
293
  }, {});
@@ -20,4 +20,4 @@ export declare const UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD = 9300;
20
20
  export declare const timeRanges: Record<string, number>;
21
21
  export declare const LEVERAGE_DECIMALS = 100;
22
22
  export declare const SLIPPAGE_DECIMALS = 100;
23
- export declare const ADDRESS_0x0 = "0x0000000000000000000000000000000000000000";
23
+ export declare const ADDRESS_0X0 = "0x0000000000000000000000000000000000000000";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ADDRESS_0x0 = exports.SLIPPAGE_DECIMALS = exports.LEVERAGE_DECIMALS = exports.timeRanges = exports.UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD = exports.LIQUIDATION_DISCOUNTED_SUM = exports.PERCENTAGE_FACTOR = exports.PERCENTAGE_DECIMALS = exports.SECONDS_PER_YEAR = exports.PRICE_DECIMALS = exports.PRICE_DECIMALS_POW = exports.WAD = exports.WAD_DECIMALS_POW = exports.halfRAY = exports.RAY = exports.RAY_DECIMALS_POW = exports.getNetworkType = exports.LOCAL_NETWORK = exports.KOVAN_NETWORK = exports.MAINNET_NETWORK = exports.MAX_INT = void 0;
3
+ exports.ADDRESS_0X0 = exports.SLIPPAGE_DECIMALS = exports.LEVERAGE_DECIMALS = exports.timeRanges = exports.UNDERLYING_TOKEN_LIQUIDATION_THRESHOLD = exports.LIQUIDATION_DISCOUNTED_SUM = exports.PERCENTAGE_FACTOR = exports.PERCENTAGE_DECIMALS = exports.SECONDS_PER_YEAR = exports.PRICE_DECIMALS = exports.PRICE_DECIMALS_POW = exports.WAD = exports.WAD_DECIMALS_POW = exports.halfRAY = exports.RAY = exports.RAY_DECIMALS_POW = exports.getNetworkType = exports.LOCAL_NETWORK = exports.KOVAN_NETWORK = exports.MAINNET_NETWORK = exports.MAX_INT = void 0;
4
4
  var ethers_1 = require("ethers");
5
5
  exports.MAX_INT = ethers_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
6
6
  exports.MAINNET_NETWORK = 1;
@@ -39,4 +39,4 @@ exports.timeRanges = {
39
39
  };
40
40
  exports.LEVERAGE_DECIMALS = 100;
41
41
  exports.SLIPPAGE_DECIMALS = 100;
42
- exports.ADDRESS_0x0 = "0x0000000000000000000000000000000000000000";
42
+ exports.ADDRESS_0X0 = "0x0000000000000000000000000000000000000000";
@@ -74,11 +74,13 @@ function sortBalances(balances, prices, tokens) {
74
74
  var price2 = prices[addr2Lc] || constants_1.PRICE_DECIMALS;
75
75
  var totalPrice1 = (0, price_1.calcTotalPrice)(price1, amount1, token1 === null || token1 === void 0 ? void 0 : token1.decimals);
76
76
  var totalPrice2 = (0, price_1.calcTotalPrice)(price2, amount2, token2 === null || token2 === void 0 ? void 0 : token2.decimals);
77
- return totalPrice1.eq(totalPrice2)
78
- ? tokensAbcComparator(token1, token2)
79
- : totalPrice1.gt(totalPrice2)
80
- ? -1
81
- : 1;
77
+ if (totalPrice1.eq(totalPrice2)) {
78
+ return tokensAbcComparator(token1, token2);
79
+ }
80
+ if (totalPrice1.gt(totalPrice2)) {
81
+ return -1;
82
+ }
83
+ return 1;
82
84
  });
83
85
  }
84
86
  exports.sortBalances = sortBalances;
@@ -22,8 +22,8 @@ export declare class CreditManagerData {
22
22
  readonly degenNFT: string;
23
23
  readonly isIncreaseDebtForbidden: boolean;
24
24
  readonly forbiddenTokenMask: BigNumber;
25
+ readonly isPaused: boolean;
25
26
  constructor(payload: CreditManagerDataPayload);
26
- get isPaused(): boolean;
27
27
  getContractETH(signer: Signer | ethers.providers.Provider): ICreditManager;
28
28
  contractToAdapter(contractAddress: string): string | undefined;
29
29
  encodeAddCollateral(accountAddress: string, tokenAddress: string, amount: BigNumber): MultiCall;
@@ -33,6 +33,7 @@ var constants_1 = require("./constants");
33
33
  var errors_1 = require("./errors");
34
34
  var CreditManagerData = /** @class */ (function () {
35
35
  function CreditManagerData(payload) {
36
+ this.isPaused = false;
36
37
  this.id = payload.addr;
37
38
  this.address = payload.addr;
38
39
  this.underlyingToken = payload.underlying || "";
@@ -67,13 +68,6 @@ var CreditManagerData = /** @class */ (function () {
67
68
  this.isIncreaseDebtForbidden = payload.isIncreaseDebtForbidden || false;
68
69
  this.forbiddenTokenMask = ethers_1.BigNumber.from(payload.forbiddenTokenMask || 0);
69
70
  }
70
- Object.defineProperty(CreditManagerData.prototype, "isPaused", {
71
- get: function () {
72
- return false;
73
- },
74
- enumerable: false,
75
- configurable: true
76
- });
77
71
  CreditManagerData.prototype.getContractETH = function (signer) {
78
72
  return types_1.ICreditManager__factory.connect(this.address, signer);
79
73
  };
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -11,7 +22,7 @@ var statusEnum = [
11
22
  "active",
12
23
  "closed",
13
24
  "repaid",
14
- "liquidated",
25
+ "liquidated"
15
26
  ];
16
27
  var CreditSession = /** @class */ (function () {
17
28
  function CreditSession(payload) {
@@ -33,8 +44,8 @@ var CreditSession = /** @class */ (function () {
33
44
  ethers_1.BigNumber.from(payload.healthFactor || 0).toNumber() / constants_1.PERCENTAGE_FACTOR;
34
45
  this.score = payload.score;
35
46
  this.operations = (payload.operations || []).map(function (op) {
36
- op.date = (0, moment_1.default)(op.timestamp * 1000).format("Do MMM YYYY");
37
- return op;
47
+ var formattedOp = __assign(__assign({}, op), { date: (0, moment_1.default)(op.timestamp * 1000).format("Do MMM YYYY") });
48
+ return formattedOp;
38
49
  });
39
50
  this.sinceDate = (0, moment_1.default)(payload.sinceTimestamp * 1000).format("Do MMM YYYY");
40
51
  this.closedAtDate = (0, moment_1.default)(payload.closedAtTimestamp * 1000).format("Do MMM YYYY");
@@ -1,5 +1,5 @@
1
1
  import { TokenData } from "../tokens/tokenData";
2
- import { TxSerialized } from "./transactions";
2
+ import type { TxSerialized } from "./transactions";
3
3
  export interface Display {
4
4
  toString(tokenData: Record<string, TokenData>): string;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { TokenData } from "../tokens/tokenData";
2
1
  import { BigNumber } from "ethers";
2
+ import { TokenData } from "../tokens/tokenData";
3
3
  import { EVMEvent, EVMTx, EVMEventProps } from "./eventOrTx";
4
4
  export interface EventSerialized {
5
5
  type: "EventAddLiquidity" | "EventRemoveLiquidity" | "EventOpenCreditAccount" | "EventCloseCreditAccount" | "EventLiquidateCreditAccount" | "EventRepayCreditAccount" | "EventAddCollateral" | "EventIncreaseBorrowAmount" | "EventCMNewParameters" | "EventTokenAllowed" | "EventTokenForbidden" | "EventContractAllowed" | "EventContractForbidden" | "EventNewFastCheckParameters" | "EventPriceOracleUpdated" | "EventTransferPluginAllowed" | "EventNewInterestRateModel" | "EventNewCreditManagerConnected" | "EventBorrowForbidden" | "EventNewExpectedLiquidityLimit" | "EventNewWithdrawFee" | "EventNewPriceFeed" | "EventTakeForever" | "EventPaused" | "EventUnPaused" | "EventPausableAdminAdded" | "EventPausableAdminRemoved" | "EventUnpausableAdminAdded" | "EventUnpausableAdminRemoved" | "EventOwnershipTransferred";
@@ -82,7 +82,7 @@ export declare class EventRepayCreditAccount extends EVMEvent {
82
82
  readonly underlyingToken: string;
83
83
  readonly creditManager: string;
84
84
  constructor(opts: RepayCreditAccountProps);
85
- toString(_: Record<string, TokenData>): string;
85
+ toString(): string;
86
86
  }
87
87
  interface AddCollateralProps extends EVMEventProps {
88
88
  amount: string;
@@ -182,7 +182,7 @@ export declare class EventContractAllowed extends EVMEvent {
182
182
  readonly adapter: string;
183
183
  readonly status: EventContractAllowedStatus;
184
184
  constructor(opts: ContractAllowedProps);
185
- toString(_: Record<string, TokenData>): string;
185
+ toString(): string;
186
186
  }
187
187
  interface ContractForbiddenProps extends EVMEventProps {
188
188
  creditManager: string;
@@ -192,7 +192,7 @@ export declare class EventContractForbidden extends EVMEvent {
192
192
  readonly creditManager: string;
193
193
  readonly protocol: string;
194
194
  constructor(opts: ContractForbiddenProps);
195
- toString(_: Record<string, TokenData>): string;
195
+ toString(): string;
196
196
  }
197
197
  interface NewFastCheckParametersProps extends EVMEventProps {
198
198
  creditManager: string;
@@ -208,7 +208,7 @@ export declare class EventNewFastCheckParameters extends EVMEvent {
208
208
  readonly prevChiThreshold?: number;
209
209
  readonly prevFastCheckDelay?: number;
210
210
  constructor(opts: NewFastCheckParametersProps);
211
- toString(_: Record<string, TokenData>): string;
211
+ toString(): string;
212
212
  }
213
213
  interface PriceOracleUpdatedProps extends EVMEventProps {
214
214
  creditManager: string;
@@ -218,7 +218,7 @@ export declare class EventPriceOracleUpdated extends EVMEvent {
218
218
  readonly creditManager: string;
219
219
  readonly priceOracle: string;
220
220
  constructor(opts: PriceOracleUpdatedProps);
221
- toString(_: Record<string, TokenData>): string;
221
+ toString(): string;
222
222
  }
223
223
  interface TransferPluginAllowedProps extends EVMEventProps {
224
224
  creditManager: string;
@@ -230,7 +230,7 @@ export declare class EventTransferPluginAllowed extends EVMEvent {
230
230
  readonly plugin: string;
231
231
  readonly state: boolean;
232
232
  constructor(opts: TransferPluginAllowedProps);
233
- toString(_: Record<string, TokenData>): string;
233
+ toString(): string;
234
234
  }
235
235
  interface NewInterestRateModelProps extends EVMEventProps {
236
236
  pool: string;
@@ -240,7 +240,7 @@ export declare class EventNewInterestRateModel extends EVMEvent {
240
240
  readonly pool: string;
241
241
  readonly newInterestRateModel: string;
242
242
  constructor(opts: NewInterestRateModelProps);
243
- toString(_: Record<string, TokenData>): string;
243
+ toString(): string;
244
244
  }
245
245
  interface NewCreditManagerConnectedProps extends EVMEventProps {
246
246
  pool: string;
@@ -250,7 +250,7 @@ export declare class EventNewCreditManagerConnected extends EVMEvent {
250
250
  readonly pool: string;
251
251
  readonly creditManager: string;
252
252
  constructor(opts: NewCreditManagerConnectedProps);
253
- toString(_: Record<string, TokenData>): string;
253
+ toString(): string;
254
254
  }
255
255
  interface BorrowForbiddenProps extends EVMEventProps {
256
256
  pool: string;
@@ -260,7 +260,7 @@ export declare class EventBorrowForbidden extends EVMEvent {
260
260
  readonly pool: string;
261
261
  readonly creditManager: string;
262
262
  constructor(opts: BorrowForbiddenProps);
263
- toString(_: Record<string, TokenData>): string;
263
+ toString(): string;
264
264
  }
265
265
  interface NewExpectedLiquidityLimitProps extends EVMEventProps {
266
266
  pool: string;
@@ -288,7 +288,7 @@ export declare class EventNewWithdrawFee extends EVMEvent {
288
288
  readonly newFee: number;
289
289
  readonly prevFee: number;
290
290
  constructor(opts: NewWithdrawFeeProps);
291
- toString(_: Record<string, TokenData>): string;
291
+ toString(): string;
292
292
  }
293
293
  interface NewPriceFeedProps extends EVMEventProps {
294
294
  token: string;
@@ -308,7 +308,7 @@ export declare class EventTakeForever extends EVMEvent {
308
308
  readonly creditAccount: string;
309
309
  readonly to: string;
310
310
  constructor(opts: TakeForeverProps);
311
- toString(_: Record<string, TokenData>): string;
311
+ toString(): string;
312
312
  }
313
313
  interface PausedProps extends EVMEventProps {
314
314
  contract: string;
@@ -316,7 +316,7 @@ interface PausedProps extends EVMEventProps {
316
316
  export declare class EventPaused extends EVMEvent {
317
317
  readonly contract: string;
318
318
  constructor(opts: PausedProps);
319
- toString(_: Record<string, TokenData>): string;
319
+ toString(): string;
320
320
  }
321
321
  interface UnPausedProps extends EVMEventProps {
322
322
  contract: string;
@@ -324,7 +324,7 @@ interface UnPausedProps extends EVMEventProps {
324
324
  export declare class EventUnPaused extends EVMEvent {
325
325
  readonly contract: string;
326
326
  constructor(opts: UnPausedProps);
327
- toString(_: Record<string, TokenData>): string;
327
+ toString(): string;
328
328
  }
329
329
  interface PausableAdminAddedProps extends EVMEventProps {
330
330
  admin: string;
@@ -332,7 +332,7 @@ interface PausableAdminAddedProps extends EVMEventProps {
332
332
  export declare class EventPausableAdminAdded extends EVMEvent {
333
333
  readonly admin: string;
334
334
  constructor(opts: PausableAdminAddedProps);
335
- toString(_: Record<string, TokenData>): string;
335
+ toString(): string;
336
336
  }
337
337
  interface PausableAdminRemovedProps extends EVMEventProps {
338
338
  admin: string;
@@ -340,7 +340,7 @@ interface PausableAdminRemovedProps extends EVMEventProps {
340
340
  export declare class EventPausableAdminRemoved extends EVMEvent {
341
341
  readonly admin: string;
342
342
  constructor(opts: PausableAdminRemovedProps);
343
- toString(_: Record<string, TokenData>): string;
343
+ toString(): string;
344
344
  }
345
345
  interface UnPausableAdminAddedProps extends EVMEventProps {
346
346
  admin: string;
@@ -348,7 +348,7 @@ interface UnPausableAdminAddedProps extends EVMEventProps {
348
348
  export declare class EventUnPausableAdminAdded extends EVMEvent {
349
349
  readonly admin: string;
350
350
  constructor(opts: UnPausableAdminAddedProps);
351
- toString(_: Record<string, TokenData>): string;
351
+ toString(): string;
352
352
  }
353
353
  interface UnPausableAdminRemovedProps extends EVMEventProps {
354
354
  admin: string;
@@ -356,7 +356,7 @@ interface UnPausableAdminRemovedProps extends EVMEventProps {
356
356
  export declare class EventUnPausableAdminRemoved extends EVMEvent {
357
357
  readonly admin: string;
358
358
  constructor(opts: UnPausableAdminRemovedProps);
359
- toString(_: Record<string, TokenData>): string;
359
+ toString(): string;
360
360
  }
361
361
  interface TransferOwnershipProps extends EVMEventProps {
362
362
  admin: string;
@@ -364,6 +364,6 @@ interface TransferOwnershipProps extends EVMEventProps {
364
364
  export declare class EventTransferOwnership extends EVMEvent {
365
365
  readonly newOwner: string;
366
366
  constructor(opts: TransferOwnershipProps);
367
- toString(_: Record<string, TokenData>): string;
367
+ toString(): string;
368
368
  }
369
369
  export {};
@@ -95,9 +95,7 @@ var EventParser = /** @class */ (function () {
95
95
  }
96
96
  };
97
97
  EventParser.deserializeArray = function (data) {
98
- return data.map(function (e) {
99
- return EventParser.deserialize(e);
100
- });
98
+ return data.map(function (e) { return EventParser.deserialize(e); });
101
99
  };
102
100
  return EventParser;
103
101
  }());
@@ -218,7 +216,7 @@ var EventRepayCreditAccount = /** @class */ (function (_super) {
218
216
  _this.creditManager = opts.creditManager;
219
217
  return _this;
220
218
  }
221
- EventRepayCreditAccount.prototype.toString = function (_) {
219
+ EventRepayCreditAccount.prototype.toString = function () {
222
220
  return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": was repaid");
223
221
  };
224
222
  return EventRepayCreditAccount;
@@ -339,6 +337,8 @@ var EventTokenAllowed = /** @class */ (function (_super) {
339
337
  return "".concat(msg, ": ").concat(token.symbol, " is allowed now, liquidation threshold: ").concat(this.liquidityThreshold / constants_1.PERCENTAGE_DECIMALS, "%");
340
338
  case "LTUpdated":
341
339
  return "".concat(msg, ": ").concat(token.symbol, " liquidation threshold: ").concat((this.prevLiquidationThreshold || 0) / constants_1.PERCENTAGE_DECIMALS, " => ").concat(this.liquidityThreshold / constants_1.PERCENTAGE_DECIMALS, "%");
340
+ default:
341
+ return "Error: TokenAllowedProps";
342
342
  }
343
343
  };
344
344
  return EventTokenAllowed;
@@ -377,13 +377,15 @@ var EventContractAllowed = /** @class */ (function (_super) {
377
377
  _this.status = opts.status;
378
378
  return _this;
379
379
  }
380
- EventContractAllowed.prototype.toString = function (_) {
380
+ EventContractAllowed.prototype.toString = function () {
381
381
  var msg = "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated");
382
382
  switch (this.status) {
383
383
  case "Connected":
384
384
  return "".concat(msg, " : ").concat((0, contractsRegister_1.getContractName)(this.protocol), " was connected. Adapter at: ").concat(this.adapter);
385
385
  case "AdapterUpdate":
386
386
  return "".concat(msg, " : ").concat((0, contractsRegister_1.getContractName)(this.protocol), " adapter was updated. New adapter: ").concat(this.adapter);
387
+ default:
388
+ return "Error: EventContractAllowed";
387
389
  }
388
390
  };
389
391
  return EventContractAllowed;
@@ -401,7 +403,7 @@ var EventContractForbidden = /** @class */ (function (_super) {
401
403
  _this.protocol = opts.protocol;
402
404
  return _this;
403
405
  }
404
- EventContractForbidden.prototype.toString = function (_) {
406
+ EventContractForbidden.prototype.toString = function () {
405
407
  return "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated: ").concat((0, contractsRegister_1.getContractName)(this.protocol));
406
408
  };
407
409
  return EventContractForbidden;
@@ -422,7 +424,7 @@ var EventNewFastCheckParameters = /** @class */ (function (_super) {
422
424
  _this.prevFastCheckDelay = opts.prevFastCheckDelay;
423
425
  return _this;
424
426
  }
425
- EventNewFastCheckParameters.prototype.toString = function (_) {
427
+ EventNewFastCheckParameters.prototype.toString = function () {
426
428
  var msg = "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated: ");
427
429
  if (this.chiThreshold !== this.prevChiThreshold) {
428
430
  msg += "Chi threshold: ".concat(this.prevChiThreshold, " => ").concat(this.chiThreshold, ", ");
@@ -447,7 +449,7 @@ var EventPriceOracleUpdated = /** @class */ (function (_super) {
447
449
  _this.priceOracle = opts.priceOracle;
448
450
  return _this;
449
451
  }
450
- EventPriceOracleUpdated.prototype.toString = function (_) {
452
+ EventPriceOracleUpdated.prototype.toString = function () {
451
453
  return "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated: price oracle was updated. New price oracle ").concat((0, contractsRegister_1.getContractName)(this.priceOracle));
452
454
  };
453
455
  return EventPriceOracleUpdated;
@@ -466,7 +468,7 @@ var EventTransferPluginAllowed = /** @class */ (function (_super) {
466
468
  _this.state = opts.state;
467
469
  return _this;
468
470
  }
469
- EventTransferPluginAllowed.prototype.toString = function (_) {
471
+ EventTransferPluginAllowed.prototype.toString = function () {
470
472
  return "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated: transfer plugin ").concat((0, contractsRegister_1.getContractName)(this.plugin), " was ").concat(this.state ? "allowed" : "forbidden");
471
473
  };
472
474
  return EventTransferPluginAllowed;
@@ -484,7 +486,7 @@ var EventNewInterestRateModel = /** @class */ (function (_super) {
484
486
  _this.newInterestRateModel = opts.newInterestRateModel;
485
487
  return _this;
486
488
  }
487
- EventNewInterestRateModel.prototype.toString = function (_) {
489
+ EventNewInterestRateModel.prototype.toString = function () {
488
490
  return "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: interest rate model was updated. New model: ").concat((0, contractsRegister_1.getContractName)(this.newInterestRateModel));
489
491
  };
490
492
  return EventNewInterestRateModel;
@@ -502,7 +504,7 @@ var EventNewCreditManagerConnected = /** @class */ (function (_super) {
502
504
  _this.creditManager = opts.creditManager;
503
505
  return _this;
504
506
  }
505
- EventNewCreditManagerConnected.prototype.toString = function (_) {
507
+ EventNewCreditManagerConnected.prototype.toString = function () {
506
508
  return "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: new credit manager ").concat((0, contractsRegister_1.getContractName)(this.creditManager), " was connected");
507
509
  };
508
510
  return EventNewCreditManagerConnected;
@@ -520,7 +522,7 @@ var EventBorrowForbidden = /** @class */ (function (_super) {
520
522
  _this.creditManager = opts.creditManager;
521
523
  return _this;
522
524
  }
523
- EventBorrowForbidden.prototype.toString = function (_) {
525
+ EventBorrowForbidden.prototype.toString = function () {
524
526
  return "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: credit manager ").concat((0, contractsRegister_1.getContractName)(this.creditManager), " was forbidden to borrow");
525
527
  };
526
528
  return EventBorrowForbidden;
@@ -563,7 +565,7 @@ var EventNewWithdrawFee = /** @class */ (function (_super) {
563
565
  _this.prevFee = Number(opts.oldFee);
564
566
  return _this;
565
567
  }
566
- EventNewWithdrawFee.prototype.toString = function (_) {
568
+ EventNewWithdrawFee.prototype.toString = function () {
567
569
  return this.prevFee === 0
568
570
  ? "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: withdraw fee was set to: ").concat(this.newFee / constants_1.PERCENTAGE_DECIMALS, "%")
569
571
  : "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: withdraw fee was ").concat(this.newFee > this.prevFee ? "increased" : "decreased", ": ").concat(this.prevFee / constants_1.PERCENTAGE_DECIMALS, "% => ").concat(this.newFee / constants_1.PERCENTAGE_DECIMALS, "%");
@@ -602,7 +604,7 @@ var EventTakeForever = /** @class */ (function (_super) {
602
604
  _this.to = opts.to;
603
605
  return _this;
604
606
  }
605
- EventTakeForever.prototype.toString = function (_) {
607
+ EventTakeForever.prototype.toString = function () {
606
608
  return "AccountFactory: account ".concat(this.creditAccount, " was taken forever and transferred to ").concat(this.to);
607
609
  };
608
610
  return EventTakeForever;
@@ -619,7 +621,7 @@ var EventPaused = /** @class */ (function (_super) {
619
621
  _this.contract = opts.contract;
620
622
  return _this;
621
623
  }
622
- EventPaused.prototype.toString = function (_) {
624
+ EventPaused.prototype.toString = function () {
623
625
  return "".concat((0, contractsRegister_1.getContractName)(this.contract), " was paused");
624
626
  };
625
627
  return EventPaused;
@@ -636,7 +638,7 @@ var EventUnPaused = /** @class */ (function (_super) {
636
638
  _this.contract = opts.contract;
637
639
  return _this;
638
640
  }
639
- EventUnPaused.prototype.toString = function (_) {
641
+ EventUnPaused.prototype.toString = function () {
640
642
  return "".concat((0, contractsRegister_1.getContractName)(this.contract), " was unpaused");
641
643
  };
642
644
  return EventUnPaused;
@@ -653,7 +655,7 @@ var EventPausableAdminAdded = /** @class */ (function (_super) {
653
655
  _this.admin = opts.admin;
654
656
  return _this;
655
657
  }
656
- EventPausableAdminAdded.prototype.toString = function (_) {
658
+ EventPausableAdminAdded.prototype.toString = function () {
657
659
  return "ACL: pausable admin ".concat(this.admin, " was added");
658
660
  };
659
661
  return EventPausableAdminAdded;
@@ -670,7 +672,7 @@ var EventPausableAdminRemoved = /** @class */ (function (_super) {
670
672
  _this.admin = opts.admin;
671
673
  return _this;
672
674
  }
673
- EventPausableAdminRemoved.prototype.toString = function (_) {
675
+ EventPausableAdminRemoved.prototype.toString = function () {
674
676
  return "ACL: pausable admin ".concat(this.admin, " was removed");
675
677
  };
676
678
  return EventPausableAdminRemoved;
@@ -687,7 +689,7 @@ var EventUnPausableAdminAdded = /** @class */ (function (_super) {
687
689
  _this.admin = opts.admin;
688
690
  return _this;
689
691
  }
690
- EventUnPausableAdminAdded.prototype.toString = function (_) {
692
+ EventUnPausableAdminAdded.prototype.toString = function () {
691
693
  return "ACL: unpausable admin ".concat(this.admin, " was added");
692
694
  };
693
695
  return EventUnPausableAdminAdded;
@@ -704,7 +706,7 @@ var EventUnPausableAdminRemoved = /** @class */ (function (_super) {
704
706
  _this.admin = opts.admin;
705
707
  return _this;
706
708
  }
707
- EventUnPausableAdminRemoved.prototype.toString = function (_) {
709
+ EventUnPausableAdminRemoved.prototype.toString = function () {
708
710
  return "ACL: unpausable admin ".concat(this.admin, " was removed");
709
711
  };
710
712
  return EventUnPausableAdminRemoved;
@@ -722,7 +724,7 @@ var EventTransferOwnership = /** @class */ (function (_super) {
722
724
  _this.newOwner = opts.admin;
723
725
  return _this;
724
726
  }
725
- EventTransferOwnership.prototype.toString = function (_) {
727
+ EventTransferOwnership.prototype.toString = function () {
726
728
  return "ACL: configurator was changed to ".concat(this.newOwner);
727
729
  };
728
730
  return EventTransferOwnership;
@@ -19,9 +19,9 @@ export declare class PoolData {
19
19
  readonly withdrawFee: number;
20
20
  readonly timestampLU: BigNumber;
21
21
  readonly cumulativeIndex_RAY: BigNumber;
22
+ readonly isPaused: boolean;
22
23
  constructor(payload: PoolDataPayload);
23
24
  getContractETH(signer: Signer): IPoolService;
24
- get isPaused(): boolean;
25
25
  }
26
26
  export interface PoolsStat {
27
27
  tvl: number;
package/lib/core/pool.js CHANGED
@@ -7,6 +7,7 @@ var types_1 = require("../types");
7
7
  var constants_1 = require("./constants");
8
8
  var PoolData = /** @class */ (function () {
9
9
  function PoolData(payload) {
10
+ this.isPaused = false;
10
11
  this.id = payload.addr;
11
12
  this.address = payload.addr;
12
13
  this.underlyingToken = payload.underlying || "";
@@ -29,13 +30,6 @@ var PoolData = /** @class */ (function () {
29
30
  PoolData.prototype.getContractETH = function (signer) {
30
31
  return types_1.IPoolService__factory.connect(this.address, signer);
31
32
  };
32
- Object.defineProperty(PoolData.prototype, "isPaused", {
33
- get: function () {
34
- return false;
35
- },
36
- enumerable: false,
37
- configurable: true
38
- });
39
33
  return PoolData;
40
34
  }());
41
35
  exports.PoolData = PoolData;