@gearbox-protocol/sdk 0.0.98 → 0.0.101

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 (86) hide show
  1. package/lib/apy/convexAPY.d.ts +8 -0
  2. package/lib/apy/convexAPY.js +202 -0
  3. package/lib/apy/lidoAPY.d.ts +4 -0
  4. package/lib/apy/lidoAPY.js +97 -0
  5. package/lib/config.d.ts +1 -0
  6. package/lib/config.js +2 -1
  7. package/lib/contracts/contracts.d.ts +6 -1
  8. package/lib/contracts/contracts.js +52 -14
  9. package/lib/contracts/contractsRegister.js +3 -3
  10. package/lib/core/constants.d.ts +4 -0
  11. package/lib/core/constants.js +8 -4
  12. package/lib/core/creditAccount.d.ts +2 -0
  13. package/lib/core/creditAccount.js +31 -30
  14. package/lib/core/creditManager.d.ts +13 -2
  15. package/lib/core/creditManager.js +79 -29
  16. package/lib/core/errors.d.ts +10 -0
  17. package/lib/core/errors.js +16 -1
  18. package/lib/core/events.js +9 -9
  19. package/lib/core/multicall.d.ts +1 -1
  20. package/lib/core/pool.d.ts +1 -1
  21. package/lib/core/pool.js +7 -5
  22. package/lib/core/price.d.ts +4 -0
  23. package/lib/core/price.js +12 -0
  24. package/lib/core/strategy.d.ts +34 -0
  25. package/lib/core/strategy.js +57 -0
  26. package/lib/index.d.ts +7 -1
  27. package/lib/index.js +8 -3
  28. package/lib/pathfinder/path.js +1 -1
  29. package/lib/pathfinder/yVault.js +7 -4
  30. package/lib/payload/creditAccount.d.ts +4 -26
  31. package/lib/payload/creditManager.d.ts +12 -24
  32. package/lib/payload/pool.d.ts +2 -17
  33. package/lib/payload/pool.js +0 -1
  34. package/lib/tokens/token.js +4 -4
  35. package/lib/utils/formatter.d.ts +1 -0
  36. package/lib/utils/formatter.js +6 -1
  37. package/lib/utils/mappers.d.ts +2 -1
  38. package/lib/utils/mappers.js +13 -5
  39. package/lib/utils/multicall.js +4 -3
  40. package/lib/utils/types.d.ts +1 -0
  41. package/package.json +1 -1
  42. package/src/apy/convexAPY.ts +249 -0
  43. package/src/apy/lidoAPY.ts +81 -0
  44. package/src/config.ts +2 -1
  45. package/src/contracts/contracts.ts +69 -16
  46. package/src/contracts/contractsRegister.ts +3 -3
  47. package/src/core/constants.ts +7 -3
  48. package/src/core/creditAccount.ts +39 -33
  49. package/src/core/creditManager.ts +230 -148
  50. package/src/core/errors.ts +24 -0
  51. package/src/core/events.ts +921 -915
  52. package/src/core/multicall.ts +1 -1
  53. package/src/core/pool.ts +56 -51
  54. package/src/core/price.ts +16 -0
  55. package/src/core/strategy.ts +123 -0
  56. package/src/index.ts +8 -1
  57. package/src/pathfinder/path.ts +154 -154
  58. package/src/pathfinder/yVault.ts +57 -56
  59. package/src/payload/creditAccount.ts +4 -26
  60. package/src/payload/creditManager.ts +13 -25
  61. package/src/payload/pool.ts +2 -19
  62. package/src/tokens/token.ts +10 -5
  63. package/src/utils/formatter.ts +5 -1
  64. package/src/utils/mappers.ts +12 -5
  65. package/src/utils/multicall.ts +4 -9
  66. package/src/utils/types.ts +6 -2
  67. package/lib/core/adapters.d.ts +0 -15
  68. package/lib/core/adapters.js +0 -19
  69. package/lib/core/contracts.d.ts +0 -67
  70. package/lib/core/contracts.js +0 -254
  71. package/lib/core/contractsRegister.d.ts +0 -2
  72. package/lib/core/contractsRegister.js +0 -58
  73. package/lib/core/creditCard.d.ts +0 -13
  74. package/lib/core/creditCard.js +0 -2
  75. package/lib/core/oracles.d.ts +0 -38
  76. package/lib/core/oracles.js +0 -12
  77. package/lib/core/priceFeeds.d.ts +0 -3
  78. package/lib/core/priceFeeds.js +0 -492
  79. package/lib/core/protocols.d.ts +0 -13
  80. package/lib/core/protocols.js +0 -39
  81. package/lib/core/swap.d.ts +0 -4
  82. package/lib/core/swap.js +0 -8
  83. package/lib/core/trade.d.ts +0 -35
  84. package/lib/core/trade.js +0 -62
  85. package/lib/core/tradeTypes.d.ts +0 -79
  86. package/lib/core/tradeTypes.js +0 -21
