@gearbox-protocol/sdk 0.0.52 → 0.0.55

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,7 +1,7 @@
1
1
  import { AdapterInterface } from "./adapters";
2
2
  import { NetworkType } from "./constants";
3
3
  import { Protocols } from "./protocols";
4
- import { ConvexStakedPhantomToken, CurveLPToken, NormalToken } from "./token";
4
+ import { CurveLPToken, NormalToken, ConvexStakedPhantomToken } from "./token";
5
5
  export declare type UniswapV2Contract = "UNISWAP_V2_ROUTER" | "SUSHISWAP_ROUTER";
6
6
  export declare type CurvePoolContract = "CURVE_3CRV_POOL" | "CURVE_STETH_GATEWAY" | "CURVE_FRAX_POOL" | "CURVE_LUSD_POOL" | "CURVE_GUSD_POOL" | "CURVE_SUSD_POOL";
7
7
  export declare type YearnVaultContract = "YEARN_DAI_VAULT" | "YEARN_USDC_VAULT" | "YEARN_WETH_VAULT" | "YEARN_WBTC_VAULT" | "YEARN_CURVE_FRAX_VAULT" | "YEARN_CURVE_STETH_VAULT";
@@ -9,37 +9,50 @@ export declare type ConvexPoolContract = "CONVEX_3CRV_POOL" | "CONVEX_GUSD_POOL"
9
9
  export declare type SupportedContract = UniswapV2Contract | "UNISWAP_V3_ROUTER" | CurvePoolContract | YearnVaultContract | "CONVEX_BOOSTER" | ConvexPoolContract | "CONVEX_CLAIM_ZAP" | "LIDO_STETH_GATEWAY";
10
10
  export declare const contractsByNetwork: Record<NetworkType, Record<SupportedContract, string>>;
11
11
  export declare const UNISWAP_V3_QUOTER = "0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6";
