@gearbox-protocol/deploy-tools 5.22.2 → 5.23.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.
- package/dist/index.mjs +92 -28
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -135609,7 +135609,7 @@ var require_sonic_boom = __commonJS({
|
|
|
135609
135609
|
if (!(this instanceof SonicBoom)) {
|
|
135610
135610
|
return new SonicBoom(opts);
|
|
135611
135611
|
}
|
|
135612
|
-
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir:
|
|
135612
|
+
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir: mkdir4, retryEAGAIN, fsync, contentMode, mode } = opts || {};
|
|
135613
135613
|
fd = fd || dest;
|
|
135614
135614
|
this._len = 0;
|
|
135615
135615
|
this.fd = -1;
|
|
@@ -135634,7 +135634,7 @@ var require_sonic_boom = __commonJS({
|
|
|
135634
135634
|
this.append = append || false;
|
|
135635
135635
|
this.mode = mode;
|
|
135636
135636
|
this.retryEAGAIN = retryEAGAIN || (() => true);
|
|
135637
|
-
this.mkdir =
|
|
135637
|
+
this.mkdir = mkdir4 || false;
|
|
135638
135638
|
let fsWriteSync;
|
|
135639
135639
|
let fsWrite;
|
|
135640
135640
|
if (contentMode === kContentModeBuffer) {
|
|
@@ -146124,7 +146124,7 @@ var require_filesystem = __commonJS({
|
|
|
146124
146124
|
var fs3 = __require("fs");
|
|
146125
146125
|
var LDD_PATH = "/usr/bin/ldd";
|
|
146126
146126
|
var readFileSync = (path12) => fs3.readFileSync(path12, "utf-8");
|
|
146127
|
-
var
|
|
146127
|
+
var readFile10 = (path12) => new Promise((resolve2, reject) => {
|
|
146128
146128
|
fs3.readFile(path12, "utf-8", (err, data) => {
|
|
146129
146129
|
if (err) {
|
|
146130
146130
|
reject(err);
|
|
@@ -146136,7 +146136,7 @@ var require_filesystem = __commonJS({
|
|
|
146136
146136
|
module2.exports = {
|
|
146137
146137
|
LDD_PATH,
|
|
146138
146138
|
readFileSync,
|
|
146139
|
-
readFile:
|
|
146139
|
+
readFile: readFile10
|
|
146140
146140
|
};
|
|
146141
146141
|
}
|
|
146142
146142
|
});
|
|
@@ -146147,7 +146147,7 @@ var require_detect_libc = __commonJS({
|
|
|
146147
146147
|
"use strict";
|
|
146148
146148
|
var childProcess = __require("child_process");
|
|
146149
146149
|
var { isLinux, getReport } = require_process();
|
|
146150
|
-
var { LDD_PATH, readFile:
|
|
146150
|
+
var { LDD_PATH, readFile: readFile10, readFileSync } = require_filesystem();
|
|
146151
146151
|
var cachedFamilyFilesystem;
|
|
146152
146152
|
var cachedVersionFilesystem;
|
|
146153
146153
|
var command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
|
|
@@ -146214,7 +146214,7 @@ var require_detect_libc = __commonJS({
|
|
|
146214
146214
|
}
|
|
146215
146215
|
cachedFamilyFilesystem = null;
|
|
146216
146216
|
try {
|
|
146217
|
-
const lddContent = await
|
|
146217
|
+
const lddContent = await readFile10(LDD_PATH);
|
|
146218
146218
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
146219
146219
|
} catch (e) {
|
|
146220
146220
|
}
|
|
@@ -146268,7 +146268,7 @@ var require_detect_libc = __commonJS({
|
|
|
146268
146268
|
}
|
|
146269
146269
|
cachedVersionFilesystem = null;
|
|
146270
146270
|
try {
|
|
146271
|
-
const lddContent = await
|
|
146271
|
+
const lddContent = await readFile10(LDD_PATH);
|
|
146272
146272
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
146273
146273
|
if (versionMatch) {
|
|
146274
146274
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -408722,7 +408722,7 @@ async function loadGovernorBatches(opts) {
|
|
|
408722
408722
|
type: "governor",
|
|
408723
408723
|
transactions: b.transactions,
|
|
408724
408724
|
status: b.status,
|
|
408725
|
-
|
|
408725
|
+
blockNumber: b.block,
|
|
408726
408726
|
queueTxHash: b.queueTxHash,
|
|
408727
408727
|
eta: b.transactions[0]?.eta
|
|
408728
408728
|
}));
|
|
@@ -408766,6 +408766,37 @@ function hexEq2(a, b) {
|
|
|
408766
408766
|
return aa === bb;
|
|
408767
408767
|
}
|
|
408768
408768
|
|
|
408769
|
+
// ../../packages/shared/dist/parser.js
|
|
408770
|
+
function transformParserToGovernorOutput(parserOutput) {
|
|
408771
|
+
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
408772
|
+
const result = {};
|
|
408773
|
+
for (const batch of parserOutput.batches) {
|
|
408774
|
+
if (!batch.blockNumber) {
|
|
408775
|
+
throw new Error("block number is required for governor batches");
|
|
408776
|
+
}
|
|
408777
|
+
const blockNumber = batch.blockNumber.toString(10);
|
|
408778
|
+
if ("error" in batch) {
|
|
408779
|
+
result[blockNumber] = {
|
|
408780
|
+
blockNumber,
|
|
408781
|
+
version: parserOutput.version,
|
|
408782
|
+
createdAt,
|
|
408783
|
+
error: batch.error,
|
|
408784
|
+
transactions: [],
|
|
408785
|
+
addresses: {}
|
|
408786
|
+
};
|
|
408787
|
+
} else {
|
|
408788
|
+
result[blockNumber] = {
|
|
408789
|
+
blockNumber,
|
|
408790
|
+
version: parserOutput.version,
|
|
408791
|
+
createdAt,
|
|
408792
|
+
transactions: batch.transactions,
|
|
408793
|
+
addresses: parserOutput.addresses
|
|
408794
|
+
};
|
|
408795
|
+
}
|
|
408796
|
+
}
|
|
408797
|
+
return result;
|
|
408798
|
+
}
|
|
408799
|
+
|
|
408769
408800
|
// ../../node_modules/lodash-es/_freeGlobal.js
|
|
408770
408801
|
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
408771
408802
|
var freeGlobal_default = freeGlobal;
|
|
@@ -413868,7 +413899,7 @@ var GearboxAddressTree = class _GearboxAddressTree extends ProviderBase {
|
|
|
413868
413899
|
|
|
413869
413900
|
// ../../packages/node/dist/UpdateParser.js
|
|
413870
413901
|
import { mkdirSync as mkdirSync5 } from "node:fs";
|
|
413871
|
-
import { stat } from "node:fs/promises";
|
|
413902
|
+
import { mkdir, readFile as readFile7, stat, writeFile as writeFile4 } from "node:fs/promises";
|
|
413872
413903
|
import path7 from "node:path";
|
|
413873
413904
|
|
|
413874
413905
|
// ../../packages/node/dist/meta/MetaRepo.js
|
|
@@ -416751,6 +416782,13 @@ var UpdateParser = class extends ProviderBase {
|
|
|
416751
416782
|
await this.#parseBatchDir(batchDir, unsafeMainnetMeta);
|
|
416752
416783
|
} else if (governor) {
|
|
416753
416784
|
await this.#parseGovernorQueue(governor.address, governor.fromBlock, governor.toBlock);
|
|
416785
|
+
if (opts.unifiedGovernorFile) {
|
|
416786
|
+
try {
|
|
416787
|
+
await this.#updateUnifiedGovernor(opts.unifiedGovernorFile, governor.address);
|
|
416788
|
+
} catch (e) {
|
|
416789
|
+
this.logger.error(`error updating unified governor file: ${e}`);
|
|
416790
|
+
}
|
|
416791
|
+
}
|
|
416754
416792
|
} else {
|
|
416755
416793
|
await this.#parseSafeTxHashes(safeTxHashes);
|
|
416756
416794
|
}
|
|
@@ -416873,15 +416911,36 @@ var UpdateParser = class extends ProviderBase {
|
|
|
416873
416911
|
for (let i = 0; i < queued.length; i++) {
|
|
416874
416912
|
try {
|
|
416875
416913
|
const parsed = await this.#parseNormalizedBatch(queued[i], i, queued.length);
|
|
416914
|
+
parsed.blockNumber = queued[i].blockNumber;
|
|
416876
416915
|
this.#output.batches.push(parsed);
|
|
416877
416916
|
} catch (e) {
|
|
416878
416917
|
this.#output.batches.push({
|
|
416879
416918
|
id: queued[i].id,
|
|
416880
|
-
error: `${e}`.replaceAll("\n", "\\n")
|
|
416919
|
+
error: `${e}`.replaceAll("\n", "\\n"),
|
|
416920
|
+
blockNumber: queued[i].blockNumber
|
|
416881
416921
|
});
|
|
416882
416922
|
}
|
|
416883
416923
|
}
|
|
416884
416924
|
}
|
|
416925
|
+
async #updateUnifiedGovernor(unifiedFile, governor) {
|
|
416926
|
+
const unifiedDir = path7.dirname(unifiedFile);
|
|
416927
|
+
this.logger.debug(`reading unified governor batches from ${unifiedFile}`);
|
|
416928
|
+
let unified = {};
|
|
416929
|
+
try {
|
|
416930
|
+
const raw = await readFile7(unifiedFile, "utf-8");
|
|
416931
|
+
unified = json_parse(raw);
|
|
416932
|
+
this.logger.debug(`reading unified governor file already exists, will merge`);
|
|
416933
|
+
} catch (e) {
|
|
416934
|
+
this.logger.warn(`error reading unified governor batches: ${e}`);
|
|
416935
|
+
}
|
|
416936
|
+
const newUnified = transformParserToGovernorOutput(this.#output);
|
|
416937
|
+
this.logger.debug(`loaded new unified governor batches`);
|
|
416938
|
+
unified = { ...unified, ...newUnified };
|
|
416939
|
+
const newBatches = Object.keys(newUnified).length;
|
|
416940
|
+
await mkdir(unifiedDir, { recursive: true });
|
|
416941
|
+
await writeFile4(unifiedFile, json_stringify(unified), "utf-8");
|
|
416942
|
+
this.logger.debug(`saved ${newBatches} unified governor batches to ${unifiedFile}`);
|
|
416943
|
+
}
|
|
416885
416944
|
#collectCreate2Addresses(tx) {
|
|
416886
416945
|
if (isDeployTransaction(tx)) {
|
|
416887
416946
|
this.#collectCreate2Addresses(tx.constructorTransaction);
|
|
@@ -418072,12 +418131,12 @@ function audit() {
|
|
|
418072
418131
|
import path8 from "node:path";
|
|
418073
418132
|
|
|
418074
418133
|
// src/commands/execute-jsons/execute.ts
|
|
418075
|
-
import { readFile as
|
|
418134
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
418076
418135
|
async function executeJSON({
|
|
418077
418136
|
jsonPath,
|
|
418078
418137
|
rpcURL
|
|
418079
418138
|
}) {
|
|
418080
|
-
const plain = await
|
|
418139
|
+
const plain = await readFile8(jsonPath, "utf-8");
|
|
418081
418140
|
const txs = json_parse(plain);
|
|
418082
418141
|
if (txs.length === 0) {
|
|
418083
418142
|
log_default.error("No transactions found");
|
|
@@ -418197,7 +418256,7 @@ function executeJson() {
|
|
|
418197
418256
|
|
|
418198
418257
|
// src/commands/open-accounts.ts
|
|
418199
418258
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
418200
|
-
import { mkdir, writeFile as
|
|
418259
|
+
import { mkdir as mkdir2, writeFile as writeFile5 } from "node:fs/promises";
|
|
418201
418260
|
import path9 from "node:path";
|
|
418202
418261
|
|
|
418203
418262
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/adapters/abi/iBalancerV3RouterAdapter.js
|
|
@@ -418799,7 +418858,7 @@ function openAccounts() {
|
|
|
418799
418858
|
nexo,
|
|
418800
418859
|
castBin = "cast"
|
|
418801
418860
|
} = opts;
|
|
418802
|
-
await
|
|
418861
|
+
await mkdir2(path9.resolve(sharedDir, "deploy-state"), { recursive: true });
|
|
418803
418862
|
const transportOptions = getSDKTransportOptions({
|
|
418804
418863
|
...opts,
|
|
418805
418864
|
anvilUrl
|
|
@@ -418816,12 +418875,12 @@ function openAccounts() {
|
|
|
418816
418875
|
adapters: AdaptersPlugin
|
|
418817
418876
|
}
|
|
418818
418877
|
});
|
|
418819
|
-
await
|
|
418878
|
+
await writeFile5(
|
|
418820
418879
|
path9.resolve(sharedDir, "deploy-state", "stateAfter.human.json"),
|
|
418821
418880
|
json_stringify(sdk.stateHuman()),
|
|
418822
418881
|
"utf-8"
|
|
418823
418882
|
);
|
|
418824
|
-
await
|
|
418883
|
+
await writeFile5(
|
|
418825
418884
|
path9.resolve(sharedDir, "deploy-state", "stateAfter.json"),
|
|
418826
418885
|
json_stringify(sdk.state),
|
|
418827
418886
|
"utf-8"
|
|
@@ -418926,8 +418985,8 @@ function openAccounts() {
|
|
|
418926
418985
|
}
|
|
418927
418986
|
const results = await accountOpener.openCreditAccounts(accounts, true);
|
|
418928
418987
|
const destDir = path9.resolve(sharedDir, "open-accounts");
|
|
418929
|
-
await
|
|
418930
|
-
await
|
|
418988
|
+
await mkdir2(destDir, { recursive: true });
|
|
418989
|
+
await writeFile5(
|
|
418931
418990
|
path9.resolve(destDir, "results.json"),
|
|
418932
418991
|
json_stringify(results),
|
|
418933
418992
|
"utf-8"
|
|
@@ -418983,7 +419042,7 @@ async function runCastCmd(args, traceId, opts) {
|
|
|
418983
419042
|
log_default.warn(`failed to run cast: ${cast.error}`);
|
|
418984
419043
|
return;
|
|
418985
419044
|
}
|
|
418986
|
-
await
|
|
419045
|
+
await writeFile5(traceFile, cast.output.join(""), "utf-8");
|
|
418987
419046
|
log_default.debug(`saved trace file: ${traceFile}`);
|
|
418988
419047
|
} catch (e) {
|
|
418989
419048
|
log_default.warn(`failed to save trace: ${e}`);
|
|
@@ -418991,7 +419050,7 @@ async function runCastCmd(args, traceId, opts) {
|
|
|
418991
419050
|
}
|
|
418992
419051
|
|
|
418993
419052
|
// src/commands/parse.ts
|
|
418994
|
-
import { writeFile as
|
|
419053
|
+
import { writeFile as writeFile6 } from "node:fs/promises";
|
|
418995
419054
|
|
|
418996
419055
|
// src/renderer/html/HtmlRenderer.tsx
|
|
418997
419056
|
var import_react = __toESM(require_react(), 1);
|
|
@@ -419037,7 +419096,7 @@ function getRenderer(opts) {
|
|
|
419037
419096
|
var package_default = {
|
|
419038
419097
|
name: "@gearbox-protocol/deploy-tools",
|
|
419039
419098
|
description: "Gearbox deploy tools",
|
|
419040
|
-
version: "5.
|
|
419099
|
+
version: "5.23.0",
|
|
419041
419100
|
homepage: "https://gearbox.fi",
|
|
419042
419101
|
keywords: [
|
|
419043
419102
|
"gearbox"
|
|
@@ -419149,6 +419208,11 @@ function parse() {
|
|
|
419149
419208
|
"--governor-to <ending block>",
|
|
419150
419209
|
"Parse governor queue up to this block"
|
|
419151
419210
|
).argParser(parseBigInt)
|
|
419211
|
+
).addOption(
|
|
419212
|
+
new Option(
|
|
419213
|
+
"--unified-governor-file <file>",
|
|
419214
|
+
"Save unified governor batches to this file"
|
|
419215
|
+
)
|
|
419152
419216
|
).addOption(
|
|
419153
419217
|
new Option(
|
|
419154
419218
|
"--unsafe-mainnet-meta",
|
|
@@ -419182,7 +419246,7 @@ function parse() {
|
|
|
419182
419246
|
const parser = new UpdateParser(opts, version_default);
|
|
419183
419247
|
const result = await parser.parse(options);
|
|
419184
419248
|
if (opts.outFile) {
|
|
419185
|
-
await
|
|
419249
|
+
await writeFile6(opts.outFile, json_stringify(result), "utf-8");
|
|
419186
419250
|
}
|
|
419187
419251
|
const renderer = getRenderer(opts);
|
|
419188
419252
|
return renderer?.render(result);
|
|
@@ -419291,7 +419355,7 @@ function printSafeTx() {
|
|
|
419291
419355
|
}
|
|
419292
419356
|
|
|
419293
419357
|
// src/commands/sdk-example.ts
|
|
419294
|
-
import { mkdir as
|
|
419358
|
+
import { mkdir as mkdir3, writeFile as writeFile7 } from "node:fs/promises";
|
|
419295
419359
|
import path11 from "node:path";
|
|
419296
419360
|
|
|
419297
419361
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/bots/abi/iPartialLiquidationBotV300.js
|
|
@@ -419714,7 +419778,7 @@ function sdkExample() {
|
|
|
419714
419778
|
anvilUrl = "http://127.0.0.1:8545",
|
|
419715
419779
|
sharedDir = "."
|
|
419716
419780
|
} = opts;
|
|
419717
|
-
await
|
|
419781
|
+
await mkdir3(path11.resolve(sharedDir, "deploy-state"), { recursive: true });
|
|
419718
419782
|
const anvil = createAnvilClient({ transport: http(anvilUrl) });
|
|
419719
419783
|
await anvil.setBlockTimestampInterval({ interval: 0 });
|
|
419720
419784
|
try {
|
|
@@ -419739,12 +419803,12 @@ function sdkExample() {
|
|
|
419739
419803
|
bots: BotsPlugin
|
|
419740
419804
|
}
|
|
419741
419805
|
});
|
|
419742
|
-
await
|
|
419806
|
+
await writeFile7(
|
|
419743
419807
|
path11.resolve(sharedDir, "deploy-state", "stateAfter.human.json"),
|
|
419744
419808
|
json_stringify(sdk.stateHuman()),
|
|
419745
419809
|
"utf-8"
|
|
419746
419810
|
);
|
|
419747
|
-
await
|
|
419811
|
+
await writeFile7(
|
|
419748
419812
|
path11.resolve(sharedDir, "deploy-state", "stateAfter.json"),
|
|
419749
419813
|
json_stringify(sdk.state),
|
|
419750
419814
|
"utf-8"
|
|
@@ -419757,7 +419821,7 @@ function sdkExample() {
|
|
|
419757
419821
|
}
|
|
419758
419822
|
|
|
419759
419823
|
// src/commands/verify-etherscan.ts
|
|
419760
|
-
import { readFile as
|
|
419824
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
419761
419825
|
function verifyEtherscan() {
|
|
419762
419826
|
return newCommand().name("verify-etherscan").description(
|
|
419763
419827
|
"performs bulk verification of gearbox contracts using etherscan"
|
|
@@ -419772,7 +419836,7 @@ function verifyEtherscan() {
|
|
|
419772
419836
|
}
|
|
419773
419837
|
let addresses = opts.addresses ?? [];
|
|
419774
419838
|
if (addresses.length === 0 && opts.addressesFile) {
|
|
419775
|
-
const content = await
|
|
419839
|
+
const content = await readFile9(opts.addressesFile, "utf-8");
|
|
419776
419840
|
addresses = Object.keys(json_parse(content));
|
|
419777
419841
|
}
|
|
419778
419842
|
if (!addresses.length) {
|