@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.
- package/lib/contracts/adapters.d.ts +15 -0
- package/lib/contracts/adapters.js +19 -0
- package/lib/contracts/contracts.d.ts +60 -0
- package/lib/contracts/contracts.js +242 -0
- package/lib/contracts/contractsRegister.d.ts +2 -0
- package/lib/contracts/contractsRegister.js +58 -0
- package/lib/contracts/protocols.d.ts +13 -0
- package/lib/contracts/protocols.js +39 -0
- package/lib/core/contracts.js +3 -3
- package/lib/core/events.js +1 -1
- package/lib/core/tradeTypes.d.ts +1 -1
- package/lib/core/transactions.js +1 -1
- package/lib/index.d.ts +8 -9
- package/lib/index.js +10 -10
- package/lib/oracles/oracles.d.ts +38 -0
- package/lib/oracles/oracles.js +12 -0
- package/lib/oracles/priceFeeds.d.ts +3 -0
- package/lib/oracles/priceFeeds.js +492 -0
- package/lib/pathfinder/convexLP.d.ts +1 -1
- package/lib/pathfinder/convexLP.js +2 -20
- package/lib/pathfinder/curveLP.d.ts +2 -2
- package/lib/pathfinder/curveLP.js +8 -27
- package/lib/pathfinder/path.d.ts +2 -8
- package/lib/pathfinder/path.js +27 -34
- package/lib/pathfinder/trade.d.ts +35 -0
- package/lib/pathfinder/trade.js +62 -0
- package/lib/pathfinder/tradeTypes.d.ts +83 -0
- package/lib/pathfinder/tradeTypes.js +26 -0
- package/lib/pathfinder/yVault.d.ts +1 -1
- package/lib/pathfinder/yVault.js +4 -23
- package/lib/tokens/convex.d.ts +2 -2
- package/lib/tokens/convex.js +1 -1
- package/lib/tokens/curveLP.d.ts +1 -1
- package/lib/tokens/curveLP.js +1 -1
- package/lib/tokens/gear.d.ts +1 -1
- package/lib/tokens/normal.d.ts +1 -1
- package/lib/tokens/normal.js +1 -1
- package/lib/tokens/token.d.ts +1 -1
- package/lib/tokens/token.js +5 -5
- package/lib/tokens/yearn.d.ts +2 -2
- package/lib/tokens/yearn.js +3 -3
- package/package.json +1 -1
- package/src/{core → contracts}/adapters.ts +0 -0
- package/src/{core → contracts}/contracts.ts +6 -6
- package/src/{core → contracts}/contractsRegister.ts +0 -0
- package/src/{core → contracts}/protocols.ts +0 -0
- package/src/core/events.ts +932 -915
- package/src/core/transactions.ts +360 -352
- package/src/index.ts +8 -9
- package/src/{core → oracles}/oracles.ts +0 -0
- package/src/oracles/priceFeeds.ts +528 -0
- package/src/pathfinder/convexLP.ts +1 -1
- package/src/pathfinder/curveLP.ts +3 -4
- package/src/pathfinder/path.ts +23 -53
- package/src/pathfinder/trade.ts +83 -0
- package/src/{core → pathfinder}/tradeTypes.ts +6 -6
- package/src/pathfinder/yVault.ts +1 -2
- package/src/tokens/convex.ts +2 -2
- package/src/tokens/curveLP.ts +1 -1
- package/src/tokens/gear.ts +1 -1
- package/src/tokens/normal.ts +1 -1
- package/src/tokens/token.ts +17 -7
- package/src/tokens/yearn.ts +4 -4
- package/src/core/creditCard.ts +0 -15
- package/src/core/priceFeeds.ts +0 -528
- package/src/core/swap.ts +0 -4
- package/src/core/trade.ts +0 -83
package/src/core/events.ts
CHANGED
|
@@ -1,395 +1,403 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
amount: string;
|
|
128
|
+
underlyingToken: string;
|
|
129
|
+
pool: string;
|
|
130
130
|
}
|
|
131
|
+
|
|
131
132
|
export class EventAddLiquidity extends EVMEvent {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
amount: string;
|
|
161
|
+
underlyingToken: string;
|
|
162
|
+
dieselToken: string;
|
|
163
|
+
pool: string;
|
|
163
164
|
}
|
|
165
|
+
|
|
164
166
|
export class EventRemoveLiquidity extends EVMEvent {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
amount: string;
|
|
199
|
+
underlyingToken: string;
|
|
200
|
+
leverage: number;
|
|
201
|
+
creditManager: string;
|
|
200
202
|
}
|
|
203
|
+
|
|
201
204
|
export class EventOpenCreditAccount extends EVMEvent {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
amount: string;
|
|
243
|
+
underlyingToken: string;
|
|
244
|
+
creditManager: string;
|
|
242
245
|
}
|
|
246
|
+
|
|
243
247
|
export class EventCloseCreditAccount extends EVMEvent {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
274
|
-
|
|
275
|
-
|
|
277
|
+
amount: string;
|
|
278
|
+
underlyingToken: string;
|
|
279
|
+
creditManager: string;
|
|
276
280
|
}
|
|
281
|
+
|
|
277
282
|
export class EventLiquidateCreditAccount extends EVMEvent {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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
|
-
|
|
308
|
-
|
|
312
|
+
underlyingToken: string;
|
|
313
|
+
creditManager: string;
|
|
309
314
|
}
|
|
315
|
+
|
|
310
316
|
export class EventRepayCreditAccount extends EVMEvent {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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
|
-
|
|
331
|
-
|
|
332
|
-
|
|
336
|
+
amount: string;
|
|
337
|
+
addedToken: string;
|
|
338
|
+
creditManager: string;
|
|
333
339
|
}
|
|
340
|
+
|
|
334
341
|
export class EventAddCollateral extends EVMEvent {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
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
|
-
|
|
363
|
-
|
|
364
|
-
|
|
369
|
+
amount: string;
|
|
370
|
+
underlyingToken: string;
|
|
371
|
+
creditManager: string;
|
|
365
372
|
}
|
|
373
|
+
|
|
366
374
|
export class EventIncreaseBorrowAmount extends EVMEvent {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
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
|
-
|
|
565
|
-
|
|
574
|
+
creditManager: string;
|
|
575
|
+
token: string;
|
|
566
576
|
}
|
|
567
577
|
|
|
568
578
|
export class EventTokenForbidden extends EVMEvent {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
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
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
607
|
+
creditManager: string;
|
|
608
|
+
protocol: string;
|
|
609
|
+
adapter: string;
|
|
610
|
+
status: EventContractAllowedStatus;
|
|
601
611
|
}
|
|
602
612
|
|
|
603
613
|
export class EventContractAllowed extends EVMEvent {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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
|
-
|
|
643
|
-
|
|
652
|
+
creditManager: string;
|
|
653
|
+
protocol: string;
|
|
644
654
|
}
|
|
645
655
|
|
|
646
656
|
export class EventContractForbidden extends EVMEvent {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
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
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
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
|
-
|
|
707
|
-
|
|
708
|
-
}
|
|
709
|
+
toString(_: Record<string, TokenData>): string {
|
|
710
|
+
let msg = `Credit manager ${getContractName(this.creditManager)} updated: `;
|
|
709
711
|
|
|
710
|
-
|
|
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
|
-
|
|
718
|
-
|
|
727
|
+
creditManager: string;
|
|
728
|
+
priceOracle: string;
|
|
719
729
|
}
|
|
720
730
|
|
|
721
731
|
export class EventPriceOracleUpdated extends EVMEvent {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
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
|
-
|
|
751
|
-
|
|
752
|
-
|
|
760
|
+
creditManager: string;
|
|
761
|
+
priceOracle: string;
|
|
762
|
+
state: boolean;
|
|
753
763
|
}
|
|
754
764
|
|
|
755
765
|
export class EventTransferPluginAllowed extends EVMEvent {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
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
|
-
|
|
785
|
-
|
|
794
|
+
pool: string;
|
|
795
|
+
newInterestRateModel: string;
|
|
786
796
|
}
|
|
787
797
|
|
|
788
798
|
export class EventNewInterestRateModel extends EVMEvent {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
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
|
-
|
|
817
|
-
|
|
826
|
+
pool: string;
|
|
827
|
+
creditManager: string;
|
|
818
828
|
}
|
|
819
829
|
|
|
820
830
|
export class EventNewCreditManagerConnected extends EVMEvent {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
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
|
-
|
|
849
|
-
|
|
858
|
+
pool: string;
|
|
859
|
+
creditManager: string;
|
|
850
860
|
}
|
|
851
861
|
|
|
852
862
|
export class EventBorrowForbidden extends EVMEvent {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
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
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
889
|
+
pool: string;
|
|
890
|
+
underlyingToken: string;
|
|
891
|
+
newLimit: string;
|
|
892
|
+
oldLimit: string;
|
|
883
893
|
}
|
|
884
894
|
|
|
885
895
|
export class EventNewExpectedLiquidityLimit extends EVMEvent {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
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
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
939
|
+
pool: string;
|
|
940
|
+
underlyingToken: string;
|
|
941
|
+
newFee: string;
|
|
942
|
+
oldFee: string;
|
|
933
943
|
}
|
|
934
944
|
|
|
935
945
|
export class EventNewWithdrawFee extends EVMEvent {
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
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
|
-
|
|
969
|
-
|
|
978
|
+
token: string;
|
|
979
|
+
priceFeed: string;
|
|
970
980
|
}
|
|
981
|
+
|
|
971
982
|
export class EventNewPriceFeed extends EVMEvent {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
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
|
-
|
|
999
|
-
|
|
1009
|
+
creditAccount: string;
|
|
1010
|
+
to: string;
|
|
1000
1011
|
}
|
|
1001
1012
|
|
|
1002
1013
|
export class EventTakeForever extends EVMEvent {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
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
|
-
|
|
1035
|
+
contract: string;
|
|
1025
1036
|
}
|
|
1037
|
+
|
|
1026
1038
|
export class EventPaused extends EVMEvent {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
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
|
-
|
|
1056
|
+
contract: string;
|
|
1045
1057
|
}
|
|
1058
|
+
|
|
1046
1059
|
export class EventUnPaused extends EVMEvent {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
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
|
-
|
|
1080
|
+
admin: string;
|
|
1068
1081
|
}
|
|
1082
|
+
|
|
1069
1083
|
export class EventPausableAdminAdded extends EVMEvent {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
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
|
-
|
|
1104
|
+
admin: string;
|
|
1091
1105
|
}
|
|
1106
|
+
|
|
1092
1107
|
export class EventPausableAdminRemoved extends EVMEvent {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
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
|
-
|
|
1128
|
+
admin: string;
|
|
1114
1129
|
}
|
|
1130
|
+
|
|
1115
1131
|
export class EventUnPausableAdminAdded extends EVMEvent {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
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
|
-
|
|
1152
|
+
admin: string;
|
|
1137
1153
|
}
|
|
1154
|
+
|
|
1138
1155
|
export class EventUnPausableAdminRemoved extends EVMEvent {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
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
|
-
|
|
1173
|
+
admin: string;
|
|
1157
1174
|
}
|
|
1158
1175
|
|
|
1159
1176
|
// ACL: Transfer ownership
|
|
1160
1177
|
export class EventTransferOwnership extends EVMEvent {
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
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
|
}
|