12
- export interface CurveSteCRVPoolParams {
13
- protocol: Protocols.Curve;
14
- type: AdapterInterface.CURVE_V1_STECRV_POOL;
15
- pool: Record<NetworkType, string>;
16
- }
17
- export interface LidoParams {
18
- protocol: Protocols.Lido;
19
- type: AdapterInterface.LIDO_V1;
20
- contract: Record<NetworkType, string>;
12
+ export interface BaseContractParams {
13
+ name: string;
21
14
  }
22
- export declare type ContractParams = {
15
+ declare type UniswapV2Params = {
23
16
  protocol: Protocols.Uniswap | Protocols.Sushiswap;
24
17
  type: AdapterInterface.UNISWAP_V2_ROUTER;
25
- } | {
18
+ } & BaseContractParams;
19
+ declare type UniswapV3Params = {
26
20
  protocol: Protocols.Uniswap;
27
21
  type: AdapterInterface.UNISWAP_V3_ROUTER;
28
22
  quoter: string;
29
- } | {
23
+ } & BaseContractParams;
24
+ declare type CurveParams = {
30
25
  protocol: Protocols.Curve;
31
26
  type: AdapterInterface.CURVE_V1_2ASSETS | AdapterInterface.CURVE_V1_3ASSETS | AdapterInterface.CURVE_V1_4ASSETS;
32
27
  lpToken: CurveLPToken;
33
28
  tokens: Array<NormalToken | CurveLPToken>;
34
- } | CurveSteCRVPoolParams | {
29
+ } & BaseContractParams;
30
+ export declare type CurveSteCRVPoolParams = {
31
+ protocol: Protocols.Curve;
32
+ type: AdapterInterface.CURVE_V1_STECRV_POOL;
33
+ pool: Record<NetworkType, string>;
34
+ lpToken: "steCRV";
35
+ } & BaseContractParams;
36
+ declare type YearnParams = {
35
37
  protocol: Protocols.Yearn;
36
38
  type: AdapterInterface.YEARN_V2;
37
- } | {
39
+ } & BaseContractParams;
40
+ declare type ConvexParams = {
38
41
  protocol: Protocols.Convex;
39
42
  type: AdapterInterface.CONVEX_V1_BOOSTER | AdapterInterface.CONVEX_V1_CLAIM_ZAP;
40
- } | {
43
+ } & BaseContractParams;
44
+ declare type ConvexPoolParams = {
41
45
  protocol: Protocols.Convex;
42
46
  type: AdapterInterface.CONVEX_V1_BASE_REWARD_POOL;
43
47
  stakedToken: ConvexStakedPhantomToken;
44
- } | LidoParams;
48
+ } & BaseContractParams;
49
+ export declare type LidoParams = {
50
+ protocol: Protocols.Lido;
51
+ type: AdapterInterface.LIDO_V1;
52
+ contract: Record<NetworkType, string>;
53
+ lpToken: "steCRV";
54
+ } & BaseContractParams;
55
+ export declare type ContractParams = UniswapV2Params | UniswapV3Params | CurveParams | CurveSteCRVPoolParams | YearnParams | ConvexParams | ConvexPoolParams | LidoParams;
45
56
  export declare const contractParams: Record<SupportedContract, ContractParams>;
57
+ export declare const contractsByAddress: Record<string, SupportedContract>;
58
+ export {};
@@ -1,11 +1,23 @@
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
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.contractsByAddress = exports.contractParams = exports.UNISWAP_V3_QUOTER = exports.contractsByNetwork = void 0;
2
15
  /*
3
16
  * SPDX-License-Identifier: BSL-1.1
4
17
  * Gearbox. Generalized leverage protocol, which allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
5
18
  * (c) Gearbox.fi, 2021
6
19
  */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.contractParams = exports.UNISWAP_V3_QUOTER = exports.contractsByNetwork = void 0;
20
+ var mappers_1 = require("../utils/mappers");
9
21
  var adapters_1 = require("./adapters");
10
22
  var protocols_1 = require("./protocols");
11
23
  var token_1 = require("./token");
@@ -72,119 +84,148 @@ exports.contractsByNetwork = {
72
84
  exports.UNISWAP_V3_QUOTER = "0xb27308f9f90d607463bb33ea1bebb41c27ce5ab6";
73
85
  exports.contractParams = {
74
86
  UNISWAP_V2_ROUTER: {
87
+ name: "Uniswap V2",
75
88
  protocol: protocols_1.Protocols.Uniswap,
76
89
  type: adapters_1.AdapterInterface.UNISWAP_V2_ROUTER
77
90
  },
78
91
  UNISWAP_V3_ROUTER: {
92
+ name: "Uniswap V3",
79
93
  protocol: protocols_1.Protocols.Uniswap,
80
94
  quoter: exports.UNISWAP_V3_QUOTER,
81
95
  type: adapters_1.AdapterInterface.UNISWAP_V3_ROUTER
82
96
  },
83
97
  SUSHISWAP_ROUTER: {
98
+ name: "Sushiswap",
84
99
  protocol: protocols_1.Protocols.Sushiswap,
85
100
  type: adapters_1.AdapterInterface.UNISWAP_V2_ROUTER
86
101
  },
87
102
  CURVE_3CRV_POOL: {
103
+ name: "Curve 3Pool",
88
104
  protocol: protocols_1.Protocols.Curve,
89
105
  type: adapters_1.AdapterInterface.CURVE_V1_3ASSETS,
90
106
  lpToken: "3Crv",
91
107
  tokens: ["DAI", "USDC", "USDT"]
92
108
  },
93
109
  CURVE_STETH_GATEWAY: {
110
+ name: "Curve stETH",
94
111
  protocol: protocols_1.Protocols.Curve,
95
112
  type: adapters_1.AdapterInterface.CURVE_V1_STECRV_POOL,
96
113
  pool: {
97
114
  Mainnet: "0xDC24316b9AE028F1497c275EB9192a3Ea0f67022",
98
115
  Kovan: "0xF695d3aa358D5087A0C157DBb9449d4f0d8E534a"
99
- }
116
+ },
117
+ lpToken: "steCRV"
100
118
  },
101
119
  CURVE_FRAX_POOL: {
120
+ name: "Curve FRAX",
102
121
  protocol: protocols_1.Protocols.Curve,
103
122
  type: adapters_1.AdapterInterface.CURVE_V1_2ASSETS,
104
123
  lpToken: "FRAX3CRV",
105
124
  tokens: ["3Crv", "FRAX"]
106
125
  },
107
126
  CURVE_LUSD_POOL: {
127
+ name: "Curve LUSD",
108
128
  protocol: protocols_1.Protocols.Curve,
109
129
  type: adapters_1.AdapterInterface.CURVE_V1_2ASSETS,
110
130
  lpToken: "LUSD3CRV",
111
- tokens: ["3Crv", "FRAX"]
131
+ tokens: ["3Crv", "LUSD"]
112
132
  },
113
133
  CURVE_SUSD_POOL: {
134
+ name: "Curve SUSD",
114
135
  protocol: protocols_1.Protocols.Curve,
115
- type: adapters_1.AdapterInterface.CURVE_V1_2ASSETS,
136
+ type: adapters_1.AdapterInterface.CURVE_V1_4ASSETS,
116
137
  lpToken: "crvPlain3andSUSD",
117
- tokens: ["3Crv", "FRAX"]
138
+ tokens: ["DAI", "USDC", "USDT", "sUSD"]
118
139
  },
119
140
  CURVE_GUSD_POOL: {
141
+ name: "Curve GUSD",
120
142
  protocol: protocols_1.Protocols.Curve,
121
143
  type: adapters_1.AdapterInterface.CURVE_V1_2ASSETS,
122
144
  lpToken: "gusd3CRV",
123
145
  tokens: ["3Crv", "FRAX"]
124
146
  },
125
147
  YEARN_DAI_VAULT: {
148
+ name: "Yearn DAI",
126
149
  protocol: protocols_1.Protocols.Yearn,
127
150
  type: adapters_1.AdapterInterface.YEARN_V2
128
151
  },
129
152
  YEARN_USDC_VAULT: {
153
+ name: "Yearn USDC",
130
154
  protocol: protocols_1.Protocols.Yearn,
131
155
  type: adapters_1.AdapterInterface.YEARN_V2
132
156
  },
133
157
  YEARN_WETH_VAULT: {
158
+ name: "Yearn WETH",
134
159
  protocol: protocols_1.Protocols.Yearn,
135
160
  type: adapters_1.AdapterInterface.YEARN_V2
136
161
  },
137
162
  YEARN_WBTC_VAULT: {
163
+ name: "Yearn WBTC",
138
164
  protocol: protocols_1.Protocols.Yearn,
139
165
  type: adapters_1.AdapterInterface.YEARN_V2
140
166
  },
141
167
  YEARN_CURVE_FRAX_VAULT: {
168
+ name: "Yearn Curve FRAX",
142
169
  protocol: protocols_1.Protocols.Yearn,
143
170
  type: adapters_1.AdapterInterface.YEARN_V2
144
171
  },
145
172
  YEARN_CURVE_STETH_VAULT: {
173
+ name: "Yearn Curve STETH",
146
174
  protocol: protocols_1.Protocols.Yearn,
147
175
  type: adapters_1.AdapterInterface.YEARN_V2
148
176
  },
149
177
  CONVEX_BOOSTER: {
178
+ name: "Convex BOOSTER",
150
179
  protocol: protocols_1.Protocols.Convex,
151
180
  type: adapters_1.AdapterInterface.CONVEX_V1_BOOSTER
152
181
  },
153
182
  CONVEX_3CRV_POOL: {
183
+ name: "Convex 3crv",
154
184
  protocol: protocols_1.Protocols.Convex,
155
185
  type: adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL,
156
186
  stakedToken: "stkcvx3Crv"
157
187
  },
158
188
  CONVEX_GUSD_POOL: {
189
+ name: "Convex GUSD",
159
190
  protocol: protocols_1.Protocols.Convex,
160
191
  type: adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL,
161
192
  stakedToken: "stkcvxgusd3CRV"
162
193
  },
163
194
  CONVEX_SUSD_POOL: {
195
+ name: "Convex SUSD",
164
196
  protocol: protocols_1.Protocols.Convex,
165
197
  type: adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL,
166
198
  stakedToken: "stkcvxcrvPlain3andSUSD"
167
199
  },
168
200
  CONVEX_STECRV_POOL: {
201
+ name: "Convex STECRV",
169
202
  protocol: protocols_1.Protocols.Convex,
170
203
  type: adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL,
171
204
  stakedToken: "stkcvxsteCRV"
172
205
  },
173
206
  CONVEX_FRAX3CRV_POOL: {
207
+ name: "Convex FRAX3CRV",
174
208
  protocol: protocols_1.Protocols.Convex,
175
209
  type: adapters_1.AdapterInterface.CONVEX_V1_BASE_REWARD_POOL,
176
210
  stakedToken: "stkcvxFRAX3CRV"
177
211
  },
178
212
  CONVEX_CLAIM_ZAP: {
213
+ name: "Convex ZAP",
179
214
  protocol: protocols_1.Protocols.Convex,
180
215
  type: adapters_1.AdapterInterface.CONVEX_V1_CLAIM_ZAP
181
216
  },
182
217
  LIDO_STETH_GATEWAY: {
218
+ name: "Lido STETH",
183
219
  protocol: protocols_1.Protocols.Lido,
184
220
  type: adapters_1.AdapterInterface.LIDO_V1,
185
221
  contract: {
186
222
  Mainnet: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
187
223
  Kovan: ""
188
- }
224
+ },
225
+ lpToken: "steCRV"
189
226
  }
190
227
  };