@@ -1,403 +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 "../contracts/contractsRegister";
1
+ import { TokenData } from "../tokens/tokenData";
2
+ import { BigNumber } from "ethers";
3
+ import { formatBN } from "../utils/formatter";
4
+ import { LEVERAGE_DECIMALS, PERCENTAGE_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()));
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");
47
115
  }
116
+ }
48
117
 
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
- }
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
132
  export class EventAddLiquidity extends EVMEvent {
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
- }
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
+ }
157
157
  }
158
158
 
159
159
  interface RemoveLiquidityProps extends EVMEventProps {
160
- amount: string;
161
- underlyingToken: string;
162
- dieselToken: string;
163
- pool: string;
160
+ amount: string;
161
+ underlyingToken: string;
162
+ dieselToken: string;
163
+ pool: string;
164
164
  }
165
165
 
166
166
  export class EventRemoveLiquidity extends EVMEvent {
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
- }
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
+ }
193
193
  }
194
194
 
195
195
  // CREDIT MANAGER EVENTS
196
196
 
197
197
  interface OpenCreditAccountProps extends EVMEventProps {
198
- amount: string;
199
- underlyingToken: string;
200
- leverage: number;
201
- creditManager: string;
198
+ amount: string;
199
+ underlyingToken: string;
200
+ leverage: number;
201
+ creditManager: string;
202
202
  }
203
203
 
204
204
  export class EventOpenCreditAccount extends EVMEvent {
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)} ⇒
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)} ⇒
232
232
  ${formatBN(
233
- this.amount
234
- .mul(Math.floor(this.leverage + LEVERAGE_DECIMALS))
235
- .div(LEVERAGE_DECIMALS),
236
- decimals + 2
237
- )} ${symbol}`;
238
- }
233
+ this.amount
234
+ .mul(Math.floor(this.leverage + LEVERAGE_DECIMALS))
235
+ .div(LEVERAGE_DECIMALS),
236
+ decimals + 2
237
+ )} ${symbol}`;
238
+ }
239
239
  }
240
240
 
241
241
  interface CloseCreditAccountProps extends EVMEventProps {
242
- amount: string;
243
- underlyingToken: string;
244
- creditManager: string;
242
+ amount: string;
243
+ underlyingToken: string;
244
+ creditManager: string;
245
245
  }
246
246
 
247
247
  export class EventCloseCreditAccount extends EVMEvent {
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
- }
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
+ }
274
274
  }
275
275
 
276
276
  interface LiquidateCreditAccountProps extends EVMEventProps {
277
- amount: string;
278
- underlyingToken: string;
279
- creditManager: string;
277
+ amount: string;
278
+ underlyingToken: string;
279
+ creditManager: string;
280
280
  }
281
281
 
282
282
  export class EventLiquidateCreditAccount extends EVMEvent {
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
- }
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
+ }
309
309
  }
310
310
 
311
311
  interface RepayCreditAccountProps extends EVMEventProps {
312
- underlyingToken: string;
313
- creditManager: string;
312
+ underlyingToken: string;
313
+ creditManager: string;
314
314
  }
315
315
 
316
316
  export class EventRepayCreditAccount extends EVMEvent {
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
- }
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
+ }
333
333
  }
334
334
 
335
335
  interface AddCollateralProps extends EVMEventProps {
336
- amount: string;
337
- addedToken: string;
338
- creditManager: string;
336
+ amount: string;
337
+ addedToken: string;
338
+ creditManager: string;
339
339
  }
340
340
 
341
341
  export class EventAddCollateral extends EVMEvent {
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
- }
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
+ }
366
366
  }
367
367
 
368
368
  interface IncreaseBorrowAmountProps extends EVMEventProps {
369
- amount: string;
370
- underlyingToken: string;
371
- creditManager: string;
369
+ amount: string;
370
+ underlyingToken: string;
371
+ creditManager: string;
372
372
  }
373
373
 
374
374
  export class EventIncreaseBorrowAmount extends EVMEvent {
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
- }
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
+ }
401
401
  }
402
402
 
403
403
  // // Emits each time when new fees are set
