@gearbox-protocol/sdk 0.0.65 → 0.0.68

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 (67) hide show
  1. package/lib/contracts/adapters.d.ts +15 -0
  2. package/lib/contracts/adapters.js +19 -0
  3. package/lib/contracts/contracts.d.ts +60 -0
  4. package/lib/contracts/contracts.js +242 -0
  5. package/lib/contracts/contractsRegister.d.ts +2 -0
  6. package/lib/contracts/contractsRegister.js +58 -0
  7. package/lib/contracts/protocols.d.ts +13 -0
  8. package/lib/contracts/protocols.js +39 -0
  9. package/lib/core/contracts.js +3 -3
  10. package/lib/core/events.js +1 -1
  11. package/lib/core/tradeTypes.d.ts +1 -1
  12. package/lib/core/transactions.js +1 -1
  13. package/lib/index.d.ts +8 -9
  14. package/lib/index.js +10 -10
  15. package/lib/oracles/oracles.d.ts +38 -0
  16. package/lib/oracles/oracles.js +12 -0
  17. package/lib/oracles/priceFeeds.d.ts +3 -0
  18. package/lib/oracles/priceFeeds.js +492 -0
  19. package/lib/pathfinder/convexLP.d.ts +1 -1
  20. package/lib/pathfinder/convexLP.js +2 -20
  21. package/lib/pathfinder/curveLP.d.ts +2 -2
  22. package/lib/pathfinder/curveLP.js +8 -27
  23. package/lib/pathfinder/path.d.ts +2 -8
  24. package/lib/pathfinder/path.js +27 -34
  25. package/lib/pathfinder/trade.d.ts +35 -0
  26. package/lib/pathfinder/trade.js +62 -0
  27. package/lib/pathfinder/tradeTypes.d.ts +83 -0
  28. package/lib/pathfinder/tradeTypes.js +26 -0
  29. package/lib/pathfinder/yVault.d.ts +1 -1
  30. package/lib/pathfinder/yVault.js +4 -23
  31. package/lib/tokens/convex.d.ts +2 -2
  32. package/lib/tokens/convex.js +1 -1
  33. package/lib/tokens/curveLP.d.ts +1 -1
  34. package/lib/tokens/curveLP.js +1 -1
  35. package/lib/tokens/gear.d.ts +1 -1
  36. package/lib/tokens/normal.d.ts +1 -1
  37. package/lib/tokens/normal.js +1 -1
  38. package/lib/tokens/token.d.ts +1 -1
  39. package/lib/tokens/token.js +5 -5
  40. package/lib/tokens/yearn.d.ts +2 -2
  41. package/lib/tokens/yearn.js +3 -3
  42. package/package.json +1 -1
  43. package/src/{core → contracts}/adapters.ts +0 -0
  44. package/src/{core → contracts}/contracts.ts +6 -6
  45. package/src/{core → contracts}/contractsRegister.ts +0 -0
  46. package/src/{core → contracts}/protocols.ts +0 -0
  47. package/src/core/events.ts +932 -915
  48. package/src/core/transactions.ts +360 -352
  49. package/src/index.ts +8 -9
  50. package/src/{core → oracles}/oracles.ts +0 -0
  51. package/src/oracles/priceFeeds.ts +528 -0
  52. package/src/pathfinder/convexLP.ts +1 -1
  53. package/src/pathfinder/curveLP.ts +3 -4
  54. package/src/pathfinder/path.ts +23 -53
  55. package/src/pathfinder/trade.ts +83 -0
  56. package/src/{core → pathfinder}/tradeTypes.ts +6 -6
  57. package/src/pathfinder/yVault.ts +1 -2
  58. package/src/tokens/convex.ts +2 -2
  59. package/src/tokens/curveLP.ts +1 -1
  60. package/src/tokens/gear.ts +1 -1
  61. package/src/tokens/normal.ts +1 -1
  62. package/src/tokens/token.ts +17 -7
  63. package/src/tokens/yearn.ts +4 -4
  64. package/src/core/creditCard.ts +0 -15
  65. package/src/core/priceFeeds.ts +0 -528
  66. package/src/core/swap.ts +0 -4
  67. package/src/core/trade.ts +0 -83
@@ -1,395 +1,403 @@
1
- import { TokenData } from "../tokens/tokenData";
2
- import { BigNumber } from "ethers";
3
- import { formatBN } from "../utils/formatter";
4
- import { LEVERAGE_DECIMALS } from "./constants";
5
- import { EVMEvent, EVMTx, EVMEventProps } from "./eventOrTx";
6
- import { getContractName } from "./contractsRegister";
1
+ import {TokenData} from "../tokens/tokenData";
2
+ import {BigNumber} from "ethers";
3
+ import {formatBN} from "../utils/formatter";
4
+ import {LEVERAGE_DECIMALS} from "./constants";
5
+ import {EVMEvent, EVMTx, EVMEventProps} from "./eventOrTx";
6
+ import {getContractName} from "../contracts/contractsRegister";
7
7
 
8
8
  export interface EventSerialized {
9
- type:
10
- | "EventAddLiquidity"
11
- | "EventRemoveLiquidity"
12
- | "EventOpenCreditAccount"
13
- | "EventCloseCreditAccount"
14
- | "EventLiquidateCreditAccount"
15
- | "EventRepayCreditAccount"
16
- | "EventAddCollateral"
17
- | "EventIncreaseBorrowAmount"
18
- | "EventCMNewParameters"
19
- | "EventTokenAllowed"
20
- | "EventTokenForbidden"
21
- | "EventContractAllowed"
22
- | "EventContractForbidden"
23
- | "EventNewFastCheckParameters"
24
- | "EventPriceOracleUpdated"
25
- | "EventTransferPluginAllowed"
26
- | "EventNewInterestRateModel"
27
- | "EventNewCreditManagerConnected"
28
- | "EventBorrowForbidden"
29
- | "EventNewExpectedLiquidityLimit"
30
- | "EventNewWithdrawFee"
31
- | "EventNewPriceFeed"
32
- | "EventTakeForever"
33
- | "EventPaused"
34
- | "EventUnPaused"
35
- | "EventPausableAdminAdded"
36
- | "EventPausableAdminRemoved"
37
- | "EventUnpausableAdminAdded"
38
- | "EventUnpausableAdminRemoved"
39
- | "EventOwnershipTransferred";
40
-
41
- content: any;
9
+ type:
10
+ | "EventAddLiquidity"
11
+ | "EventRemoveLiquidity"
12
+ | "EventOpenCreditAccount"
13
+ | "EventCloseCreditAccount"
14
+ | "EventLiquidateCreditAccount"
15
+ | "EventRepayCreditAccount"
16
+ | "EventAddCollateral"
17
+ | "EventIncreaseBorrowAmount"
18
+ | "EventCMNewParameters"
19
+ | "EventTokenAllowed"
20
+ | "EventTokenForbidden"
21
+ | "EventContractAllowed"
22
+ | "EventContractForbidden"
23
+ | "EventNewFastCheckParameters"
24
+ | "EventPriceOracleUpdated"
25
+ | "EventTransferPluginAllowed"
26
+ | "EventNewInterestRateModel"
27
+ | "EventNewCreditManagerConnected"
28
+ | "EventBorrowForbidden"
29
+ | "EventNewExpectedLiquidityLimit"
30
+ | "EventNewWithdrawFee"
31
+ | "EventNewPriceFeed"
32
+ | "EventTakeForever"
33
+ | "EventPaused"
34
+ | "EventUnPaused"
35
+ | "EventPausableAdminAdded"
36
+ | "EventPausableAdminRemoved"
37
+ | "EventUnpausableAdminAdded"
38
+ | "EventUnpausableAdminRemoved"
39
+ | "EventOwnershipTransferred";
40
+
41
+ content: any;
42
42
  }
43
43
 