228
+ exports.contractsByAddress = (0, mappers_1.objectEntries)(exports.contractsByNetwork).reduce(function (sum, _a) {
229
+ var _ = _a[0], contracts = _a[1];
230
+ return __assign(__assign({}, sum), (0, mappers_1.keyToLowercase)((0, mappers_1.swapKeyValue)(contracts)));
231
+ }, {});
@@ -1,6 +1,19 @@
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
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.getContractName = exports.deployedContracts = void 0;
15
+ var mappers_1 = require("../utils/mappers");
16
+ var contracts_1 = require("./contracts");
4
17
  exports.deployedContracts = {
5
18
  // MAINNET
6
19
  "0x24946bCbBd028D5ABb62ad9B635EB1b1a67AF668": "DAI",
@@ -25,16 +38,21 @@ exports.deployedContracts = {
25
38
  "0xe04b4db67127d1930D36f16B51653120C4285708": "WBTC",
26
39
  "0x600073357c29d169aAF3E543A4519749830553F1": "WETH",
27
40
  "0xdBAd1361d9A03B81Be8D3a54Ef0dc9e39a1bA5b3": "USDC",
28
- "0x50d1fA47b0D88BA0D108148B8481b4A762eFB99e": "DAI",
41
+ "0x50d1fA47b0D88BA0D108148B8481b4A762eFB99e": "DAI"
29
42
  // [YEARN_DAI_VAULT_KOVAN_MOCK]: "Yearn DAI",
30
43
  // [YEARN_USDC_VAULT_KOVAN_MOCK]: "Yearn USDC",
31
44
  // [SUSHISWAP_KOVAN]: "Sushiswap"
32
45
  };
46
+ var contractNames = Object.entries(contracts_1.contractsByAddress).reduce(function (sum, _a) {
47
+ var _b;
48
+ var addr = _a[0], cSymbol = _a[1];
49
+ var params = contracts_1.contractParams[cSymbol];
50
+ if (!params)
51
+ return sum;
52
+ return __assign(__assign({}, sum), (_b = {}, _b[addr] = params.name, _b));
53
+ }, {});
54
+ var contractsFullList = __assign(__assign({}, (0, mappers_1.keyToLowercase)(exports.deployedContracts)), contractNames);
33
55
  function getContractName(address) {
34
- Object.entries(exports.deployedContracts).forEach(function (_a) {
35
- var addr = _a[0], name = _a[1];
36
- exports.deployedContracts[addr.toLowerCase()] = name;
37
- });
38
- return exports.deployedContracts[address.toLowerCase()] || address;
56
+ return contractsFullList[address.toLowerCase()] || address;
39
57
  }
40
58
  exports.getContractName = getContractName;
@@ -54,30 +54,36 @@ var CreditAccountData = /** @class */ (function () {
54
54
  }
55
55
  CreditAccountData.prototype.balancesSorted = function (prices, tokens) {
56
56
  var priceCalc = function (addr, amount) {
57
- var _a;
57
+ var price = prices[addr] || 0;
58
+ var _a = (tokens[addr] || {}).decimals, decimals = _a === void 0 ? 18 : _a;
58
59
  return amount
59
- .mul(Math.floor(1000 * prices[addr.toLowerCase() || ""] || 0))
60
- .div(ethers_1.BigNumber.from(10).pow(((_a = tokens[addr]) === null || _a === void 0 ? void 0 : _a.decimals) || 18));
60
+ .mul(Math.floor(1000 * price))
61
+ .div(ethers_1.BigNumber.from(10).pow(decimals));
61
62
  };
62
63
  var tokensAbcComparator = function (t1, t2) {
63
- return ((t1 === null || t1 === void 0 ? void 0 : t1.symbol) || "") > ((t2 === null || t2 === void 0 ? void 0 : t2.symbol) || "") ? 1 : -1;
64
+ var _a = (t1 || {}).symbol, symbol1 = _a === void 0 ? "" : _a;
65
+ var _b = (t2 || {}).symbol, symbol2 = _b === void 0 ? "" : _b;
66
+ return symbol1 > symbol2 ? 1 : -1;
64
67
  };
65
- return tokens
66
- ? Object.entries(this.balances || [])
67
- .sort(function (_a, _b) {
68
- var addr1 = _a[0], amount1 = _a[1];
69
- var addr2 = _b[0], amount2 = _b[1];
70
- return priceCalc(addr1, amount1).eq(priceCalc(addr2, amount2))
71
- ? tokensAbcComparator(tokens[addr1], tokens[addr2])
72
- : priceCalc(addr1, amount1).gt(priceCalc(addr2, amount2))
73
- ? -1
74
- : 1;
75
- })
76
- .map(function (_a) {
77
- var address = _a[0], balance = _a[1];
78
- return ({ address: address, balance: balance });
79
- })
80
- : [];
68
+ var safeBalances = this.balances || [];
69
+ return Object.entries(safeBalances)
70
+ .sort(function (_a, _b) {
71
+ var addr1 = _a[0], amount1 = _a[1];
72
+ var addr2 = _b[0], amount2 = _b[1];
73
+ var addr1Lc = addr1.toLowerCase();
74
+ var addr2Lc = addr2.toLowerCase();
75
+ var price1 = priceCalc(addr1Lc, amount1);
76
+ var price2 = priceCalc(addr2Lc, amount2);
77
+ return price1.eq(price2)
78
+ ? tokensAbcComparator(tokens[addr1Lc], tokens[addr2Lc])
79
+ : price1.gt(price2)
80
+ ? -1
81
+ : 1;
82
+ })
83
+ .map(function (_a) {
84
+ var address = _a[0], balance = _a[1];
85
+ return ({ address: address, balance: balance });
86
+ });
81
87
  };
82
88
  return CreditAccountData;
83
89
  }());
