@gearbox-protocol/sdk 11.0.0-next.3 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/cjs/abi/310/iTreasurySplitter.js +465 -1
  2. package/dist/cjs/permissionless/bindings/instance-manager.js +38 -0
  3. package/dist/cjs/permissionless/bindings/market-configurator.js +12 -0
  4. package/dist/cjs/permissionless/bindings/treasury-splitter.js +71 -0
  5. package/dist/cjs/sdk/market/loss-policy/AliasLossPolicyV310Contract.js +39 -0
  6. package/dist/cjs/sdk/market/loss-policy/constants.js +38 -0
  7. package/dist/cjs/sdk/market/loss-policy/createLossPolicy.js +3 -2
  8. package/dist/esm/abi/310/iTreasurySplitter.js +465 -1
  9. package/dist/esm/permissionless/bindings/instance-manager.js +38 -0
  10. package/dist/esm/permissionless/bindings/market-configurator.js +12 -0
  11. package/dist/esm/permissionless/bindings/treasury-splitter.js +71 -0
  12. package/dist/esm/sdk/market/loss-policy/AliasLossPolicyV310Contract.js +43 -1
  13. package/dist/esm/sdk/market/loss-policy/constants.js +12 -0
  14. package/dist/esm/sdk/market/loss-policy/createLossPolicy.js +3 -2
  15. package/dist/types/abi/310/iTreasurySplitter.d.ts +355 -0
  16. package/dist/types/permissionless/bindings/instance-manager.d.ts +1 -0
  17. package/dist/types/permissionless/bindings/market-configurator.d.ts +2 -0
  18. package/dist/types/permissionless/bindings/treasury-splitter.d.ts +373 -1
  19. package/dist/types/permissionless/utils/governance/types.d.ts +1 -0
  20. package/dist/types/sdk/market/loss-policy/AliasLossPolicyV310Contract.d.ts +12 -0
  21. package/dist/types/sdk/market/loss-policy/constants.d.ts +4 -0
  22. package/dist/types/sdk/types/state-human.d.ts +14 -1
  23. package/package.json +1 -1
@@ -1,8 +1,94 @@
1
- import type { Address, DecodeFunctionDataReturnType, PublicClient } from "viem";
1
+ import type { Address, DecodeFunctionDataReturnType, Hex, PublicClient } from "viem";
2
2
  import type { RawTx } from "../../sdk/types/index.js";
3
3
  import type { ParsedCall } from "../core/index.js";
4
4
  import { BaseContract } from "./base-contract.js";