44
44
  export class EventParser {
45
- static serialize(items: Array<EVMTx>): string {
46
- return JSON.stringify(items.map(i => i.serialize()));
47
- }
48
-
49
- static deserialize(data: EventSerialized): EVMEvent {
50
- const params = data.content;
51
- switch (data.type) {
52
- case "EventAddLiquidity":
53
- return new EventAddLiquidity(params);
54
- case "EventRemoveLiquidity":
55
- return new EventRemoveLiquidity(params);
56
- case "EventOpenCreditAccount":
57
- return new EventOpenCreditAccount(params);
58
- case "EventCloseCreditAccount":
59
- return new EventCloseCreditAccount(params);
60
- case "EventLiquidateCreditAccount":
61
- return new EventLiquidateCreditAccount(params);
62
- case "EventRepayCreditAccount":
63
- return new EventRepayCreditAccount(params);
64
- case "EventAddCollateral":
65
- return new EventAddCollateral(params);
66
- case "EventIncreaseBorrowAmount":
67
- return new EventIncreaseBorrowAmount(params);
68
- case "EventCMNewParameters":
69
- return new EventCMNewParameters(params);
70
- case "EventTokenAllowed":
71
- return new EventTokenAllowed(params);
72
- case "EventTokenForbidden":
73
- return new EventTokenForbidden(params);
74
- case "EventContractAllowed":
75
- return new EventContractAllowed(params);
76
- case "EventContractForbidden":
77
- return new EventContractForbidden(params);
78
- case "EventNewFastCheckParameters":
79
- return new EventNewFastCheckParameters(params);
80
- case "EventPriceOracleUpdated":
81
- return new EventPriceOracleUpdated(params);
82
- case "EventTransferPluginAllowed":
83
- return new EventTransferPluginAllowed(params);
84
- case "EventNewInterestRateModel":
85
- return new EventNewInterestRateModel(params);
86
- case "EventNewCreditManagerConnected":
87
- return new EventNewCreditManagerConnected(params);
88
- case "EventBorrowForbidden":
89
- return new EventBorrowForbidden(params);
90
- case "EventNewExpectedLiquidityLimit":
91
- return new EventNewExpectedLiquidityLimit(params);
92
- case "EventNewWithdrawFee":
93
- return new EventNewWithdrawFee(params);
94
- case "EventNewPriceFeed":
95
- return new EventNewPriceFeed(params);
96
- case "EventTakeForever":
97
- return new EventTakeForever(params);
98
- case "EventPaused":
99
- return new EventPaused(params);
100
- case "EventUnPaused":
101
- return new EventUnPaused(params);
102
- case "EventPausableAdminAdded":
103
- return new EventPausableAdminAdded(params);
104
- case "EventPausableAdminRemoved":
105
- return new EventPausableAdminRemoved(params);
106
- case "EventUnpausableAdminAdded":
107
- return new EventUnPausableAdminAdded(params);
108
- case "EventUnpausableAdminRemoved":
109
- return new EventUnPausableAdminRemoved(params);
110
- case "EventOwnershipTransferred":
111
- return new EventTransferOwnership(params);
112
-
113
- default:
114
- throw new Error("Unknown transaction for parsing");
45
+ static serialize(items: Array<EVMTx>): string {
46
+ return JSON.stringify(items.map(i => i.serialize()));
115
47
  }
116
- }
117
48
 
118
- static deserializeArray(data: Array<EventSerialized>): Array<EVMEvent> {
119
- return data.map(e => {
120
- return EventParser.deserialize(e);
121
- });
122
- }
49
+ static deserialize(data: EventSerialized): EVMEvent {
50
+ const params = data.content;
51
+ switch (data.type) {
52
+ case "EventAddLiquidity":
53
+ return new EventAddLiquidity(params);
54
+ case "EventRemoveLiquidity":
55
+ return new EventRemoveLiquidity(params);
56
+ case "EventOpenCreditAccount":
57
+ return new EventOpenCreditAccount(params);
58
+ case "EventCloseCreditAccount":
59
+ return new EventCloseCreditAccount(params);
60
+ case "EventLiquidateCreditAccount":
61
+ return new EventLiquidateCreditAccount(params);
62
+ case "EventRepayCreditAccount":
63
+ return new EventRepayCreditAccount(params);
64
+ case "EventAddCollateral":
65
+ return new EventAddCollateral(params);
66
+ case "EventIncreaseBorrowAmount":
67
+ return new EventIncreaseBorrowAmount(params);
68
+ case "EventCMNewParameters":
69
+ return new EventCMNewParameters(params);
70
+ case "EventTokenAllowed":
71
+ return new EventTokenAllowed(params);
72
+ case "EventTokenForbidden":
73
+ return new EventTokenForbidden(params);
74
+ case "EventContractAllowed":
75
+ return new EventContractAllowed(params);
76
+ case "EventContractForbidden":
77
+ return new EventContractForbidden(params);
78
+ case "EventNewFastCheckParameters":
79
+ return new EventNewFastCheckParameters(params);
80
+ case "EventPriceOracleUpdated":
81
+ return new EventPriceOracleUpdated(params);
82
+ case "EventTransferPluginAllowed":
83
+ return new EventTransferPluginAllowed(params);
84
+ case "EventNewInterestRateModel":
85
+ return new EventNewInterestRateModel(params);
86
+ case "EventNewCreditManagerConnected":
87
+ return new EventNewCreditManagerConnected(params);
88
+ case "EventBorrowForbidden":
89
+ return new EventBorrowForbidden(params);
90
+ case "EventNewExpectedLiquidityLimit":
91
+ return new EventNewExpectedLiquidityLimit(params);
92
+ case "EventNewWithdrawFee":
93
+ return new EventNewWithdrawFee(params);
94
+ case "EventNewPriceFeed":
95
+ return new EventNewPriceFeed(params);
96
+ case "EventTakeForever":
97
+ return new EventTakeForever(params);
98
+ case "EventPaused":
99
+ return new EventPaused(params);
100
+ case "EventUnPaused":
101
+ return new EventUnPaused(params);
102
+ case "EventPausableAdminAdded":
103
+ return new EventPausableAdminAdded(params);
104
+ case "EventPausableAdminRemoved":
105
+ return new EventPausableAdminRemoved(params);
106
+ case "EventUnpausableAdminAdded":
107
+ return new EventUnPausableAdminAdded(params);
108
+ case "EventUnpausableAdminRemoved":
109
+ return new EventUnPausableAdminRemoved(params);
110
+ case "EventOwnershipTransferred":
111
+ return new EventTransferOwnership(params);
112
+
113
+ default:
114
+ throw new Error("Unknown transaction for parsing");
115
+ }
116
+ }
117
+
118
+ static deserializeArray(data: Array<EventSerialized>): Array<EVMEvent> {
119
+ return data.map(e => {
120
+ return EventParser.deserialize(e);
121
+ });
122
+ }
123
123
  }
124
124
 
125
125
  // POOL EVENTS
126
126
  interface EventAddLiquidityProps extends EVMEventProps {
127
- amount: string;
128
- underlyingToken: string;
129
- pool: string;
127
+ amount: string;
128
+ underlyingToken: string;
129
+ pool: string;
130
130
  }
131
+
131
132
  export class EventAddLiquidity extends EVMEvent {
132
- public readonly amount: BigNumber;
133
- public readonly underlyingToken: string;
134
- public readonly pool: string;
135
-
136
- constructor(opts: EventAddLiquidityProps) {
137
- super({
138
- block: opts.block,
139
- txHash: opts.txHash,
140
- timestamp: opts.timestamp
141
- });
142
- this.amount = BigNumber.from(opts.amount);
143
- this.underlyingToken = opts.underlyingToken;
144
- this.pool = opts.pool;
145
- }
146
-
147
- toString(tokenData: Record<string, TokenData>): string {
148
- const { decimals = 18, symbol } =
149
- tokenData[this.underlyingToken.toLowerCase()] || {};
150
-
151
- return `Pool ${getContractName(this.pool)}: Deposit ${formatBN(
152
- this.amount,
153
- decimals
154
- )} ${symbol}`;
155
- }
133
+ public readonly amount: BigNumber;
134
+ public readonly underlyingToken: string;
135
+ public readonly pool: string;
136
+
137
+ constructor(opts: EventAddLiquidityProps) {
138
+ super({
139
+ block: opts.block,
140
+ txHash: opts.txHash,
141
+ timestamp: opts.timestamp
142
+ });
143
+ this.amount = BigNumber.from(opts.amount);
144
+ this.underlyingToken = opts.underlyingToken;
145
+ this.pool = opts.pool;
146
+ }
147
+
148
+ toString(tokenData: Record<string, TokenData>): string {
149
+ const {decimals = 18, symbol} =
150
+ tokenData[this.underlyingToken.toLowerCase()] || {};
151
+
152
+ return `Pool ${getContractName(this.pool)}: Deposit ${formatBN(
153
+ this.amount,
154
+ decimals
155
+ )} ${symbol}`;
156
+ }
156
157
  }
157
158
 
158
159
  interface RemoveLiquidityProps extends EVMEventProps {
159
- amount: string;
160
- underlyingToken: string;
161
- dieselToken: string;
162
- pool: string;
160
+ amount: string;
161
+ underlyingToken: string;
162
+ dieselToken: string;
163
+ pool: string;
163
164
  }
165
+
164
166
  export class EventRemoveLiquidity extends EVMEvent {
165
- public readonly amount: BigNumber;
166
- public readonly underlyingToken: string;
167
- public readonly dieselToken: string;
168
- public readonly pool: string;
169
-
170
- constructor(opts: RemoveLiquidityProps) {
171
- super({
172
- block: opts.block,
173
- txHash: opts.txHash,
174
- timestamp: opts.timestamp
175
- });
176
- this.amount = BigNumber.from(opts.amount);
177
- this.underlyingToken = opts.underlyingToken;
178
- this.dieselToken = opts.dieselToken;
179
- this.pool = opts.pool;
180
- }
181
-
182
- toString(tokenData: Record<string, TokenData>): string {
183
- const { decimals = 18, symbol } =
184
- tokenData[this.dieselToken.toLowerCase()] || {};
185
-
186
- return `Pool ${getContractName(this.pool)}: withdraw ${formatBN(
187
- this.amount,
188
- decimals
189
- )} ${symbol}`;
190
- }
167
+ public readonly amount: BigNumber;
168
+ public readonly underlyingToken: string;
169
+ public readonly dieselToken: string;
170
+ public readonly pool: string;
171
+
172
+ constructor(opts: RemoveLiquidityProps) {
173
+ super({
174
+ block: opts.block,
175
+ txHash: opts.txHash,
176
+ timestamp: opts.timestamp
177
+ });
178
+ this.amount = BigNumber.from(opts.amount);
179
+ this.underlyingToken = opts.underlyingToken;
180
+ this.dieselToken = opts.dieselToken;
181
+ this.pool = opts.pool;
182
+ }
183
+
184
+ toString(tokenData: Record<string, TokenData>): string {
185
+ const {decimals = 18, symbol} =
186
+ tokenData[this.dieselToken.toLowerCase()] || {};
187
+
188
+ return `Pool ${getContractName(this.pool)}: withdraw ${formatBN(
189
+ this.amount,
190
+ decimals
191
+ )} ${symbol}`;
192
+ }
191
193
  }
192
194
 
193
195
  // CREDIT MANAGER EVENTS
194
196
 
195
197
  interface OpenCreditAccountProps extends EVMEventProps {
196
- amount: string;
197
- underlyingToken: string;
198
- leverage: number;
199
- creditManager: string;
198
+ amount: string;
199
+ underlyingToken: string;
200
+ leverage: number;
201
+ creditManager: string;
200
202
  }
203
+
201
204
  export class EventOpenCreditAccount extends EVMEvent {
202
- public readonly amount: BigNumber;
203
- public readonly underlyingToken: string;
204
- public readonly leverage: number;
205
- public readonly creditManager: string;
206
-
207
- constructor(opts: OpenCreditAccountProps) {
208
- super({
209
- block: opts.block,
210
- txHash: opts.txHash,
211
- timestamp: opts.timestamp
212
- });
213
- this.amount = BigNumber.from(opts.amount);
214
- this.underlyingToken = opts.underlyingToken;
215
- this.leverage = opts.leverage;
216
- this.creditManager = opts.creditManager;
217
- }
218
-
219
- toString(tokenData: Record<string, TokenData>): string {
220
- const { decimals = 18, symbol } =
221
- tokenData[this.underlyingToken.toLowerCase()] || {};
222
-
223
- return `Credit account ${getContractName(
224
- this.creditManager
225
- )}: open ${formatBN(
226
- this.amount,
227
- decimals
228
- )} ${symbol} x ${this.leverage.toFixed(2)} ⇒
205
+ public readonly amount: BigNumber;
206
+ public readonly underlyingToken: string;
207
+ public readonly leverage: number;
208
+ public readonly creditManager: string;
209
+
210
+ constructor(opts: OpenCreditAccountProps) {
211
+ super({
212
+ block: opts.block,
213
+ txHash: opts.txHash,
214
+ timestamp: opts.timestamp
215
+ });
216
+ this.amount = BigNumber.from(opts.amount);
217
+ this.underlyingToken = opts.underlyingToken;
218
+ this.leverage = opts.leverage;
219
+ this.creditManager = opts.creditManager;
220
+ }
221
+
222
+ toString(tokenData: Record<string, TokenData>): string {
223
+ const {decimals = 18, symbol} =
224
+ tokenData[this.underlyingToken.toLowerCase()] || {};
225
+
226
+ return `Credit account ${getContractName(
227
+ this.creditManager
228
+ )}: open ${formatBN(
229
+ this.amount,
230
+ decimals
231
+ )} ${symbol} x ${this.leverage.toFixed(2)} ⇒
229
232
  ${formatBN(
230
- this.amount
231
- .mul(Math.floor(this.leverage + LEVERAGE_DECIMALS))
232
- .div(LEVERAGE_DECIMALS),
233
- decimals + 2
234
- )} ${symbol}`;
235
- }
233
+ this.amount
234
+ .mul(Math.floor(this.leverage + LEVERAGE_DECIMALS))
235
+ .div(LEVERAGE_DECIMALS),
236
+ decimals + 2
237
+ )} ${symbol}`;
238
+ }
236
239
  }
237
240
 
238
241
  interface CloseCreditAccountProps extends EVMEventProps {
239
- amount: string;
240
- underlyingToken: string;
241
- creditManager: string;
242
+ amount: string;
243
+ underlyingToken: string;
244
+ creditManager: string;
242
245
  }
246
+
243
247
  export class EventCloseCreditAccount extends EVMEvent {
244
- public readonly amount: BigNumber;
245
- public readonly underlyingToken: string;
246
- public readonly creditManager: string;
247
-
248
- constructor(opts: CloseCreditAccountProps) {
249
- super({
250
- block: opts.block,
251
- txHash: opts.txHash,
252
- timestamp: opts.timestamp
253
- });
254
- this.amount = BigNumber.from(opts.amount);
255
- this.underlyingToken = opts.underlyingToken;
256
- this.creditManager = opts.creditManager;
257
- }
258
-
259
- toString(tokenData: Record<string, TokenData>): string {
260
- const { decimals = 18, symbol } =
261
- tokenData[this.underlyingToken.toLowerCase()] || {};
262
-
263
- return `Credit account ${getContractName(
264
- this.creditManager
265
- )}: was closed and got ${formatBN(
266
- this.amount,
267
- decimals
268
- )} ${symbol} as remaining funds`;
269
- }
248
+ public readonly amount: BigNumber;
249
+ public readonly underlyingToken: string;
250
+ public readonly creditManager: string;
251
+
252
+ constructor(opts: CloseCreditAccountProps) {
253
+ super({
254
+ block: opts.block,
255
+ txHash: opts.txHash,
256
+ timestamp: opts.timestamp
257
+ });
258
+ this.amount = BigNumber.from(opts.amount);
259
+ this.underlyingToken = opts.underlyingToken;
260
+ this.creditManager = opts.creditManager;
261
+ }
262
+
263
+ toString(tokenData: Record<string, TokenData>): string {
264
+ const {decimals = 18, symbol} =
265
+ tokenData[this.underlyingToken.toLowerCase()] || {};
266
+
267
+ return `Credit account ${getContractName(
268
+ this.creditManager
269
+ )}: was closed and got ${formatBN(
270
+ this.amount,
271
+ decimals
272
+ )} ${symbol} as remaining funds`;
273
+ }
270
274
  }
271
275
 
272
276
  interface LiquidateCreditAccountProps extends EVMEventProps {
273
- amount: string;
274
- underlyingToken: string;
275
- creditManager: string;
277
+ amount: string;
278
+ underlyingToken: string;
279
+ creditManager: string;
276
280
  }
281
+
277
282
  export class EventLiquidateCreditAccount extends EVMEvent {
278
- public readonly amount: BigNumber;
279
- public readonly underlyingToken: string;
280
- public readonly creditManager: string;
281
-
282
- constructor(opts: LiquidateCreditAccountProps) {
283
- super({
284
- block: opts.block,
285
- txHash: opts.txHash,
286
- timestamp: opts.timestamp
287
- });
288
- this.amount = BigNumber.from(opts.amount);
289
- this.underlyingToken = opts.underlyingToken;
290
- this.creditManager = opts.creditManager;
291
- }
292
-
293
- toString(tokenData: Record<string, TokenData>): string {
294
- const { decimals = 18, symbol } =
295
- tokenData[this.underlyingToken.toLowerCase()] || {};
296
-
297
- return `Credit account ${getContractName(
298
- this.creditManager
299
- )}: was liquidated. ${formatBN(
300
- this.amount,
301
- decimals
302
- )} ${symbol} were paid back as remaining funds`;
303
- }
283
+ public readonly amount: BigNumber;
284
+ public readonly underlyingToken: string;
285
+ public readonly creditManager: string;
286
+
287
+ constructor(opts: LiquidateCreditAccountProps) {
288
+ super({
289
+ block: opts.block,
290
+ txHash: opts.txHash,
291
+ timestamp: opts.timestamp
292
+ });
293
+ this.amount = BigNumber.from(opts.amount);
294
+ this.underlyingToken = opts.underlyingToken;
295
+ this.creditManager = opts.creditManager;
296
+ }
297
+
298
+ toString(tokenData: Record<string, TokenData>): string {
299
+ const {decimals = 18, symbol} =
300
+ tokenData[this.underlyingToken.toLowerCase()] || {};
301
+
302
+ return `Credit account ${getContractName(
303
+ this.creditManager
304
+ )}: was liquidated. ${formatBN(
305
+ this.amount,
306
+ decimals
307
+ )} ${symbol} were paid back as remaining funds`;
308
+ }
304
309
  }
305
310
 
306
311
  interface RepayCreditAccountProps extends EVMEventProps {
307
- underlyingToken: string;
308
- creditManager: string;
312
+ underlyingToken: string;
313
+ creditManager: string;
309
314
  }
315
+
310
316
  export class EventRepayCreditAccount extends EVMEvent {
311
- public readonly underlyingToken: string;
312
- public readonly creditManager: string;
313
-
314
- constructor(opts: RepayCreditAccountProps) {
315
- super({
316
- block: opts.block,
317
- txHash: opts.txHash,
318
- timestamp: opts.timestamp
319
- });
320
- this.underlyingToken = opts.underlyingToken;
321
- this.creditManager = opts.creditManager;
322
- }
323
-
324
- toString(_: Record<string, TokenData>): string {
325
- return `Credit account ${getContractName(this.creditManager)}: was repaid`;
326
- }
317
+ public readonly underlyingToken: string;
318
+ public readonly creditManager: string;
319
+
320
+ constructor(opts: RepayCreditAccountProps) {
321
+ super({
322
+ block: opts.block,
323
+ txHash: opts.txHash,
324
+ timestamp: opts.timestamp
325
+ });
326
+ this.underlyingToken = opts.underlyingToken;
327
+ this.creditManager = opts.creditManager;
328
+ }
329
+
330
+ toString(_: Record<string, TokenData>): string {
331
+ return `Credit account ${getContractName(this.creditManager)}: was repaid`;
332
+ }
327
333
  }
328
334
 
329
335
  interface AddCollateralProps extends EVMEventProps {
330
- amount: string;
331
- addedToken: string;
332
- creditManager: string;
336
+ amount: string;
337
+ addedToken: string;
338
+ creditManager: string;
333
339
  }
340
+
334
341
  export class EventAddCollateral extends EVMEvent {
335
- public readonly amount: BigNumber;
336
- public readonly addedToken: string;
337
- public readonly creditManager: string;
338
-
339
- constructor(opts: AddCollateralProps) {
340
- super({
341
- block: opts.block,
342
- txHash: opts.txHash,
343
- timestamp: opts.timestamp
344
- });
345
- this.amount = BigNumber.from(opts.amount);
346
-
347
- this.addedToken = opts.addedToken;
348
- this.creditManager = opts.creditManager;
349
- }
350
-
351
- toString(tokenData: Record<string, TokenData>): string {
352
- const { decimals = 18, symbol } =
353
- tokenData[this.addedToken.toLowerCase()] || {};
354
-
355
- return `Credit account ${getContractName(
356
- this.creditManager
357
- )}: added ${formatBN(this.amount, decimals)} ${symbol} as collateral`;
358
- }
342
+ public readonly amount: BigNumber;
343
+ public readonly addedToken: string;
344
+ public readonly creditManager: string;
345
+
346
+ constructor(opts: AddCollateralProps) {
347
+ super({
348
+ block: opts.block,
349
+ txHash: opts.txHash,
350
+ timestamp: opts.timestamp
351
+ });
352
+ this.amount = BigNumber.from(opts.amount);
353
+
354
+ this.addedToken = opts.addedToken;
355
+ this.creditManager = opts.creditManager;
356
+ }
357
+
358
+ toString(tokenData: Record<string, TokenData>): string {
359
+ const {decimals = 18, symbol} =
360
+ tokenData[this.addedToken.toLowerCase()] || {};
361
+
362
+ return `Credit account ${getContractName(
363
+ this.creditManager
364
+ )}: added ${formatBN(this.amount, decimals)} ${symbol} as collateral`;
365
+ }
359
366
  }
360
367
 
361
368
  interface IncreaseBorrowAmountProps extends EVMEventProps {
362
- amount: string;
363
- underlyingToken: string;
364
- creditManager: string;
369
+ amount: string;
370
+ underlyingToken: string;
371
+ creditManager: string;
365
372
  }
373
+
366
374
  export class EventIncreaseBorrowAmount extends EVMEvent {
367
- public readonly amount: BigNumber;
368
- public readonly underlyingToken: string;
369
- public readonly creditManager: string;
370
-
371
- constructor(opts: IncreaseBorrowAmountProps) {
372
- super({
373
- block: opts.block,
374
- txHash: opts.txHash,
375
- timestamp: opts.timestamp
376
- });
377
- this.amount = BigNumber.from(opts.amount);
378
- this.underlyingToken = opts.underlyingToken;
379
- this.creditManager = opts.creditManager;
380
- }
381
-
382
- toString(tokenData: Record<string, TokenData>): string {
383
- const { decimals = 18, symbol } =
384
- tokenData[this.underlyingToken.toLowerCase()] || {};
385
-
386
- return `Credit account ${getContractName(
387
- this.creditManager
388
- )}: borrowed amount was increased for ${formatBN(
389
- this.amount,
390
- decimals
391
- )} ${symbol}`;
392
- }
375
+ public readonly amount: BigNumber;
376
+ public readonly underlyingToken: string;
377
+ public readonly creditManager: string;
378
+
379
+ constructor(opts: IncreaseBorrowAmountProps) {
380
+ super({
381
+ block: opts.block,
382
+ txHash: opts.txHash,
383
+ timestamp: opts.timestamp
384
+ });
385
+ this.amount = BigNumber.from(opts.amount);
386
+ this.underlyingToken = opts.underlyingToken;
387
+ this.creditManager = opts.creditManager;
388
+ }
389
+
390
+ toString(tokenData: Record<string, TokenData>): string {
391
+ const {decimals = 18, symbol} =
392
+ tokenData[this.underlyingToken.toLowerCase()] || {};
393
+
394
+ return `Credit account ${getContractName(
395
+ this.creditManager
396
+ )}: borrowed amount was increased for ${formatBN(
397
+ this.amount,
398
+ decimals
399
+ )} ${symbol}`;
400
+ }
393
401
  }
394
402
 
395
403
  // // Emits each time when new fees are set
@@ -403,104 +411,105 @@ export class EventIncreaseBorrowAmount extends EVMEvent {
403
411
  // );
404
412
 
405
413
  interface CMNewParametersProps extends EVMEventProps {
406
- creditManager: string;
407
- underlyingToken: string;
408
- minAmount: string;
409
- maxAmount: string;
410
- maxLeverage: number;
411
- feeInterest: number;
412
- feeLiquidation: number;
413
- liquidationDiscount: number;
414
- prevMinAmount: string;
415
- prevMaxAmount: string;
416
- prevMaxLeverage: number;
417
- prevFeeInterest: number;
418
- prevFeeLiquidation: number;
419
- prevLiquidationDiscount: number;
414
+ creditManager: string;
415
+ underlyingToken: string;
416
+ minAmount: string;
417
+ maxAmount: string;
418
+ maxLeverage: number;
419
+ feeInterest: number;
420
+ feeLiquidation: number;
421
+ liquidationDiscount: number;
422
+ prevMinAmount: string;
423
+ prevMaxAmount: string;
424
+ prevMaxLeverage: number;
425
+ prevFeeInterest: number;
426
+ prevFeeLiquidation: number;
427
+ prevLiquidationDiscount: number;
420
428
  }
421
- export class EventCMNewParameters extends EVMEvent {
422
- public readonly creditManager: string;
423
- public readonly underlyingToken: string;
424
- public readonly minAmount: BigNumber;
425
- public readonly maxAmount: BigNumber;
426
- public readonly maxLeverage: number;
427
- public readonly feeInterest: number;
428
- public readonly feeLiquidation: number;
429
- public readonly liquidationDiscount: number;
430
- public readonly prevMinAmount: BigNumber;
431
- public readonly prevMaxAmount: BigNumber;
432
- public readonly prevMaxLeverage: number;
433
- public readonly prevFeeInterest: number;
434
- public readonly prevFeeLiquidation: number;
435
- public readonly prevLiquidationDiscount: number;
436
-
437
- constructor(opts: CMNewParametersProps) {
438
- super({
439
- block: opts.block,
440
- txHash: opts.txHash,
441
- timestamp: opts.timestamp
442
- });
443
- this.creditManager = opts.creditManager;
444
- this.underlyingToken = opts.underlyingToken;
445
- this.minAmount = BigNumber.from(opts.minAmount);
446
- this.maxAmount = BigNumber.from(opts.maxAmount);
447
- this.maxLeverage = opts.maxLeverage;
448
- this.feeInterest = opts.feeInterest;
449
- this.feeLiquidation = opts.feeLiquidation;
450
- this.liquidationDiscount = opts.liquidationDiscount;
451
-
452
- this.prevMinAmount = BigNumber.from(opts.prevMinAmount);
453
- this.prevMaxAmount = BigNumber.from(opts.prevMaxAmount);
454
- this.prevMaxLeverage = opts.prevMaxLeverage;
455
- this.prevFeeInterest = opts.prevFeeInterest;
456
- this.prevFeeLiquidation = opts.prevFeeLiquidation;
457
- this.prevLiquidationDiscount = opts.prevLiquidationDiscount;
458
- }
459
-
460
- toString(tokenData: Record<string, TokenData>): string {
461
- const token = tokenData[this.underlyingToken.toLowerCase()];
462
- let msg = `Credit manager ${getContractName(this.creditManager)} updated: `;
463
-
464
- if (this.minAmount !== this.prevMinAmount) {
465
- msg += `min amount: ${formatBN(
466
- this.prevMinAmount,
467
- token.decimals
468
- )} => ${formatBN(this.minAmount, token.decimals)} ${token.symbol}, `;
469
- }
470
429
 
471
- if (this.maxAmount !== this.prevMaxAmount) {
472
- msg += `max amount: ${formatBN(
473
- this.prevMaxAmount,
474
- token.decimals
475
- )} => ${formatBN(this.maxAmount, token.decimals)} ${token.symbol}, `;
476
- }
477
-
478
- if (this.maxLeverage !== this.prevMaxLeverage) {
479
- msg += `max leverage: ${this.prevMaxLeverage / 100 + 1} => ${
480
- this.maxLeverage / 100 + 1
481
- }, `;
482
- }
483
-
484
- if (this.feeInterest !== this.prevFeeInterest) {
485
- msg += `interest fee: ${this.prevFeeInterest / 100}% => ${
486
- this.feeInterest / 100
487
- }%, `;
488
- }
489
-
490
- if (this.feeLiquidation !== this.prevFeeLiquidation) {
491
- msg += `liquidation fee: ${this.prevFeeLiquidation / 100}% => ${
492
- this.feeLiquidation / 100
493
- }%, `;
430
+ export class EventCMNewParameters extends EVMEvent {
431
+ public readonly creditManager: string;
432
+ public readonly underlyingToken: string;
433
+ public readonly minAmount: BigNumber;
434
+ public readonly maxAmount: BigNumber;
435
+ public readonly maxLeverage: number;
436
+ public readonly feeInterest: number;
437
+ public readonly feeLiquidation: number;
438
+ public readonly liquidationDiscount: number;
439
+ public readonly prevMinAmount: BigNumber;
440
+ public readonly prevMaxAmount: BigNumber;
441
+ public readonly prevMaxLeverage: number;
442
+ public readonly prevFeeInterest: number;
443
+ public readonly prevFeeLiquidation: number;
444
+ public readonly prevLiquidationDiscount: number;
445
+
446
+ constructor(opts: CMNewParametersProps) {
447
+ super({
448
+ block: opts.block,
449
+ txHash: opts.txHash,
450
+ timestamp: opts.timestamp
451
+ });
452
+ this.creditManager = opts.creditManager;
453
+ this.underlyingToken = opts.underlyingToken;
454
+ this.minAmount = BigNumber.from(opts.minAmount);
455
+ this.maxAmount = BigNumber.from(opts.maxAmount);
456
+ this.maxLeverage = opts.maxLeverage;
457
+ this.feeInterest = opts.feeInterest;
458
+ this.feeLiquidation = opts.feeLiquidation;
459
+ this.liquidationDiscount = opts.liquidationDiscount;
460
+
461
+ this.prevMinAmount = BigNumber.from(opts.prevMinAmount);
462
+ this.prevMaxAmount = BigNumber.from(opts.prevMaxAmount);
463
+ this.prevMaxLeverage = opts.prevMaxLeverage;
464
+ this.prevFeeInterest = opts.prevFeeInterest;
465
+ this.prevFeeLiquidation = opts.prevFeeLiquidation;
466
+ this.prevLiquidationDiscount = opts.prevLiquidationDiscount;
494
467
  }
495
468
 
496
- if (this.liquidationDiscount !== this.prevLiquidationDiscount) {
497
- msg += `liquidation premium: ${
498
- 100 - this.prevLiquidationDiscount / 100
499
- }% => ${100 - this.liquidationDiscount / 100}%, `;
469
+ toString(tokenData: Record<string, TokenData>): string {
470
+ const token = tokenData[this.underlyingToken.toLowerCase()];
471
+ let msg = `Credit manager ${getContractName(this.creditManager)} updated: `;
472
+
473
+ if (this.minAmount !== this.prevMinAmount) {
474
+ msg += `min amount: ${formatBN(
475
+ this.prevMinAmount,
476
+ token.decimals
477
+ )} => ${formatBN(this.minAmount, token.decimals)} ${token.symbol}, `;
478
+ }
479
+
480
+ if (this.maxAmount !== this.prevMaxAmount) {
481
+ msg += `max amount: ${formatBN(
482
+ this.prevMaxAmount,
483
+ token.decimals
484
+ )} => ${formatBN(this.maxAmount, token.decimals)} ${token.symbol}, `;
485
+ }
486
+
487
+ if (this.maxLeverage !== this.prevMaxLeverage) {
488
+ msg += `max leverage: ${this.prevMaxLeverage / 100 + 1} => ${
489
+ this.maxLeverage / 100 + 1
490
+ }, `;
491
+ }
492
+
493
+ if (this.feeInterest !== this.prevFeeInterest) {
494
+ msg += `interest fee: ${this.prevFeeInterest / 100}% => ${
495
+ this.feeInterest / 100
496
+ }%, `;
497
+ }
498
+
499
+ if (this.feeLiquidation !== this.prevFeeLiquidation) {
500
+ msg += `liquidation fee: ${this.prevFeeLiquidation / 100}% => ${
501
+ this.feeLiquidation / 100
502
+ }%, `;
503
+ }
504
+
505
+ if (this.liquidationDiscount !== this.prevLiquidationDiscount) {
506
+ msg += `liquidation premium: ${
507
+ 100 - this.prevLiquidationDiscount / 100
508
+ }% => ${100 - this.liquidationDiscount / 100}%, `;
509
+ }
510
+
511
+ return msg.slice(0, msg.length - 2);
500
512
  }
501
-
502
- return msg.slice(0, msg.length - 2);
503
- }
504
513
  }
505
514
 
506
515
  // // Emits each time token is allowed or liquidation threshold changed
@@ -509,82 +518,83 @@ export class EventCMNewParameters extends EVMEvent {
509
518
  export type TokenAllowanceType = "NewToken" | "LTUpdated" | "Allowed";
510
519
 
511
520
  interface TokenAllowedProps extends EVMEventProps {
512
- creditManager: string;
513
- token: string;
514
- liquidityThreshold: number;
515
- prevLiquidationThreshold?: number;
516
- status: TokenAllowanceType;
521
+ creditManager: string;
522
+ token: string;
523
+ liquidityThreshold: number;
524
+ prevLiquidationThreshold?: number;
525
+ status: TokenAllowanceType;
517
526
  }
527
+
518
528
  export class EventTokenAllowed extends EVMEvent {
519
- public readonly creditManager: string;
520
- public readonly token: string;
521
- public readonly liquidityThreshold: number;
522
- public readonly prevLiquidationThreshold?: number;
523
- public readonly status: TokenAllowanceType;
524
-
525
- constructor(opts: TokenAllowedProps) {
526
- super({
527
- block: opts.block,
528
- txHash: opts.txHash,
529
- timestamp: opts.timestamp
530
- });
531
- this.creditManager = opts.creditManager;
532
- this.token = opts.token;
533
- this.liquidityThreshold = opts.liquidityThreshold;
534
- this.prevLiquidationThreshold = opts.prevLiquidationThreshold;
535
- this.status = opts.status;
536
- }
537
-
538
- toString(tokenData: Record<string, TokenData>): string {
539
- const token = tokenData[this.token.toLowerCase()];
540
- let msg = `Credit manager ${getContractName(this.creditManager)} updated `;
541
- switch (this.status) {
542
- case "NewToken":
543
- return `${msg}: New token allowed: ${
544
- token.symbol
545
- }, liquidation threshold: ${this.liquidityThreshold / 100}%`;
546
- case "Allowed":
547
- return `${msg}: ${
548
- token.symbol
549
- } is allowed now, liquidation threshold: ${
550
- this.liquidityThreshold / 100
551
- }%`;
552
- case "LTUpdated":
553
- return `${msg}: ${token.symbol} liquidation threshold: ${
554
- (this.prevLiquidationThreshold || 0) / 100
555
- } => ${this.liquidityThreshold / 100}%`;
529
+ public readonly creditManager: string;
530
+ public readonly token: string;
531
+ public readonly liquidityThreshold: number;
532
+ public readonly prevLiquidationThreshold?: number;
533
+ public readonly status: TokenAllowanceType;
534
+
535
+ constructor(opts: TokenAllowedProps) {
536
+ super({
537
+ block: opts.block,
538
+ txHash: opts.txHash,
539
+ timestamp: opts.timestamp
540
+ });
541
+ this.creditManager = opts.creditManager;
542
+ this.token = opts.token;
543
+ this.liquidityThreshold = opts.liquidityThreshold;
544
+ this.prevLiquidationThreshold = opts.prevLiquidationThreshold;
545
+ this.status = opts.status;
546
+ }
547
+
548
+ toString(tokenData: Record<string, TokenData>): string {
549
+ const token = tokenData[this.token.toLowerCase()];
550
+ let msg = `Credit manager ${getContractName(this.creditManager)} updated `;
551
+ switch (this.status) {
552
+ case "NewToken":
553
+ return `${msg}: New token allowed: ${
554
+ token.symbol
555
+ }, liquidation threshold: ${this.liquidityThreshold / 100}%`;
556
+ case "Allowed":
557
+ return `${msg}: ${
558
+ token.symbol
559
+ } is allowed now, liquidation threshold: ${
560
+ this.liquidityThreshold / 100
561
+ }%`;
562
+ case "LTUpdated":
563
+ return `${msg}: ${token.symbol} liquidation threshold: ${
564
+ (this.prevLiquidationThreshold || 0) / 100
565
+ } => ${this.liquidityThreshold / 100}%`;
566
+ }
556
567
  }
557
- }
558
568
  }
559
569
 
560
570
  // // Emits each time token is allowed or liquidtion threshold changed
561
571
  // event TokenForbidden(address indexed token);
562
572
 
563
573
  interface TokenForbiddenProps extends EVMEventProps {
564
- creditManager: string;
565
- token: string;
574
+ creditManager: string;
575
+ token: string;
566
576
  }
567
577
 
568
578
  export class EventTokenForbidden extends EVMEvent {
569
- public readonly creditManager: string;
570
- public readonly token: string;
571
-
572
- constructor(opts: TokenForbiddenProps) {
573
- super({
574
- block: opts.block,
575
- txHash: opts.txHash,
576
- timestamp: opts.timestamp
577
- });
578
- this.creditManager = opts.creditManager;
579
- this.token = opts.token;
580
- }
581
-
582
- toString(tokenData: Record<string, TokenData>): string {
583
- const token = tokenData[this.token.toLowerCase()];
584
- return `Credit manager ${getContractName(this.creditManager)} updated ${
585
- token.symbol
586
- } forbidden`;
587
- }
579
+ public readonly creditManager: string;
580
+ public readonly token: string;
581
+
582
+ constructor(opts: TokenForbiddenProps) {
583
+ super({
584
+ block: opts.block,
585
+ txHash: opts.txHash,
586
+ timestamp: opts.timestamp
587
+ });
588
+ this.creditManager = opts.creditManager;
589
+ this.token = opts.token;
590
+ }
591
+
592
+ toString(tokenData: Record<string, TokenData>): string {
593
+ const token = tokenData[this.token.toLowerCase()];
594
+ return `Credit manager ${getContractName(this.creditManager)} updated ${
595
+ token.symbol
596
+ } forbidden`;
597
+ }
588
598
  }
589
599
 
590
600
  //
@@ -594,44 +604,44 @@ export class EventTokenForbidden extends EVMEvent {
594
604
  export type EventContractAllowedStatus = "Connected" | "AdapterUpdate";
595
605
 
596
606
  interface ContractAllowedProps extends EVMEventProps {
597
- creditManager: string;
598
- protocol: string;
599
- adapter: string;
600
- status: EventContractAllowedStatus;
607
+ creditManager: string;
608
+ protocol: string;
609
+ adapter: string;
610
+ status: EventContractAllowedStatus;
601
611
  }
602
612
 
603
613
  export class EventContractAllowed extends EVMEvent {
604
- public readonly creditManager: string;
605
- public readonly protocol: string;
606
- public readonly adapter: string;
607
- public readonly status: EventContractAllowedStatus;
608
-
609
- constructor(opts: ContractAllowedProps) {
610
- super({
611
- block: opts.block,
612
- txHash: opts.txHash,
613
- timestamp: opts.timestamp
614
- });
615
- this.creditManager = opts.creditManager;
616
- this.protocol = opts.protocol;
617
- this.adapter = opts.adapter;
618
- this.status = opts.status;
619
- }
620
-
621
- toString(_: Record<string, TokenData>): string {
622
- let msg = `Credit manager ${getContractName(this.creditManager)} updated`;
623
-
624
- switch (this.status) {
625
- case "Connected":
626
- return `${msg} : ${getContractName(
627
- this.protocol
628
- )} was connected. Adapter at: ${this.adapter}`;
629
- case "AdapterUpdate":
630
- return `${msg} : ${getContractName(
631
- this.protocol
632
- )} adapter was updated. New adapter: ${this.adapter}`;
614
+ public readonly creditManager: string;
615
+ public readonly protocol: string;
616
+ public readonly adapter: string;
617
+ public readonly status: EventContractAllowedStatus;
618
+
619
+ constructor(opts: ContractAllowedProps) {
620
+ super({
621
+ block: opts.block,
622
+ txHash: opts.txHash,
623
+ timestamp: opts.timestamp
624
+ });
625
+ this.creditManager = opts.creditManager;
626
+ this.protocol = opts.protocol;
627
+ this.adapter = opts.adapter;
628
+ this.status = opts.status;
629
+ }
630
+
631
+ toString(_: Record<string, TokenData>): string {
632
+ let msg = `Credit manager ${getContractName(this.creditManager)} updated`;
633
+
634
+ switch (this.status) {
635
+ case "Connected":
636
+ return `${msg} : ${getContractName(
637
+ this.protocol
638
+ )} was connected. Adapter at: ${this.adapter}`;
639
+ case "AdapterUpdate":
640
+ return `${msg} : ${getContractName(
641
+ this.protocol
642
+ )} adapter was updated. New adapter: ${this.adapter}`;
643
+ }
633
644
  }
634
- }
635
645
  }
636
646
 
637
647
  //
@@ -639,29 +649,29 @@ export class EventContractAllowed extends EVMEvent {
639
649
  // event ContractForbidden(address indexed protocol);
640
650
 
641
651
  interface ContractForbiddenProps extends EVMEventProps {
642
- creditManager: string;
643
- protocol: string;
652
+ creditManager: string;
653
+ protocol: string;
644
654
  }
645
655
 
646
656
  export class EventContractForbidden extends EVMEvent {
647
- public readonly creditManager: string;
648
- public readonly protocol: string;
649
-
650
- constructor(opts: ContractForbiddenProps) {
651
- super({
652
- block: opts.block,
653
- txHash: opts.txHash,
654
- timestamp: opts.timestamp
655
- });
656
- this.creditManager = opts.creditManager;
657
- this.protocol = opts.protocol;
658
- }
659
-
660
- toString(_: Record<string, TokenData>): string {
661
- return `Credit manager ${getContractName(
662
- this.creditManager
663
- )} updated: ${getContractName(this.protocol)}`;
664
- }
657
+ public readonly creditManager: string;
658
+ public readonly protocol: string;
659
+
660
+ constructor(opts: ContractForbiddenProps) {
661
+ super({
662
+ block: opts.block,
663
+ txHash: opts.txHash,
664
+ timestamp: opts.timestamp
665
+ });
666
+ this.creditManager = opts.creditManager;
667
+ this.protocol = opts.protocol;
668
+ }
669
+
670
+ toString(_: Record<string, TokenData>): string {
671
+ return `Credit manager ${getContractName(
672
+ this.creditManager
673
+ )} updated: ${getContractName(this.protocol)}`;
674
+ }
665
675
  }
666
676
 
667
677
  //
@@ -669,76 +679,76 @@ export class EventContractForbidden extends EVMEvent {
669
679
  // event NewFastCheckParameters(uint256 chiThreshold, uint256 fastCheckDelay);
670
680
 
671
681
  interface NewFastCheckParametersProps extends EVMEventProps {
672
- creditManager: string;
673
- chiThreshold: number;
674
- fastCheckDelay: number;
675
- prevChiThreshold?: number;
676
- prevFastCheckDelay?: number;
682
+ creditManager: string;
683
+ chiThreshold: number;
684
+ fastCheckDelay: number;
685
+ prevChiThreshold?: number;
686
+ prevFastCheckDelay?: number;
677
687
  }
678
688
 
679
689
  export class EventNewFastCheckParameters extends EVMEvent {
680
- public readonly creditManager: string;
681
- public readonly chiThreshold: number;
682
- public readonly fastCheckDelay: number;
683
- public readonly prevChiThreshold?: number;
684
- public readonly prevFastCheckDelay?: number;
685
-
686
- constructor(opts: NewFastCheckParametersProps) {
687
- super({
688
- block: opts.block,
689
- txHash: opts.txHash,
690
- timestamp: opts.timestamp
691
- });
692
- this.creditManager = opts.creditManager;
693
- this.chiThreshold = opts.chiThreshold;
694
- this.fastCheckDelay = opts.fastCheckDelay;
695
- this.prevChiThreshold = opts.prevChiThreshold;
696
- this.prevFastCheckDelay = opts.prevFastCheckDelay;
697
- }
698
-
699
- toString(_: Record<string, TokenData>): string {
700
- let msg = `Credit manager ${getContractName(this.creditManager)} updated: `;
701
-
702
- if (this.chiThreshold !== this.prevChiThreshold) {
703
- msg += `Chi threshold: ${this.prevChiThreshold} => ${this.chiThreshold}, `;
690
+ public readonly creditManager: string;
691
+ public readonly chiThreshold: number;
692
+ public readonly fastCheckDelay: number;
693
+ public readonly prevChiThreshold?: number;
694
+ public readonly prevFastCheckDelay?: number;
695
+
696
+ constructor(opts: NewFastCheckParametersProps) {
697
+ super({
698
+ block: opts.block,
699
+ txHash: opts.txHash,
700
+ timestamp: opts.timestamp
701
+ });
702
+ this.creditManager = opts.creditManager;
703
+ this.chiThreshold = opts.chiThreshold;
704
+ this.fastCheckDelay = opts.fastCheckDelay;
705
+ this.prevChiThreshold = opts.prevChiThreshold;
706
+ this.prevFastCheckDelay = opts.prevFastCheckDelay;
704
707
  }
705
708
 
706
- if (this.fastCheckDelay !== this.prevFastCheckDelay) {
707
- msg += `fast check delay: ${this.prevFastCheckDelay} => ${this.fastCheckDelay}, `;
708
- }
709
+ toString(_: Record<string, TokenData>): string {
710
+ let msg = `Credit manager ${getContractName(this.creditManager)} updated: `;
709
711
 
710
- return msg.slice(0, msg.length - 2);
711
- }
712
+ if (this.chiThreshold !== this.prevChiThreshold) {
713
+ msg += `Chi threshold: ${this.prevChiThreshold} => ${this.chiThreshold}, `;
714
+ }
715
+
716
+ if (this.fastCheckDelay !== this.prevFastCheckDelay) {
717
+ msg += `fast check delay: ${this.prevFastCheckDelay} => ${this.fastCheckDelay}, `;
718
+ }
719
+
720
+ return msg.slice(0, msg.length - 2);
721
+ }
712
722
  }
713
723
 
714
724
  // event PriceOracleUpdated(address indexed newPriceOracle);
715
725
 
716
726
  interface PriceOracleUpdatedProps extends EVMEventProps {
717
- creditManager: string;
718
- priceOracle: string;
727
+ creditManager: string;
728
+ priceOracle: string;
719
729
  }
720
730
 
721
731
  export class EventPriceOracleUpdated extends EVMEvent {
722
- public readonly creditManager: string;
723
- public readonly priceOracle: string;
724
-
725
- constructor(opts: PriceOracleUpdatedProps) {
726
- super({
727
- block: opts.block,
728
- txHash: opts.txHash,
729
- timestamp: opts.timestamp
730
- });
731
- this.creditManager = opts.creditManager;
732
- this.priceOracle = opts.priceOracle;
733
- }
734
-
735
- toString(_: Record<string, TokenData>): string {
736
- return `Credit manager ${getContractName(
737
- this.creditManager
738
- )} updated: price oracle was updated. New price oracle ${getContractName(
739
- this.priceOracle
740
- )}`;
741
- }
732
+ public readonly creditManager: string;
733
+ public readonly priceOracle: string;
734
+
735
+ constructor(opts: PriceOracleUpdatedProps) {
736
+ super({
737
+ block: opts.block,
738
+ txHash: opts.txHash,
739
+ timestamp: opts.timestamp
740
+ });
741
+ this.creditManager = opts.creditManager;
742
+ this.priceOracle = opts.priceOracle;
743
+ }
744
+
745
+ toString(_: Record<string, TokenData>): string {
746
+ return `Credit manager ${getContractName(
747
+ this.creditManager
748
+ )} updated: price oracle was updated. New price oracle ${getContractName(
749
+ this.priceOracle
750
+ )}`;
751
+ }
742
752
  }
743
753
 
744
754
  // event TransferPluginAllowed(
@@ -747,65 +757,65 @@ export class EventPriceOracleUpdated extends EVMEvent {
747
757
  // );
748
758
 
749
759
  interface TransferPluginAllowedProps extends EVMEventProps {
750
- creditManager: string;
751
- priceOracle: string;
752
- state: boolean;
760
+ creditManager: string;
761
+ priceOracle: string;
762
+ state: boolean;
753
763
  }
754
764
 
755
765
  export class EventTransferPluginAllowed extends EVMEvent {
756
- public readonly creditManager: string;
757
- public readonly plugin: string;
758
- public readonly state: boolean;
759
-
760
- constructor(opts: TransferPluginAllowedProps) {
761
- super({
762
- block: opts.block,
763
- txHash: opts.txHash,
764
- timestamp: opts.timestamp
765
- });
766
- this.creditManager = opts.creditManager;
767
- this.plugin = opts.priceOracle;
768
- this.state = opts.state;
769
- }
770
-
771
- toString(_: Record<string, TokenData>): string {
772
- return `Credit manager ${getContractName(
773
- this.creditManager
774
- )} updated: transfer plugin ${getContractName(this.plugin)} was ${
775
- this.state ? "allowed" : "forbidden"
776
- }`;
777
- }
766
+ public readonly creditManager: string;
767
+ public readonly plugin: string;
768
+ public readonly state: boolean;
769
+
770
+ constructor(opts: TransferPluginAllowedProps) {
771
+ super({
772
+ block: opts.block,
773
+ txHash: opts.txHash,
774
+ timestamp: opts.timestamp
775
+ });
776
+ this.creditManager = opts.creditManager;
777
+ this.plugin = opts.priceOracle;
778
+ this.state = opts.state;
779
+ }
780
+
781
+ toString(_: Record<string, TokenData>): string {
782
+ return `Credit manager ${getContractName(
783
+ this.creditManager
784
+ )} updated: transfer plugin ${getContractName(this.plugin)} was ${
785
+ this.state ? "allowed" : "forbidden"
786
+ }`;
787
+ }
778
788
  }
779
789
 
780
790
  // // Emits each time when Interest Rate model was changed
781
791
  // event NewInterestRateModel(address indexed newInterestRateModel);
782
792
 
783
793
  interface NewInterestRateModelProps extends EVMEventProps {
784
- pool: string;
785
- newInterestRateModel: string;
794
+ pool: string;
795
+ newInterestRateModel: string;
786
796
  }
787
797
 
788
798
  export class EventNewInterestRateModel extends EVMEvent {
789
- public readonly pool: string;
790
- public readonly newInterestRateModel: string;
791
-
792
- constructor(opts: NewInterestRateModelProps) {
793
- super({
794
- block: opts.block,
795
- txHash: opts.txHash,
796
- timestamp: opts.timestamp
797
- });
798
- this.pool = opts.pool;
799
- this.newInterestRateModel = opts.newInterestRateModel;
800
- }
801
-
802
- toString(_: Record<string, TokenData>): string {
803
- return `Pool ${getContractName(
804
- this.pool
805
- )} updated: interest rate model was updated. New model: ${getContractName(
806
- this.newInterestRateModel
807
- )}`;
808
- }
799
+ public readonly pool: string;
800
+ public readonly newInterestRateModel: string;
801
+
802
+ constructor(opts: NewInterestRateModelProps) {
803
+ super({
804
+ block: opts.block,
805
+ txHash: opts.txHash,
806
+ timestamp: opts.timestamp
807
+ });
808
+ this.pool = opts.pool;
809
+ this.newInterestRateModel = opts.newInterestRateModel;
810
+ }
811
+
812
+ toString(_: Record<string, TokenData>): string {
813
+ return `Pool ${getContractName(
814
+ this.pool
815
+ )} updated: interest rate model was updated. New model: ${getContractName(
816
+ this.newInterestRateModel
817
+ )}`;
818
+ }
809
819
  }
810
820
 
811
821
  //
@@ -813,31 +823,31 @@ export class EventNewInterestRateModel extends EVMEvent {
813
823
  // event NewCreditManagerConnected(address indexed creditManager);
814
824
 
815
825
  interface NewCreditManagerConnectedProps extends EVMEventProps {
816
- pool: string;
817
- creditManager: string;
826
+ pool: string;
827
+ creditManager: string;
818
828
  }
819
829
 
820
830
  export class EventNewCreditManagerConnected extends EVMEvent {
821
- public readonly pool: string;
822
- public readonly creditManager: string;
823
-
824
- constructor(opts: NewCreditManagerConnectedProps) {
825
- super({
826
- block: opts.block,
827
- txHash: opts.txHash,
828
- timestamp: opts.timestamp
829
- });
830
- this.pool = opts.pool;
831
- this.creditManager = opts.creditManager;
832
- }
833
-
834
- toString(_: Record<string, TokenData>): string {
835
- return `Pool ${getContractName(
836
- this.pool
837
- )} updated: new credit manager ${getContractName(
838
- this.creditManager
839
- )} was connected`;
840
- }
831
+ public readonly pool: string;
832
+ public readonly creditManager: string;
833
+
834
+ constructor(opts: NewCreditManagerConnectedProps) {
835
+ super({
836
+ block: opts.block,
837
+ txHash: opts.txHash,
838
+ timestamp: opts.timestamp
839
+ });
840
+ this.pool = opts.pool;
841
+ this.creditManager = opts.creditManager;
842
+ }
843
+
844
+ toString(_: Record<string, TokenData>): string {
845
+ return `Pool ${getContractName(
846
+ this.pool
847
+ )} updated: new credit manager ${getContractName(
848
+ this.creditManager
849
+ )} was connected`;
850
+ }
841
851
  }
842
852
 
843
853
  //
@@ -845,331 +855,338 @@ export class EventNewCreditManagerConnected extends EVMEvent {
845
855
  // event BorrowForbidden(address indexed creditManager);
846
856
 
847
857
  interface BorrowForbiddenProps extends EVMEventProps {
848
- pool: string;
849
- creditManager: string;
858
+ pool: string;
859
+ creditManager: string;
850
860
  }
851
861
 
852
862
  export class EventBorrowForbidden extends EVMEvent {
853
- public readonly pool: string;
854
- public readonly creditManager: string;
855
-
856
- constructor(opts: BorrowForbiddenProps) {
857
- super({
858
- block: opts.block,
859
- txHash: opts.txHash,
860
- timestamp: opts.timestamp
861
- });
862
- this.pool = opts.pool;
863
- this.creditManager = opts.creditManager;
864
- }
865
-
866
- toString(_: Record<string, TokenData>): string {
867
- return `Pool ${getContractName(
868
- this.pool
869
- )} updated: credit manager ${getContractName(
870
- this.creditManager
871
- )} was forbidden to borrow`;
872
- }
863
+ public readonly pool: string;
864
+ public readonly creditManager: string;
865
+
866
+ constructor(opts: BorrowForbiddenProps) {
867
+ super({
868
+ block: opts.block,
869
+ txHash: opts.txHash,
870
+ timestamp: opts.timestamp
871
+ });
872
+ this.pool = opts.pool;
873
+ this.creditManager = opts.creditManager;
874
+ }
875
+
876
+ toString(_: Record<string, TokenData>): string {
877
+ return `Pool ${getContractName(
878
+ this.pool
879
+ )} updated: credit manager ${getContractName(
880
+ this.creditManager
881
+ )} was forbidden to borrow`;
882
+ }
873
883
  }
874
884
 
875
885
  // // Emits after expected liquidity limit update
876
886
  // event NewExpectedLiquidityLimit(uint256 newLimit);
877
887
 
878
888
  interface NewExpectedLiquidityLimitProps extends EVMEventProps {
879
- pool: string;
880
- underlyingToken: string;
881
- newLimit: string;
882
- oldLimit: string;
889
+ pool: string;
890
+ underlyingToken: string;
891
+ newLimit: string;
892
+ oldLimit: string;
883
893
  }
884
894
 
885
895
  export class EventNewExpectedLiquidityLimit extends EVMEvent {
886
- public readonly pool: string;
887
- public readonly underlyingToken: string;
888
- public readonly newLimit: BigNumber;
889
- public readonly prevLimit: BigNumber;
890
-
891
- constructor(opts: NewExpectedLiquidityLimitProps) {
892
- super({
893
- block: opts.block,
894
- txHash: opts.txHash,
895
- timestamp: opts.timestamp
896
- });
897
- this.pool = opts.pool;
898
- this.underlyingToken = opts.underlyingToken;
899
- this.newLimit = BigNumber.from(opts.newLimit);
900
- this.prevLimit = BigNumber.from(opts.oldLimit);
901
- }
902
-
903
- toString(tokenData: Record<string, TokenData>): string {
904
- const { decimals = 18, symbol } =
905
- tokenData[this.underlyingToken.toLowerCase()] || {};
906
-
907
- return this.prevLimit.isZero()
908
- ? `Pool ${getContractName(
909
- this.pool
910
- )} updated: expected liquidity limit was set to ${formatBN(
911
- this.newLimit,
912
- decimals
913
- )} ${symbol}`
914
- : `Pool ${getContractName(
915
- this.pool
916
- )} updated: expected liquidity limit was ${
917
- this.newLimit.gt(this.prevLimit) ? "increased" : "decreased"
918
- }: ${formatBN(this.prevLimit, decimals)} ${symbol} => ${formatBN(
919
- this.newLimit,
920
- decimals
921
- )} ${symbol}`;
922
- }
896
+ public readonly pool: string;
897
+ public readonly underlyingToken: string;
898
+ public readonly newLimit: BigNumber;
899
+ public readonly prevLimit: BigNumber;
900
+
901
+ constructor(opts: NewExpectedLiquidityLimitProps) {
902
+ super({
903
+ block: opts.block,
904
+ txHash: opts.txHash,
905
+ timestamp: opts.timestamp
906
+ });
907
+ this.pool = opts.pool;
908
+ this.underlyingToken = opts.underlyingToken;
909
+ this.newLimit = BigNumber.from(opts.newLimit);
910
+ this.prevLimit = BigNumber.from(opts.oldLimit);
911
+ }
912
+
913
+ toString(tokenData: Record<string, TokenData>): string {
914
+ const {decimals = 18, symbol} =
915
+ tokenData[this.underlyingToken.toLowerCase()] || {};
916
+
917
+ return this.prevLimit.isZero()
918
+ ? `Pool ${getContractName(
919
+ this.pool
920
+ )} updated: expected liquidity limit was set to ${formatBN(
921
+ this.newLimit,
922
+ decimals
923
+ )} ${symbol}`
924
+ : `Pool ${getContractName(
925
+ this.pool
926
+ )} updated: expected liquidity limit was ${
927
+ this.newLimit.gt(this.prevLimit) ? "increased" : "decreased"
928
+ }: ${formatBN(this.prevLimit, decimals)} ${symbol} => ${formatBN(
929
+ this.newLimit,
930
+ decimals
931
+ )} ${symbol}`;
932
+ }
923
933
  }
924
934
 
925
935
  // // Emits each time when withdraw fee is udpated
926
936
  // event NewWithdrawFee(uint256 fee);
927
937
 
928
938
  interface NewWithdrawFeeProps extends EVMEventProps {
929
- pool: string;
930
- underlyingToken: string;
931
- newFee: string;
932
- oldFee: string;
939
+ pool: string;
940
+ underlyingToken: string;
941
+ newFee: string;
942
+ oldFee: string;
933
943
  }
934
944
 
935
945
  export class EventNewWithdrawFee extends EVMEvent {
936
- public readonly pool: string;
937
- public readonly underlyingToken: string;
938
- public readonly newFee: number;
939
- public readonly prevFee: number;
940
-
941
- constructor(opts: NewWithdrawFeeProps) {
942
- super({
943
- block: opts.block,
944
- txHash: opts.txHash,
945
- timestamp: opts.timestamp
946
- });
947
- this.pool = opts.pool;
948
- this.underlyingToken = opts.underlyingToken;
949
- this.newFee = Number(opts.newFee);
950
- this.prevFee = Number(opts.oldFee);
951
- }
952
-
953
- toString(_: Record<string, TokenData>): string {
954
- return this.prevFee === 0
955
- ? `Pool ${getContractName(this.pool)} updated: withdraw fee was set to: ${
956
- this.newFee / 100
957
- }%`
958
- : `Pool ${getContractName(this.pool)} updated: withdraw fee was ${
959
- this.newFee > this.prevFee ? "increased" : "decreased"
960
- }: ${this.prevFee / 100}% => ${this.newFee / 100}%`;
961
- }
946
+ public readonly pool: string;
947
+ public readonly underlyingToken: string;
948
+ public readonly newFee: number;
949
+ public readonly prevFee: number;
950
+
951
+ constructor(opts: NewWithdrawFeeProps) {
952
+ super({
953
+ block: opts.block,
954
+ txHash: opts.txHash,
955
+ timestamp: opts.timestamp
956
+ });
957
+ this.pool = opts.pool;
958
+ this.underlyingToken = opts.underlyingToken;
959
+ this.newFee = Number(opts.newFee);
960
+ this.prevFee = Number(opts.oldFee);
961
+ }
962
+
963
+ toString(_: Record<string, TokenData>): string {
964
+ return this.prevFee === 0
965
+ ? `Pool ${getContractName(this.pool)} updated: withdraw fee was set to: ${
966
+ this.newFee / 100
967
+ }%`
968
+ : `Pool ${getContractName(this.pool)} updated: withdraw fee was ${
969
+ this.newFee > this.prevFee ? "increased" : "decreased"
970
+ }: ${this.prevFee / 100}% => ${this.newFee / 100}%`;
971
+ }
962
972
  }
963
973
 
964
974
  // // Emits each time new configurator is set up
965
975
  // event NewPriceFeed(address indexed token, address indexed priceFeed);
966
976
 
967
977
  interface NewPriceFeedProps extends EVMEventProps {
968
- token: string;
969
- priceFeed: string;
978
+ token: string;
979
+ priceFeed: string;
970
980
  }
981
+
971
982
  export class EventNewPriceFeed extends EVMEvent {
972
- public readonly token: string;
973
- public readonly priceFeed: string;
974
-
975
- constructor(opts: NewPriceFeedProps) {
976
- super({
977
- block: opts.block,
978
- txHash: opts.txHash,
979
- timestamp: opts.timestamp
980
- });
981
- this.token = opts.token;
982
- this.priceFeed = opts.priceFeed;
983
- }
984
-
985
- toString(tokenData: Record<string, TokenData>): string {
986
- const { symbol } = tokenData[this.token.toLowerCase()] || {};
987
-
988
- return `PriceOracle: oracle for ${symbol} was updated to ${getContractName(
989
- this.priceFeed
990
- )}`;
991
- }
983
+ public readonly token: string;
984
+ public readonly priceFeed: string;
985
+
986
+ constructor(opts: NewPriceFeedProps) {
987
+ super({
988
+ block: opts.block,
989
+ txHash: opts.txHash,
990
+ timestamp: opts.timestamp
991
+ });
992
+ this.token = opts.token;
993
+ this.priceFeed = opts.priceFeed;
994
+ }
995
+
996
+ toString(tokenData: Record<string, TokenData>): string {
997
+ const {symbol} = tokenData[this.token.toLowerCase()] || {};
998
+
999
+ return `PriceOracle: oracle for ${symbol} was updated to ${getContractName(
1000
+ this.priceFeed
1001
+ )}`;
1002
+ }
992
1003
  }
993
1004
 
994
1005
  // // emits each time when DAO takes account from account factory forever
995
1006
  // event TakeForever(address indexed creditAccount, address indexed to);
996
1007
 
997
1008
  interface TakeForeverProps extends EVMEventProps {
998
- creditAccount: string;
999
- to: string;
1009
+ creditAccount: string;
1010
+ to: string;
1000
1011
  }
1001
1012
 
1002
1013
  export class EventTakeForever extends EVMEvent {
1003
- public readonly creditAccount: string;
1004
- public readonly to: string;
1005
-
1006
- constructor(opts: TakeForeverProps) {
1007
- super({
1008
- block: opts.block,
1009
- txHash: opts.txHash,
1010
- timestamp: opts.timestamp
1011
- });
1012
- this.creditAccount = opts.creditAccount;
1013
- this.to = opts.to;
1014
- }
1015
-
1016
- toString(_: Record<string, TokenData>): string {
1017
- return `AccountFactory: account ${this.creditAccount} was taken forever and transferred to ${this.to}`;
1018
- }
1014
+ public readonly creditAccount: string;
1015
+ public readonly to: string;
1016
+
1017
+ constructor(opts: TakeForeverProps) {
1018
+ super({
1019
+ block: opts.block,
1020
+ txHash: opts.txHash,
1021
+ timestamp: opts.timestamp
1022
+ });
1023
+ this.creditAccount = opts.creditAccount;
1024
+ this.to = opts.to;
1025
+ }
1026
+
1027
+ toString(_: Record<string, TokenData>): string {
1028
+ return `AccountFactory: account ${this.creditAccount} was taken forever and transferred to ${this.to}`;
1029
+ }
1019
1030
  }
1020
1031
 
1021
1032
  // Paused / Unpaused event (!)
1022
1033
 
1023
1034
  interface PausedProps extends EVMEventProps {
1024
- contract: string;
1035
+ contract: string;
1025
1036
  }
1037
+
1026
1038
  export class EventPaused extends EVMEvent {
1027
- public readonly contract: string;
1028
-
1029
- constructor(opts: PausedProps) {
1030
- super({
1031
- block: opts.block,
1032
- txHash: opts.txHash,
1033
- timestamp: opts.timestamp
1034
- });
1035
- this.contract = opts.contract;
1036
- }
1037
-
1038
- toString(_: Record<string, TokenData>): string {
1039
- return `${getContractName(this.contract)} was paused`;
1040
- }
1039
+ public readonly contract: string;
1040
+
1041
+ constructor(opts: PausedProps) {
1042
+ super({
1043
+ block: opts.block,
1044
+ txHash: opts.txHash,
1045
+ timestamp: opts.timestamp
1046
+ });
1047
+ this.contract = opts.contract;
1048
+ }
1049
+
1050
+ toString(_: Record<string, TokenData>): string {
1051
+ return `${getContractName(this.contract)} was paused`;
1052
+ }
1041
1053
  }
1042
1054
 
1043
1055
  interface UnPausedProps extends EVMEventProps {
1044
- contract: string;
1056
+ contract: string;
1045
1057
  }
1058
+
1046
1059
  export class EventUnPaused extends EVMEvent {
1047
- public readonly contract: string;
1048
-
1049
- constructor(opts: UnPausedProps) {
1050
- super({
1051
- block: opts.block,
1052
- txHash: opts.txHash,
1053
- timestamp: opts.timestamp
1054
- });
1055
- this.contract = opts.contract;
1056
- }
1057
-
1058
- toString(_: Record<string, TokenData>): string {
1059
- return `${getContractName(this.contract)} was unpaused`;
1060
- }
1060
+ public readonly contract: string;
1061
+
1062
+ constructor(opts: UnPausedProps) {
1063
+ super({
1064
+ block: opts.block,
1065
+ txHash: opts.txHash,
1066
+ timestamp: opts.timestamp
1067
+ });
1068
+ this.contract = opts.contract;
1069
+ }
1070
+
1071
+ toString(_: Record<string, TokenData>): string {
1072
+ return `${getContractName(this.contract)} was unpaused`;
1073
+ }
1061
1074
  }
1062
1075
 
1063
1076
  // // emits each time when new pausable admin added
1064
1077
  // event PausableAdminAdded(address indexed newAdmin);
1065
1078
 
1066
1079
  interface PausableAdminAddedProps extends EVMEventProps {
1067
- admin: string;
1080
+ admin: string;
1068
1081
  }
1082
+
1069
1083
  export class EventPausableAdminAdded extends EVMEvent {
1070
- public readonly admin: string;
1071
-
1072
- constructor(opts: PausableAdminAddedProps) {
1073
- super({
1074
- block: opts.block,
1075
- txHash: opts.txHash,
1076
- timestamp: opts.timestamp
1077
- });
1078
- this.admin = opts.admin;
1079
- }
1080
-
1081
- toString(_: Record<string, TokenData>): string {
1082
- return `ACL: pausable admin ${this.admin} was added`;
1083
- }
1084
+ public readonly admin: string;
1085
+
1086
+ constructor(opts: PausableAdminAddedProps) {
1087
+ super({
1088
+ block: opts.block,
1089
+ txHash: opts.txHash,
1090
+ timestamp: opts.timestamp
1091
+ });
1092
+ this.admin = opts.admin;
1093
+ }
1094
+
1095
+ toString(_: Record<string, TokenData>): string {
1096
+ return `ACL: pausable admin ${this.admin} was added`;
1097
+ }
1084
1098
  }
1085
1099
 
1086
1100
  // emits each time when pausable admin removed
1087
1101
  // event PausableAdminRemoved(address indexed admin);
1088
1102
 
1089
1103
  interface PausableAdminRemovedProps extends EVMEventProps {
1090
- admin: string;
1104
+ admin: string;
1091
1105
  }
1106
+
1092
1107
  export class EventPausableAdminRemoved extends EVMEvent {
1093
- public readonly admin: string;
1094
-
1095
- constructor(opts: PausableAdminRemovedProps) {
1096
- super({
1097
- block: opts.block,
1098
- txHash: opts.txHash,
1099
- timestamp: opts.timestamp
1100
- });
1101
- this.admin = opts.admin;
1102
- }
1103
-
1104
- toString(_: Record<string, TokenData>): string {
1105
- return `ACL: pausable admin ${this.admin} was removed`;
1106
- }
1108
+ public readonly admin: string;
1109
+
1110
+ constructor(opts: PausableAdminRemovedProps) {
1111
+ super({
1112
+ block: opts.block,
1113
+ txHash: opts.txHash,
1114
+ timestamp: opts.timestamp
1115
+ });
1116
+ this.admin = opts.admin;
1117
+ }
1118
+
1119
+ toString(_: Record<string, TokenData>): string {
1120
+ return `ACL: pausable admin ${this.admin} was removed`;
1121
+ }
1107
1122
  }
1108
1123
 
1109
1124
  // // emits each time when new unpausable admin added
1110
1125
  // event UnpausableAdminAdded(address indexed newAdmin);
1111
1126
 
1112
1127
  interface UnPausableAdminAddedProps extends EVMEventProps {
1113
- admin: string;
1128
+ admin: string;
1114
1129
  }
1130
+
1115
1131
  export class EventUnPausableAdminAdded extends EVMEvent {
1116
- public readonly admin: string;
1117
-
1118
- constructor(opts: UnPausableAdminAddedProps) {
1119
- super({
1120
- block: opts.block,
1121
- txHash: opts.txHash,
1122
- timestamp: opts.timestamp
1123
- });
1124
- this.admin = opts.admin;
1125
- }
1126
-
1127
- toString(_: Record<string, TokenData>): string {
1128
- return `ACL: unpausable admin ${this.admin} was added`;
1129
- }
1132
+ public readonly admin: string;
1133
+
1134
+ constructor(opts: UnPausableAdminAddedProps) {
1135
+ super({
1136
+ block: opts.block,
1137
+ txHash: opts.txHash,
1138
+ timestamp: opts.timestamp
1139
+ });
1140
+ this.admin = opts.admin;
1141
+ }
1142
+
1143
+ toString(_: Record<string, TokenData>): string {
1144
+ return `ACL: unpausable admin ${this.admin} was added`;
1145
+ }
1130
1146
  }
1131
1147
 
1132
1148
  // emits each times when unpausable admin removed
1133
1149
  // event UnpausableAdminRemoved(address indexed admin);
1134
1150
 
1135
1151
  interface UnPausableAdminRemovedProps extends EVMEventProps {
1136
- admin: string;
1152
+ admin: string;
1137
1153
  }
1154
+
1138
1155
  export class EventUnPausableAdminRemoved extends EVMEvent {
1139
- public readonly admin: string;
1140
-
1141
- constructor(opts: UnPausableAdminRemovedProps) {
1142
- super({
1143
- block: opts.block,
1144
- txHash: opts.txHash,
1145
- timestamp: opts.timestamp
1146
- });
1147
- this.admin = opts.admin;
1148
- }
1149
-
1150
- toString(_: Record<string, TokenData>): string {
1151
- return `ACL: unpausable admin ${this.admin} was removed`;
1152
- }
1156
+ public readonly admin: string;
1157
+
1158
+ constructor(opts: UnPausableAdminRemovedProps) {
1159
+ super({
1160
+ block: opts.block,
1161
+ txHash: opts.txHash,
1162
+ timestamp: opts.timestamp
1163
+ });
1164
+ this.admin = opts.admin;
1165
+ }
1166
+
1167
+ toString(_: Record<string, TokenData>): string {
1168
+ return `ACL: unpausable admin ${this.admin} was removed`;
1169
+ }
1153
1170
  }
1154
1171
 
1155
1172
  interface TransferOwnershipProps extends EVMEventProps {
1156
- admin: string;
1173
+ admin: string;
1157
1174
  }
1158
1175
 
1159
1176
  // ACL: Transfer ownership
1160
1177
  export class EventTransferOwnership extends EVMEvent {
1161
- public readonly newOwner: string;
1162
-
1163
- constructor(opts: TransferOwnershipProps) {
1164
- super({
1165
- block: opts.block,
1166
- txHash: opts.txHash,
1167
- timestamp: opts.timestamp
1168
- });
1169
- this.newOwner = opts.admin;
1170
- }
1171
-
1172
- toString(_: Record<string, TokenData>): string {
1173
- return `ACL: configurator was changed to ${this.newOwner}`;
1174
- }
1178
+ public readonly newOwner: string;
1179
+
1180
+ constructor(opts: TransferOwnershipProps) {
1181
+ super({
1182
+ block: opts.block,
1183
+ txHash: opts.txHash,
1184
+ timestamp: opts.timestamp
1185
+ });
1186
+ this.newOwner = opts.admin;
1187
+ }
1188
+
1189
+ toString(_: Record<string, TokenData>): string {
1190
+ return `ACL: configurator was changed to ${this.newOwner}`;
1191
+ }
1175
1192
  }