@@ -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(_tokenData: Record<string, TokenData>): string;
85
+ toString(_: Record<string, TokenData>): string;
86
86
  }
87
87
  interface AddCollateralProps extends EVMEventProps {
88
88
  amount: 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(_tokenData: Record<string, TokenData>): string;
291
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
311
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
319
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
327
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
335
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
343
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
351
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
359
+ toString(_: Record<string, TokenData>): 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(_tokenData: Record<string, TokenData>): string;
367
+ toString(_: Record<string, TokenData>): string;
368
368
  }
369
369
  export {};
@@ -116,7 +116,7 @@ var EventAddLiquidity = /** @class */ (function (_super) {
116
116
  return _this;
117
117
  }
118
118
  EventAddLiquidity.prototype.toString = function (tokenData) {
119
- var _a = tokenData[this.underlyingToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
119
+ var _a = tokenData[this.underlyingToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
120
120
  return "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), ": Deposit ").concat((0, formatter_1.formatBN)(this.amount, decimals), " ").concat(symbol);
121
121
  };
122
122
  return EventAddLiquidity;
@@ -137,7 +137,7 @@ var EventRemoveLiquidity = /** @class */ (function (_super) {
137
137
  return _this;
138
138
  }
139
139
  EventRemoveLiquidity.prototype.toString = function (tokenData) {
140
- var _a = tokenData[this.dieselToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
140
+ var _a = tokenData[this.dieselToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
141
141
  return "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), ": withdraw ").concat((0, formatter_1.formatBN)(this.amount, decimals), " ").concat(symbol);
142
142
  };
143
143
  return EventRemoveLiquidity;
@@ -158,7 +158,7 @@ var EventOpenCreditAccount = /** @class */ (function (_super) {
158
158
  return _this;
159
159
  }
160
160
  EventOpenCreditAccount.prototype.toString = function (tokenData) {
161
- var _a = tokenData[this.underlyingToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
161
+ var _a = tokenData[this.underlyingToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
162
162
  return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": open ").concat((0, formatter_1.formatBN)(this.amount, decimals), " ").concat(symbol, " x ").concat(this.leverage.toFixed(2), " \u21D2 \n ").concat((0, formatter_1.formatBN)(this.amount
163
163
  .mul(Math.floor(this.leverage + constants_1.LEVERAGE_DECIMALS))
164
164
  .div(constants_1.LEVERAGE_DECIMALS), decimals + 2), " ").concat(symbol);
@@ -180,7 +180,7 @@ var EventCloseCreditAccount = /** @class */ (function (_super) {
180
180
  return _this;
181
181
  }
182
182
  EventCloseCreditAccount.prototype.toString = function (tokenData) {
183
- var _a = tokenData[this.underlyingToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
183
+ var _a = tokenData[this.underlyingToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
184
184
  return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": was closed and got ").concat((0, formatter_1.formatBN)(this.amount, decimals), " ").concat(symbol, " as remaining funds");
185
185
  };
186
186
  return EventCloseCreditAccount;
@@ -200,7 +200,7 @@ var EventLiquidateCreditAccount = /** @class */ (function (_super) {
200
200
  return _this;
201
201
  }
202
202
  EventLiquidateCreditAccount.prototype.toString = function (tokenData) {
203
- var _a = tokenData[this.underlyingToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
203
+ var _a = tokenData[this.underlyingToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
204
204
  return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": was liquidated. ").concat((0, formatter_1.formatBN)(this.amount, decimals), " ").concat(symbol, " were paid back as remaining funds");
205
205
  };
206
206
  return EventLiquidateCreditAccount;
@@ -218,7 +218,7 @@ var EventRepayCreditAccount = /** @class */ (function (_super) {
218
218
  _this.creditManager = opts.creditManager;
219
219
  return _this;
220
220
  }
221
- EventRepayCreditAccount.prototype.toString = function (_tokenData) {
221
+ EventRepayCreditAccount.prototype.toString = function (_) {
222
222
  return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": was repaid");
223
223
  };
224
224
  return EventRepayCreditAccount;
@@ -238,7 +238,7 @@ var EventAddCollateral = /** @class */ (function (_super) {
238
238
  return _this;
239
239
  }
240
240
  EventAddCollateral.prototype.toString = function (tokenData) {
241
- var _a = tokenData[this.addedToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
241
+ var _a = tokenData[this.addedToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
242
242
  return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": added ").concat((0, formatter_1.formatBN)(this.amount, decimals), " ").concat(symbol, " as collateral");
243
243
  };
244
244
  return EventAddCollateral;
@@ -258,7 +258,7 @@ var EventIncreaseBorrowAmount = /** @class */ (function (_super) {
258
258
  return _this;
259
259
  }
260
260
  EventIncreaseBorrowAmount.prototype.toString = function (tokenData) {
261
- var _a = tokenData[this.underlyingToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
261
+ var _a = tokenData[this.underlyingToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
262
262
  return "Credit account ".concat((0, contractsRegister_1.getContractName)(this.creditManager), ": borrowed amount was increased for ").concat((0, formatter_1.formatBN)(this.amount, decimals), " ").concat(symbol);
263
263
  };
264
264
  return EventIncreaseBorrowAmount;
@@ -289,7 +289,7 @@ var EventCMNewParameters = /** @class */ (function (_super) {
289
289
  return _this;
290
290
  }
291
291
  EventCMNewParameters.prototype.toString = function (tokenData) {
292
- var token = tokenData[this.underlyingToken];
292
+ var token = tokenData[this.underlyingToken.toLowerCase()];
293
293
  var msg = "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated: ");
294
294
  if (this.minAmount !== this.prevMinAmount) {
295
295
  msg += "min amount: ".concat((0, formatter_1.formatBN)(this.prevMinAmount, token.decimals), " => ").concat((0, formatter_1.formatBN)(this.minAmount, token.decimals), " ").concat(token.symbol, ", ");
@@ -330,7 +330,7 @@ var EventTokenAllowed = /** @class */ (function (_super) {
330
330
  return _this;
331
331
  }
332
332
  EventTokenAllowed.prototype.toString = function (tokenData) {
333
- var token = tokenData[this.token];
333
+ var token = tokenData[this.token.toLowerCase()];
334
334
  var msg = "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated ");
335
335
  switch (this.status) {
336
336
  case "NewToken":
@@ -357,7 +357,7 @@ var EventTokenForbidden = /** @class */ (function (_super) {
357
357
  return _this;
358
358
  }
359
359
  EventTokenForbidden.prototype.toString = function (tokenData) {
360
- var token = tokenData[this.token];
360
+ var token = tokenData[this.token.toLowerCase()];
361
361
  return "Credit manager ".concat((0, contractsRegister_1.getContractName)(this.creditManager), " updated ").concat(token.symbol, " forbidden");
362
362
  };
363
363
  return EventTokenForbidden;
@@ -541,7 +541,7 @@ var EventNewExpectedLiquidityLimit = /** @class */ (function (_super) {
541
541
  return _this;
542
542
  }
543
543
  EventNewExpectedLiquidityLimit.prototype.toString = function (tokenData) {
544
- var _a = tokenData[this.underlyingToken] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
544
+ var _a = tokenData[this.underlyingToken.toLowerCase()] || {}, _b = _a.decimals, decimals = _b === void 0 ? 18 : _b, symbol = _a.symbol;
545
545
  return this.prevLimit.isZero()
546
546
  ? "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: expected liquidity limit was set to ").concat((0, formatter_1.formatBN)(this.newLimit, decimals), " ").concat(symbol)
547
547
  : "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: expected liquidity limit was ").concat(this.newLimit.gt(this.prevLimit) ? "increased" : "decreased", ": ").concat((0, formatter_1.formatBN)(this.prevLimit, decimals), " ").concat(symbol, " => ").concat((0, formatter_1.formatBN)(this.newLimit, decimals), " ").concat(symbol);
@@ -563,7 +563,7 @@ var EventNewWithdrawFee = /** @class */ (function (_super) {
563
563
  _this.prevFee = Number(opts.oldFee);
564
564
  return _this;
565
565
  }
566
- EventNewWithdrawFee.prototype.toString = function (_tokenData) {
566
+ EventNewWithdrawFee.prototype.toString = function (_) {
567
567
  return this.prevFee === 0
568
568
  ? "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: withdraw fee was set to: ").concat(this.newFee / 100, "%")
569
569
  : "Pool ".concat((0, contractsRegister_1.getContractName)(this.pool), " updated: withdraw fee was ").concat(this.newFee > this.prevFee ? "increased" : "decreased", ": ").concat(this.prevFee / 100, "% => ").concat(this.newFee / 100, "%");
@@ -584,7 +584,7 @@ var EventNewPriceFeed = /** @class */ (function (_super) {
584
584
  return _this;
585
585
  }
586
586
  EventNewPriceFeed.prototype.toString = function (tokenData) {
587
- var symbol = (tokenData[this.token] || {}).symbol;
587
+ var symbol = (tokenData[this.token.toLowerCase()] || {}).symbol;
588
588
  return "PriceOracle: oracle for ".concat(symbol, " was updated to ").concat((0, contractsRegister_1.getContractName)(this.priceFeed));
589
589
  };
590
590
  return EventNewPriceFeed;
@@ -602,7 +602,7 @@ var EventTakeForever = /** @class */ (function (_super) {
602
602
  _this.to = opts.to;
603
603
  return _this;
604
604
  }
605
- EventTakeForever.prototype.toString = function (_tokenData) {
605
+ EventTakeForever.prototype.toString = function (_) {
606
606
  return "AccountFactory: account ".concat(this.creditAccount, " was taken forever and transferred to ").concat(this.to);
607
607
  };
608
608
  return EventTakeForever;
@@ -619,7 +619,7 @@ var EventPaused = /** @class */ (function (_super) {
619
619
  _this.contract = opts.contract;
620
620
  return _this;
621
621
  }
622
- EventPaused.prototype.toString = function (_tokenData) {
622
+ EventPaused.prototype.toString = function (_) {
623
623
  return "".concat((0, contractsRegister_1.getContractName)(this.contract), " was paused");
624
624
  };
625
625
  return EventPaused;
@@ -636,7 +636,7 @@ var EventUnPaused = /** @class */ (function (_super) {
636
636
  _this.contract = opts.contract;
637
637
  return _this;
638
638
  }
639
- EventUnPaused.prototype.toString = function (_tokenData) {
639
+ EventUnPaused.prototype.toString = function (_) {
640
640
  return "".concat((0, contractsRegister_1.getContractName)(this.contract), " was unpaused");
641
641
  };
642
642
  return EventUnPaused;
@@ -653,7 +653,7 @@ var EventPausableAdminAdded = /** @class */ (function (_super) {
653
653
  _this.admin = opts.admin;
654
654
  return _this;
655
655
  }
656
- EventPausableAdminAdded.prototype.toString = function (_tokenData) {
656
+ EventPausableAdminAdded.prototype.toString = function (_) {
657
657
  return "ACL: pausable admin ".concat(this.admin, " was added");
658
658
  };
659
659
  return EventPausableAdminAdded;
@@ -670,7 +670,7 @@ var EventPausableAdminRemoved = /** @class */ (function (_super) {
670
670
  _this.admin = opts.admin;
671
671
  return _this;
672
672
  }
673
- EventPausableAdminRemoved.prototype.toString = function (_tokenData) {
673
+ EventPausableAdminRemoved.prototype.toString = function (_) {
674
674
  return "ACL: pausable admin ".concat(this.admin, " was removed");
675
675
  };
676
676
  return EventPausableAdminRemoved;
@@ -687,7 +687,7 @@ var EventUnPausableAdminAdded = /** @class */ (function (_super) {
687
687
  _this.admin = opts.admin;
688
688
  return _this;
689
689
  }
690
- EventUnPausableAdminAdded.prototype.toString = function (_tokenData) {
690
+ EventUnPausableAdminAdded.prototype.toString = function (_) {
691
691
  return "ACL: unpausable admin ".concat(this.admin, " was added");
692
692
  };
693
693
  return EventUnPausableAdminAdded;
@@ -704,7 +704,7 @@ var EventUnPausableAdminRemoved = /** @class */ (function (_super) {
704
704
  _this.admin = opts.admin;
705
705
  return _this;
706
706
  }
707
- EventUnPausableAdminRemoved.prototype.toString = function (_tokenData) {
707
+ EventUnPausableAdminRemoved.prototype.toString = function (_) {
708
708
  return "ACL: unpausable admin ".concat(this.admin, " was removed");
709
709
  };
710
710
  return EventUnPausableAdminRemoved;
@@ -722,7 +722,7 @@ var EventTransferOwnership = /** @class */ (function (_super) {
722
722
  _this.newOwner = opts.admin;
723
723
  return _this;
724
724
  }
725
- EventTransferOwnership.prototype.toString = function (_tokenData) {
725
+ EventTransferOwnership.prototype.toString = function (_) {
726
726
  return "ACL: configurator was changed to ".concat(this.newOwner);
727
727
  };
728
728
  return EventTransferOwnership;