@gearbox-protocol/deploy-tools 5.45.4 → 5.45.6
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/index.mjs +70 -44
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -446349,19 +446349,20 @@ var DefillamaCompressorAbi = [
|
|
|
446349
446349
|
];
|
|
446350
446350
|
|
|
446351
446351
|
// src/commands/defillama-test/bytecode.ts
|
|
446352
|
-
var DefillamaCompressorBytecode = "
|
|
446352
|
+
var DefillamaCompressorBytecode = "0x60a060405234801561000f575f80fd5b506040516112e73803806112e783398101604081905261002e9161003f565b6001600160a01b031660805261006c565b5f6020828403121561004f575f80fd5b81516001600160a01b0381168114610065575f80fd5b9392505050565b60805161125d61008a5f395f8181608e015261020d015261125d5ff3fe608060405234801561000f575f80fd5b5060043610610085575f3560e01c8063673a2a1f11610058578063673a2a1f146101245780638ae5aaad1461012c578063a595f79e1461013f578063cb2ef6f71461015f575f80fd5b80632954018c146100895780633b007fb9146100cd57806354fd4d50146100ed5780635e63547a14610104575b5f80fd5b6100b07f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6100e06100db366004610d70565b610186565b6040516100c49190610e19565b6100f661013681565b6040519081526020016100c4565b610117610112366004610ee3565b61019b565b6040516100c49190610f7d565b6101176101ac565b6100e061013a366004610fee565b6102ed565b61015261014d366004610fee565b6102fb565b6040516100c49190611009565b6100f67f474c4f42414c3a3a444546494c4c414d415f434f4d50524553534f520000000081565b606061019384848461038a565b949350505050565b60606101a682610558565b92915050565b6040517f57b5a1c60000000000000000000000000000000000000000000000000000000081527f4d41524b45545f434f4e464947555241544f525f464143544f5259000000000060048201525f602482018190526060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906357b5a1c690604401602060405180830381865afa158015610252573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610276919061101b565b90505f816001600160a01b0316639fb7385a6040518163ffffffff1660e01b81526004015f60405180830381865afa1580156102b4573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526102db9190810190611036565b90506102e681610558565b9250505090565b60606101a6825f5f1961038a565b60408051606080820183525f8083526020830152918101919091525f826001600160a01b031663c12c21c06040518163ffffffff1660e01b8152600401602060405180830381865afa158015610353573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610377919061101b565b90506103838382610935565b9392505050565b60605f846001600160a01b031663f13d0fc66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103c9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103ed91906110c0565b90505f6001600160a01b038616632c9db6f18661041361040d82876110eb565b88610d44565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925260248201526044015f60405180830381865afa158015610469573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526104909190810190611036565b9050805167ffffffffffffffff8111156104ac576104ac610e7b565b6040519080825280602002602001820160405280156104f857816020015b60408051606080820183525f8083526020830152918101919091528152602001906001900390816104ca5790505b5092505f5b815181101561054e5761052982828151811061051b5761051b6110fe565b602002602001015188610935565b84828151811061053b5761053b6110fe565b60209081029190910101526001016104fd565b5050509392505050565b60605f805b835181101561065a575f848281518110610579576105796110fe565b60200260200101516001600160a01b0316637a0c7b216040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105bc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105e0919061101b565b9050806001600160a01b031663673a2a1f6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561061d573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526106449190810190611036565b5161064f9084611112565b92505060010161055d565b508067ffffffffffffffff81111561067457610674610e7b565b6040519080825280602002602001820160405280156106c457816020015b604080516080810182525f8082526020808301829052928201819052606082015282525f199092019101816106925790505b5091505f805b845181101561092d575f8582815181106106e6576106e66110fe565b60200260200101516001600160a01b0316637a0c7b216040518163ffffffff1660e01b8152600401602060405180830381865afa158015610729573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061074d919061101b565b90505f816001600160a01b031663673a2a1f6040518163ffffffff1660e01b81526004015f60405180830381865afa15801561078b573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526107b29190810190611036565b90505f5b815181101561091f575f8282815181106107d2576107d26110fe565b602002602001015190506040518060800160405280826001600160a01b031681526020018a8781518110610808576108086110fe565b60200260200101516001600160a01b03168152602001826001600160a01b03166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561085a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087e919061101b565b6001600160a01b03168152602001826001600160a01b0316634c19386c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108c8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108ec91906110c0565b905288876108f981611125565b98508151811061090b5761090b6110fe565b6020908102919091010152506001016107b6565b5050508060010190506106ca565b505050919050565b60408051606080820183525f8083526020830152918101919091526001600160a01b038381168083526040517f3c5bc3b200000000000000000000000000000000000000000000000000000000815260048101919091525f91829190851690633c5bc3b29060240161010060405180830381865afa1580156109b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109dd9190611161565b5050509450505050915081836020018181525050815f036109ff5750506101a6565b5f846001600160a01b031663458936f56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a3c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a6091906111fa565b60ff1690505f805f5b83811015610b84576001811b8581165f03610b6b576040516309f81c7560e31b8152600481018290525f906001600160a01b038b1690634fc0e3a890602401602060405180830381865afa158015610ac3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ae7919061101b565b6040516370a0823160e01b81526001600160a01b038d81166004830152919250908216906370a0823190602401602060405180830381865afa925050508015610b4d575060408051601f3d908101601f19168201909252610b4a918101906110c0565b60015b610b58575050610b7c565b60018111610b6857505050610b7c565b50505b610b7484611125565b935091909117905b600101610a69565b508167ffffffffffffffff811115610b9e57610b9e610e7b565b604051908082528060200260200182016040528015610be257816020015b604080518082019091525f8082526020820152815260200190600190039081610bbc5790505b5060408701525f5b8115610d38575f610bfa8361121a565b6040516309f81c7560e31b81529084166004820181905291505f906001600160a01b038b1690634fc0e3a890602401602060405180830381865afa158015610c44573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c68919061101b565b90508089604001518481518110610c8157610c816110fe565b60209081029190910101516001600160a01b0391821690526040516370a0823160e01b81528c82166004820152908216906370a0823190602401602060405180830381865afa925050508015610cf4575060408051601f3d908101601f19168201909252610cf1918101906110c0565b60015b15610d2257808a604001518581518110610d1057610d106110fe565b60200260200101516020018181525050505b92811892610d2f83611125565b92505050610bea565b50505050505092915050565b5f818310610d525781610383565b5090919050565b6001600160a01b0381168114610d6d575f80fd5b50565b5f805f60608486031215610d82575f80fd5b8335610d8d81610d59565b95602085013595506040909401359392505050565b5f606083016001600160a01b03808451168552602080850151818701526040808601516060604089015284815180875260808a01915084830196505f92505b80831015610e0c57865180518716835285015185830152958401956001929092019190830190610de1565b5098975050505050505050565b5f60208083016020845280855180835260408601915060408160051b8701019250602087015f5b82811015610e6e57603f19888603018452610e5c858351610da2565b94509285019290850190600101610e40565b5092979650505050505050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610eb857610eb8610e7b565b604052919050565b5f67ffffffffffffffff821115610ed957610ed9610e7b565b5060051b60200190565b5f6020808385031215610ef4575f80fd5b823567ffffffffffffffff811115610f0a575f80fd5b8301601f81018513610f1a575f80fd5b8035610f2d610f2882610ec0565b610e8f565b81815260059190911b82018301908381019087831115610f4b575f80fd5b928401925b82841015610f72578335610f6381610d59565b82529284019290840190610f50565b979650505050505050565b602080825282518282018190525f919060409081850190868401855b82811015610fe157815180516001600160a01b039081168652878201518116888701528682015116868601526060908101519085015260809093019290850190600101610f99565b5091979650505050505050565b5f60208284031215610ffe575f80fd5b813561038381610d59565b602081525f6103836020830184610da2565b5f6020828403121561102b575f80fd5b815161038381610d59565b5f6020808385031215611047575f80fd5b825167ffffffffffffffff81111561105d575f80fd5b8301601f8101851361106d575f80fd5b805161107b610f2882610ec0565b81815260059190911b82018301908381019087831115611099575f80fd5b928401925b82841015610f725783516110b181610d59565b8252928401929084019061109e565b5f602082840312156110d0575f80fd5b5051919050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156101a6576101a66110d7565b634e487b7160e01b5f52603260045260245ffd5b808201808211156101a6576101a66110d7565b5f60018201611136576111366110d7565b5060010190565b80516fffffffffffffffffffffffffffffffff8116811461115c575f80fd5b919050565b5f805f805f805f80610100898b031215611179575f80fd5b885197506020890151965061119060408a0161113d565b955061119e60608a0161113d565b94506080890151935060a089015161ffff811681146111bb575f80fd5b60c08a015190935067ffffffffffffffff811681146111d8575f80fd5b60e08a01519092506111e981610d59565b809150509295985092959890939650565b5f6020828403121561120a575f80fd5b815160ff81168114610383575f80fd5b5f7f8000000000000000000000000000000000000000000000000000000000000000820361124a5761124a6110d7565b505f039056fea164736f6c6343000817000a";
|
|
446353
446353
|
|
|
446354
446354
|
// src/commands/defillama-test/index.ts
|
|
446355
446355
|
function defillamaTest() {
|
|
446356
446356
|
return newCommand().name("defillama-test").description("Test defillama compressor").addOption(
|
|
446357
446357
|
new Option("--output-dir <file>", "output dir").env("OUTPUT_DIR")
|
|
446358
|
-
).addOption(new Option("--gas-limit <number>", "gas limit")).action(async (opts) => {
|
|
446358
|
+
).addOption(new Option("--gas-limit <number>", "gas limit")).addOption(new Option("--page-size <number>", "page size")).action(async (opts) => {
|
|
446359
446359
|
const {
|
|
446360
446360
|
addressProvider,
|
|
446361
446361
|
marketConfigurators,
|
|
446362
446362
|
anvilUrl = "http://127.0.0.1:8545",
|
|
446363
446363
|
outputDir,
|
|
446364
|
-
gasLimit = "550000000"
|
|
446364
|
+
gasLimit = "550000000",
|
|
446365
|
+
pageSize = 100
|
|
446365
446366
|
} = opts;
|
|
446366
446367
|
const transportOptions = getSDKTransportOptions({
|
|
446367
446368
|
...opts,
|
|
@@ -446424,47 +446425,14 @@ function defillamaTest() {
|
|
|
446424
446425
|
result.pools = { error: `${e}` };
|
|
446425
446426
|
}
|
|
446426
446427
|
const creditManagers = {};
|
|
446427
|
-
const creditManagersGas = {};
|
|
446428
446428
|
for (const suite of sdk.marketRegister.creditManagers) {
|
|
446429
|
-
|
|
446430
|
-
|
|
446429
|
+
const creditAccounts = await loadCreditAccounts(
|
|
446430
|
+
sdk,
|
|
446431
|
+
address,
|
|
446432
|
+
suite,
|
|
446433
|
+
Number(pageSize)
|
|
446431
446434
|
);
|
|
446432
|
-
|
|
446433
|
-
const cmGas = await sdk.provider.publicClient.estimateContractGas({
|
|
446434
|
-
address,
|
|
446435
|
-
abi: DefillamaCompressorAbi,
|
|
446436
|
-
functionName: "getCreditAccounts",
|
|
446437
|
-
args: [suite.creditManager.address]
|
|
446438
|
-
});
|
|
446439
|
-
creditManagersGas[suite.creditManager.address] = cmGas;
|
|
446440
|
-
log_default.debug(
|
|
446441
|
-
`estimated gas for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${Number(cmGas / 100000n) / 10}M`
|
|
446442
|
-
);
|
|
446443
|
-
} catch (e) {
|
|
446444
|
-
log_default.error(
|
|
446445
|
-
`error estimating gas for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${e}`
|
|
446446
|
-
);
|
|
446447
|
-
creditManagersGas[suite.creditManager.address] = { error: `${e}` };
|
|
446448
|
-
}
|
|
446449
|
-
try {
|
|
446450
|
-
const creditAccounts = await sdk.provider.publicClient.readContract({
|
|
446451
|
-
address,
|
|
446452
|
-
abi: DefillamaCompressorAbi,
|
|
446453
|
-
functionName: "getCreditAccounts",
|
|
446454
|
-
args: [suite.creditManager.address],
|
|
446455
|
-
// @ts-expect-error
|
|
446456
|
-
gas
|
|
446457
|
-
});
|
|
446458
|
-
creditManagers[suite.creditManager.address] = creditAccounts;
|
|
446459
|
-
log_default.debug(
|
|
446460
|
-
`got ${creditAccounts.length} credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}`
|
|
446461
|
-
);
|
|
446462
|
-
} catch (e) {
|
|
446463
|
-
log_default.error(
|
|
446464
|
-
`error getting credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}: ${e}`
|
|
446465
|
-
);
|
|
446466
|
-
creditManagers[suite.creditManager.address] = { error: `${e}` };
|
|
446467
|
-
}
|
|
446435
|
+
result.creditManagers[suite.creditManager.address] = creditAccounts;
|
|
446468
446436
|
}
|
|
446469
446437
|
const outDir = outputDir ?? process.cwd();
|
|
446470
446438
|
await mkdir2(outDir, { recursive: true });
|
|
@@ -446472,12 +446440,70 @@ function defillamaTest() {
|
|
|
446472
446440
|
log_default.debug(`saving results to ${outputJson}`);
|
|
446473
446441
|
await writeFile5(
|
|
446474
446442
|
outputJson,
|
|
446475
|
-
json_stringify({ ...result, creditManagers
|
|
446443
|
+
json_stringify({ ...result, creditManagers }),
|
|
446476
446444
|
"utf-8"
|
|
446477
446445
|
);
|
|
446478
446446
|
log_default.info("done");
|
|
446479
446447
|
});
|
|
446480
446448
|
}
|
|
446449
|
+
async function loadCreditAccounts(sdk, compressor, suite, limit) {
|
|
446450
|
+
log_default.debug(
|
|
446451
|
+
`getting credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)}`
|
|
446452
|
+
);
|
|
446453
|
+
let offset = 0;
|
|
446454
|
+
let page = 0;
|
|
446455
|
+
let creditAccounts = [];
|
|
446456
|
+
const result = [];
|
|
446457
|
+
do {
|
|
446458
|
+
log_default.debug(
|
|
446459
|
+
`loading page ${page} with offset ${offset} for ${sdk.provider.addressLabels.get(suite.creditManager.address)}`
|
|
446460
|
+
);
|
|
446461
|
+
creditAccounts = await loadPage(sdk, compressor, suite, offset, limit);
|
|
446462
|
+
result.push(...creditAccounts);
|
|
446463
|
+
page++;
|
|
446464
|
+
offset += limit;
|
|
446465
|
+
log_default.debug(
|
|
446466
|
+
`got ${creditAccounts.length} credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)} page ${page}`
|
|
446467
|
+
);
|
|
446468
|
+
} while (creditAccounts.length > 0);
|
|
446469
|
+
return result;
|
|
446470
|
+
}
|
|
446471
|
+
async function loadPage(sdk, compressor, suite, offset, limit) {
|
|
446472
|
+
try {
|
|
446473
|
+
const estGas = await sdk.provider.publicClient.estimateContractGas({
|
|
446474
|
+
address: compressor,
|
|
446475
|
+
abi: DefillamaCompressorAbi,
|
|
446476
|
+
functionName: "getCreditAccounts",
|
|
446477
|
+
args: [suite.creditManager.address, BigInt(offset), BigInt(limit)]
|
|
446478
|
+
});
|
|
446479
|
+
log_default.debug(
|
|
446480
|
+
`estimated gas for ${offset}: ${Number(estGas / 10000n) / 100}M`
|
|
446481
|
+
);
|
|
446482
|
+
} catch (e) {
|
|
446483
|
+
log_default.error(
|
|
446484
|
+
`error estimating gas for ${sdk.provider.addressLabels.get(suite.creditManager.address)} for offset ${offset}: ${e}`
|
|
446485
|
+
);
|
|
446486
|
+
}
|
|
446487
|
+
try {
|
|
446488
|
+
const creditAccounts = await sdk.provider.publicClient.readContract({
|
|
446489
|
+
address: compressor,
|
|
446490
|
+
abi: DefillamaCompressorAbi,
|
|
446491
|
+
functionName: "getCreditAccounts",
|
|
446492
|
+
args: [suite.creditManager.address, BigInt(offset), BigInt(limit)],
|
|
446493
|
+
// @ts-expect-error
|
|
446494
|
+
gas: 550000000n
|
|
446495
|
+
});
|
|
446496
|
+
log_default.debug(
|
|
446497
|
+
`got ${creditAccounts.length} credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)} for offset ${offset}`
|
|
446498
|
+
);
|
|
446499
|
+
return [...creditAccounts];
|
|
446500
|
+
} catch (e) {
|
|
446501
|
+
log_default.error(
|
|
446502
|
+
`error getting credit accounts for ${sdk.provider.addressLabels.get(suite.creditManager.address)} for offset ${offset}: ${e}`
|
|
446503
|
+
);
|
|
446504
|
+
}
|
|
446505
|
+
return [];
|
|
446506
|
+
}
|
|
446481
446507
|
|
|
446482
446508
|
// src/commands/open-accounts.ts
|
|
446483
446509
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
@@ -446739,7 +446765,7 @@ function getRenderer(opts) {
|
|
|
446739
446765
|
var package_default = {
|
|
446740
446766
|
name: "@gearbox-protocol/deploy-tools",
|
|
446741
446767
|
description: "Gearbox deploy tools",
|
|
446742
|
-
version: "5.45.
|
|
446768
|
+
version: "5.45.6",
|
|
446743
446769
|
homepage: "https://gearbox.fi",
|
|
446744
446770
|
keywords: [
|
|
446745
446771
|
"gearbox"
|