@gearbox-protocol/sdk 3.0.0-next.26 → 3.0.0-next.28
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/core/creditAccount.js +1 -0
- package/lib/core/pool.d.ts +2 -2
- package/lib/core/pool.js +4 -4
- package/lib/types/IConvexToken.d.ts +9 -1
- package/lib/types/IConvexV1BaseRewardPoolAdapter.d.ts +17 -1
- package/lib/types/IDataCompressorV2_10.d.ts +8 -5
- package/lib/types/IDataCompressorV3_00.d.ts +8 -5
- package/lib/types/factories/IConvexToken__factory.d.ts +10 -0
- package/lib/types/factories/IConvexToken__factory.js +13 -0
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.d.ts +20 -0
- package/lib/types/factories/IConvexV1BaseRewardPoolAdapter__factory.js +26 -0
- package/lib/types/factories/IDataCompressorV2_10__factory.d.ts +12 -4
- package/lib/types/factories/IDataCompressorV2_10__factory.js +14 -4
- package/lib/types/factories/IDataCompressorV3_00__factory.d.ts +16 -4
- package/lib/types/factories/IDataCompressorV3_00__factory.js +19 -4
- package/lib/watchers/creditManagerWatcher.d.ts +5 -3
- package/lib/watchers/creditManagerWatcher.js +32 -10
- package/lib/watchers/creditManagerWatcher.spec.js +12 -4
- package/package.json +4 -4
|
@@ -84,6 +84,7 @@ class CreditAccountData {
|
|
|
84
84
|
isQuoted: b.isQuoted,
|
|
85
85
|
quota: (0, sdk_gov_1.toBigInt)(b.quota),
|
|
86
86
|
quotaRate: Number((0, sdk_gov_1.toBigInt)(b.quotaRate) * sdk_gov_1.PERCENTAGE_DECIMALS),
|
|
87
|
+
quotaCumulativeIndexLU: (0, sdk_gov_1.toBigInt)(b.quotaCumulativeIndexLU),
|
|
87
88
|
};
|
|
88
89
|
if (!b.isForbidden) {
|
|
89
90
|
this.balances[token] = balance.balance;
|
package/lib/core/pool.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class PoolData {
|
|
|
15
15
|
readonly expectedLiquidity: bigint;
|
|
16
16
|
readonly expectedLiquidityLimit: bigint;
|
|
17
17
|
readonly availableLiquidity: bigint;
|
|
18
|
-
readonly
|
|
18
|
+
readonly baseInterestIndex: bigint;
|
|
19
19
|
readonly totalBorrowed: bigint;
|
|
20
20
|
readonly totalDebtLimit: bigint;
|
|
21
21
|
readonly creditManagerDebtParams: Record<string, CreditManagerDebtParams>;
|
|
@@ -30,7 +30,7 @@ export declare class PoolData {
|
|
|
30
30
|
readonly dieselRate: number;
|
|
31
31
|
readonly dieselRateRay: bigint;
|
|
32
32
|
readonly withdrawFee: number;
|
|
33
|
-
readonly
|
|
33
|
+
readonly lastBaseInterestUpdate: bigint;
|
|
34
34
|
constructor(payload: PoolDataPayload);
|
|
35
35
|
getPoolContractV1(signer: Signer): IPoolService;
|
|
36
36
|
getPoolContractV3(signer: Signer): IPoolV3;
|
package/lib/core/pool.js
CHANGED
|
@@ -18,7 +18,7 @@ class PoolData {
|
|
|
18
18
|
expectedLiquidity;
|
|
19
19
|
expectedLiquidityLimit;
|
|
20
20
|
availableLiquidity;
|
|
21
|
-
|
|
21
|
+
baseInterestIndex;
|
|
22
22
|
totalBorrowed;
|
|
23
23
|
totalDebtLimit;
|
|
24
24
|
creditManagerDebtParams;
|
|
@@ -33,7 +33,7 @@ class PoolData {
|
|
|
33
33
|
dieselRate;
|
|
34
34
|
dieselRateRay;
|
|
35
35
|
withdrawFee;
|
|
36
|
-
|
|
36
|
+
lastBaseInterestUpdate;
|
|
37
37
|
constructor(payload) {
|
|
38
38
|
this.address = payload.addr.toLowerCase();
|
|
39
39
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
@@ -48,7 +48,7 @@ class PoolData {
|
|
|
48
48
|
this.availableLiquidity = (0, sdk_gov_1.toBigInt)(payload.availableLiquidity);
|
|
49
49
|
this.expectedLiquidityLimit =
|
|
50
50
|
this.expectedLiquidity + this.availableLiquidity;
|
|
51
|
-
this.
|
|
51
|
+
this.baseInterestIndex = (0, sdk_gov_1.toBigInt)(payload.baseInterestIndex);
|
|
52
52
|
this.totalBorrowed = (0, sdk_gov_1.toBigInt)(payload.totalBorrowed);
|
|
53
53
|
this.totalDebtLimit = (0, sdk_gov_1.toBigInt)(payload.totalDebtLimit);
|
|
54
54
|
this.creditManagerDebtParams = Object.fromEntries(payload.creditManagerDebtParams.map(p => {
|
|
@@ -106,7 +106,7 @@ class PoolData {
|
|
|
106
106
|
};
|
|
107
107
|
this.dieselRate = (0, formatter_1.rayToNumber)(payload.dieselRate_RAY);
|
|
108
108
|
this.dieselRateRay = (0, sdk_gov_1.toBigInt)(payload.dieselRate_RAY);
|
|
109
|
-
this.
|
|
109
|
+
this.lastBaseInterestUpdate = (0, sdk_gov_1.toBigInt)(payload.lastBaseInterestUpdate);
|
|
110
110
|
this.withdrawFee =
|
|
111
111
|
Number((0, sdk_gov_1.toBigInt)(payload.withdrawFee)) / Number(sdk_gov_1.PERCENTAGE_DECIMALS);
|
|
112
112
|
}
|
|
@@ -4,6 +4,7 @@ import type { Listener, Provider } from "@ethersproject/providers";
|
|
|
4
4
|
import type { TypedEventFilter, TypedEvent, TypedListener, OnEvent, PromiseOrValue } from "./common";
|
|
5
5
|
export interface IConvexTokenInterface extends utils.Interface {
|
|
6
6
|
functions: {
|
|
7
|
+
"EMISSIONS_MAX_SUPPLY()": FunctionFragment;
|
|
7
8
|
"allowance(address,address)": FunctionFragment;
|
|
8
9
|
"approve(address,uint256)": FunctionFragment;
|
|
9
10
|
"balanceOf(address)": FunctionFragment;
|
|
@@ -16,7 +17,8 @@ export interface IConvexTokenInterface extends utils.Interface {
|
|
|
16
17
|
"transferFrom(address,address,uint256)": FunctionFragment;
|
|
17
18
|
"vecrvProxy()": FunctionFragment;
|
|
18
19
|
};
|
|
19
|
-
getFunction(nameOrSignatureOrTopic: "allowance" | "approve" | "balanceOf" | "maxSupply" | "operator" | "reductionPerCliff" | "totalCliffs" | "totalSupply" | "transfer" | "transferFrom" | "vecrvProxy"): FunctionFragment;
|
|
20
|
+
getFunction(nameOrSignatureOrTopic: "EMISSIONS_MAX_SUPPLY" | "allowance" | "approve" | "balanceOf" | "maxSupply" | "operator" | "reductionPerCliff" | "totalCliffs" | "totalSupply" | "transfer" | "transferFrom" | "vecrvProxy"): FunctionFragment;
|
|
21
|
+
encodeFunctionData(functionFragment: "EMISSIONS_MAX_SUPPLY", values?: undefined): string;
|
|
20
22
|
encodeFunctionData(functionFragment: "allowance", values: [PromiseOrValue<string>, PromiseOrValue<string>]): string;
|
|
21
23
|
encodeFunctionData(functionFragment: "approve", values: [PromiseOrValue<string>, PromiseOrValue<BigNumberish>]): string;
|
|
22
24
|
encodeFunctionData(functionFragment: "balanceOf", values: [PromiseOrValue<string>]): string;
|
|
@@ -32,6 +34,7 @@ export interface IConvexTokenInterface extends utils.Interface {
|
|
|
32
34
|
PromiseOrValue<BigNumberish>
|
|
33
35
|
]): string;
|
|
34
36
|
encodeFunctionData(functionFragment: "vecrvProxy", values?: undefined): string;
|
|
37
|
+
decodeFunctionResult(functionFragment: "EMISSIONS_MAX_SUPPLY", data: BytesLike): Result;
|
|
35
38
|
decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result;
|
|
36
39
|
decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result;
|
|
37
40
|
decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result;
|
|
@@ -87,6 +90,7 @@ export interface IConvexToken extends BaseContract {
|
|
|
87
90
|
once: OnEvent<this>;
|
|
88
91
|
removeListener: OnEvent<this>;
|
|
89
92
|
functions: {
|
|
93
|
+
EMISSIONS_MAX_SUPPLY(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
90
94
|
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
91
95
|
approve(spender: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
92
96
|
from?: PromiseOrValue<string>;
|
|
@@ -105,6 +109,7 @@ export interface IConvexToken extends BaseContract {
|
|
|
105
109
|
}): Promise<ContractTransaction>;
|
|
106
110
|
vecrvProxy(overrides?: CallOverrides): Promise<[string]>;
|
|
107
111
|
};
|
|
112
|
+
EMISSIONS_MAX_SUPPLY(overrides?: CallOverrides): Promise<BigNumber>;
|
|
108
113
|
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
109
114
|
approve(spender: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
110
115
|
from?: PromiseOrValue<string>;
|
|
@@ -123,6 +128,7 @@ export interface IConvexToken extends BaseContract {
|
|
|
123
128
|
}): Promise<ContractTransaction>;
|
|
124
129
|
vecrvProxy(overrides?: CallOverrides): Promise<string>;
|
|
125
130
|
callStatic: {
|
|
131
|
+
EMISSIONS_MAX_SUPPLY(overrides?: CallOverrides): Promise<BigNumber>;
|
|
126
132
|
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
127
133
|
approve(spender: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, overrides?: CallOverrides): Promise<boolean>;
|
|
128
134
|
balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
@@ -142,6 +148,7 @@ export interface IConvexToken extends BaseContract {
|
|
|
142
148
|
Transfer(from?: PromiseOrValue<string> | null, to?: PromiseOrValue<string> | null, value?: null): TransferEventFilter;
|
|
143
149
|
};
|
|
144
150
|
estimateGas: {
|
|
151
|
+
EMISSIONS_MAX_SUPPLY(overrides?: CallOverrides): Promise<BigNumber>;
|
|
145
152
|
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<BigNumber>;
|
|
146
153
|
approve(spender: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
147
154
|
from?: PromiseOrValue<string>;
|
|
@@ -161,6 +168,7 @@ export interface IConvexToken extends BaseContract {
|
|
|
161
168
|
vecrvProxy(overrides?: CallOverrides): Promise<BigNumber>;
|
|
162
169
|
};
|
|
163
170
|
populateTransaction: {
|
|
171
|
+
EMISSIONS_MAX_SUPPLY(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
164
172
|
allowance(owner: PromiseOrValue<string>, spender: PromiseOrValue<string>, overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
165
173
|
approve(spender: PromiseOrValue<string>, amount: PromiseOrValue<BigNumberish>, overrides?: Overrides & {
|
|
166
174
|
from?: PromiseOrValue<string>;
|
|
@@ -10,6 +10,8 @@ export interface IConvexV1BaseRewardPoolAdapterInterface extends utils.Interface
|
|
|
10
10
|
"creditManager()": FunctionFragment;
|
|
11
11
|
"curveLPTokenMask()": FunctionFragment;
|
|
12
12
|
"curveLPtoken()": FunctionFragment;
|
|
13
|
+
"extraReward1()": FunctionFragment;
|
|
14
|
+
"extraReward2()": FunctionFragment;
|
|
13
15
|
"getReward()": FunctionFragment;
|
|
14
16
|
"rewardTokensMask()": FunctionFragment;
|
|
15
17
|
"stake(uint256)": FunctionFragment;
|
|
@@ -24,13 +26,15 @@ export interface IConvexV1BaseRewardPoolAdapterInterface extends utils.Interface
|
|
|
24
26
|
"withdrawAllAndUnwrap(bool)": FunctionFragment;
|
|
25
27
|
"withdrawAndUnwrap(uint256,bool)": FunctionFragment;
|
|
26
28
|
};
|
|
27
|
-
getFunction(nameOrSignatureOrTopic: "_gearboxAdapterType" | "_gearboxAdapterVersion" | "addressProvider" | "creditManager" | "curveLPTokenMask" | "curveLPtoken" | "getReward" | "rewardTokensMask" | "stake" | "stakeAll" | "stakedPhantomToken" | "stakedTokenMask" | "stakingToken" | "stakingTokenMask" | "targetContract" | "withdraw" | "withdrawAll" | "withdrawAllAndUnwrap" | "withdrawAndUnwrap"): FunctionFragment;
|
|
29
|
+
getFunction(nameOrSignatureOrTopic: "_gearboxAdapterType" | "_gearboxAdapterVersion" | "addressProvider" | "creditManager" | "curveLPTokenMask" | "curveLPtoken" | "extraReward1" | "extraReward2" | "getReward" | "rewardTokensMask" | "stake" | "stakeAll" | "stakedPhantomToken" | "stakedTokenMask" | "stakingToken" | "stakingTokenMask" | "targetContract" | "withdraw" | "withdrawAll" | "withdrawAllAndUnwrap" | "withdrawAndUnwrap"): FunctionFragment;
|
|
28
30
|
encodeFunctionData(functionFragment: "_gearboxAdapterType", values?: undefined): string;
|
|
29
31
|
encodeFunctionData(functionFragment: "_gearboxAdapterVersion", values?: undefined): string;
|
|
30
32
|
encodeFunctionData(functionFragment: "addressProvider", values?: undefined): string;
|
|
31
33
|
encodeFunctionData(functionFragment: "creditManager", values?: undefined): string;
|
|
32
34
|
encodeFunctionData(functionFragment: "curveLPTokenMask", values?: undefined): string;
|
|
33
35
|
encodeFunctionData(functionFragment: "curveLPtoken", values?: undefined): string;
|
|
36
|
+
encodeFunctionData(functionFragment: "extraReward1", values?: undefined): string;
|
|
37
|
+
encodeFunctionData(functionFragment: "extraReward2", values?: undefined): string;
|
|
34
38
|
encodeFunctionData(functionFragment: "getReward", values?: undefined): string;
|
|
35
39
|
encodeFunctionData(functionFragment: "rewardTokensMask", values?: undefined): string;
|
|
36
40
|
encodeFunctionData(functionFragment: "stake", values: [PromiseOrValue<BigNumberish>]): string;
|
|
@@ -50,6 +54,8 @@ export interface IConvexV1BaseRewardPoolAdapterInterface extends utils.Interface
|
|
|
50
54
|
decodeFunctionResult(functionFragment: "creditManager", data: BytesLike): Result;
|
|
51
55
|
decodeFunctionResult(functionFragment: "curveLPTokenMask", data: BytesLike): Result;
|
|
52
56
|
decodeFunctionResult(functionFragment: "curveLPtoken", data: BytesLike): Result;
|
|
57
|
+
decodeFunctionResult(functionFragment: "extraReward1", data: BytesLike): Result;
|
|
58
|
+
decodeFunctionResult(functionFragment: "extraReward2", data: BytesLike): Result;
|
|
53
59
|
decodeFunctionResult(functionFragment: "getReward", data: BytesLike): Result;
|
|
54
60
|
decodeFunctionResult(functionFragment: "rewardTokensMask", data: BytesLike): Result;
|
|
55
61
|
decodeFunctionResult(functionFragment: "stake", data: BytesLike): Result;
|
|
@@ -86,6 +92,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
86
92
|
creditManager(overrides?: CallOverrides): Promise<[string]>;
|
|
87
93
|
curveLPTokenMask(overrides?: CallOverrides): Promise<[BigNumber]>;
|
|
88
94
|
curveLPtoken(overrides?: CallOverrides): Promise<[string]>;
|
|
95
|
+
extraReward1(overrides?: CallOverrides): Promise<[string]>;
|
|
96
|
+
extraReward2(overrides?: CallOverrides): Promise<[string]>;
|
|
89
97
|
getReward(overrides?: Overrides & {
|
|
90
98
|
from?: PromiseOrValue<string>;
|
|
91
99
|
}): Promise<ContractTransaction>;
|
|
@@ -120,6 +128,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
120
128
|
creditManager(overrides?: CallOverrides): Promise<string>;
|
|
121
129
|
curveLPTokenMask(overrides?: CallOverrides): Promise<BigNumber>;
|
|
122
130
|
curveLPtoken(overrides?: CallOverrides): Promise<string>;
|
|
131
|
+
extraReward1(overrides?: CallOverrides): Promise<string>;
|
|
132
|
+
extraReward2(overrides?: CallOverrides): Promise<string>;
|
|
123
133
|
getReward(overrides?: Overrides & {
|
|
124
134
|
from?: PromiseOrValue<string>;
|
|
125
135
|
}): Promise<ContractTransaction>;
|
|
@@ -154,6 +164,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
154
164
|
creditManager(overrides?: CallOverrides): Promise<string>;
|
|
155
165
|
curveLPTokenMask(overrides?: CallOverrides): Promise<BigNumber>;
|
|
156
166
|
curveLPtoken(overrides?: CallOverrides): Promise<string>;
|
|
167
|
+
extraReward1(overrides?: CallOverrides): Promise<string>;
|
|
168
|
+
extraReward2(overrides?: CallOverrides): Promise<string>;
|
|
157
169
|
getReward(overrides?: CallOverrides): Promise<[
|
|
158
170
|
BigNumber,
|
|
159
171
|
BigNumber
|
|
@@ -218,6 +230,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
218
230
|
creditManager(overrides?: CallOverrides): Promise<BigNumber>;
|
|
219
231
|
curveLPTokenMask(overrides?: CallOverrides): Promise<BigNumber>;
|
|
220
232
|
curveLPtoken(overrides?: CallOverrides): Promise<BigNumber>;
|
|
233
|
+
extraReward1(overrides?: CallOverrides): Promise<BigNumber>;
|
|
234
|
+
extraReward2(overrides?: CallOverrides): Promise<BigNumber>;
|
|
221
235
|
getReward(overrides?: Overrides & {
|
|
222
236
|
from?: PromiseOrValue<string>;
|
|
223
237
|
}): Promise<BigNumber>;
|
|
@@ -253,6 +267,8 @@ export interface IConvexV1BaseRewardPoolAdapter extends BaseContract {
|
|
|
253
267
|
creditManager(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
254
268
|
curveLPTokenMask(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
255
269
|
curveLPtoken(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
270
|
+
extraReward1(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
271
|
+
extraReward2(overrides?: CallOverrides): Promise<PopulatedTransaction>;
|
|
256
272
|
getReward(overrides?: Overrides & {
|
|
257
273
|
from?: PromiseOrValue<string>;
|
|
258
274
|
}): Promise<PopulatedTransaction>;
|
|
@@ -10,6 +10,7 @@ export type TokenBalanceStruct = {
|
|
|
10
10
|
isQuoted: PromiseOrValue<boolean>;
|
|
11
11
|
quota: PromiseOrValue<BigNumberish>;
|
|
12
12
|
quotaRate: PromiseOrValue<BigNumberish>;
|
|
13
|
+
quotaCumulativeIndexLU: PromiseOrValue<BigNumberish>;
|
|
13
14
|
};
|
|
14
15
|
export type TokenBalanceStructOutput = [
|
|
15
16
|
string,
|
|
@@ -18,7 +19,8 @@ export type TokenBalanceStructOutput = [
|
|
|
18
19
|
boolean,
|
|
19
20
|
boolean,
|
|
20
21
|
BigNumber,
|
|
21
|
-
number
|
|
22
|
+
number,
|
|
23
|
+
BigNumber
|
|
22
24
|
] & {
|
|
23
25
|
token: string;
|
|
24
26
|
balance: BigNumber;
|
|
@@ -27,6 +29,7 @@ export type TokenBalanceStructOutput = [
|
|
|
27
29
|
isQuoted: boolean;
|
|
28
30
|
quota: BigNumber;
|
|
29
31
|
quotaRate: number;
|
|
32
|
+
quotaCumulativeIndexLU: BigNumber;
|
|
30
33
|
};
|
|
31
34
|
export type ScheduledWithdrawalStruct = {
|
|
32
35
|
tokenIndex: PromiseOrValue<BigNumberish>;
|
|
@@ -328,7 +331,7 @@ export type PoolDataStruct = {
|
|
|
328
331
|
dieselToken: PromiseOrValue<string>;
|
|
329
332
|
symbol: PromiseOrValue<string>;
|
|
330
333
|
name: PromiseOrValue<string>;
|
|
331
|
-
|
|
334
|
+
baseInterestIndex: PromiseOrValue<BigNumberish>;
|
|
332
335
|
availableLiquidity: PromiseOrValue<BigNumberish>;
|
|
333
336
|
expectedLiquidity: PromiseOrValue<BigNumberish>;
|
|
334
337
|
totalBorrowed: PromiseOrValue<BigNumberish>;
|
|
@@ -340,7 +343,7 @@ export type PoolDataStruct = {
|
|
|
340
343
|
baseInterestRate: PromiseOrValue<BigNumberish>;
|
|
341
344
|
dieselRate_RAY: PromiseOrValue<BigNumberish>;
|
|
342
345
|
withdrawFee: PromiseOrValue<BigNumberish>;
|
|
343
|
-
|
|
346
|
+
lastBaseInterestUpdate: PromiseOrValue<BigNumberish>;
|
|
344
347
|
baseInterestIndexLU: PromiseOrValue<BigNumberish>;
|
|
345
348
|
version: PromiseOrValue<BigNumberish>;
|
|
346
349
|
poolQuotaKeeper: PromiseOrValue<string>;
|
|
@@ -383,7 +386,7 @@ export type PoolDataStructOutput = [
|
|
|
383
386
|
dieselToken: string;
|
|
384
387
|
symbol: string;
|
|
385
388
|
name: string;
|
|
386
|
-
|
|
389
|
+
baseInterestIndex: BigNumber;
|
|
387
390
|
availableLiquidity: BigNumber;
|
|
388
391
|
expectedLiquidity: BigNumber;
|
|
389
392
|
totalBorrowed: BigNumber;
|
|
@@ -395,7 +398,7 @@ export type PoolDataStructOutput = [
|
|
|
395
398
|
baseInterestRate: BigNumber;
|
|
396
399
|
dieselRate_RAY: BigNumber;
|
|
397
400
|
withdrawFee: BigNumber;
|
|
398
|
-
|
|
401
|
+
lastBaseInterestUpdate: BigNumber;
|
|
399
402
|
baseInterestIndexLU: BigNumber;
|
|
400
403
|
version: BigNumber;
|
|
401
404
|
poolQuotaKeeper: string;
|
|
@@ -18,6 +18,7 @@ export type TokenBalanceStruct = {
|
|
|
18
18
|
isQuoted: PromiseOrValue<boolean>;
|
|
19
19
|
quota: PromiseOrValue<BigNumberish>;
|
|
20
20
|
quotaRate: PromiseOrValue<BigNumberish>;
|
|
21
|
+
quotaCumulativeIndexLU: PromiseOrValue<BigNumberish>;
|
|
21
22
|
};
|
|
22
23
|
export type TokenBalanceStructOutput = [
|
|
23
24
|
string,
|
|
@@ -26,7 +27,8 @@ export type TokenBalanceStructOutput = [
|
|
|
26
27
|
boolean,
|
|
27
28
|
boolean,
|
|
28
29
|
BigNumber,
|
|
29
|
-
number
|
|
30
|
+
number,
|
|
31
|
+
BigNumber
|
|
30
32
|
] & {
|
|
31
33
|
token: string;
|
|
32
34
|
balance: BigNumber;
|
|
@@ -35,6 +37,7 @@ export type TokenBalanceStructOutput = [
|
|
|
35
37
|
isQuoted: boolean;
|
|
36
38
|
quota: BigNumber;
|
|
37
39
|
quotaRate: number;
|
|
40
|
+
quotaCumulativeIndexLU: BigNumber;
|
|
38
41
|
};
|
|
39
42
|
export type ScheduledWithdrawalStruct = {
|
|
40
43
|
tokenIndex: PromiseOrValue<BigNumberish>;
|
|
@@ -403,7 +406,7 @@ export type PoolDataStruct = {
|
|
|
403
406
|
dieselToken: PromiseOrValue<string>;
|
|
404
407
|
symbol: PromiseOrValue<string>;
|
|
405
408
|
name: PromiseOrValue<string>;
|
|
406
|
-
|
|
409
|
+
baseInterestIndex: PromiseOrValue<BigNumberish>;
|
|
407
410
|
availableLiquidity: PromiseOrValue<BigNumberish>;
|
|
408
411
|
expectedLiquidity: PromiseOrValue<BigNumberish>;
|
|
409
412
|
totalBorrowed: PromiseOrValue<BigNumberish>;
|
|
@@ -415,7 +418,7 @@ export type PoolDataStruct = {
|
|
|
415
418
|
baseInterestRate: PromiseOrValue<BigNumberish>;
|
|
416
419
|
dieselRate_RAY: PromiseOrValue<BigNumberish>;
|
|
417
420
|
withdrawFee: PromiseOrValue<BigNumberish>;
|
|
418
|
-
|
|
421
|
+
lastBaseInterestUpdate: PromiseOrValue<BigNumberish>;
|
|
419
422
|
baseInterestIndexLU: PromiseOrValue<BigNumberish>;
|
|
420
423
|
version: PromiseOrValue<BigNumberish>;
|
|
421
424
|
poolQuotaKeeper: PromiseOrValue<string>;
|
|
@@ -458,7 +461,7 @@ export type PoolDataStructOutput = [
|
|
|
458
461
|
dieselToken: string;
|
|
459
462
|
symbol: string;
|
|
460
463
|
name: string;
|
|
461
|
-
|
|
464
|
+
baseInterestIndex: BigNumber;
|
|
462
465
|
availableLiquidity: BigNumber;
|
|
463
466
|
expectedLiquidity: BigNumber;
|
|
464
467
|
totalBorrowed: BigNumber;
|
|
@@ -470,7 +473,7 @@ export type PoolDataStructOutput = [
|
|
|
470
473
|
baseInterestRate: BigNumber;
|
|
471
474
|
dieselRate_RAY: BigNumber;
|
|
472
475
|
withdrawFee: BigNumber;
|
|
473
|
-
|
|
476
|
+
lastBaseInterestUpdate: BigNumber;
|
|
474
477
|
baseInterestIndexLU: BigNumber;
|
|
475
478
|
version: BigNumber;
|
|
476
479
|
poolQuotaKeeper: string;
|
|
@@ -42,6 +42,16 @@ export declare class IConvexToken__factory {
|
|
|
42
42
|
}];
|
|
43
43
|
readonly name: "Transfer";
|
|
44
44
|
readonly type: "event";
|
|
45
|
+
}, {
|
|
46
|
+
readonly inputs: readonly [];
|
|
47
|
+
readonly name: "EMISSIONS_MAX_SUPPLY";
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly internalType: "uint256";
|
|
50
|
+
readonly name: "";
|
|
51
|
+
readonly type: "uint256";
|
|
52
|
+
}];
|
|
53
|
+
readonly stateMutability: "view";
|
|
54
|
+
readonly type: "function";
|
|
45
55
|
}, {
|
|
46
56
|
readonly inputs: readonly [{
|
|
47
57
|
readonly internalType: "address";
|
|
@@ -56,6 +56,19 @@ const _abi = [
|
|
|
56
56
|
name: "Transfer",
|
|
57
57
|
type: "event",
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
inputs: [],
|
|
61
|
+
name: "EMISSIONS_MAX_SUPPLY",
|
|
62
|
+
outputs: [
|
|
63
|
+
{
|
|
64
|
+
internalType: "uint256",
|
|
65
|
+
name: "",
|
|
66
|
+
type: "uint256",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
stateMutability: "view",
|
|
70
|
+
type: "function",
|
|
71
|
+
},
|
|
59
72
|
{
|
|
60
73
|
inputs: [
|
|
61
74
|
{
|
|
@@ -62,6 +62,26 @@ export declare class IConvexV1BaseRewardPoolAdapter__factory {
|
|
|
62
62
|
}];
|
|
63
63
|
readonly stateMutability: "view";
|
|
64
64
|
readonly type: "function";
|
|
65
|
+
}, {
|
|
66
|
+
readonly inputs: readonly [];
|
|
67
|
+
readonly name: "extraReward1";
|
|
68
|
+
readonly outputs: readonly [{
|
|
69
|
+
readonly internalType: "address";
|
|
70
|
+
readonly name: "";
|
|
71
|
+
readonly type: "address";
|
|
72
|
+
}];
|
|
73
|
+
readonly stateMutability: "view";
|
|
74
|
+
readonly type: "function";
|
|
75
|
+
}, {
|
|
76
|
+
readonly inputs: readonly [];
|
|
77
|
+
readonly name: "extraReward2";
|
|
78
|
+
readonly outputs: readonly [{
|
|
79
|
+
readonly internalType: "address";
|
|
80
|
+
readonly name: "";
|
|
81
|
+
readonly type: "address";
|
|
82
|
+
}];
|
|
83
|
+
readonly stateMutability: "view";
|
|
84
|
+
readonly type: "function";
|
|
65
85
|
}, {
|
|
66
86
|
readonly inputs: readonly [];
|
|
67
87
|
readonly name: "getReward";
|
|
@@ -84,6 +84,32 @@ const _abi = [
|
|
|
84
84
|
stateMutability: "view",
|
|
85
85
|
type: "function",
|
|
86
86
|
},
|
|
87
|
+
{
|
|
88
|
+
inputs: [],
|
|
89
|
+
name: "extraReward1",
|
|
90
|
+
outputs: [
|
|
91
|
+
{
|
|
92
|
+
internalType: "address",
|
|
93
|
+
name: "",
|
|
94
|
+
type: "address",
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
stateMutability: "view",
|
|
98
|
+
type: "function",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
inputs: [],
|
|
102
|
+
name: "extraReward2",
|
|
103
|
+
outputs: [
|
|
104
|
+
{
|
|
105
|
+
internalType: "address",
|
|
106
|
+
name: "",
|
|
107
|
+
type: "address",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
stateMutability: "view",
|
|
111
|
+
type: "function",
|
|
112
|
+
},
|
|
87
113
|
{
|
|
88
114
|
inputs: [],
|
|
89
115
|
name: "getReward",
|
|
@@ -149,6 +149,10 @@ export declare class IDataCompressorV2_10__factory {
|
|
|
149
149
|
readonly internalType: "uint16";
|
|
150
150
|
readonly name: "quotaRate";
|
|
151
151
|
readonly type: "uint16";
|
|
152
|
+
}, {
|
|
153
|
+
readonly internalType: "uint256";
|
|
154
|
+
readonly name: "quotaCumulativeIndexLU";
|
|
155
|
+
readonly type: "uint256";
|
|
152
156
|
}];
|
|
153
157
|
readonly internalType: "struct TokenBalance[]";
|
|
154
158
|
readonly name: "balances";
|
|
@@ -326,6 +330,10 @@ export declare class IDataCompressorV2_10__factory {
|
|
|
326
330
|
readonly internalType: "uint16";
|
|
327
331
|
readonly name: "quotaRate";
|
|
328
332
|
readonly type: "uint16";
|
|
333
|
+
}, {
|
|
334
|
+
readonly internalType: "uint256";
|
|
335
|
+
readonly name: "quotaCumulativeIndexLU";
|
|
336
|
+
readonly type: "uint256";
|
|
329
337
|
}];
|
|
330
338
|
readonly internalType: "struct TokenBalance[]";
|
|
331
339
|
readonly name: "balances";
|
|
@@ -800,7 +808,7 @@ export declare class IDataCompressorV2_10__factory {
|
|
|
800
808
|
readonly type: "string";
|
|
801
809
|
}, {
|
|
802
810
|
readonly internalType: "uint256";
|
|
803
|
-
readonly name: "
|
|
811
|
+
readonly name: "baseInterestIndex";
|
|
804
812
|
readonly type: "uint256";
|
|
805
813
|
}, {
|
|
806
814
|
readonly internalType: "uint256";
|
|
@@ -865,7 +873,7 @@ export declare class IDataCompressorV2_10__factory {
|
|
|
865
873
|
readonly type: "uint256";
|
|
866
874
|
}, {
|
|
867
875
|
readonly internalType: "uint256";
|
|
868
|
-
readonly name: "
|
|
876
|
+
readonly name: "lastBaseInterestUpdate";
|
|
869
877
|
readonly type: "uint256";
|
|
870
878
|
}, {
|
|
871
879
|
readonly internalType: "uint256";
|
|
@@ -1007,7 +1015,7 @@ export declare class IDataCompressorV2_10__factory {
|
|
|
1007
1015
|
readonly type: "string";
|
|
1008
1016
|
}, {
|
|
1009
1017
|
readonly internalType: "uint256";
|
|
1010
|
-
readonly name: "
|
|
1018
|
+
readonly name: "baseInterestIndex";
|
|
1011
1019
|
readonly type: "uint256";
|
|
1012
1020
|
}, {
|
|
1013
1021
|
readonly internalType: "uint256";
|
|
@@ -1072,7 +1080,7 @@ export declare class IDataCompressorV2_10__factory {
|
|
|
1072
1080
|
readonly type: "uint256";
|
|
1073
1081
|
}, {
|
|
1074
1082
|
readonly internalType: "uint256";
|
|
1075
|
-
readonly name: "
|
|
1083
|
+
readonly name: "lastBaseInterestUpdate";
|
|
1076
1084
|
readonly type: "uint256";
|
|
1077
1085
|
}, {
|
|
1078
1086
|
readonly internalType: "uint256";
|
|
@@ -194,6 +194,11 @@ const _abi = [
|
|
|
194
194
|
name: "quotaRate",
|
|
195
195
|
type: "uint16",
|
|
196
196
|
},
|
|
197
|
+
{
|
|
198
|
+
internalType: "uint256",
|
|
199
|
+
name: "quotaCumulativeIndexLU",
|
|
200
|
+
type: "uint256",
|
|
201
|
+
},
|
|
197
202
|
],
|
|
198
203
|
internalType: "struct TokenBalance[]",
|
|
199
204
|
name: "balances",
|
|
@@ -419,6 +424,11 @@ const _abi = [
|
|
|
419
424
|
name: "quotaRate",
|
|
420
425
|
type: "uint16",
|
|
421
426
|
},
|
|
427
|
+
{
|
|
428
|
+
internalType: "uint256",
|
|
429
|
+
name: "quotaCumulativeIndexLU",
|
|
430
|
+
type: "uint256",
|
|
431
|
+
},
|
|
422
432
|
],
|
|
423
433
|
internalType: "struct TokenBalance[]",
|
|
424
434
|
name: "balances",
|
|
@@ -1022,7 +1032,7 @@ const _abi = [
|
|
|
1022
1032
|
},
|
|
1023
1033
|
{
|
|
1024
1034
|
internalType: "uint256",
|
|
1025
|
-
name: "
|
|
1035
|
+
name: "baseInterestIndex",
|
|
1026
1036
|
type: "uint256",
|
|
1027
1037
|
},
|
|
1028
1038
|
{
|
|
@@ -1104,7 +1114,7 @@ const _abi = [
|
|
|
1104
1114
|
},
|
|
1105
1115
|
{
|
|
1106
1116
|
internalType: "uint256",
|
|
1107
|
-
name: "
|
|
1117
|
+
name: "lastBaseInterestUpdate",
|
|
1108
1118
|
type: "uint256",
|
|
1109
1119
|
},
|
|
1110
1120
|
{
|
|
@@ -1285,7 +1295,7 @@ const _abi = [
|
|
|
1285
1295
|
},
|
|
1286
1296
|
{
|
|
1287
1297
|
internalType: "uint256",
|
|
1288
|
-
name: "
|
|
1298
|
+
name: "baseInterestIndex",
|
|
1289
1299
|
type: "uint256",
|
|
1290
1300
|
},
|
|
1291
1301
|
{
|
|
@@ -1367,7 +1377,7 @@ const _abi = [
|
|
|
1367
1377
|
},
|
|
1368
1378
|
{
|
|
1369
1379
|
internalType: "uint256",
|
|
1370
|
-
name: "
|
|
1380
|
+
name: "lastBaseInterestUpdate",
|
|
1371
1381
|
type: "uint256",
|
|
1372
1382
|
},
|
|
1373
1383
|
{
|
|
@@ -140,6 +140,10 @@ export declare class IDataCompressorV3_00__factory {
|
|
|
140
140
|
readonly internalType: "uint16";
|
|
141
141
|
readonly name: "quotaRate";
|
|
142
142
|
readonly type: "uint16";
|
|
143
|
+
}, {
|
|
144
|
+
readonly internalType: "uint256";
|
|
145
|
+
readonly name: "quotaCumulativeIndexLU";
|
|
146
|
+
readonly type: "uint256";
|
|
143
147
|
}];
|
|
144
148
|
readonly internalType: "struct TokenBalance[]";
|
|
145
149
|
readonly name: "balances";
|
|
@@ -330,6 +334,10 @@ export declare class IDataCompressorV3_00__factory {
|
|
|
330
334
|
readonly internalType: "uint16";
|
|
331
335
|
readonly name: "quotaRate";
|
|
332
336
|
readonly type: "uint16";
|
|
337
|
+
}, {
|
|
338
|
+
readonly internalType: "uint256";
|
|
339
|
+
readonly name: "quotaCumulativeIndexLU";
|
|
340
|
+
readonly type: "uint256";
|
|
333
341
|
}];
|
|
334
342
|
readonly internalType: "struct TokenBalance[]";
|
|
335
343
|
readonly name: "balances";
|
|
@@ -520,6 +528,10 @@ export declare class IDataCompressorV3_00__factory {
|
|
|
520
528
|
readonly internalType: "uint16";
|
|
521
529
|
readonly name: "quotaRate";
|
|
522
530
|
readonly type: "uint16";
|
|
531
|
+
}, {
|
|
532
|
+
readonly internalType: "uint256";
|
|
533
|
+
readonly name: "quotaCumulativeIndexLU";
|
|
534
|
+
readonly type: "uint256";
|
|
523
535
|
}];
|
|
524
536
|
readonly internalType: "struct TokenBalance[]";
|
|
525
537
|
readonly name: "balances";
|
|
@@ -1086,7 +1098,7 @@ export declare class IDataCompressorV3_00__factory {
|
|
|
1086
1098
|
readonly type: "string";
|
|
1087
1099
|
}, {
|
|
1088
1100
|
readonly internalType: "uint256";
|
|
1089
|
-
readonly name: "
|
|
1101
|
+
readonly name: "baseInterestIndex";
|
|
1090
1102
|
readonly type: "uint256";
|
|
1091
1103
|
}, {
|
|
1092
1104
|
readonly internalType: "uint256";
|
|
@@ -1151,7 +1163,7 @@ export declare class IDataCompressorV3_00__factory {
|
|
|
1151
1163
|
readonly type: "uint256";
|
|
1152
1164
|
}, {
|
|
1153
1165
|
readonly internalType: "uint256";
|
|
1154
|
-
readonly name: "
|
|
1166
|
+
readonly name: "lastBaseInterestUpdate";
|
|
1155
1167
|
readonly type: "uint256";
|
|
1156
1168
|
}, {
|
|
1157
1169
|
readonly internalType: "uint256";
|
|
@@ -1293,7 +1305,7 @@ export declare class IDataCompressorV3_00__factory {
|
|
|
1293
1305
|
readonly type: "string";
|
|
1294
1306
|
}, {
|
|
1295
1307
|
readonly internalType: "uint256";
|
|
1296
|
-
readonly name: "
|
|
1308
|
+
readonly name: "baseInterestIndex";
|
|
1297
1309
|
readonly type: "uint256";
|
|
1298
1310
|
}, {
|
|
1299
1311
|
readonly internalType: "uint256";
|
|
@@ -1358,7 +1370,7 @@ export declare class IDataCompressorV3_00__factory {
|
|
|
1358
1370
|
readonly type: "uint256";
|
|
1359
1371
|
}, {
|
|
1360
1372
|
readonly internalType: "uint256";
|
|
1361
|
-
readonly name: "
|
|
1373
|
+
readonly name: "lastBaseInterestUpdate";
|
|
1362
1374
|
readonly type: "uint256";
|
|
1363
1375
|
}, {
|
|
1364
1376
|
readonly internalType: "uint256";
|
|
@@ -182,6 +182,11 @@ const _abi = [
|
|
|
182
182
|
name: "quotaRate",
|
|
183
183
|
type: "uint16",
|
|
184
184
|
},
|
|
185
|
+
{
|
|
186
|
+
internalType: "uint256",
|
|
187
|
+
name: "quotaCumulativeIndexLU",
|
|
188
|
+
type: "uint256",
|
|
189
|
+
},
|
|
185
190
|
],
|
|
186
191
|
internalType: "struct TokenBalance[]",
|
|
187
192
|
name: "balances",
|
|
@@ -424,6 +429,11 @@ const _abi = [
|
|
|
424
429
|
name: "quotaRate",
|
|
425
430
|
type: "uint16",
|
|
426
431
|
},
|
|
432
|
+
{
|
|
433
|
+
internalType: "uint256",
|
|
434
|
+
name: "quotaCumulativeIndexLU",
|
|
435
|
+
type: "uint256",
|
|
436
|
+
},
|
|
427
437
|
],
|
|
428
438
|
internalType: "struct TokenBalance[]",
|
|
429
439
|
name: "balances",
|
|
@@ -666,6 +676,11 @@ const _abi = [
|
|
|
666
676
|
name: "quotaRate",
|
|
667
677
|
type: "uint16",
|
|
668
678
|
},
|
|
679
|
+
{
|
|
680
|
+
internalType: "uint256",
|
|
681
|
+
name: "quotaCumulativeIndexLU",
|
|
682
|
+
type: "uint256",
|
|
683
|
+
},
|
|
669
684
|
],
|
|
670
685
|
internalType: "struct TokenBalance[]",
|
|
671
686
|
name: "balances",
|
|
@@ -1387,7 +1402,7 @@ const _abi = [
|
|
|
1387
1402
|
},
|
|
1388
1403
|
{
|
|
1389
1404
|
internalType: "uint256",
|
|
1390
|
-
name: "
|
|
1405
|
+
name: "baseInterestIndex",
|
|
1391
1406
|
type: "uint256",
|
|
1392
1407
|
},
|
|
1393
1408
|
{
|
|
@@ -1469,7 +1484,7 @@ const _abi = [
|
|
|
1469
1484
|
},
|
|
1470
1485
|
{
|
|
1471
1486
|
internalType: "uint256",
|
|
1472
|
-
name: "
|
|
1487
|
+
name: "lastBaseInterestUpdate",
|
|
1473
1488
|
type: "uint256",
|
|
1474
1489
|
},
|
|
1475
1490
|
{
|
|
@@ -1650,7 +1665,7 @@ const _abi = [
|
|
|
1650
1665
|
},
|
|
1651
1666
|
{
|
|
1652
1667
|
internalType: "uint256",
|
|
1653
|
-
name: "
|
|
1668
|
+
name: "baseInterestIndex",
|
|
1654
1669
|
type: "uint256",
|
|
1655
1670
|
},
|
|
1656
1671
|
{
|
|
@@ -1732,7 +1747,7 @@ const _abi = [
|
|
|
1732
1747
|
},
|
|
1733
1748
|
{
|
|
1734
1749
|
internalType: "uint256",
|
|
1735
|
-
name: "
|
|
1750
|
+
name: "lastBaseInterestUpdate",
|
|
1736
1751
|
type: "uint256",
|
|
1737
1752
|
},
|
|
1738
1753
|
{
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { providers, Signer } from "ethers";
|
|
2
2
|
import { CreditManagerData } from "../core/creditManager";
|
|
3
3
|
export declare class CreditManagerWatcher {
|
|
4
|
-
static
|
|
5
|
-
static
|
|
6
|
-
static
|
|
4
|
+
private static newConfiguratorV2Topic;
|
|
5
|
+
private static newConfiguratorV3Topic;
|
|
6
|
+
static getAllCreditManagers(addressProvider: string, signer: Signer | providers.Provider, atBlock?: number): Promise<Record<string, CreditManagerData>>;
|
|
7
|
+
static getV2CreditManagers(dataCompressorV210: string, signer: Signer | providers.Provider, atBlock?: number): Promise<Record<string, CreditManagerData>>;
|
|
8
|
+
static getV3CreditManagers(dataCompressorV300: string, signer: Signer | providers.Provider, atBlock?: number): Promise<Record<string, CreditManagerData>>;
|
|
7
9
|
static detectConfigChanges(freshLogs: Array<providers.Log>, creditManagers: Array<CreditManagerData>): boolean;
|
|
8
10
|
}
|
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreditManagerWatcher = void 0;
|
|
4
|
-
const
|
|
4
|
+
const utils_1 = require("ethers/lib/utils");
|
|
5
5
|
const creditManager_1 = require("../core/creditManager");
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
class CreditManagerWatcher {
|
|
8
|
-
static
|
|
9
|
-
static
|
|
10
|
-
static async
|
|
8
|
+
static newConfiguratorV2Topic = types_1.ICreditManagerV2__factory.createInterface().getEventTopic("NewConfigurator");
|
|
9
|
+
static newConfiguratorV3Topic = types_1.ICreditManagerV3__factory.createInterface().getEventTopic("SetCreditConfigurator");
|
|
10
|
+
static async getAllCreditManagers(addressProvider, signer, atBlock) {
|
|
11
|
+
const ap = types_1.IAddressProviderV3__factory.connect(addressProvider, signer);
|
|
12
|
+
const [dc210, dc300] = await Promise.all([
|
|
13
|
+
ap.getAddressOrRevert((0, utils_1.formatBytes32String)("DATA_COMPRESSOR"), 210, {
|
|
14
|
+
blockTag: atBlock,
|
|
15
|
+
}),
|
|
16
|
+
ap.getAddressOrRevert((0, utils_1.formatBytes32String)("DATA_COMPRESSOR"), 300, {
|
|
17
|
+
blockTag: atBlock,
|
|
18
|
+
}),
|
|
19
|
+
]);
|
|
20
|
+
const [cms2, cms3] = await Promise.all([
|
|
21
|
+
CreditManagerWatcher.getV2CreditManagers(dc210, signer, atBlock),
|
|
22
|
+
CreditManagerWatcher.getV3CreditManagers(dc300, signer, atBlock),
|
|
23
|
+
]);
|
|
24
|
+
return { ...cms2, ...cms3 };
|
|
25
|
+
}
|
|
26
|
+
static async getV2CreditManagers(dataCompressorV210, signer, atBlock) {
|
|
27
|
+
const creditManagers = {};
|
|
28
|
+
const creditManagersPayload = await types_1.IDataCompressorV2_10__factory.connect(dataCompressorV210, signer).getCreditManagersV2List({ blockTag: atBlock });
|
|
29
|
+
creditManagersPayload.forEach(c => {
|
|
30
|
+
creditManagers[c.addr.toLowerCase()] = new creditManager_1.CreditManagerData(c);
|
|
31
|
+
});
|
|
32
|
+
return creditManagers;
|
|
33
|
+
}
|
|
34
|
+
static async getV3CreditManagers(dataCompressorV300, signer, atBlock) {
|
|
11
35
|
const creditManagers = {};
|
|
12
|
-
const creditManagersPayload = await types_1.
|
|
13
|
-
creditManagersPayload
|
|
14
|
-
.filter(c => (0, sdk_gov_1.toBigInt)(c.cfVersion) === 2n || (0, sdk_gov_1.toBigInt)(c.cfVersion) === 210n)
|
|
15
|
-
.forEach(c => {
|
|
36
|
+
const creditManagersPayload = await types_1.IDataCompressorV3_00__factory.connect(dataCompressorV300, signer).getCreditManagersV3List({ blockTag: atBlock });
|
|
37
|
+
creditManagersPayload.forEach(c => {
|
|
16
38
|
creditManagers[c.addr.toLowerCase()] = new creditManager_1.CreditManagerData(c);
|
|
17
39
|
});
|
|
18
40
|
return creditManagers;
|
|
@@ -22,8 +44,8 @@ class CreditManagerWatcher {
|
|
|
22
44
|
const ccs = creditManagers.map(c => c.creditConfigurator);
|
|
23
45
|
for (let log of freshLogs) {
|
|
24
46
|
if (cms.includes(log.address.toLowerCase())) {
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
if (log.topics[0] === CreditManagerWatcher.newConfiguratorV2Topic ||
|
|
48
|
+
log.topics[0] === CreditManagerWatcher.newConfiguratorV3Topic) {
|
|
27
49
|
return true;
|
|
28
50
|
}
|
|
29
51
|
}
|
|
@@ -26,20 +26,28 @@ const makeLog = (address, topics, data = sdk_gov_1.ADDRESS_0X0) => {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
describe("CreditManagerTracker test", () => {
|
|
29
|
-
it("detects
|
|
30
|
-
const
|
|
29
|
+
it("detects CreditManagerV2 events correctly", () => {
|
|
30
|
+
const cmV2Interface = types_1.ICreditManagerV2__factory.createInterface();
|
|
31
31
|
let log = makeLog(CREDIT_MANAGER_ADDRESS, [
|
|
32
|
-
|
|
32
|
+
cmV2Interface.getEventTopic("NewConfigurator"),
|
|
33
33
|
encode("address", sdk_gov_1.DUMB_ADDRESS),
|
|
34
34
|
]);
|
|
35
35
|
(0, chai_1.expect)(creditManagerWatcher_1.CreditManagerWatcher.detectConfigChanges([log], [cmDumb])).to.be.eq(true);
|
|
36
36
|
log = makeLog(CREDIT_MANAGER_ADDRESS, [
|
|
37
|
-
|
|
37
|
+
cmV2Interface.getEventTopic("ExecuteOrder"),
|
|
38
38
|
encode("address", sdk_gov_1.DUMB_ADDRESS),
|
|
39
39
|
encode("address", sdk_gov_1.DUMB_ADDRESS),
|
|
40
40
|
]);
|
|
41
41
|
(0, chai_1.expect)(creditManagerWatcher_1.CreditManagerWatcher.detectConfigChanges([log], [cmDumb])).to.be.eq(false);
|
|
42
42
|
});
|
|
43
|
+
it("detects CreditManagerV3 events correctly", () => {
|
|
44
|
+
const cmV3Interface = types_1.ICreditManagerV3__factory.createInterface();
|
|
45
|
+
let log = makeLog(CREDIT_MANAGER_ADDRESS, [
|
|
46
|
+
cmV3Interface.getEventTopic("SetCreditConfigurator"),
|
|
47
|
+
encode("address", sdk_gov_1.DUMB_ADDRESS),
|
|
48
|
+
]);
|
|
49
|
+
(0, chai_1.expect)(creditManagerWatcher_1.CreditManagerWatcher.detectConfigChanges([log], [cmDumb])).to.be.eq(true);
|
|
50
|
+
});
|
|
43
51
|
it("detects CreditConfigurator events correctly", () => {
|
|
44
52
|
const ccInterface = types_1.ICreditConfiguratorV2__factory.createInterface();
|
|
45
53
|
let log = makeLog(CREDIT_CONFIGIURATOR_ADDRESS, [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.28",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@commitlint/cli": "^17.6.3",
|
|
42
42
|
"@commitlint/config-conventional": "^17.0.3",
|
|
43
43
|
"@gearbox-protocol/core-v2": "1.19.0-base.17",
|
|
44
|
-
"@gearbox-protocol/core-v3": "^1.41.
|
|
44
|
+
"@gearbox-protocol/core-v3": "^1.41.1",
|
|
45
45
|
"@gearbox-protocol/eslint-config": "^1.4.1",
|
|
46
|
-
"@gearbox-protocol/integrations-v3": "^1.
|
|
46
|
+
"@gearbox-protocol/integrations-v3": "^1.19.0",
|
|
47
47
|
"@gearbox-protocol/oracles-v3": "^1.7.6",
|
|
48
|
-
"@gearbox-protocol/periphery-v3": "^1.3.
|
|
48
|
+
"@gearbox-protocol/periphery-v3": "^1.3.3",
|
|
49
49
|
"@gearbox-protocol/prettier-config": "^1.4.1",
|
|
50
50
|
"@openzeppelin/contracts": "^4.9.3",
|
|
51
51
|
"@typechain/ethers-v5": "^10.1.0",
|