@gearbox-protocol/deploy-tools 2.1.1 → 2.2.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.js +48 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -266453,9 +266453,13 @@ var require_EtherscanVerifier = __commonJS({
|
|
|
266453
266453
|
var axios_1 = __importStar2(require_axios());
|
|
266454
266454
|
var axios_retry_1 = __importDefault2(require_cjs2());
|
|
266455
266455
|
var log_1 = __importDefault2(require_log());
|
|
266456
|
+
var API_SUBDOMAINS = {
|
|
266457
|
+
Mainnet: "api",
|
|
266458
|
+
Optimism: "api-optimistic"
|
|
266459
|
+
};
|
|
266456
266460
|
var _logger, _etherscanApi, _cacheDir, _cachePolicy, _result, _verify, verify_fn, _getCached, getCached_fn, _saveCached, saveCached_fn;
|
|
266457
266461
|
var EtherscanVerifier2 = class {
|
|
266458
|
-
constructor(opts) {
|
|
266462
|
+
constructor(network, opts) {
|
|
266459
266463
|
__privateAdd(this, _verify);
|
|
266460
266464
|
__privateAdd(this, _getCached);
|
|
266461
266465
|
__privateAdd(this, _saveCached);
|
|
@@ -266468,8 +266472,12 @@ var require_EtherscanVerifier = __commonJS({
|
|
|
266468
266472
|
if (!opts.etherscanApiKey) {
|
|
266469
266473
|
throw new Error("etherscan api key not specified");
|
|
266470
266474
|
}
|
|
266475
|
+
const subdomain = API_SUBDOMAINS[network];
|
|
266476
|
+
if (!subdomain) {
|
|
266477
|
+
throw new Error(`etherscan api subdomain not specified for ${network}`);
|
|
266478
|
+
}
|
|
266471
266479
|
__privateSet(this, _etherscanApi, axios_1.default.create({
|
|
266472
|
-
baseURL:
|
|
266480
|
+
baseURL: `https://${subdomain}.etherscan.io`,
|
|
266473
266481
|
headers: {
|
|
266474
266482
|
accept: "application/json"
|
|
266475
266483
|
},
|
|
@@ -266502,7 +266510,7 @@ var require_EtherscanVerifier = __commonJS({
|
|
|
266502
266510
|
},
|
|
266503
266511
|
retryDelay: axios_retry_1.default.exponentialDelay
|
|
266504
266512
|
});
|
|
266505
|
-
__privateSet(this, _cacheDir, node_path_1.default.resolve(opts.sandboxDir, "etherscan"));
|
|
266513
|
+
__privateSet(this, _cacheDir, node_path_1.default.resolve(opts.sandboxDir, "etherscan", network.toLowerCase()));
|
|
266506
266514
|
(0, node_fs_1.mkdirSync)(__privateGet(this, _cacheDir), { recursive: true });
|
|
266507
266515
|
}
|
|
266508
266516
|
async verifyMany(addresses) {
|
|
@@ -292376,6 +292384,7 @@ var require_GearboxAddressTree = __commonJS({
|
|
|
292376
292384
|
};
|
|
292377
292385
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
292378
292386
|
exports2.GearboxAddressTree = void 0;
|
|
292387
|
+
var node_fs_1 = require("fs");
|
|
292379
292388
|
var promises_1 = require("fs/promises");
|
|
292380
292389
|
var node_path_1 = __importDefault2(require("path"));
|
|
292381
292390
|
var deploy_suite_1 = require_dist2();
|
|
@@ -292388,7 +292397,7 @@ var require_GearboxAddressTree = __commonJS({
|
|
|
292388
292397
|
var types_1 = require_types16();
|
|
292389
292398
|
var Verifier_1 = __importDefault2(require_Verifier());
|
|
292390
292399
|
var visitors_1 = require_visitors();
|
|
292391
|
-
var _etherscan, _verifier, _auditor, _outFile, _cachePolicy, _queue, _visited, _create2, _loadCache, loadCache_fn, _saveCache, saveCache_fn, _process2, process_fn, _addToQueue, addToQueue_fn;
|
|
292400
|
+
var _etherscan, _verifier, _auditor, _options4, _outFile, _cachePolicy, _queue, _visited, _create2, _loadCache, loadCache_fn, _saveCache, saveCache_fn, _process2, process_fn, _addToQueue, addToQueue_fn;
|
|
292392
292401
|
var _GearboxAddressTree = class _GearboxAddressTree extends ProviderBase_1.ProviderBase {
|
|
292393
292402
|
constructor(options) {
|
|
292394
292403
|
super(options.rpcUrl);
|
|
@@ -292399,17 +292408,23 @@ var require_GearboxAddressTree = __commonJS({
|
|
|
292399
292408
|
__privateAdd(this, _etherscan, void 0);
|
|
292400
292409
|
__privateAdd(this, _verifier, void 0);
|
|
292401
292410
|
__privateAdd(this, _auditor, void 0);
|
|
292411
|
+
__privateAdd(this, _options4, void 0);
|
|
292402
292412
|
__privateAdd(this, _outFile, void 0);
|
|
292403
292413
|
__privateAdd(this, _cachePolicy, void 0);
|
|
292404
292414
|
__privateAdd(this, _queue, new queue_1.default({ concurrency: 5 }));
|
|
292405
292415
|
__privateAdd(this, _visited, /* @__PURE__ */ new Map());
|
|
292406
292416
|
__privateAdd(this, _create2, /* @__PURE__ */ new Map());
|
|
292407
292417
|
this.logger = this.logger.getSubLogger({ name: "tree" });
|
|
292408
|
-
__privateSet(this, _outFile, node_path_1.default.resolve(options.sandboxDir, "tree.json"));
|
|
292409
|
-
__privateSet(this, _etherscan, new EtherscanVerifier_1.EtherscanVerifier(options));
|
|
292410
292418
|
__privateSet(this, _verifier, new Verifier_1.default());
|
|
292411
292419
|
__privateSet(this, _auditor, new Auditor_1.Auditor(options));
|
|
292412
292420
|
__privateSet(this, _cachePolicy, options.cachePolicy);
|
|
292421
|
+
__privateSet(this, _options4, options);
|
|
292422
|
+
}
|
|
292423
|
+
async init() {
|
|
292424
|
+
await super.init();
|
|
292425
|
+
__privateSet(this, _outFile, node_path_1.default.resolve(__privateGet(this, _options4).sandboxDir, "tree", `${this.network.toLowerCase()}.json`));
|
|
292426
|
+
(0, node_fs_1.mkdirSync)(node_path_1.default.dirname(__privateGet(this, _outFile)), { recursive: true });
|
|
292427
|
+
__privateSet(this, _etherscan, new EtherscanVerifier_1.EtherscanVerifier(this.network, __privateGet(this, _options4)));
|
|
292413
292428
|
}
|
|
292414
292429
|
async build() {
|
|
292415
292430
|
await this.init();
|
|
@@ -292492,10 +292507,23 @@ var require_GearboxAddressTree = __commonJS({
|
|
|
292492
292507
|
getContract(address) {
|
|
292493
292508
|
return __privateGet(this, _visited).get(address.toLowerCase()) ?? __privateGet(this, _create2).get(address.toLowerCase());
|
|
292494
292509
|
}
|
|
292510
|
+
get outFile() {
|
|
292511
|
+
if (!__privateGet(this, _outFile)) {
|
|
292512
|
+
throw new Error(`cannot get outfile: not initialized`);
|
|
292513
|
+
}
|
|
292514
|
+
return __privateGet(this, _outFile);
|
|
292515
|
+
}
|
|
292516
|
+
get etherscan() {
|
|
292517
|
+
if (!__privateGet(this, _etherscan)) {
|
|
292518
|
+
throw new Error(`cannot get etherscan: not initialized`);
|
|
292519
|
+
}
|
|
292520
|
+
return __privateGet(this, _etherscan);
|
|
292521
|
+
}
|
|
292495
292522
|
};
|
|
292496
292523
|
_etherscan = new WeakMap();
|
|
292497
292524
|
_verifier = new WeakMap();
|
|
292498
292525
|
_auditor = new WeakMap();
|
|
292526
|
+
_options4 = new WeakMap();
|
|
292499
292527
|
_outFile = new WeakMap();
|
|
292500
292528
|
_cachePolicy = new WeakMap();
|
|
292501
292529
|
_queue = new WeakMap();
|
|
@@ -292508,7 +292536,7 @@ var require_GearboxAddressTree = __commonJS({
|
|
|
292508
292536
|
return [];
|
|
292509
292537
|
}
|
|
292510
292538
|
try {
|
|
292511
|
-
const content = await (0, promises_1.readFile)(
|
|
292539
|
+
const content = await (0, promises_1.readFile)(this.outFile, "utf-8").then(deploy_suite_1.json_parse);
|
|
292512
292540
|
if (content.version !== _GearboxAddressTree.version) {
|
|
292513
292541
|
this.logger.warn(`ignoring cache file because it has version ${content.version}, but we need ${_GearboxAddressTree.version}`);
|
|
292514
292542
|
return [];
|
|
@@ -292534,7 +292562,7 @@ var require_GearboxAddressTree = __commonJS({
|
|
|
292534
292562
|
version: _GearboxAddressTree.version,
|
|
292535
292563
|
tree: Object.fromEntries(__privateGet(this, _visited))
|
|
292536
292564
|
};
|
|
292537
|
-
await (0, promises_1.writeFile)(
|
|
292565
|
+
await (0, promises_1.writeFile)(this.outFile, (0, deploy_suite_1.json_stringify)(content), "utf-8");
|
|
292538
292566
|
this.logger.trace(`saved to ${__privateGet(this, _outFile)}`);
|
|
292539
292567
|
};
|
|
292540
292568
|
_process2 = new WeakSet();
|
|
@@ -292546,7 +292574,7 @@ var require_GearboxAddressTree = __commonJS({
|
|
|
292546
292574
|
if (entry.address === sdk_gov_1.ADDRESS_0X0) {
|
|
292547
292575
|
return;
|
|
292548
292576
|
}
|
|
292549
|
-
const etherscanEntry = await
|
|
292577
|
+
const etherscanEntry = await this.etherscan.verify(entry.address);
|
|
292550
292578
|
if (etherscanEntry.verified) {
|
|
292551
292579
|
const auditedFiles = [];
|
|
292552
292580
|
for (const contract of etherscanEntry.data) {
|
|
@@ -355340,7 +355368,7 @@ var require_package3 = __commonJS({
|
|
|
355340
355368
|
module2.exports = {
|
|
355341
355369
|
name: "@gearbox-protocol/deploy-tools",
|
|
355342
355370
|
description: "Gearbox deploy tools",
|
|
355343
|
-
version: "2.1.
|
|
355371
|
+
version: "2.1.2",
|
|
355344
355372
|
homepage: "https://gearbox.fi",
|
|
355345
355373
|
keywords: [
|
|
355346
355374
|
"gearbox"
|
|
@@ -372645,7 +372673,7 @@ function updateEpoch() {
|
|
|
372645
372673
|
return new Command().name("update-epoch").description(
|
|
372646
372674
|
"finds all Pool_v3 -> PQK -> Gauge and calls updateRates on each PQK on behalf of impersonated gauge"
|
|
372647
372675
|
).addOption(
|
|
372648
|
-
new Option("--anvil-url <url>", "anvil rpc url").env("ANVIL_URL")
|
|
372676
|
+
new Option("--anvil-url <url>", "anvil rpc url").default("http://127.0.0.1:8545").env("ANVIL_URL")
|
|
372649
372677
|
).addOption(
|
|
372650
372678
|
new Option("--address-provider <hex>", "address provider address").env(
|
|
372651
372679
|
"ADDRESS_PROVIDER"
|
|
@@ -372702,6 +372730,11 @@ function verifyEtherscan() {
|
|
|
372702
372730
|
"--addresses-file [json]",
|
|
372703
372731
|
"json file where keys are addresses to verify, e.g. gearbox contracts tree"
|
|
372704
372732
|
)
|
|
372733
|
+
).addOption(
|
|
372734
|
+
new Option(
|
|
372735
|
+
"--network <network_type>",
|
|
372736
|
+
"NetworkType supported by sdk-gov"
|
|
372737
|
+
).default("Mainnet")
|
|
372705
372738
|
).addOption(new Option("--addresses [addr...]", "addresses to verify")).action(async (opts) => {
|
|
372706
372739
|
var _a;
|
|
372707
372740
|
if (!((_a = opts.addresses) == null ? void 0 : _a.length) && !opts.addressesFile) {
|
|
@@ -372710,12 +372743,12 @@ function verifyEtherscan() {
|
|
|
372710
372743
|
let addresses = opts.addresses ?? [];
|
|
372711
372744
|
if (addresses.length === 0 && opts.addressesFile) {
|
|
372712
372745
|
const content = await (0, import_promises2.readFile)(opts.addressesFile, "utf-8");
|
|
372713
|
-
addresses = Object.keys(import_deploy_suite4.json_parse);
|
|
372746
|
+
addresses = Object.keys((0, import_deploy_suite4.json_parse)(content));
|
|
372714
372747
|
}
|
|
372715
372748
|
if (!addresses.length) {
|
|
372716
372749
|
throw new Error("no addresses provided");
|
|
372717
372750
|
}
|
|
372718
|
-
await new import_deploy_tools_lib8.EtherscanVerifier(opts).verifyMany(addresses);
|
|
372751
|
+
await new import_deploy_tools_lib8.EtherscanVerifier(opts.network, opts).verifyMany(addresses);
|
|
372719
372752
|
});
|
|
372720
372753
|
}
|
|
372721
372754
|
|
|
@@ -372724,11 +372757,11 @@ function warpTime() {
|
|
|
372724
372757
|
return new Command().name("warp-time").description("Sets next block timestamp on anvil").addArgument(
|
|
372725
372758
|
new Argument("<timestamp>", "Timestamp. Can accept 'now' value")
|
|
372726
372759
|
).addOption(
|
|
372727
|
-
new Option("--anvil-url <url>", "anvil rpc url").env("ANVIL_URL")
|
|
372760
|
+
new Option("--anvil-url <url>", "anvil rpc url").default("http://127.0.0.1:8545").env("ANVIL_URL")
|
|
372728
372761
|
).action(
|
|
372729
372762
|
async (timestampStr, options) => {
|
|
372730
372763
|
const { anvilUrl } = options;
|
|
372731
|
-
let timestamp = (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
372764
|
+
let timestamp = Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
372732
372765
|
if (timestampStr !== "now") {
|
|
372733
372766
|
timestamp = parseInt(timestampStr, 10);
|
|
372734
372767
|
}
|