@@ -411,105 +411,107 @@ export class EventIncreaseBorrowAmount extends EVMEvent {
411
411
  // );
412
412
 
413
413
  interface CMNewParametersProps extends EVMEventProps {
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;
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;
428
428
  }
429
429
 
430
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;
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;
467
+ }
468
+
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: ${
489
+ this.prevMaxLeverage / LEVERAGE_DECIMALS + 1
490
+ } => ${this.maxLeverage / LEVERAGE_DECIMALS + 1}, `;
467
491
  }
468
492
 
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);
493
+ if (this.feeInterest !== this.prevFeeInterest) {
494
+ msg += `interest fee: ${this.prevFeeInterest / PERCENTAGE_DECIMALS}% => ${
495
+ this.feeInterest / PERCENTAGE_DECIMALS
496
+ }%, `;
512
497
  }
498
+
499
+ if (this.feeLiquidation !== this.prevFeeLiquidation) {
500
+ msg += `liquidation fee: ${
501
+ this.prevFeeLiquidation / PERCENTAGE_DECIMALS
502
+ }% => ${this.feeLiquidation / PERCENTAGE_DECIMALS}%, `;
503
+ }
504
+
505
+ if (this.liquidationDiscount !== this.prevLiquidationDiscount) {
506
+ msg += `liquidation premium: ${
507
+ PERCENTAGE_DECIMALS - this.prevLiquidationDiscount / PERCENTAGE_DECIMALS
508
+ }% => ${
509
+ PERCENTAGE_DECIMALS - this.liquidationDiscount / PERCENTAGE_DECIMALS
510
+ }%, `;
511
+ }
512
+
513
+ return msg.slice(0, msg.length - 2);
514
+ }
513
515
  }
514
516
 
515
517
  // // Emits each time token is allowed or liquidation threshold changed
@@ -518,83 +520,85 @@ export class EventCMNewParameters extends EVMEvent {
518
520
  export type TokenAllowanceType = "NewToken" | "LTUpdated" | "Allowed";
519
521
 
520
522
  interface TokenAllowedProps extends EVMEventProps {
521
- creditManager: string;
522
- token: string;
523
- liquidityThreshold: number;
524
- prevLiquidationThreshold?: number;
525
- status: TokenAllowanceType;
523
+ creditManager: string;
524
+ token: string;
525
+ liquidityThreshold: number;
526
+ prevLiquidationThreshold?: number;
527
+ status: TokenAllowanceType;
526
528
  }
527
529
 
528
530
  export class EventTokenAllowed extends EVMEvent {
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
- }
531
+ public readonly creditManager: string;
532
+ public readonly token: string;
533
+ public readonly liquidityThreshold: number;
534
+ public readonly prevLiquidationThreshold?: number;
535
+ public readonly status: TokenAllowanceType;
536
+
537
+ constructor(opts: TokenAllowedProps) {
538
+ super({
539
+ block: opts.block,
540
+ txHash: opts.txHash,
541
+ timestamp: opts.timestamp
542
+ });
543
+ this.creditManager = opts.creditManager;
544
+ this.token = opts.token;
545
+ this.liquidityThreshold = opts.liquidityThreshold;
546
+ this.prevLiquidationThreshold = opts.prevLiquidationThreshold;
547
+ this.status = opts.status;
548
+ }
549
+
550
+ toString(tokenData: Record<string, TokenData>): string {
551
+ const token = tokenData[this.token.toLowerCase()];
552
+ let msg = `Credit manager ${getContractName(this.creditManager)} updated `;
553
+ switch (this.status) {
554
+ case "NewToken":
555
+ return `${msg}: New token allowed: ${
556
+ token.symbol
557
+ }, liquidation threshold: ${
558
+ this.liquidityThreshold / PERCENTAGE_DECIMALS
559
+ }%`;
560
+ case "Allowed":
561
+ return `${msg}: ${
562
+ token.symbol
563
+ } is allowed now, liquidation threshold: ${
564
+ this.liquidityThreshold / PERCENTAGE_DECIMALS
565
+ }%`;
566
+ case "LTUpdated":
567
+ return `${msg}: ${token.symbol} liquidation threshold: ${
568
+ (this.prevLiquidationThreshold || 0) / PERCENTAGE_DECIMALS
569
+ } => ${this.liquidityThreshold / PERCENTAGE_DECIMALS}%`;
567
570
  }
571
+ }
568
572
  }
569
573
 
570
574
  // // Emits each time token is allowed or liquidtion threshold changed
571
575
  // event TokenForbidden(address indexed token);
572
576
 
573
577
  interface TokenForbiddenProps extends EVMEventProps {
574
- creditManager: string;
575
- token: string;
578
+ creditManager: string;
579
+ token: string;
576
580
  }
577
581
 
578
582
  export class EventTokenForbidden extends EVMEvent {
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
- }
583
+ public readonly creditManager: string;
584
+ public readonly token: string;
585
+
586
+ constructor(opts: TokenForbiddenProps) {
587
+ super({
588
+ block: opts.block,
589
+ txHash: opts.txHash,
590
+ timestamp: opts.timestamp
591
+ });
592
+ this.creditManager = opts.creditManager;
593
+ this.token = opts.token;
594
+ }
595
+
596
+ toString(tokenData: Record<string, TokenData>): string {
597
+ const token = tokenData[this.token.toLowerCase()];
598
+ return `Credit manager ${getContractName(this.creditManager)} updated ${
599
+ token.symbol
600
+ } forbidden`;
601
+ }
598
602
  }
599
603
 
600
604
  //
@@ -604,44 +608,44 @@ export class EventTokenForbidden extends EVMEvent {
604
608
  export type EventContractAllowedStatus = "Connected" | "AdapterUpdate";
605
609
 
606
610
  interface ContractAllowedProps extends EVMEventProps {
607
- creditManager: string;
608
- protocol: string;
609
- adapter: string;
610
- status: EventContractAllowedStatus;
611
+ creditManager: string;
612
+ protocol: string;
613
+ adapter: string;
614
+ status: EventContractAllowedStatus;
611
615
  }
612
616
 
613
617
  export class EventContractAllowed extends EVMEvent {
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
- }
618
+ public readonly creditManager: string;
619
+ public readonly protocol: string;
620
+ public readonly adapter: string;
621
+ public readonly status: EventContractAllowedStatus;
622
+
623
+ constructor(opts: ContractAllowedProps) {
624
+ super({
625
+ block: opts.block,
626
+ txHash: opts.txHash,
627
+ timestamp: opts.timestamp
628
+ });
629
+ this.creditManager = opts.creditManager;
630
+ this.protocol = opts.protocol;
631
+ this.adapter = opts.adapter;
632
+ this.status = opts.status;
633
+ }
634
+
635
+ toString(_: Record<string, TokenData>): string {
636
+ let msg = `Credit manager ${getContractName(this.creditManager)} updated`;
637
+
638
+ switch (this.status) {
639
+ case "Connected":
640
+ return `${msg} : ${getContractName(
641
+ this.protocol
642
+ )} was connected. Adapter at: ${this.adapter}`;
643
+ case "AdapterUpdate":
644
+ return `${msg} : ${getContractName(
645
+ this.protocol
646
+ )} adapter was updated. New adapter: ${this.adapter}`;
644
647
  }
648
+ }
645
649
  }
646
650
 
647
651
  //
@@ -649,29 +653,29 @@ export class EventContractAllowed extends EVMEvent {
649
653
  // event ContractForbidden(address indexed protocol);
650
654
 
651
655
  interface ContractForbiddenProps extends EVMEventProps {
652
- creditManager: string;
653
- protocol: string;
656
+ creditManager: string;
657
+ protocol: string;
654
658
  }
655
659
 
656
660
  export class EventContractForbidden extends EVMEvent {
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
- }
661
+ public readonly creditManager: string;
662
+ public readonly protocol: string;
663
+
664
+ constructor(opts: ContractForbiddenProps) {
665
+ super({
666
+ block: opts.block,
667
+ txHash: opts.txHash,
668
+ timestamp: opts.timestamp
669
+ });
670
+ this.creditManager = opts.creditManager;
671
+ this.protocol = opts.protocol;
672
+ }
673
+
674
+ toString(_: Record<string, TokenData>): string {
675
+ return `Credit manager ${getContractName(
676
+ this.creditManager
677
+ )} updated: ${getContractName(this.protocol)}`;
678
+ }
675
679
  }
676
680
 
677
681
  //
@@ -679,76 +683,76 @@ export class EventContractForbidden extends EVMEvent {
679
683
  // event NewFastCheckParameters(uint256 chiThreshold, uint256 fastCheckDelay);
680
684
 
681
685
  interface NewFastCheckParametersProps extends EVMEventProps {
682
- creditManager: string;
683
- chiThreshold: number;
684
- fastCheckDelay: number;
685
- prevChiThreshold?: number;
686
- prevFastCheckDelay?: number;
686
+ creditManager: string;
687
+ chiThreshold: number;
688
+ fastCheckDelay: number;
689
+ prevChiThreshold?: number;
690
+ prevFastCheckDelay?: number;
687
691
  }
688
692
 
689
693
  export class EventNewFastCheckParameters extends EVMEvent {
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;
694
+ public readonly creditManager: string;
695
+ public readonly chiThreshold: number;
696
+ public readonly fastCheckDelay: number;
697
+ public readonly prevChiThreshold?: number;
698
+ public readonly prevFastCheckDelay?: number;
699
+
700
+ constructor(opts: NewFastCheckParametersProps) {
701
+ super({
702
+ block: opts.block,
703
+ txHash: opts.txHash,
704
+ timestamp: opts.timestamp
705
+ });
706
+ this.creditManager = opts.creditManager;
707
+ this.chiThreshold = opts.chiThreshold;
708
+ this.fastCheckDelay = opts.fastCheckDelay;
709
+ this.prevChiThreshold = opts.prevChiThreshold;
710
+ this.prevFastCheckDelay = opts.prevFastCheckDelay;
711
+ }
712
+
713
+ toString(_: Record<string, TokenData>): string {
714
+ let msg = `Credit manager ${getContractName(this.creditManager)} updated: `;
715
+
716
+ if (this.chiThreshold !== this.prevChiThreshold) {
717
+ msg += `Chi threshold: ${this.prevChiThreshold} => ${this.chiThreshold}, `;
707
718
  }
708
719
 
709
- toString(_: Record<string, TokenData>): string {
710
- let msg = `Credit manager ${getContractName(this.creditManager)} updated: `;
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);
720
+ if (this.fastCheckDelay !== this.prevFastCheckDelay) {
721
+ msg += `fast check delay: ${this.prevFastCheckDelay} => ${this.fastCheckDelay}, `;
721
722
  }
723
+
724
+ return msg.slice(0, msg.length - 2);
725
+ }
722
726
  }
723
727
 
724
728
  // event PriceOracleUpdated(address indexed newPriceOracle);
725
729
 
726
730
  interface PriceOracleUpdatedProps extends EVMEventProps {
727
- creditManager: string;
728
- priceOracle: string;
731
+ creditManager: string;
732
+ priceOracle: string;
729
733
  }
730
734
 
731
735
  export class EventPriceOracleUpdated extends EVMEvent {
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
- }
736
+ public readonly creditManager: string;
737
+ public readonly priceOracle: string;
738
+
739
+ constructor(opts: PriceOracleUpdatedProps) {
740
+ super({
741
+ block: opts.block,
742
+ txHash: opts.txHash,
743
+ timestamp: opts.timestamp
744
+ });
745
+ this.creditManager = opts.creditManager;
746
+ this.priceOracle = opts.priceOracle;
747
+ }
748
+
749
+ toString(_: Record<string, TokenData>): string {
750
+ return `Credit manager ${getContractName(
751
+ this.creditManager
752
+ )} updated: price oracle was updated. New price oracle ${getContractName(
753
+ this.priceOracle
754
+ )}`;
755
+ }
752
756
  }
753
757
 
754
758
  // event TransferPluginAllowed(
@@ -757,65 +761,65 @@ export class EventPriceOracleUpdated extends EVMEvent {
757
761
  // );
758
762
 
759
763
  interface TransferPluginAllowedProps extends EVMEventProps {
760
- creditManager: string;
761
- priceOracle: string;
762
- state: boolean;
764
+ creditManager: string;
765
+ priceOracle: string;
766
+ state: boolean;
763
767
  }
764
768
 
765
769
  export class EventTransferPluginAllowed extends EVMEvent {
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
- }
770
+ public readonly creditManager: string;
771
+ public readonly plugin: string;
772
+ public readonly state: boolean;
773
+
774
+ constructor(opts: TransferPluginAllowedProps) {
775
+ super({
776
+ block: opts.block,
777
+ txHash: opts.txHash,
778
+ timestamp: opts.timestamp
779
+ });
780
+ this.creditManager = opts.creditManager;
781
+ this.plugin = opts.priceOracle;
782
+ this.state = opts.state;
783
+ }
784
+
785
+ toString(_: Record<string, TokenData>): string {
786
+ return `Credit manager ${getContractName(
787
+ this.creditManager
788
+ )} updated: transfer plugin ${getContractName(this.plugin)} was ${
789
+ this.state ? "allowed" : "forbidden"
790
+ }`;
791
+ }
788
792
  }
789
793
 
790
794
  // // Emits each time when Interest Rate model was changed
791
795
  // event NewInterestRateModel(address indexed newInterestRateModel);
792
796
 
793
797
  interface NewInterestRateModelProps extends EVMEventProps {
794
- pool: string;
795
- newInterestRateModel: string;
798
+ pool: string;
799
+ newInterestRateModel: string;
796
800
  }
797
801
 
798
802
  export class EventNewInterestRateModel extends EVMEvent {
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
- }
803
+ public readonly pool: string;
804
+ public readonly newInterestRateModel: string;
805
+
806
+ constructor(opts: NewInterestRateModelProps) {
807
+ super({
808
+ block: opts.block,
809
+ txHash: opts.txHash,
810
+ timestamp: opts.timestamp
811
+ });
812
+ this.pool = opts.pool;
813
+ this.newInterestRateModel = opts.newInterestRateModel;
814
+ }
815
+
816
+ toString(_: Record<string, TokenData>): string {
817
+ return `Pool ${getContractName(
818
+ this.pool
819
+ )} updated: interest rate model was updated. New model: ${getContractName(
820
+ this.newInterestRateModel
821
+ )}`;
822
+ }
819
823
  }
820
824
 
821
825
  //
@@ -823,31 +827,31 @@ export class EventNewInterestRateModel extends EVMEvent {
823
827
  // event NewCreditManagerConnected(address indexed creditManager);
824
828
 
825
829
  interface NewCreditManagerConnectedProps extends EVMEventProps {
826
- pool: string;
827
- creditManager: string;
830
+ pool: string;
831
+ creditManager: string;
828
832
  }
829
833
 
830
834
  export class EventNewCreditManagerConnected extends EVMEvent {
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
- }
835
+ public readonly pool: string;
836
+ public readonly creditManager: string;
837
+
838
+ constructor(opts: NewCreditManagerConnectedProps) {
839
+ super({
840
+ block: opts.block,
841
+ txHash: opts.txHash,
842
+ timestamp: opts.timestamp
843
+ });
844
+ this.pool = opts.pool;
845
+ this.creditManager = opts.creditManager;
846
+ }
847
+
848
+ toString(_: Record<string, TokenData>): string {
849
+ return `Pool ${getContractName(
850
+ this.pool
851
+ )} updated: new credit manager ${getContractName(
852
+ this.creditManager
853
+ )} was connected`;
854
+ }
851
855
  }
852
856
 
853
857
  //
@@ -855,338 +859,340 @@ export class EventNewCreditManagerConnected extends EVMEvent {
855
859
  // event BorrowForbidden(address indexed creditManager);
856
860
 
857
861
  interface BorrowForbiddenProps extends EVMEventProps {
858
- pool: string;
859
- creditManager: string;
862
+ pool: string;
863
+ creditManager: string;
860
864
  }
861
865
 
862
866
  export class EventBorrowForbidden extends EVMEvent {
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
- }
867
+ public readonly pool: string;
868
+ public readonly creditManager: string;
869
+
870
+ constructor(opts: BorrowForbiddenProps) {
871
+ super({
872
+ block: opts.block,
873
+ txHash: opts.txHash,
874
+ timestamp: opts.timestamp
875
+ });
876
+ this.pool = opts.pool;
877
+ this.creditManager = opts.creditManager;
878
+ }
879
+
880
+ toString(_: Record<string, TokenData>): string {
881
+ return `Pool ${getContractName(
882
+ this.pool
883
+ )} updated: credit manager ${getContractName(
884
+ this.creditManager
885
+ )} was forbidden to borrow`;
886
+ }
883
887
  }
884
888
 
885
889
  // // Emits after expected liquidity limit update
886
890
  // event NewExpectedLiquidityLimit(uint256 newLimit);
887
891
 
888
892
  interface NewExpectedLiquidityLimitProps extends EVMEventProps {
889
- pool: string;
890
- underlyingToken: string;
891
- newLimit: string;
892
- oldLimit: string;
893
+ pool: string;
894
+ underlyingToken: string;
895
+ newLimit: string;
896
+ oldLimit: string;
893
897
  }
894
898
 
895
899
  export class EventNewExpectedLiquidityLimit extends EVMEvent {
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
- }
900
+ public readonly pool: string;
901
+ public readonly underlyingToken: string;
902
+ public readonly newLimit: BigNumber;
903
+ public readonly prevLimit: BigNumber;
904
+
905
+ constructor(opts: NewExpectedLiquidityLimitProps) {
906
+ super({
907
+ block: opts.block,
908
+ txHash: opts.txHash,
909
+ timestamp: opts.timestamp
910
+ });
911
+ this.pool = opts.pool;
912
+ this.underlyingToken = opts.underlyingToken;
913
+ this.newLimit = BigNumber.from(opts.newLimit);
914
+ this.prevLimit = BigNumber.from(opts.oldLimit);
915
+ }
916
+
917
+ toString(tokenData: Record<string, TokenData>): string {
918
+ const { decimals = 18, symbol } =
919
+ tokenData[this.underlyingToken.toLowerCase()] || {};
920
+
921
+ return this.prevLimit.isZero()
922
+ ? `Pool ${getContractName(
923
+ this.pool
924
+ )} updated: expected liquidity limit was set to ${formatBN(
925
+ this.newLimit,
926
+ decimals
927
+ )} ${symbol}`
928
+ : `Pool ${getContractName(
929
+ this.pool
930
+ )} updated: expected liquidity limit was ${
931
+ this.newLimit.gt(this.prevLimit) ? "increased" : "decreased"
932
+ }: ${formatBN(this.prevLimit, decimals)} ${symbol} => ${formatBN(
933
+ this.newLimit,
934
+ decimals
935
+ )} ${symbol}`;
936
+ }
933
937
  }
934
938
 
935
939
  // // Emits each time when withdraw fee is udpated
936
940
  // event NewWithdrawFee(uint256 fee);
937
941
 
938
942
  interface NewWithdrawFeeProps extends EVMEventProps {
939
- pool: string;
940
- underlyingToken: string;
941
- newFee: string;
942
- oldFee: string;
943
+ pool: string;
944
+ underlyingToken: string;
945
+ newFee: string;
946
+ oldFee: string;
943
947
  }
944
948
 
945
949
  export class EventNewWithdrawFee extends EVMEvent {
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
- }
950
+ public readonly pool: string;
951
+ public readonly underlyingToken: string;
952
+ public readonly newFee: number;
953
+ public readonly prevFee: number;
954
+
955
+ constructor(opts: NewWithdrawFeeProps) {
956
+ super({
957
+ block: opts.block,
958
+ txHash: opts.txHash,
959
+ timestamp: opts.timestamp
960
+ });
961
+ this.pool = opts.pool;
962
+ this.underlyingToken = opts.underlyingToken;
963
+ this.newFee = Number(opts.newFee);
964
+ this.prevFee = Number(opts.oldFee);
965
+ }
966
+
967
+ toString(_: Record<string, TokenData>): string {
968
+ return this.prevFee === 0
969
+ ? `Pool ${getContractName(this.pool)} updated: withdraw fee was set to: ${
970
+ this.newFee / PERCENTAGE_DECIMALS
971
+ }%`
972
+ : `Pool ${getContractName(this.pool)} updated: withdraw fee was ${
973
+ this.newFee > this.prevFee ? "increased" : "decreased"
974
+ }: ${this.prevFee / PERCENTAGE_DECIMALS}% => ${
975
+ this.newFee / PERCENTAGE_DECIMALS
976
+ }%`;
977
+ }
972
978
  }
973
979
 
974
980
  // // Emits each time new configurator is set up
975
981
  // event NewPriceFeed(address indexed token, address indexed priceFeed);
976
982
 
977
983
  interface NewPriceFeedProps extends EVMEventProps {
978
- token: string;
979
- priceFeed: string;
984
+ token: string;
985
+ priceFeed: string;
980
986
  }
981
987
 
982
988
  export class EventNewPriceFeed extends EVMEvent {
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
- }
989
+ public readonly token: string;
990
+ public readonly priceFeed: string;
991
+
992
+ constructor(opts: NewPriceFeedProps) {
993
+ super({
994
+ block: opts.block,
995
+ txHash: opts.txHash,
996
+ timestamp: opts.timestamp
997
+ });
998
+ this.token = opts.token;
999
+ this.priceFeed = opts.priceFeed;
1000
+ }
1001
+
1002
+ toString(tokenData: Record<string, TokenData>): string {
1003
+ const { symbol } = tokenData[this.token.toLowerCase()] || {};
1004
+
1005
+ return `PriceOracle: oracle for ${symbol} was updated to ${getContractName(
1006
+ this.priceFeed
1007
+ )}`;
1008
+ }
1003
1009
  }
1004
1010
 
1005
1011
  // // emits each time when DAO takes account from account factory forever
1006
1012
  // event TakeForever(address indexed creditAccount, address indexed to);
1007
1013
 
1008
1014
  interface TakeForeverProps extends EVMEventProps {
1009
- creditAccount: string;
1010
- to: string;
1015
+ creditAccount: string;
1016
+ to: string;
1011
1017
  }
1012
1018
 
1013
1019
  export class EventTakeForever extends EVMEvent {
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
- }
1020
+ public readonly creditAccount: string;
1021
+ public readonly to: string;
1022
+
1023
+ constructor(opts: TakeForeverProps) {
1024
+ super({
1025
+ block: opts.block,
1026
+ txHash: opts.txHash,
1027
+ timestamp: opts.timestamp
1028
+ });
1029
+ this.creditAccount = opts.creditAccount;
1030
+ this.to = opts.to;
1031
+ }
1032
+
1033
+ toString(_: Record<string, TokenData>): string {
1034
+ return `AccountFactory: account ${this.creditAccount} was taken forever and transferred to ${this.to}`;
1035
+ }
1030
1036
  }
1031
1037
 
1032
1038
  // Paused / Unpaused event (!)
1033
1039
 
1034
1040
  interface PausedProps extends EVMEventProps {
1035
- contract: string;
1041
+ contract: string;
1036
1042
  }
1037
1043
 
1038
1044
  export class EventPaused extends EVMEvent {
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
- }
1045
+ public readonly contract: string;
1046
+
1047
+ constructor(opts: PausedProps) {
1048
+ super({
1049
+ block: opts.block,
1050
+ txHash: opts.txHash,
1051
+ timestamp: opts.timestamp
1052
+ });
1053
+ this.contract = opts.contract;
1054
+ }
1055
+
1056
+ toString(_: Record<string, TokenData>): string {
1057
+ return `${getContractName(this.contract)} was paused`;
1058
+ }
1053
1059
  }
1054
1060
 
1055
1061
  interface UnPausedProps extends EVMEventProps {
1056
- contract: string;
1062
+ contract: string;
1057
1063
  }
1058
1064
 
1059
1065
  export class EventUnPaused extends EVMEvent {
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
- }
1066
+ public readonly contract: string;
1067
+
1068
+ constructor(opts: UnPausedProps) {
1069
+ super({
1070
+ block: opts.block,
1071
+ txHash: opts.txHash,
1072
+ timestamp: opts.timestamp
1073
+ });
1074
+ this.contract = opts.contract;
1075
+ }
1076
+
1077
+ toString(_: Record<string, TokenData>): string {
1078
+ return `${getContractName(this.contract)} was unpaused`;
1079
+ }
1074
1080
  }
1075
1081
 
1076
1082
  // // emits each time when new pausable admin added
1077
1083
  // event PausableAdminAdded(address indexed newAdmin);
1078
1084
 
1079
1085
  interface PausableAdminAddedProps extends EVMEventProps {
1080
- admin: string;
1086
+ admin: string;
1081
1087
  }
1082
1088
 
1083
1089
  export class EventPausableAdminAdded extends EVMEvent {
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
- }
1090
+ public readonly admin: string;
1091
+
1092
+ constructor(opts: PausableAdminAddedProps) {
1093
+ super({
1094
+ block: opts.block,
1095
+ txHash: opts.txHash,
1096
+ timestamp: opts.timestamp
1097
+ });
1098
+ this.admin = opts.admin;
1099
+ }
1100
+
1101
+ toString(_: Record<string, TokenData>): string {
1102
+ return `ACL: pausable admin ${this.admin} was added`;
1103
+ }
1098
1104
  }
1099
1105
 
1100
1106
  // emits each time when pausable admin removed
1101
1107
  // event PausableAdminRemoved(address indexed admin);
1102
1108
 
1103
1109
  interface PausableAdminRemovedProps extends EVMEventProps {
1104
- admin: string;
1110
+ admin: string;
1105
1111
  }
1106
1112
 
1107
1113
  export class EventPausableAdminRemoved extends EVMEvent {
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
- }
1114
+ public readonly admin: string;
1115
+
1116
+ constructor(opts: PausableAdminRemovedProps) {
1117
+ super({
1118
+ block: opts.block,
1119
+ txHash: opts.txHash,
1120
+ timestamp: opts.timestamp
1121
+ });
1122
+ this.admin = opts.admin;
1123
+ }
1124
+
1125
+ toString(_: Record<string, TokenData>): string {
1126
+ return `ACL: pausable admin ${this.admin} was removed`;
1127
+ }
1122
1128
  }
1123
1129
 
1124
1130
  // // emits each time when new unpausable admin added
1125
1131
  // event UnpausableAdminAdded(address indexed newAdmin);
1126
1132
 
1127
1133
  interface UnPausableAdminAddedProps extends EVMEventProps {
1128
- admin: string;
1134
+ admin: string;
1129
1135
  }
1130
1136
 
1131
1137
  export class EventUnPausableAdminAdded extends EVMEvent {
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
- }
1138
+ public readonly admin: string;
1139
+
1140
+ constructor(opts: UnPausableAdminAddedProps) {
1141
+ super({
1142
+ block: opts.block,
1143
+ txHash: opts.txHash,
1144
+ timestamp: opts.timestamp
1145
+ });
1146
+ this.admin = opts.admin;
1147
+ }
1148
+
1149
+ toString(_: Record<string, TokenData>): string {
1150
+ return `ACL: unpausable admin ${this.admin} was added`;
1151
+ }
1146
1152
  }
1147
1153
 
1148
1154
  // emits each times when unpausable admin removed
1149
1155
  // event UnpausableAdminRemoved(address indexed admin);
1150
1156
 
1151
1157
  interface UnPausableAdminRemovedProps extends EVMEventProps {
1152
- admin: string;
1158
+ admin: string;
1153
1159
  }
1154
1160
 
1155
1161
  export class EventUnPausableAdminRemoved extends EVMEvent {
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
- }
1162
+ public readonly admin: string;
1163
+
1164
+ constructor(opts: UnPausableAdminRemovedProps) {
1165
+ super({
1166
+ block: opts.block,
1167
+ txHash: opts.txHash,
1168
+ timestamp: opts.timestamp
1169
+ });
1170
+ this.admin = opts.admin;
1171
+ }
1172
+
1173
+ toString(_: Record<string, TokenData>): string {
1174
+ return `ACL: unpausable admin ${this.admin} was removed`;
1175
+ }
1170
1176
  }
1171
1177
 
1172
1178
  interface TransferOwnershipProps extends EVMEventProps {
1173
- admin: string;
1179
+ admin: string;
1174
1180
  }
1175
1181
 
1176
1182
  // ACL: Transfer ownership
1177
1183
  export class EventTransferOwnership extends EVMEvent {
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
- }
1184
+ public readonly newOwner: string;
1185
+
1186
+ constructor(opts: TransferOwnershipProps) {
1187
+ super({
1188
+ block: opts.block,
1189
+ txHash: opts.txHash,
1190
+ timestamp: opts.timestamp
1191
+ });
1192
+ this.newOwner = opts.admin;
1193
+ }
1194
+
1195
+ toString(_: Record<string, TokenData>): string {
1196
+ return `ACL: configurator was changed to ${this.newOwner}`;
1197
+ }
1192
1198
  }