@gearbox-protocol/sdk 12.0.0-next.3 → 12.0.0-next.5
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/dist/cjs/permissionless/bindings/bytecode-repository.js +0 -32
- package/dist/cjs/permissionless/bindings/compressors/withdrawal-compressor.js +2 -6
- package/dist/cjs/permissionless/bindings/cross-chain-multisig.js +0 -18
- package/dist/cjs/permissionless/bindings/instance-manager.js +6 -34
- package/dist/cjs/permissionless/bindings/router/routing-manager.js +1 -3
- package/dist/cjs/permissionless/bindings/treasury-splitter.js +0 -6
- package/dist/cjs/sdk/base/BaseContract.js +1 -1
- package/dist/cjs/sdk/base/ChainContractsRegister.js +2 -2
- package/dist/esm/permissionless/bindings/bytecode-repository.js +0 -32
- package/dist/esm/permissionless/bindings/compressors/withdrawal-compressor.js +2 -6
- package/dist/esm/permissionless/bindings/cross-chain-multisig.js +0 -18
- package/dist/esm/permissionless/bindings/instance-manager.js +6 -34
- package/dist/esm/permissionless/bindings/router/routing-manager.js +1 -3
- package/dist/esm/permissionless/bindings/treasury-splitter.js +0 -6
- package/dist/esm/sdk/base/BaseContract.js +1 -1
- package/dist/esm/sdk/base/ChainContractsRegister.js +2 -2
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +1 -1
- package/package.json +1 -1
|
@@ -206,23 +206,6 @@ class BytecodeRepositoryContract extends import_sdk.BaseContract {
|
|
|
206
206
|
}
|
|
207
207
|
parseFunctionParams(params) {
|
|
208
208
|
switch (params.functionName) {
|
|
209
|
-
// TODO: simple array -> map can be removed, since this is what super.parseFunctionParams does
|
|
210
|
-
case "allowSystemContract": {
|
|
211
|
-
const [bytecodeHash] = params.args;
|
|
212
|
-
return {
|
|
213
|
-
bytecodeHash
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
case "addAuditor": {
|
|
217
|
-
const [auditor, name] = params.args;
|
|
218
|
-
return { auditor, name };
|
|
219
|
-
}
|
|
220
|
-
case "removeAuditor": {
|
|
221
|
-
const [auditor] = params.args;
|
|
222
|
-
return {
|
|
223
|
-
auditor
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
209
|
case "addPublicDomain": {
|
|
227
210
|
const [domain] = params.args;
|
|
228
211
|
return {
|
|
@@ -235,12 +218,6 @@ class BytecodeRepositoryContract extends import_sdk.BaseContract {
|
|
|
235
218
|
contractType: (0, import_viem.hexToString)(contractType, { size: 32 })
|
|
236
219
|
};
|
|
237
220
|
}
|
|
238
|
-
case "forbidInitCode": {
|
|
239
|
-
const [bytecodeHash] = params.args;
|
|
240
|
-
return {
|
|
241
|
-
bytecodeHash
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
221
|
case "setTokenSpecificPostfix": {
|
|
245
222
|
const [token, postfix] = params.args;
|
|
246
223
|
return {
|
|
@@ -259,15 +236,6 @@ class BytecodeRepositoryContract extends import_sdk.BaseContract {
|
|
|
259
236
|
authorSignature: uploadData.authorSignature
|
|
260
237
|
};
|
|
261
238
|
}
|
|
262
|
-
case "submitAuditReport": {
|
|
263
|
-
const [bytecodeHash, { auditor, reportUrl, signature }] = params.args;
|
|
264
|
-
return {
|
|
265
|
-
bytecodeHash,
|
|
266
|
-
auditor,
|
|
267
|
-
reportUrl,
|
|
268
|
-
signature
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
239
|
// TODO: add all functions here!
|
|
272
240
|
// case "deployContract": {
|
|
273
241
|
// const [contractType, version, encodedParams, salt, owner] = params.args;
|
|
@@ -35,12 +35,8 @@ class WithdrawalCompressorContract extends import_sdk.BaseContract {
|
|
|
35
35
|
case "setWithdrawableTypeToCompressorType": {
|
|
36
36
|
const [withdrawableType, compressorType] = args;
|
|
37
37
|
return {
|
|
38
|
-
withdrawableType: (0, import_viem.hexToString)(withdrawableType, {
|
|
39
|
-
|
|
40
|
-
}),
|
|
41
|
-
compressorType: (0, import_viem.hexToString)(compressorType, {
|
|
42
|
-
size: 32
|
|
43
|
-
})
|
|
38
|
+
withdrawableType: (0, import_viem.hexToString)(withdrawableType, { size: 32 }),
|
|
39
|
+
compressorType: (0, import_viem.hexToString)(compressorType, { size: 32 })
|
|
44
40
|
};
|
|
45
41
|
}
|
|
46
42
|
default:
|
|
@@ -205,24 +205,6 @@ class CrossChainMultisigContract extends import_sdk.BaseContract {
|
|
|
205
205
|
}
|
|
206
206
|
parseFunctionParams(params) {
|
|
207
207
|
switch (params.functionName) {
|
|
208
|
-
case "addSigner": {
|
|
209
|
-
const [signer] = params.args;
|
|
210
|
-
return {
|
|
211
|
-
signer
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
case "removeSigner": {
|
|
215
|
-
const [signer] = params.args;
|
|
216
|
-
return {
|
|
217
|
-
signer
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
case "setConfirmationThreshold": {
|
|
221
|
-
const [threshold] = params.args;
|
|
222
|
-
return {
|
|
223
|
-
threshold: threshold.toString()
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
208
|
case "submitBatch": {
|
|
227
209
|
const [name, calls, prevHash] = params.args;
|
|
228
210
|
return {
|
|
@@ -166,35 +166,15 @@ class InstanceManagerContract extends import_sdk.BaseContract {
|
|
|
166
166
|
}
|
|
167
167
|
case "configureTreasury": {
|
|
168
168
|
const [target, data] = params.args;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const parsedData = treasurySplitter.parseFunctionData(data);
|
|
176
|
-
if (!parsedData.functionName.startsWith("Unknown function")) {
|
|
177
|
-
decoded = parsedData;
|
|
178
|
-
}
|
|
179
|
-
} catch {
|
|
180
|
-
decoded = void 0;
|
|
181
|
-
}
|
|
182
|
-
return decoded ? {
|
|
169
|
+
const treasurySplitter = new import_treasury_splitter.TreasurySplitterContract(
|
|
170
|
+
target,
|
|
171
|
+
this.client
|
|
172
|
+
);
|
|
173
|
+
const decoded = treasurySplitter.mustParseFunctionData(data);
|
|
174
|
+
return {
|
|
183
175
|
target,
|
|
184
176
|
functionName: decoded.functionName,
|
|
185
177
|
data: (0, import_sdk.json_stringify)(decoded.args)
|
|
186
|
-
} : {
|
|
187
|
-
target,
|
|
188
|
-
data
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
case "activate": {
|
|
192
|
-
const [instanceOwner, treasury, weth, gear] = params.args;
|
|
193
|
-
return {
|
|
194
|
-
instanceOwner,
|
|
195
|
-
treasury,
|
|
196
|
-
weth,
|
|
197
|
-
gear
|
|
198
178
|
};
|
|
199
179
|
}
|
|
200
180
|
case "deploySystemContract": {
|
|
@@ -205,14 +185,6 @@ class InstanceManagerContract extends import_sdk.BaseContract {
|
|
|
205
185
|
saveVersion: saveVersion ? "true" : "false"
|
|
206
186
|
};
|
|
207
187
|
}
|
|
208
|
-
case "setGlobalAddress": {
|
|
209
|
-
const [key, address, saveVersion] = params.args;
|
|
210
|
-
return {
|
|
211
|
-
key,
|
|
212
|
-
address,
|
|
213
|
-
saveVersion: saveVersion ? "true" : "false"
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
188
|
default:
|
|
217
189
|
return super.parseFunctionParams(params);
|
|
218
190
|
}
|
|
@@ -35,9 +35,7 @@ class RoutingManagerContract extends import_sdk.BaseContract {
|
|
|
35
35
|
case "setAdapterToWorkerType": {
|
|
36
36
|
const [adapterType, workerType] = args;
|
|
37
37
|
return {
|
|
38
|
-
adapterType: (0, import_viem.hexToString)(adapterType, {
|
|
39
|
-
size: 32
|
|
40
|
-
}),
|
|
38
|
+
adapterType: (0, import_viem.hexToString)(adapterType, { size: 32 }),
|
|
41
39
|
workerType: (0, import_viem.hexToString)(workerType, { size: 32 })
|
|
42
40
|
};
|
|
43
41
|
}
|
|
@@ -91,12 +91,6 @@ class TreasurySplitterContract extends import_sdk.BaseContract {
|
|
|
91
91
|
parseFunctionParams(params) {
|
|
92
92
|
const { functionName, args } = params;
|
|
93
93
|
switch (functionName) {
|
|
94
|
-
case "distribute": {
|
|
95
|
-
const [token] = args;
|
|
96
|
-
return {
|
|
97
|
-
token
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
94
|
case "configure": {
|
|
101
95
|
const [callData] = args;
|
|
102
96
|
const decoded = (0, import_viem.decodeFunctionData)({
|
|
@@ -202,7 +202,7 @@ class BaseContract extends import_Construct.Construct {
|
|
|
202
202
|
chainId: this.chainId,
|
|
203
203
|
target: this.address,
|
|
204
204
|
contractType: this.contractType,
|
|
205
|
-
label: this.register.labelAddress(this.address),
|
|
205
|
+
label: this.register.labelAddress(this.address, false),
|
|
206
206
|
functionName,
|
|
207
207
|
args
|
|
208
208
|
};
|
|
@@ -74,9 +74,9 @@ class ChainContractsRegister {
|
|
|
74
74
|
this.labels.upsert(address, label(this.labels.get(address)));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
labelAddress(address) {
|
|
77
|
+
labelAddress(address, includeAddress = true) {
|
|
78
78
|
const label = this.labels.get(address);
|
|
79
|
-
return label ? `${address} [${label}]` : address;
|
|
79
|
+
return label ? includeAddress ? `${address} [${label}]` : label : address;
|
|
80
80
|
}
|
|
81
81
|
get chain() {
|
|
82
82
|
return this.client.chain;
|
|
@@ -189,23 +189,6 @@ class BytecodeRepositoryContract extends BaseContract {
|
|
|
189
189
|
}
|
|
190
190
|
parseFunctionParams(params) {
|
|
191
191
|
switch (params.functionName) {
|
|
192
|
-
// TODO: simple array -> map can be removed, since this is what super.parseFunctionParams does
|
|
193
|
-
case "allowSystemContract": {
|
|
194
|
-
const [bytecodeHash] = params.args;
|
|
195
|
-
return {
|
|
196
|
-
bytecodeHash
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
case "addAuditor": {
|
|
200
|
-
const [auditor, name] = params.args;
|
|
201
|
-
return { auditor, name };
|
|
202
|
-
}
|
|
203
|
-
case "removeAuditor": {
|
|
204
|
-
const [auditor] = params.args;
|
|
205
|
-
return {
|
|
206
|
-
auditor
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
192
|
case "addPublicDomain": {
|
|
210
193
|
const [domain] = params.args;
|
|
211
194
|
return {
|
|
@@ -218,12 +201,6 @@ class BytecodeRepositoryContract extends BaseContract {
|
|
|
218
201
|
contractType: hexToString(contractType, { size: 32 })
|
|
219
202
|
};
|
|
220
203
|
}
|
|
221
|
-
case "forbidInitCode": {
|
|
222
|
-
const [bytecodeHash] = params.args;
|
|
223
|
-
return {
|
|
224
|
-
bytecodeHash
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
204
|
case "setTokenSpecificPostfix": {
|
|
228
205
|
const [token, postfix] = params.args;
|
|
229
206
|
return {
|
|
@@ -242,15 +219,6 @@ class BytecodeRepositoryContract extends BaseContract {
|
|
|
242
219
|
authorSignature: uploadData.authorSignature
|
|
243
220
|
};
|
|
244
221
|
}
|
|
245
|
-
case "submitAuditReport": {
|
|
246
|
-
const [bytecodeHash, { auditor, reportUrl, signature }] = params.args;
|
|
247
|
-
return {
|
|
248
|
-
bytecodeHash,
|
|
249
|
-
auditor,
|
|
250
|
-
reportUrl,
|
|
251
|
-
signature
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
222
|
// TODO: add all functions here!
|
|
255
223
|
// case "deployContract": {
|
|
256
224
|
// const [contractType, version, encodedParams, salt, owner] = params.args;
|
|
@@ -14,12 +14,8 @@ class WithdrawalCompressorContract extends BaseContract {
|
|
|
14
14
|
case "setWithdrawableTypeToCompressorType": {
|
|
15
15
|
const [withdrawableType, compressorType] = args;
|
|
16
16
|
return {
|
|
17
|
-
withdrawableType: hexToString(withdrawableType, {
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
compressorType: hexToString(compressorType, {
|
|
21
|
-
size: 32
|
|
22
|
-
})
|
|
17
|
+
withdrawableType: hexToString(withdrawableType, { size: 32 }),
|
|
18
|
+
compressorType: hexToString(compressorType, { size: 32 })
|
|
23
19
|
};
|
|
24
20
|
}
|
|
25
21
|
default:
|
|
@@ -190,24 +190,6 @@ class CrossChainMultisigContract extends BaseContract {
|
|
|
190
190
|
}
|
|
191
191
|
parseFunctionParams(params) {
|
|
192
192
|
switch (params.functionName) {
|
|
193
|
-
case "addSigner": {
|
|
194
|
-
const [signer] = params.args;
|
|
195
|
-
return {
|
|
196
|
-
signer
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
case "removeSigner": {
|
|
200
|
-
const [signer] = params.args;
|
|
201
|
-
return {
|
|
202
|
-
signer
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
case "setConfirmationThreshold": {
|
|
206
|
-
const [threshold] = params.args;
|
|
207
|
-
return {
|
|
208
|
-
threshold: threshold.toString()
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
193
|
case "submitBatch": {
|
|
212
194
|
const [name, calls, prevHash] = params.args;
|
|
213
195
|
return {
|
|
@@ -149,35 +149,15 @@ class InstanceManagerContract extends BaseContract {
|
|
|
149
149
|
}
|
|
150
150
|
case "configureTreasury": {
|
|
151
151
|
const [target, data] = params.args;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const parsedData = treasurySplitter.parseFunctionData(data);
|
|
159
|
-
if (!parsedData.functionName.startsWith("Unknown function")) {
|
|
160
|
-
decoded = parsedData;
|
|
161
|
-
}
|
|
162
|
-
} catch {
|
|
163
|
-
decoded = void 0;
|
|
164
|
-
}
|
|
165
|
-
return decoded ? {
|
|
152
|
+
const treasurySplitter = new TreasurySplitterContract(
|
|
153
|
+
target,
|
|
154
|
+
this.client
|
|
155
|
+
);
|
|
156
|
+
const decoded = treasurySplitter.mustParseFunctionData(data);
|
|
157
|
+
return {
|
|
166
158
|
target,
|
|
167
159
|
functionName: decoded.functionName,
|
|
168
160
|
data: json_stringify(decoded.args)
|
|
169
|
-
} : {
|
|
170
|
-
target,
|
|
171
|
-
data
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
case "activate": {
|
|
175
|
-
const [instanceOwner, treasury, weth, gear] = params.args;
|
|
176
|
-
return {
|
|
177
|
-
instanceOwner,
|
|
178
|
-
treasury,
|
|
179
|
-
weth,
|
|
180
|
-
gear
|
|
181
161
|
};
|
|
182
162
|
}
|
|
183
163
|
case "deploySystemContract": {
|
|
@@ -188,14 +168,6 @@ class InstanceManagerContract extends BaseContract {
|
|
|
188
168
|
saveVersion: saveVersion ? "true" : "false"
|
|
189
169
|
};
|
|
190
170
|
}
|
|
191
|
-
case "setGlobalAddress": {
|
|
192
|
-
const [key, address, saveVersion] = params.args;
|
|
193
|
-
return {
|
|
194
|
-
key,
|
|
195
|
-
address,
|
|
196
|
-
saveVersion: saveVersion ? "true" : "false"
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
171
|
default:
|
|
200
172
|
return super.parseFunctionParams(params);
|
|
201
173
|
}
|
|
@@ -14,9 +14,7 @@ class RoutingManagerContract extends BaseContract {
|
|
|
14
14
|
case "setAdapterToWorkerType": {
|
|
15
15
|
const [adapterType, workerType] = args;
|
|
16
16
|
return {
|
|
17
|
-
adapterType: hexToString(adapterType, {
|
|
18
|
-
size: 32
|
|
19
|
-
}),
|
|
17
|
+
adapterType: hexToString(adapterType, { size: 32 }),
|
|
20
18
|
workerType: hexToString(workerType, { size: 32 })
|
|
21
19
|
};
|
|
22
20
|
}
|
|
@@ -70,12 +70,6 @@ class TreasurySplitterContract extends BaseContract {
|
|
|
70
70
|
parseFunctionParams(params) {
|
|
71
71
|
const { functionName, args } = params;
|
|
72
72
|
switch (functionName) {
|
|
73
|
-
case "distribute": {
|
|
74
|
-
const [token] = args;
|
|
75
|
-
return {
|
|
76
|
-
token
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
73
|
case "configure": {
|
|
80
74
|
const [callData] = args;
|
|
81
75
|
const decoded = decodeFunctionData({
|
|
@@ -190,7 +190,7 @@ class BaseContract extends Construct {
|
|
|
190
190
|
chainId: this.chainId,
|
|
191
191
|
target: this.address,
|
|
192
192
|
contractType: this.contractType,
|
|
193
|
-
label: this.register.labelAddress(this.address),
|
|
193
|
+
label: this.register.labelAddress(this.address, false),
|
|
194
194
|
functionName,
|
|
195
195
|
args
|
|
196
196
|
};
|
|
@@ -51,9 +51,9 @@ class ChainContractsRegister {
|
|
|
51
51
|
this.labels.upsert(address, label(this.labels.get(address)));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
labelAddress(address) {
|
|
54
|
+
labelAddress(address, includeAddress = true) {
|
|
55
55
|
const label = this.labels.get(address);
|
|
56
|
-
return label ? `${address} [${label}]` : address;
|
|
56
|
+
return label ? includeAddress ? `${address} [${label}]` : label : address;
|
|
57
57
|
}
|
|
58
58
|
get chain() {
|
|
59
59
|
return this.client.chain;
|
|
@@ -21,7 +21,7 @@ export declare class ChainContractsRegister {
|
|
|
21
21
|
mustGetContract<T = unknown[]>(address: Address): ContractOrInterface<T>;
|
|
22
22
|
setContract(address: Address, contract: BaseContract<any>): void;
|
|
23
23
|
setAddressLabel(address: Address, label: string | ((oldLabel?: string) => string)): void;
|
|
24
|
-
labelAddress(address: Address): string;
|
|
24
|
+
labelAddress(address: Address, includeAddress?: boolean): string;
|
|
25
25
|
get chain(): Chain;
|
|
26
26
|
get chainId(): number;
|
|
27
27
|
/**
|