5
5
  declare const abi: readonly [{
6
+ readonly type: "function";
7
+ readonly name: "activeProposals";
8
+ readonly inputs: readonly [];
9
+ readonly outputs: readonly [{
10
+ readonly name: "";
11
+ readonly type: "tuple[]";
12
+ readonly internalType: "struct TwoAdminProposal[]";
13
+ readonly components: readonly [{
14
+ readonly name: "callData";
15
+ readonly type: "bytes";
16
+ readonly internalType: "bytes";
17
+ }, {
18
+ readonly name: "confirmedByAdmin";
19
+ readonly type: "bool";
20
+ readonly internalType: "bool";
21
+ }, {
22
+ readonly name: "confirmedByTreasuryProxy";
23
+ readonly type: "bool";
24
+ readonly internalType: "bool";
25
+ }];
26
+ }];
27
+ readonly stateMutability: "view";
28
+ }, {
29
+ readonly type: "function";
30
+ readonly name: "admin";
31
+ readonly inputs: readonly [];
32
+ readonly outputs: readonly [{
33
+ readonly name: "";
34
+ readonly type: "address";
35
+ readonly internalType: "address";
36
+ }];
37
+ readonly stateMutability: "view";
38
+ }, {
39
+ readonly type: "function";
40
+ readonly name: "cancelConfigure";
41
+ readonly inputs: readonly [{
42
+ readonly name: "callData";
43
+ readonly type: "bytes";
44
+ readonly internalType: "bytes";
45
+ }];
46
+ readonly outputs: readonly [];
47
+ readonly stateMutability: "nonpayable";
48
+ }, {
49
+ readonly type: "function";
50
+ readonly name: "configure";
51
+ readonly inputs: readonly [{
52
+ readonly name: "callData";
53
+ readonly type: "bytes";
54
+ readonly internalType: "bytes";
55
+ }];
56
+ readonly outputs: readonly [];
57
+ readonly stateMutability: "nonpayable";
58
+ }, {
59
+ readonly type: "function";
60
+ readonly name: "contractType";
61
+ readonly inputs: readonly [];
62
+ readonly outputs: readonly [{
63
+ readonly name: "";
64
+ readonly type: "bytes32";
65
+ readonly internalType: "bytes32";
66
+ }];
67
+ readonly stateMutability: "view";
68
+ }, {
69
+ readonly type: "function";
70
+ readonly name: "defaultSplit";
71
+ readonly inputs: readonly [];
72
+ readonly outputs: readonly [{
73
+ readonly name: "";
74
+ readonly type: "tuple";
75
+ readonly internalType: "struct Split";
76
+ readonly components: readonly [{
77
+ readonly name: "initialized";
78
+ readonly type: "bool";
79
+ readonly internalType: "bool";
80
+ }, {
81
+ readonly name: "receivers";
82
+ readonly type: "address[]";
83
+ readonly internalType: "address[]";
84
+ }, {
85
+ readonly name: "proportions";
86
+ readonly type: "uint16[]";
87
+ readonly internalType: "uint16[]";
88
+ }];
89
+ }];
90
+ readonly stateMutability: "view";
91
+ }, {
6
92
  readonly type: "function";
7
93
  readonly name: "distribute";
8
94
  readonly inputs: readonly [{
@@ -12,10 +98,296 @@ declare const abi: readonly [{
12
98
  }];
13
99
  readonly outputs: readonly [];
14
100
  readonly stateMutability: "nonpayable";
101
+ }, {
102
+ readonly type: "function";
103
+ readonly name: "getProposal";
104
+ readonly inputs: readonly [{
105
+ readonly name: "callDataHash";
106
+ readonly type: "bytes32";
107
+ readonly internalType: "bytes32";
108
+ }];
109
+ readonly outputs: readonly [{
110
+ readonly name: "";
111
+ readonly type: "tuple";
112
+ readonly internalType: "struct TwoAdminProposal";
113
+ readonly components: readonly [{
114
+ readonly name: "callData";
115
+ readonly type: "bytes";
116
+ readonly internalType: "bytes";
117
+ }, {
118
+ readonly name: "confirmedByAdmin";
119
+ readonly type: "bool";
120
+ readonly internalType: "bool";
121
+ }, {
122
+ readonly name: "confirmedByTreasuryProxy";
123
+ readonly type: "bool";
124
+ readonly internalType: "bool";
125
+ }];
126
+ }];
127
+ readonly stateMutability: "view";
128
+ }, {
129
+ readonly type: "function";
130
+ readonly name: "setDefaultSplit";
131
+ readonly inputs: readonly [{
132
+ readonly name: "receivers";
133
+ readonly type: "address[]";
134
+ readonly internalType: "address[]";
135
+ }, {
136
+ readonly name: "proportions";
137
+ readonly type: "uint16[]";
138
+ readonly internalType: "uint16[]";
139
+ }];
140
+ readonly outputs: readonly [];
141
+ readonly stateMutability: "nonpayable";
142
+ }, {
143
+ readonly type: "function";
144
+ readonly name: "setTokenInsuranceAmount";
145
+ readonly inputs: readonly [{
146
+ readonly name: "token";
147
+ readonly type: "address";
148
+ readonly internalType: "address";
149
+ }, {
150
+ readonly name: "amount";
151
+ readonly type: "uint256";
152
+ readonly internalType: "uint256";
153
+ }];
154
+ readonly outputs: readonly [];
155
+ readonly stateMutability: "nonpayable";
156
+ }, {
157
+ readonly type: "function";
158
+ readonly name: "setTokenSplit";
159
+ readonly inputs: readonly [{
160
+ readonly name: "token";
161
+ readonly type: "address";
162
+ readonly internalType: "address";
163
+ }, {
164
+ readonly name: "receivers";
165
+ readonly type: "address[]";
166
+ readonly internalType: "address[]";
167
+ }, {
168
+ readonly name: "proportions";
169
+ readonly type: "uint16[]";
170
+ readonly internalType: "uint16[]";
171
+ }, {
172
+ readonly name: "distribute";
173
+ readonly type: "bool";
174
+ readonly internalType: "bool";
175
+ }];
176
+ readonly outputs: readonly [];
177
+ readonly stateMutability: "nonpayable";
178
+ }, {
179
+ readonly type: "function";
180
+ readonly name: "tokenInsuranceAmount";
181
+ readonly inputs: readonly [{
182
+ readonly name: "token";
183
+ readonly type: "address";
184
+ readonly internalType: "address";
185
+ }];
186
+ readonly outputs: readonly [{
187
+ readonly name: "";
188
+ readonly type: "uint256";
189
+ readonly internalType: "uint256";
190
+ }];
191
+ readonly stateMutability: "view";
192
+ }, {
193
+ readonly type: "function";
194
+ readonly name: "tokenSplits";
195
+ readonly inputs: readonly [{
196
+ readonly name: "token";
197
+ readonly type: "address";
198
+ readonly internalType: "address";
199
+ }];
200
+ readonly outputs: readonly [{
201
+ readonly name: "";
202
+ readonly type: "tuple";
203
+ readonly internalType: "struct Split";
204
+ readonly components: readonly [{
205
+ readonly name: "initialized";
206
+ readonly type: "bool";
207
+ readonly internalType: "bool";
208
+ }, {
209
+ readonly name: "receivers";
210
+ readonly type: "address[]";
211
+ readonly internalType: "address[]";
212
+ }, {
213
+ readonly name: "proportions";
214
+ readonly type: "uint16[]";
215
+ readonly internalType: "uint16[]";
216
+ }];
217
+ }];
218
+ readonly stateMutability: "view";
219
+ }, {
220
+ readonly type: "function";
221
+ readonly name: "treasuryProxy";
222
+ readonly inputs: readonly [];
223
+ readonly outputs: readonly [{
224
+ readonly name: "";
225
+ readonly type: "address";
226
+ readonly internalType: "address";
227
+ }];
228
+ readonly stateMutability: "view";
229
+ }, {
230
+ readonly type: "function";
231
+ readonly name: "version";
232
+ readonly inputs: readonly [];
233
+ readonly outputs: readonly [{
234
+ readonly name: "";
235
+ readonly type: "uint256";
236
+ readonly internalType: "uint256";
237
+ }];
238
+ readonly stateMutability: "view";
239
+ }, {
240
+ readonly type: "function";
241
+ readonly name: "withdrawToken";
242
+ readonly inputs: readonly [{
243
+ readonly name: "token";
244
+ readonly type: "address";
245
+ readonly internalType: "address";
246
+ }, {
247
+ readonly name: "to";
248
+ readonly type: "address";
249
+ readonly internalType: "address";
250
+ }, {
251
+ readonly name: "amount";
252
+ readonly type: "uint256";
253
+ readonly internalType: "uint256";
254
+ }];
255
+ readonly outputs: readonly [];
256
+ readonly stateMutability: "nonpayable";
257
+ }, {
258
+ readonly type: "event";
259
+ readonly name: "DistributeToken";
260
+ readonly inputs: readonly [{
261
+ readonly name: "token";
262
+ readonly type: "address";
263
+ readonly indexed: true;
264
+ readonly internalType: "address";
265
+ }, {
266
+ readonly name: "distributedAmount";
267
+ readonly type: "uint256";
268
+ readonly indexed: false;
269
+ readonly internalType: "uint256";
270
+ }];
271
+ readonly anonymous: false;
272
+ }, {
273
+ readonly type: "event";
274
+ readonly name: "SetDefaultSplit";
275
+ readonly inputs: readonly [{
276
+ readonly name: "receivers";
277
+ readonly type: "address[]";
278
+ readonly indexed: false;
279
+ readonly internalType: "address[]";
280
+ }, {
281
+ readonly name: "proportions";
282
+ readonly type: "uint16[]";
283
+ readonly indexed: false;
284
+ readonly internalType: "uint16[]";
285
+ }];
286
+ readonly anonymous: false;
287
+ }, {
288
+ readonly type: "event";
289
+ readonly name: "SetTokenInsuranceAmount";
290
+ readonly inputs: readonly [{
291
+ readonly name: "token";
292
+ readonly type: "address";
293
+ readonly indexed: true;
294
+ readonly internalType: "address";
295
+ }, {
296
+ readonly name: "amount";
297
+ readonly type: "uint256";
298
+ readonly indexed: false;
299
+ readonly internalType: "uint256";
300
+ }];
301
+ readonly anonymous: false;
302
+ }, {
303
+ readonly type: "event";
304
+ readonly name: "SetTokenSplit";
305
+ readonly inputs: readonly [{
306
+ readonly name: "token";
307
+ readonly type: "address";
308
+ readonly indexed: true;
309
+ readonly internalType: "address";
310
+ }, {
311
+ readonly name: "receivers";
312
+ readonly type: "address[]";
313
+ readonly indexed: false;
314
+ readonly internalType: "address[]";
315
+ }, {
316
+ readonly name: "proportions";
317
+ readonly type: "uint16[]";
318
+ readonly indexed: false;
319
+ readonly internalType: "uint16[]";
320
+ }];
321
+ readonly anonymous: false;
322
+ }, {
323
+ readonly type: "event";
324
+ readonly name: "WithdrawToken";
325
+ readonly inputs: readonly [{
326
+ readonly name: "token";
327
+ readonly type: "address";
328
+ readonly indexed: true;
329
+ readonly internalType: "address";
330
+ }, {
331
+ readonly name: "to";
332
+ readonly type: "address";
333
+ readonly indexed: true;
334
+ readonly internalType: "address";
335
+ }, {
336
+ readonly name: "withdrawnAmount";
337
+ readonly type: "uint256";
338
+ readonly indexed: false;
339
+ readonly internalType: "uint256";
340
+ }];
341
+ readonly anonymous: false;
342
+ }, {
343
+ readonly type: "error";
344
+ readonly name: "IncorrectConfigureSelectorException";
345
+ readonly inputs: readonly [];
346
+ }, {
347
+ readonly type: "error";
348
+ readonly name: "OnlyAdminOrTreasuryProxyException";
349
+ readonly inputs: readonly [];
350
+ }, {
351
+ readonly type: "error";
352
+ readonly name: "OnlySelfException";
353
+ readonly inputs: readonly [];
354
+ }, {
355
+ readonly type: "error";
356
+ readonly name: "PropotionSumIncorrectException";
357
+ readonly inputs: readonly [];
358
+ }, {
359
+ readonly type: "error";
360
+ readonly name: "SplitArraysDifferentLengthException";
361
+ readonly inputs: readonly [];
362
+ }, {
363
+ readonly type: "error";
364
+ readonly name: "TreasurySplitterAsReceiverException";
365
+ readonly inputs: readonly [];
366
+ }, {
367
+ readonly type: "error";
368
+ readonly name: "UndefinedSplitException";
369
+ readonly inputs: readonly [];
15
370
  }];
16
371
  export declare class TreasurySplitterContract extends BaseContract<typeof abi> {
17
372
  constructor(address: Address, client: PublicClient);
373
+ defaultSplit(): Promise<{
374
+ initialized: boolean;
375
+ receivers: readonly `0x${string}`[];
376
+ proportions: readonly number[];
377
+ }>;
378
+ activeProposals(): Promise<readonly {
379
+ callData: `0x${string}`;
380
+ confirmedByAdmin: boolean;
381
+ confirmedByTreasuryProxy: boolean;
382
+ }[]>;
18
383
  distribute(token: Address): RawTx;
384
+ setDefaultSplitTx(receivers: Address[], proportions: number[]): RawTx;
385
+ setTokenSplitTx(token: Address, receivers: Address[], proportions: number[], distributeBefore: boolean): RawTx;
386
+ setTokenInsuranceAmountTx(token: Address, amount: bigint): RawTx;
387
+ withdrawTokenTx(token: Address, to: Address, amount: bigint): RawTx;
388
+ configureTx(callData: Hex): RawTx;
389
+ cancelConfigureTx(callData: Hex): RawTx;
390
+ private wrapConfigure;
19
391
  parseFunctionParams(params: DecodeFunctionDataReturnType<typeof abi>): ParsedCall | undefined;
20
392
  }
21
393
  export {};
@@ -16,4 +16,5 @@ export interface InstanceTxs {
16
16
  batches: SafeTx[][];
17
17
  createdAtBlock?: number;
18
18
  updatableFeeds?: Address[][];
19
+ safeAddress?: Address;
19
20
  }
@@ -1,6 +1,7 @@
1
1
  import { type Address, type Hex } from "viem";
2
2
  import { BaseContract, type BaseParams } from "../../base/index.js";
3
3
  import type { GearboxSDK } from "../../GearboxSDK.js";
4
+ import type { AliasLossPolicyStateHuman } from "../../types/state-human.js";
4
5
  import type { ILossPolicyContract } from "./types.js";
5
6
  declare const abi: readonly [{
6
7
  readonly type: "function";
@@ -273,8 +274,19 @@ declare const abi: readonly [{
273
274
  readonly anonymous: false;
274
275
  }];
275
276
  type abi = typeof abi;
277
+ export interface AliasedPriceFeedParams {
278
+ priceFeed: Address;
279
+ stalenessPeriod: number;
280
+ skipCheck: boolean;
281
+ tokenDecimals: number;
282
+ }
276
283
  export declare class AliasLossPolicyV310Contract extends BaseContract<abi> implements ILossPolicyContract {
284
+ readonly accessMode: number;
285
+ readonly checksEnabled: boolean;
286
+ readonly tokens: readonly Address[];
287
+ readonly priceFeedParams: readonly AliasedPriceFeedParams[];
277
288
  constructor(sdk: GearboxSDK, params: BaseParams);
278
289
  getLiquidationData(creditAccount: Address, blockNumber?: bigint): Promise<Hex | undefined>;
290
+ stateHuman(raw?: boolean): AliasLossPolicyStateHuman;
279
291
  }
280
292
  export {};
@@ -0,0 +1,4 @@
1
+ export declare const LOSS_POLICY_ALIASED: "LOSS_POLICY::ALIASED";
2
+ export declare const LOSS_POLICY_DEFAULT: "LOSS_POLICY::DEFAULT";
3
+ export declare const LOSS_POLICY_ACCESS_MODES: readonly ["Permissionless", "Permissioned", "Forbidden"];
4
+ export type LossPolicyAccessMode = (typeof LOSS_POLICY_ACCESS_MODES)[number];
@@ -171,12 +171,25 @@ export interface PoolSuiteStateHuman {
171
171
  interestRateModel?: InterestRateModelStateHuman;
172
172
  rateKeeper: RateKeeperStateHuman;
173
173
  }
174
+ export interface AliasLossPolicyStateHuman extends BaseContractStateHuman {
175
+ contractType: "LOSS_POLICY::ALIASED";
176
+ accessMode: string;
177
+ checksEnabled: boolean;
178
+ tokens: string[];
179
+ priceFeedParams: {
180
+ priceFeed: string;
181
+ stalenessPeriod: string;
182
+ skipCheck: boolean;
183
+ tokenDecimals: number;
184
+ }[];
185
+ }
186
+ export type LossPolicyStateHuman = AliasLossPolicyStateHuman | BaseContractStateHuman;
174
187
  export interface MarketStateHuman {
175
188
  configurator: string;
176
189
  pool: PoolSuiteStateHuman;
177
190
  creditManagers: CreditSuiteStateHuman[];
178
191
  priceOracle: PriceOracleStateHuman;
179
- lossPolicy: BaseContractStateHuman;
192
+ lossPolicy: LossPolicyStateHuman;
180
193
  pausableAdmins: string[];
181
194
  unpausableAdmins: string[];
182
195
  emergencyLiquidators: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "11.0.0-next.3",
3
+ "version": "11.1.0",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",