@gearbox-protocol/deploy-tools 4.16.2 → 4.18.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 +407 -356
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -135421,13 +135421,13 @@ var require_github_checker = __commonJS({
|
|
|
135421
135421
|
}
|
|
135422
135422
|
const repo = repoName;
|
|
135423
135423
|
const audits2 = this._audits[repo];
|
|
135424
|
-
for (const
|
|
135425
|
-
console.log("checking audit",
|
|
135424
|
+
for (const audit2 of audits2) {
|
|
135425
|
+
console.log("checking audit", audit2, "for entry", entry);
|
|
135426
135426
|
let replacementPath;
|
|
135427
|
-
if (
|
|
135428
|
-
replacementPath = `${repo}/${
|
|
135427
|
+
if (audit2.type === "commit") {
|
|
135428
|
+
replacementPath = `${repo}/${audit2.commit}`;
|
|
135429
135429
|
} else {
|
|
135430
|
-
replacementPath = `${repo}/${
|
|
135430
|
+
replacementPath = `${repo}/${audit2.branch}`;
|
|
135431
135431
|
}
|
|
135432
135432
|
const githubRawUrl = entry.replace("@gearbox-protocol", "https://raw.githubusercontent.com/Gearbox-protocol").replace(repo, replacementPath);
|
|
135433
135433
|
console.log("githubRawUrl", githubRawUrl);
|
|
@@ -135453,7 +135453,7 @@ var require_github_checker = __commonJS({
|
|
|
135453
135453
|
if (identical) {
|
|
135454
135454
|
result = {
|
|
135455
135455
|
identical: true,
|
|
135456
|
-
audit,
|
|
135456
|
+
audit: audit2,
|
|
135457
135457
|
githubUrl
|
|
135458
135458
|
};
|
|
135459
135459
|
contractCheckResult.reportsVerificationResult.push(result);
|
|
@@ -347564,8 +347564,8 @@ var Auditor = class {
|
|
|
347564
347564
|
await clearDir(this.#sandboxDir);
|
|
347565
347565
|
}
|
|
347566
347566
|
for (const [repo, repoAudits] of Object.entries(import_sdk_gov.audits)) {
|
|
347567
|
-
for (const
|
|
347568
|
-
await this.#checkoutAudit(repo,
|
|
347567
|
+
for (const audit2 of repoAudits) {
|
|
347568
|
+
await this.#checkoutAudit(repo, audit2);
|
|
347569
347569
|
}
|
|
347570
347570
|
}
|
|
347571
347571
|
this.#logger.debug("audit repositories setup complete");
|
|
@@ -347672,8 +347672,8 @@ var Auditor = class {
|
|
|
347672
347672
|
* @param repo
|
|
347673
347673
|
* @param audit
|
|
347674
347674
|
*/
|
|
347675
|
-
async #checkoutAudit(repo,
|
|
347676
|
-
const committish =
|
|
347675
|
+
async #checkoutAudit(repo, audit2) {
|
|
347676
|
+
const committish = audit2.type === "commit" ? audit2.commit : audit2.branch;
|
|
347677
347677
|
try {
|
|
347678
347678
|
await cloneRepo({
|
|
347679
347679
|
repo: `@gearbox-protocol/${repo}`,
|
|
@@ -347730,122 +347730,13 @@ var container = new Container();
|
|
|
347730
347730
|
|
|
347731
347731
|
// ../../packages/node/dist/EtherscanVerifier.js
|
|
347732
347732
|
import { mkdirSync as mkdirSync2 } from "node:fs";
|
|
347733
|
-
import { readFile as
|
|
347733
|
+
import { readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
|
|
347734
347734
|
import path3 from "node:path";
|
|
347735
|
-
var import_sdk_gov2 = __toESM(require_lib222(), 1);
|
|
347736
|
-
var API_KEYS = {
|
|
347737
|
-
Mainnet: (o) => o.etherscanApiKey,
|
|
347738
|
-
Optimism: (o) => o.etherscanOptimism,
|
|
347739
|
-
Arbitrum: (o) => o.etherscanArbitrum
|
|
347740
|
-
};
|
|
347741
|
-
var EtherscanVerifier = class {
|
|
347742
|
-
#logger = log_default.getSubLogger({ name: "etherscan" });
|
|
347743
|
-
#cacheDir;
|
|
347744
|
-
#cachePolicy;
|
|
347745
|
-
#result = /* @__PURE__ */ new Map();
|
|
347746
|
-
#etherscanBase;
|
|
347747
|
-
#etherscanApiKey;
|
|
347748
|
-
constructor(network, opts) {
|
|
347749
|
-
this.#cachePolicy = opts.cachePolicy;
|
|
347750
|
-
this.#etherscanBase = etherscanApiUrl(import_sdk_gov2.CHAINS[network]);
|
|
347751
|
-
const apikey = API_KEYS[network]?.(opts);
|
|
347752
|
-
if (!apikey) {
|
|
347753
|
-
throw new Error(`etherscan api key not specified for ${network}`);
|
|
347754
|
-
}
|
|
347755
|
-
this.#etherscanApiKey = apikey;
|
|
347756
|
-
this.#cacheDir = path3.resolve(opts.sandboxDir, "etherscan", network.toLowerCase());
|
|
347757
|
-
mkdirSync2(this.#cacheDir, { recursive: true });
|
|
347758
|
-
}
|
|
347759
|
-
async verifyMany(addresses) {
|
|
347760
|
-
for (const address of addresses) {
|
|
347761
|
-
if (!address.startsWith("0x")) {
|
|
347762
|
-
throw new Error(`invalid addresses detected: ${address}`);
|
|
347763
|
-
}
|
|
347764
|
-
}
|
|
347765
|
-
this.#logger.info(`will verify ${addresses.length} addresses`);
|
|
347766
|
-
let goodCnt = 0;
|
|
347767
|
-
for (let i = 0; i < addresses.length; i++) {
|
|
347768
|
-
const address = addresses[i].toLowerCase();
|
|
347769
|
-
this.#logger.trace(`verifying ${i + 1}/${addresses.length} | ${address}`);
|
|
347770
|
-
await this.#verify(address);
|
|
347771
|
-
goodCnt += this.check(address).verified ? 1 : 0;
|
|
347772
|
-
}
|
|
347773
|
-
this.#logger.info(`verification completed: ${goodCnt}/${addresses.length} are verified`);
|
|
347774
|
-
return this.#result;
|
|
347775
|
-
}
|
|
347776
|
-
async verify(address) {
|
|
347777
|
-
await this.#verify(address.toLowerCase());
|
|
347778
|
-
return this.check(address);
|
|
347779
|
-
}
|
|
347780
|
-
check(address) {
|
|
347781
|
-
const result = this.#result.get(address.toLowerCase());
|
|
347782
|
-
return result ?? { verified: false };
|
|
347783
|
-
}
|
|
347784
|
-
async #verify(address) {
|
|
347785
|
-
if (this.#result.has(address)) {
|
|
347786
|
-
this.#logger.trace(`address ${address} already verified`);
|
|
347787
|
-
return;
|
|
347788
|
-
}
|
|
347789
|
-
if (this.#cachePolicy !== "never") {
|
|
347790
|
-
const cached = await this.#getCached(address);
|
|
347791
|
-
if (cached) {
|
|
347792
|
-
this.#result.set(address, { verified: true, data: cached });
|
|
347793
|
-
return;
|
|
347794
|
-
} else if (this.#cachePolicy === "only") {
|
|
347795
|
-
throw new Error(`address ${address} not found in cache, and cache policy is cache-only`);
|
|
347796
|
-
}
|
|
347797
|
-
}
|
|
347798
|
-
const resp = await this.#fetch(address);
|
|
347799
|
-
if (resp.status === "0") {
|
|
347800
|
-
throw new Error(`cannot verify address ${address}: ${resp.result}`);
|
|
347801
|
-
}
|
|
347802
|
-
if (resp.result.length === 0 || resp.result[0].ABI.startsWith("Contract source code not verified")) {
|
|
347803
|
-
this.#logger.warn(`${address} is not verified`);
|
|
347804
|
-
this.#result.set(address, { verified: false });
|
|
347805
|
-
return;
|
|
347806
|
-
}
|
|
347807
|
-
this.#logger.debug(`${address} is verified`);
|
|
347808
|
-
if (this.#cachePolicy !== "never") {
|
|
347809
|
-
await this.#saveCached(address, resp.result);
|
|
347810
|
-
}
|
|
347811
|
-
this.#result.set(address, { verified: true, data: resp.result });
|
|
347812
|
-
}
|
|
347813
|
-
async #getCached(address) {
|
|
347814
|
-
try {
|
|
347815
|
-
const cacheFile = path3.resolve(this.#cacheDir, `${address.toLowerCase()}.json`);
|
|
347816
|
-
const content = await readFile3(cacheFile, "utf8");
|
|
347817
|
-
const resp = json_parse(content);
|
|
347818
|
-
this.#logger.trace(`cache hit for ${address}`);
|
|
347819
|
-
return resp;
|
|
347820
|
-
} catch (e) {
|
|
347821
|
-
if (e.code === "ENOENT") {
|
|
347822
|
-
return void 0;
|
|
347823
|
-
}
|
|
347824
|
-
throw e;
|
|
347825
|
-
}
|
|
347826
|
-
}
|
|
347827
|
-
async #saveCached(address, result) {
|
|
347828
|
-
const cacheFile = path3.resolve(this.#cacheDir, `${address.toLowerCase()}.json`);
|
|
347829
|
-
await writeFile2(cacheFile, json_stringify(result));
|
|
347830
|
-
}
|
|
347831
|
-
async #fetch(address) {
|
|
347832
|
-
const url = `${this.#etherscanBase}/api?module=contract&action=getsourcecode&address=${address}&apikey=${this.#etherscanApiKey}`;
|
|
347833
|
-
const _fetch = async () => {
|
|
347834
|
-
const resp = await fetch(url);
|
|
347835
|
-
const data = await resp.json();
|
|
347836
|
-
if (data.status === "0" && data.result.toLowerCase().startsWith("max rate")) {
|
|
347837
|
-
throw new Error("etherscan_rate_limit");
|
|
347838
|
-
}
|
|
347839
|
-
return data;
|
|
347840
|
-
};
|
|
347841
|
-
return pRetry(_fetch);
|
|
347842
|
-
}
|
|
347843
|
-
};
|
|
347844
347735
|
|
|
347845
347736
|
// ../../packages/node/dist/ProviderBase.js
|
|
347846
|
-
import { readFile as
|
|
347737
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
347847
347738
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
347848
|
-
var
|
|
347739
|
+
var import_sdk_gov2 = __toESM(require_lib222(), 1);
|
|
347849
347740
|
var import_api_kit = __toESM(require_src8(), 1);
|
|
347850
347741
|
|
|
347851
347742
|
// ../../packages/node/dist/providers/RetryProvider.js
|
|
@@ -347938,16 +347829,16 @@ var RetryProvider = class extends JsonRpcProvider {
|
|
|
347938
347829
|
|
|
347939
347830
|
// ../../packages/node/dist/ProviderBase.js
|
|
347940
347831
|
var utilityContracts = {
|
|
347941
|
-
ADDRESS_PROVIDER:
|
|
347942
|
-
TIMELOCK:
|
|
347943
|
-
GOVERNOR:
|
|
347944
|
-
BLACKLIST_HELPER:
|
|
347945
|
-
CREATE2FACTORY:
|
|
347946
|
-
ROUTER_MULTISIG_ADDRESS:
|
|
347947
|
-
ROUTER_CREATE2FACTORY:
|
|
347948
|
-
MULTISIG:
|
|
347949
|
-
VETO_ADMIN:
|
|
347950
|
-
TREASURY:
|
|
347832
|
+
ADDRESS_PROVIDER: import_sdk_gov2.ADDRESS_PROVIDER,
|
|
347833
|
+
TIMELOCK: import_sdk_gov2.TIMELOCK,
|
|
347834
|
+
GOVERNOR: import_sdk_gov2.GOVERNOR,
|
|
347835
|
+
BLACKLIST_HELPER: import_sdk_gov2.BLACKLIST_HELPER,
|
|
347836
|
+
CREATE2FACTORY: import_sdk_gov2.CREATE2FACTORY,
|
|
347837
|
+
ROUTER_MULTISIG_ADDRESS: import_sdk_gov2.ROUTER_MULTISIG_ADDRESS,
|
|
347838
|
+
ROUTER_CREATE2FACTORY: import_sdk_gov2.ROUTER_CREATE2FACTORY,
|
|
347839
|
+
MULTISIG: import_sdk_gov2.MULTISIG,
|
|
347840
|
+
VETO_ADMIN: import_sdk_gov2.VETO_ADMIN,
|
|
347841
|
+
TREASURY: import_sdk_gov2.TREASURY
|
|
347951
347842
|
};
|
|
347952
347843
|
var NetworkMismatchError = class extends Error {
|
|
347953
347844
|
constructor(expected, received) {
|
|
@@ -347971,15 +347862,15 @@ var ProviderBase = class {
|
|
|
347971
347862
|
this.#options = opts;
|
|
347972
347863
|
}
|
|
347973
347864
|
async init() {
|
|
347974
|
-
this.#network = await (0,
|
|
347975
|
-
this.#chainId =
|
|
347865
|
+
this.#network = await (0, import_sdk_gov2.detectNetwork)(this.#provider);
|
|
347866
|
+
this.#chainId = import_sdk_gov2.CHAINS[this.#network];
|
|
347976
347867
|
this.#service = new import_api_kit.default.default({
|
|
347977
347868
|
chainId: BigInt(this.#chainId)
|
|
347978
347869
|
});
|
|
347979
347870
|
if (this.#options.addressProviderJson) {
|
|
347980
347871
|
try {
|
|
347981
347872
|
this.logger.debug(`reading address provider json ${this.#options.addressProviderJson}`);
|
|
347982
|
-
const gov = await
|
|
347873
|
+
const gov = await readFile3(this.#options.addressProviderJson, "utf-8").then(JSON.parse);
|
|
347983
347874
|
if (gov.network !== this.#network) {
|
|
347984
347875
|
throw new NetworkMismatchError(this.#network, gov.network);
|
|
347985
347876
|
}
|
|
@@ -347998,7 +347889,7 @@ var ProviderBase = class {
|
|
|
347998
347889
|
if (this.#options.governanceJson) {
|
|
347999
347890
|
try {
|
|
348000
347891
|
this.logger.debug(`reading governance json ${this.#options.governanceJson}`);
|
|
348001
|
-
const gov = await
|
|
347892
|
+
const gov = await readFile3(this.#options.governanceJson, "utf-8").then(JSON.parse);
|
|
348002
347893
|
if (gov.network !== this.#network) {
|
|
348003
347894
|
throw new NetworkMismatchError(this.#network, gov.network);
|
|
348004
347895
|
}
|
|
@@ -348045,6 +347936,12 @@ var ProviderBase = class {
|
|
|
348045
347936
|
}
|
|
348046
347937
|
return transactions;
|
|
348047
347938
|
}
|
|
347939
|
+
get options() {
|
|
347940
|
+
if (!this.#initialized) {
|
|
347941
|
+
throw new Error("provider base not initialized");
|
|
347942
|
+
}
|
|
347943
|
+
return this.#options;
|
|
347944
|
+
}
|
|
348048
347945
|
get provider() {
|
|
348049
347946
|
if (!this.#initialized) {
|
|
348050
347947
|
throw new Error("provider base not initialized");
|
|
@@ -348089,11 +347986,138 @@ var ProviderBase = class {
|
|
|
348089
347986
|
}
|
|
348090
347987
|
};
|
|
348091
347988
|
|
|
347989
|
+
// ../../packages/node/dist/EtherscanVerifier.js
|
|
347990
|
+
var API_KEYS = {
|
|
347991
|
+
Mainnet: (o) => o.etherscanApiKey,
|
|
347992
|
+
Optimism: (o) => o.etherscanOptimism,
|
|
347993
|
+
Arbitrum: (o) => o.etherscanArbitrum
|
|
347994
|
+
};
|
|
347995
|
+
var EtherscanVerifier = class extends ProviderBase {
|
|
347996
|
+
#logger = log_default.getSubLogger({ name: "etherscan" });
|
|
347997
|
+
#result = /* @__PURE__ */ new Map();
|
|
347998
|
+
#cacheDir;
|
|
347999
|
+
#etherscanBase;
|
|
348000
|
+
#etherscanApiKey;
|
|
348001
|
+
async init() {
|
|
348002
|
+
await super.init();
|
|
348003
|
+
this.#etherscanBase = etherscanApiUrl(this.chainId);
|
|
348004
|
+
const apikey = API_KEYS[this.network]?.(this.options);
|
|
348005
|
+
if (!apikey) {
|
|
348006
|
+
throw new Error(`etherscan api key not specified for ${this.network}`);
|
|
348007
|
+
}
|
|
348008
|
+
this.#etherscanApiKey = apikey;
|
|
348009
|
+
this.#cacheDir = path3.resolve(this.options.sandboxDir, "etherscan", this.network.toLowerCase());
|
|
348010
|
+
mkdirSync2(this.#cacheDir, { recursive: true });
|
|
348011
|
+
}
|
|
348012
|
+
async verifyMany(addresses) {
|
|
348013
|
+
for (const address of addresses) {
|
|
348014
|
+
if (!address.startsWith("0x")) {
|
|
348015
|
+
throw new Error(`invalid addresses detected: ${address}`);
|
|
348016
|
+
}
|
|
348017
|
+
}
|
|
348018
|
+
this.#logger.info(`will verify ${addresses.length} addresses`);
|
|
348019
|
+
let goodCnt = 0;
|
|
348020
|
+
for (let i = 0; i < addresses.length; i++) {
|
|
348021
|
+
const address = addresses[i].toLowerCase();
|
|
348022
|
+
this.#logger.trace(`verifying ${i + 1}/${addresses.length} | ${address}`);
|
|
348023
|
+
await this.#verify(address);
|
|
348024
|
+
goodCnt += this.#check(address).verified ? 1 : 0;
|
|
348025
|
+
}
|
|
348026
|
+
this.#logger.info(`verification completed: ${goodCnt}/${addresses.length} are verified`);
|
|
348027
|
+
return this.#result;
|
|
348028
|
+
}
|
|
348029
|
+
async verify(address) {
|
|
348030
|
+
await this.#verify(address.toLowerCase());
|
|
348031
|
+
return this.#check(address);
|
|
348032
|
+
}
|
|
348033
|
+
#check(address) {
|
|
348034
|
+
const result = this.#result.get(address.toLowerCase());
|
|
348035
|
+
return result ?? { verified: false };
|
|
348036
|
+
}
|
|
348037
|
+
async #verify(address) {
|
|
348038
|
+
if (this.#result.has(address)) {
|
|
348039
|
+
this.#logger.trace(`address ${address} already verified`);
|
|
348040
|
+
return;
|
|
348041
|
+
}
|
|
348042
|
+
if (this.options.cachePolicy !== "never") {
|
|
348043
|
+
const cached = await this.#getCached(address);
|
|
348044
|
+
if (cached) {
|
|
348045
|
+
this.#result.set(address, { verified: true, data: cached });
|
|
348046
|
+
return;
|
|
348047
|
+
} else if (this.options.cachePolicy === "only") {
|
|
348048
|
+
throw new Error(`address ${address} not found in cache, and cache policy is cache-only`);
|
|
348049
|
+
}
|
|
348050
|
+
}
|
|
348051
|
+
const resp = await this.#fetch(address);
|
|
348052
|
+
if (resp.status === "0") {
|
|
348053
|
+
throw new Error(`cannot verify address ${address}: ${resp.result}`);
|
|
348054
|
+
}
|
|
348055
|
+
if (resp.result.length === 0 || resp.result[0].ABI.startsWith("Contract source code not verified")) {
|
|
348056
|
+
this.#logger.warn(`${address} is not verified`);
|
|
348057
|
+
this.#result.set(address, { verified: false });
|
|
348058
|
+
return;
|
|
348059
|
+
}
|
|
348060
|
+
this.#logger.debug(`${address} is verified`);
|
|
348061
|
+
if (this.options.cachePolicy !== "never") {
|
|
348062
|
+
await this.#saveCached(address, resp.result);
|
|
348063
|
+
}
|
|
348064
|
+
this.#result.set(address, { verified: true, data: resp.result });
|
|
348065
|
+
}
|
|
348066
|
+
async #getCached(address) {
|
|
348067
|
+
try {
|
|
348068
|
+
const cacheFile = path3.resolve(this.cacheDir, `${address.toLowerCase()}.json`);
|
|
348069
|
+
const content = await readFile4(cacheFile, "utf8");
|
|
348070
|
+
const resp = json_parse(content);
|
|
348071
|
+
this.#logger.trace(`cache hit for ${address}`);
|
|
348072
|
+
return resp;
|
|
348073
|
+
} catch (e) {
|
|
348074
|
+
if (e.code === "ENOENT") {
|
|
348075
|
+
return void 0;
|
|
348076
|
+
}
|
|
348077
|
+
throw e;
|
|
348078
|
+
}
|
|
348079
|
+
}
|
|
348080
|
+
async #saveCached(address, result) {
|
|
348081
|
+
const cacheFile = path3.resolve(this.cacheDir, `${address.toLowerCase()}.json`);
|
|
348082
|
+
await writeFile2(cacheFile, json_stringify(result));
|
|
348083
|
+
}
|
|
348084
|
+
async #fetch(address) {
|
|
348085
|
+
const url = `${this.etherscanBase}/api?module=contract&action=getsourcecode&address=${address}&apikey=${this.etherscanApiKey}`;
|
|
348086
|
+
const _fetch = async () => {
|
|
348087
|
+
const resp = await fetch(url);
|
|
348088
|
+
const data = await resp.json();
|
|
348089
|
+
if (data.status === "0" && data.result.toLowerCase().startsWith("max rate")) {
|
|
348090
|
+
throw new Error("etherscan_rate_limit");
|
|
348091
|
+
}
|
|
348092
|
+
return data;
|
|
348093
|
+
};
|
|
348094
|
+
return pRetry(_fetch);
|
|
348095
|
+
}
|
|
348096
|
+
get cacheDir() {
|
|
348097
|
+
if (!this.#cacheDir) {
|
|
348098
|
+
throw new Error("not initialized");
|
|
348099
|
+
}
|
|
348100
|
+
return this.#cacheDir;
|
|
348101
|
+
}
|
|
348102
|
+
get etherscanBase() {
|
|
348103
|
+
if (!this.#etherscanBase) {
|
|
348104
|
+
throw new Error("not initialized");
|
|
348105
|
+
}
|
|
348106
|
+
return this.#etherscanBase;
|
|
348107
|
+
}
|
|
348108
|
+
get etherscanApiKey() {
|
|
348109
|
+
if (!this.#etherscanApiKey) {
|
|
348110
|
+
throw new Error("not initialized");
|
|
348111
|
+
}
|
|
348112
|
+
return this.#etherscanApiKey;
|
|
348113
|
+
}
|
|
348114
|
+
};
|
|
348115
|
+
|
|
348092
348116
|
// ../../packages/node/dist/tree/GearboxAddressTree.js
|
|
348093
348117
|
import { mkdirSync as mkdirSync3 } from "node:fs";
|
|
348094
348118
|
import { readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
|
|
348095
348119
|
import path4 from "node:path";
|
|
348096
|
-
var
|
|
348120
|
+
var import_sdk_gov8 = __toESM(require_lib222(), 1);
|
|
348097
348121
|
|
|
348098
348122
|
// ../../node_modules/queue/index.js
|
|
348099
348123
|
var has = Object.prototype.hasOwnProperty;
|
|
@@ -348439,7 +348463,7 @@ var SourcifyLoggerAdaper = class _SourcifyLoggerAdaper {
|
|
|
348439
348463
|
};
|
|
348440
348464
|
|
|
348441
348465
|
// ../../packages/node/dist/tree/visitors/AbstractVisitor.js
|
|
348442
|
-
var
|
|
348466
|
+
var import_sdk_gov3 = __toESM(require_lib222(), 1);
|
|
348443
348467
|
var AbstractVisitor = class {
|
|
348444
348468
|
logger;
|
|
348445
348469
|
contractType;
|
|
@@ -348450,7 +348474,7 @@ var AbstractVisitor = class {
|
|
|
348450
348474
|
}
|
|
348451
348475
|
async visit(entry, provider, block) {
|
|
348452
348476
|
this.logger.trace(`visiting ${entry.address} at [${entry.lastVisitBlock}:${block}]`);
|
|
348453
|
-
if (!this.allowZeroAddress && entry.address ===
|
|
348477
|
+
if (!this.allowZeroAddress && entry.address === import_sdk_gov3.ADDRESS_0X0) {
|
|
348454
348478
|
throw new Error(`detected ${entry.contract} with zero address`);
|
|
348455
348479
|
}
|
|
348456
348480
|
if (entry.contract !== this.contractType) {
|
|
@@ -348792,7 +348816,7 @@ var ContractsRegisterVisitor = class extends AbstractVisitor {
|
|
|
348792
348816
|
};
|
|
348793
348817
|
|
|
348794
348818
|
// ../../packages/node/dist/tree/visitors/adapters.js
|
|
348795
|
-
var
|
|
348819
|
+
var import_sdk_gov4 = __toESM(require_lib222(), 1);
|
|
348796
348820
|
async function loadAdapters(provider, entries) {
|
|
348797
348821
|
const addresses = entries.filter((e) => e.contract === "ADAPTER_UNKNOWN").map((e) => e.address.toLowerCase());
|
|
348798
348822
|
const iAdapter = IAdapter__factory.createInterface();
|
|
@@ -348816,7 +348840,7 @@ async function loadAdapters(provider, entries) {
|
|
|
348816
348840
|
const { value } = resps[i];
|
|
348817
348841
|
if (value != null) {
|
|
348818
348842
|
if (method === "_gearboxAdapterType") {
|
|
348819
|
-
adapterTypes.set(address, "ADAPTER_" +
|
|
348843
|
+
adapterTypes.set(address, "ADAPTER_" + import_sdk_gov4.AdapterInterface[value]);
|
|
348820
348844
|
} else {
|
|
348821
348845
|
adapterVersions.set(address, value);
|
|
348822
348846
|
}
|
|
@@ -349208,14 +349232,14 @@ var GaugeV3Visitor = class extends AbstractVisitor {
|
|
|
349208
349232
|
};
|
|
349209
349233
|
|
|
349210
349234
|
// ../../packages/node/dist/tree/visitors/NoopVisitor.js
|
|
349211
|
-
var
|
|
349235
|
+
var import_sdk_gov5 = __toESM(require_lib222(), 1);
|
|
349212
349236
|
var NoopVisitor = class {
|
|
349213
349237
|
#allowZeroAddress;
|
|
349214
349238
|
constructor(allowZeroAddress = false) {
|
|
349215
349239
|
this.#allowZeroAddress = allowZeroAddress;
|
|
349216
349240
|
}
|
|
349217
349241
|
async visit(entry, provider, block) {
|
|
349218
|
-
if (!this.#allowZeroAddress && entry.address ===
|
|
349242
|
+
if (!this.#allowZeroAddress && entry.address === import_sdk_gov5.ADDRESS_0X0) {
|
|
349219
349243
|
throw new Error(`detected ${entry.contract} with zero address`);
|
|
349220
349244
|
}
|
|
349221
349245
|
return [];
|
|
@@ -349321,7 +349345,7 @@ var PoolV3Visitor = class extends AbstractVisitor {
|
|
|
349321
349345
|
};
|
|
349322
349346
|
|
|
349323
349347
|
// ../../packages/node/dist/tree/visitors/priceFeeds.js
|
|
349324
|
-
var
|
|
349348
|
+
var import_sdk_gov6 = __toESM(require_lib222(), 1);
|
|
349325
349349
|
async function loadPriceFeedTypes(provider, entries) {
|
|
349326
349350
|
const addresses = entries.map((e) => e.address.toLowerCase());
|
|
349327
349351
|
const iPriceFeed = IPriceFeed__factory.createInterface();
|
|
@@ -349338,7 +349362,7 @@ async function loadPriceFeedTypes(provider, entries) {
|
|
|
349338
349362
|
if (error || !value) {
|
|
349339
349363
|
pfTypes.set(address, "PRICE_FEED_CHAINLINK_ORACLE");
|
|
349340
349364
|
} else {
|
|
349341
|
-
pfTypes.set(address, `PRICE_FEED_${
|
|
349365
|
+
pfTypes.set(address, `PRICE_FEED_${import_sdk_gov6.PriceFeedType[value]}`);
|
|
349342
349366
|
}
|
|
349343
349367
|
}
|
|
349344
349368
|
for (const entry of entries) {
|
|
@@ -349367,7 +349391,7 @@ var PriceOracleV2Visitor = class extends AbstractVisitor {
|
|
|
349367
349391
|
};
|
|
349368
349392
|
|
|
349369
349393
|
// ../../packages/node/dist/tree/visitors/PriceOracleV3Visitor.js
|
|
349370
|
-
var
|
|
349394
|
+
var import_sdk_gov7 = __toESM(require_lib222(), 1);
|
|
349371
349395
|
var PriceOracleV3Visitor = class extends AbstractVisitor {
|
|
349372
349396
|
async _visit({ address, lastVisitBlock }, provider, block) {
|
|
349373
349397
|
const contract = IPriceOracleV3__factory.connect(address, provider);
|
|
@@ -349409,7 +349433,7 @@ var PriceOracleV3Visitor = class extends AbstractVisitor {
|
|
|
349409
349433
|
if (error || !value) {
|
|
349410
349434
|
pfTypes.set(address, "PRICE_FEED_UNKNOWN");
|
|
349411
349435
|
} else {
|
|
349412
|
-
pfTypes.set(address, `PRICE_FEED_${
|
|
349436
|
+
pfTypes.set(address, `PRICE_FEED_${import_sdk_gov7.PriceFeedType[value]}`);
|
|
349413
349437
|
}
|
|
349414
349438
|
}
|
|
349415
349439
|
for (const entry of entries) {
|
|
@@ -349500,7 +349524,8 @@ var GearboxAddressTree = class _GearboxAddressTree extends ProviderBase {
|
|
|
349500
349524
|
await super.init();
|
|
349501
349525
|
this.#outFile = path4.resolve(this.#options.sandboxDir, "tree", `${this.network.toLowerCase()}.json`);
|
|
349502
349526
|
mkdirSync3(path4.dirname(this.#outFile), { recursive: true });
|
|
349503
|
-
this.#etherscan = new EtherscanVerifier(this
|
|
349527
|
+
this.#etherscan = new EtherscanVerifier(this.#options);
|
|
349528
|
+
await this.#etherscan.init();
|
|
349504
349529
|
await this.#auditor.setup();
|
|
349505
349530
|
if (this.isDeployFromScratch) {
|
|
349506
349531
|
this.#cachePolicy = "never";
|
|
@@ -349629,7 +349654,7 @@ var GearboxAddressTree = class _GearboxAddressTree extends ProviderBase {
|
|
|
349629
349654
|
return;
|
|
349630
349655
|
}
|
|
349631
349656
|
const newEntries = await visitorFor(entry).visit(entry, this.provider, block);
|
|
349632
|
-
if (entry.address ===
|
|
349657
|
+
if (entry.address === import_sdk_gov8.ADDRESS_0X0) {
|
|
349633
349658
|
return;
|
|
349634
349659
|
}
|
|
349635
349660
|
const etherscanEntry = await this.etherscan.verify(entry.address);
|
|
@@ -349766,7 +349791,7 @@ function augmentInterface(iFace, ...extraFunctions) {
|
|
|
349766
349791
|
}
|
|
349767
349792
|
|
|
349768
349793
|
// ../../packages/node/dist/parsers/helpers/parameterParsers.js
|
|
349769
|
-
var
|
|
349794
|
+
var import_sdk_gov9 = __toESM(require_lib222(), 1);
|
|
349770
349795
|
var import_date_fns = __toESM(require_date_fns(), 1);
|
|
349771
349796
|
var defaultParser = (parameter, parameters, address) => {
|
|
349772
349797
|
switch (parameter.type) {
|
|
@@ -349899,7 +349924,7 @@ var parseAddress = (humanName) => (parameter) => {
|
|
|
349899
349924
|
raw: parameter,
|
|
349900
349925
|
name: humanName ?? parameter.name,
|
|
349901
349926
|
type: "address",
|
|
349902
|
-
value: parameter.value ===
|
|
349927
|
+
value: parameter.value === import_sdk_gov9.ADDRESS_0X0 ? "0x0" : parameter.value
|
|
349903
349928
|
};
|
|
349904
349929
|
};
|
|
349905
349930
|
function numberToDuration(n3) {
|
|
@@ -349940,7 +349965,7 @@ var parseAddressArray = (humanName) => (parameter) => {
|
|
|
349940
349965
|
};
|
|
349941
349966
|
};
|
|
349942
349967
|
function getParsedToken(address) {
|
|
349943
|
-
let symbol =
|
|
349968
|
+
let symbol = import_sdk_gov9.tokenSymbolByAddress[address.toLowerCase()];
|
|
349944
349969
|
let isCreate2;
|
|
349945
349970
|
if (!symbol) {
|
|
349946
349971
|
const pool = container.addressTree.getContract(address);
|
|
@@ -349967,11 +349992,11 @@ var parseToken = (humanName) => (parameter) => {
|
|
|
349967
349992
|
};
|
|
349968
349993
|
};
|
|
349969
349994
|
var parseTokenAmount = (token, humanName) => (parameter) => {
|
|
349970
|
-
const symbol =
|
|
349995
|
+
const symbol = import_sdk_gov9.tokenSymbolByAddress[token.toLowerCase()];
|
|
349971
349996
|
if (!symbol) {
|
|
349972
349997
|
throw new Error(`unknown token ${token}`);
|
|
349973
349998
|
}
|
|
349974
|
-
const decimals = (0,
|
|
349999
|
+
const decimals = (0, import_sdk_gov9.getDecimals)(token);
|
|
349975
350000
|
return {
|
|
349976
350001
|
raw: parameter,
|
|
349977
350002
|
name: humanName ?? parameter.name,
|
|
@@ -350787,7 +350812,7 @@ var CreditConfiguratorV2Parser = class extends AbstractParser {
|
|
|
350787
350812
|
};
|
|
350788
350813
|
|
|
350789
350814
|
// ../../packages/node/dist/parsers/CreditConfiguratorV3Parser.js
|
|
350790
|
-
var
|
|
350815
|
+
var import_sdk_gov10 = __toESM(require_lib222(), 1);
|
|
350791
350816
|
var constructorV300 = {
|
|
350792
350817
|
inputs: [
|
|
350793
350818
|
{
|
|
@@ -350944,7 +350969,7 @@ var CreditConfiguratorV3Parser = class extends AbstractParser {
|
|
|
350944
350969
|
const { maxDebt, minDebt, collateralTokens, degenNFT, expirable, name } = parameter.value;
|
|
350945
350970
|
const cmAddr = parameters[0].value;
|
|
350946
350971
|
const underlying = this.getUnderlying(cmAddr, "CREDIT_MANAGER_V3").toLowerCase();
|
|
350947
|
-
const symbol =
|
|
350972
|
+
const symbol = import_sdk_gov10.tokenSymbolByAddress[underlying];
|
|
350948
350973
|
return {
|
|
350949
350974
|
raw: parameter,
|
|
350950
350975
|
name: "options",
|
|
@@ -350960,12 +350985,12 @@ var CreditConfiguratorV3Parser = class extends AbstractParser {
|
|
|
350960
350985
|
})) ?? [],
|
|
350961
350986
|
minDebt: {
|
|
350962
350987
|
amount: minDebt,
|
|
350963
|
-
decimals: (0,
|
|
350988
|
+
decimals: (0, import_sdk_gov10.getDecimals)(underlying),
|
|
350964
350989
|
symbol
|
|
350965
350990
|
},
|
|
350966
350991
|
maxDebt: {
|
|
350967
350992
|
amount: maxDebt,
|
|
350968
|
-
decimals: (0,
|
|
350993
|
+
decimals: (0, import_sdk_gov10.getDecimals)(underlying),
|
|
350969
350994
|
symbol
|
|
350970
350995
|
}
|
|
350971
350996
|
}
|
|
@@ -352300,7 +352325,7 @@ var UpdateParser = class extends ProviderBase {
|
|
|
352300
352325
|
};
|
|
352301
352326
|
|
|
352302
352327
|
// ../../packages/node/dist/ZeroLT.js
|
|
352303
|
-
var
|
|
352328
|
+
var import_sdk_gov11 = __toESM(require_lib222(), 1);
|
|
352304
352329
|
var ZeroLT = class extends ProviderBase {
|
|
352305
352330
|
#acl;
|
|
352306
352331
|
#dc210;
|
|
@@ -352378,9 +352403,9 @@ var ZeroLT = class extends ProviderBase {
|
|
|
352378
352403
|
const cc = ICreditConfiguratorV2__factory.connect(cm.creditConfigurator, root2);
|
|
352379
352404
|
const newFeeLiquidation = Number(cm.liquidationDiscount) - 1;
|
|
352380
352405
|
logger2.trace("setFees part 1");
|
|
352381
|
-
await cc.setFees(cm.feeInterest, newFeeLiquidation,
|
|
352406
|
+
await cc.setFees(cm.feeInterest, newFeeLiquidation, import_sdk_gov11.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
|
|
352382
352407
|
logger2.trace("setFees part 2");
|
|
352383
|
-
await cc.setFees(cm.feeInterest, cm.feeLiquidation,
|
|
352408
|
+
await cc.setFees(cm.feeInterest, cm.feeLiquidation, import_sdk_gov11.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
|
|
352384
352409
|
logger2.trace("setFees done");
|
|
352385
352410
|
const ccRoot = await impersonate(this.provider, cm.creditConfigurator);
|
|
352386
352411
|
logger2.trace(`impresonating creditConfigurator ${cm.creditConfigurator}`);
|
|
@@ -352406,9 +352431,9 @@ var ZeroLT = class extends ProviderBase {
|
|
|
352406
352431
|
const cc = ICreditConfiguratorV3__factory.connect(cm.creditConfigurator, root2);
|
|
352407
352432
|
const newFeeLiquidation = Number(cm.liquidationDiscount) - 1;
|
|
352408
352433
|
logger2.trace("setFees part 1");
|
|
352409
|
-
await cc.setFees(cm.feeInterest, newFeeLiquidation,
|
|
352434
|
+
await cc.setFees(cm.feeInterest, newFeeLiquidation, import_sdk_gov11.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
|
|
352410
352435
|
logger2.trace("setFees part 2");
|
|
352411
|
-
await cc.setFees(cm.feeInterest, cm.feeLiquidation,
|
|
352436
|
+
await cc.setFees(cm.feeInterest, cm.feeLiquidation, import_sdk_gov11.PERCENTAGE_FACTOR - BigInt(cm.liquidationDiscount), cm.feeLiquidationExpired, cm.liquidationDiscountExpired);
|
|
352412
352437
|
logger2.trace("setFees done");
|
|
352413
352438
|
const ccRoot = await impersonate(this.provider, cm.creditConfigurator);
|
|
352414
352439
|
logger2.trace(`impresonating creditConfigurator ${cm.creditConfigurator}`);
|
|
@@ -352462,75 +352487,6 @@ function addressTree() {
|
|
|
352462
352487
|
});
|
|
352463
352488
|
}
|
|
352464
352489
|
|
|
352465
|
-
// src/commands/launch-forks.ts
|
|
352466
|
-
import { readFile as readFile7 } from "node:fs/promises";
|
|
352467
|
-
import { request } from "node:https";
|
|
352468
|
-
function launchForks() {
|
|
352469
|
-
return new Command().name("launch-forks").description("launches anvil-manager test forks from template json file").addOption(
|
|
352470
|
-
new Option(
|
|
352471
|
-
"--endpoint <url>",
|
|
352472
|
-
"Endpoint to call for fork creation"
|
|
352473
|
-
).default("https://anvil.gearbox.foundation/api/forks")
|
|
352474
|
-
).addOption(new Option("--no-wait", "Ignore response")).addOption(new Option("--api-key <key>", "anvil-manager api key")).addOption(
|
|
352475
|
-
new Option(
|
|
352476
|
-
"--template <json_file>",
|
|
352477
|
-
"Json file with POST requests payloads"
|
|
352478
|
-
)
|
|
352479
|
-
).addOption(
|
|
352480
|
-
new Option(
|
|
352481
|
-
"--release [version]",
|
|
352482
|
-
"release name to interpolate inside json files"
|
|
352483
|
-
).default("")
|
|
352484
|
-
).action(async (opts) => {
|
|
352485
|
-
const { endpoint, apiKey, release, template } = opts;
|
|
352486
|
-
let raw = await readFile7(template, "utf-8");
|
|
352487
|
-
raw = raw.replace(/%release/g, release);
|
|
352488
|
-
const requests = JSON.parse(raw);
|
|
352489
|
-
if (!Array.isArray(requests)) {
|
|
352490
|
-
throw new Error("template must contain array of requets");
|
|
352491
|
-
}
|
|
352492
|
-
if (opts.wait) {
|
|
352493
|
-
await Promise.all(
|
|
352494
|
-
requests.map(
|
|
352495
|
-
(r) => fetch(endpoint, {
|
|
352496
|
-
method: "POST",
|
|
352497
|
-
headers: {
|
|
352498
|
-
"Content-Type": "application/json",
|
|
352499
|
-
Authorization: `Bearer ${apiKey}`
|
|
352500
|
-
},
|
|
352501
|
-
body: JSON.stringify(r)
|
|
352502
|
-
})
|
|
352503
|
-
)
|
|
352504
|
-
);
|
|
352505
|
-
} else {
|
|
352506
|
-
requests.forEach((r) => {
|
|
352507
|
-
post(endpoint, apiKey, { ...r, noWait: true });
|
|
352508
|
-
});
|
|
352509
|
-
}
|
|
352510
|
-
});
|
|
352511
|
-
}
|
|
352512
|
-
function post(endpoint, apiKey, payload) {
|
|
352513
|
-
const postData = JSON.stringify(payload);
|
|
352514
|
-
const url = new URL(endpoint);
|
|
352515
|
-
const options = {
|
|
352516
|
-
hostname: url.hostname,
|
|
352517
|
-
port: url.port,
|
|
352518
|
-
path: url.pathname + url.search,
|
|
352519
|
-
method: "POST",
|
|
352520
|
-
headers: {
|
|
352521
|
-
"Content-Type": "application/json",
|
|
352522
|
-
Authorization: `Bearer ${apiKey}`,
|
|
352523
|
-
"Content-Length": Buffer.byteLength(postData)
|
|
352524
|
-
}
|
|
352525
|
-
};
|
|
352526
|
-
const req = request(options);
|
|
352527
|
-
req.write(postData);
|
|
352528
|
-
req.end();
|
|
352529
|
-
}
|
|
352530
|
-
|
|
352531
|
-
// src/commands/parse.ts
|
|
352532
|
-
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
352533
|
-
|
|
352534
352490
|
// src/renderer/cli/CliRenderer.ts
|
|
352535
352491
|
import readline from "node:readline";
|
|
352536
352492
|
|
|
@@ -353024,7 +352980,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
|
353024
352980
|
var source_default = chalk;
|
|
353025
352981
|
|
|
353026
352982
|
// src/renderer/cli/BaseRenderer.ts
|
|
353027
|
-
var
|
|
352983
|
+
var import_sdk_gov12 = __toESM(require_lib222(), 1);
|
|
353028
352984
|
var import_date_fns2 = __toESM(require_date_fns(), 1);
|
|
353029
352985
|
|
|
353030
352986
|
// src/renderer/helpers/emojis.ts
|
|
@@ -353134,7 +353090,7 @@ var BaseRenderer = class {
|
|
|
353134
353090
|
return `${prefix}${p.value.symbol}`;
|
|
353135
353091
|
}
|
|
353136
353092
|
case "token_amount":
|
|
353137
|
-
return `${(0,
|
|
353093
|
+
return `${(0, import_sdk_gov12.formatBN)(p.value.amount, p.value.decimals)} ${p.value.symbol}`;
|
|
353138
353094
|
case "percent":
|
|
353139
353095
|
return formatPercent(p.value);
|
|
353140
353096
|
case "timestamp":
|
|
@@ -353164,6 +353120,122 @@ function clearCli() {
|
|
|
353164
353120
|
);
|
|
353165
353121
|
}
|
|
353166
353122
|
|
|
353123
|
+
// src/renderer/cli/prettyPrintVerification.ts
|
|
353124
|
+
function prettyPrintVerification(r) {
|
|
353125
|
+
const rows = [
|
|
353126
|
+
["VERIFICATION RESULTS", "", ""]
|
|
353127
|
+
];
|
|
353128
|
+
const config = {
|
|
353129
|
+
columns: [
|
|
353130
|
+
{
|
|
353131
|
+
width: 10,
|
|
353132
|
+
alignment: "left"
|
|
353133
|
+
},
|
|
353134
|
+
{
|
|
353135
|
+
width: 80,
|
|
353136
|
+
alignment: "left"
|
|
353137
|
+
},
|
|
353138
|
+
{
|
|
353139
|
+
width: 80,
|
|
353140
|
+
alignment: "left"
|
|
353141
|
+
}
|
|
353142
|
+
],
|
|
353143
|
+
spanningCells: [
|
|
353144
|
+
{
|
|
353145
|
+
col: 0,
|
|
353146
|
+
row: 0,
|
|
353147
|
+
colSpan: 3,
|
|
353148
|
+
alignment: "center"
|
|
353149
|
+
}
|
|
353150
|
+
]
|
|
353151
|
+
};
|
|
353152
|
+
let ok = true;
|
|
353153
|
+
if ("error" in r) {
|
|
353154
|
+
ok = false;
|
|
353155
|
+
rows.push([
|
|
353156
|
+
`${escapeEmoji("\u{1F6AB}")} contract ${source_default.yellow(
|
|
353157
|
+
r.contract
|
|
353158
|
+
)} verification failed: ${r.error}`,
|
|
353159
|
+
"",
|
|
353160
|
+
""
|
|
353161
|
+
]);
|
|
353162
|
+
config.spanningCells?.push({
|
|
353163
|
+
col: 0,
|
|
353164
|
+
row: rows.length - 1,
|
|
353165
|
+
colSpan: 3,
|
|
353166
|
+
alignment: "left"
|
|
353167
|
+
});
|
|
353168
|
+
} else {
|
|
353169
|
+
rows.push(["", "", ""]);
|
|
353170
|
+
const contractRow = rows.length - 1;
|
|
353171
|
+
rows.push(["Status", "File", "Audits"]);
|
|
353172
|
+
let auditOk = true;
|
|
353173
|
+
for (const file of r.files) {
|
|
353174
|
+
let status = "";
|
|
353175
|
+
if (file.gearbox && !file.path.startsWith("contracts/interfaces")) {
|
|
353176
|
+
if (file.audits?.length) {
|
|
353177
|
+
status = escapeEmoji("\u2705");
|
|
353178
|
+
} else {
|
|
353179
|
+
auditOk = false;
|
|
353180
|
+
status = escapeEmoji("\u{1F6AB}");
|
|
353181
|
+
ok = false;
|
|
353182
|
+
}
|
|
353183
|
+
}
|
|
353184
|
+
rows.push([
|
|
353185
|
+
status,
|
|
353186
|
+
`${file.repo}/${file.path}`,
|
|
353187
|
+
stringifyAudits(file.audits)
|
|
353188
|
+
]);
|
|
353189
|
+
}
|
|
353190
|
+
if (auditOk) {
|
|
353191
|
+
rows[contractRow] = [
|
|
353192
|
+
`${escapeEmoji("\u2705")} contract ${source_default.green(
|
|
353193
|
+
r.contract
|
|
353194
|
+
)} verified as a ${r.match} match and is fully audited`,
|
|
353195
|
+
"",
|
|
353196
|
+
""
|
|
353197
|
+
];
|
|
353198
|
+
config.spanningCells?.push({
|
|
353199
|
+
col: 0,
|
|
353200
|
+
row: contractRow,
|
|
353201
|
+
colSpan: 3,
|
|
353202
|
+
alignment: "left"
|
|
353203
|
+
});
|
|
353204
|
+
} else {
|
|
353205
|
+
ok = false;
|
|
353206
|
+
rows[contractRow] = [
|
|
353207
|
+
`${escapeEmoji("\u{1F6AB}")} contract ${source_default.yellow(
|
|
353208
|
+
r.contract
|
|
353209
|
+
)} verified as a ${r.match} match, but has missing audits`,
|
|
353210
|
+
"",
|
|
353211
|
+
""
|
|
353212
|
+
];
|
|
353213
|
+
config.spanningCells?.push({
|
|
353214
|
+
col: 0,
|
|
353215
|
+
row: contractRow,
|
|
353216
|
+
colSpan: 3,
|
|
353217
|
+
alignment: "left"
|
|
353218
|
+
});
|
|
353219
|
+
}
|
|
353220
|
+
}
|
|
353221
|
+
config.spanningCells?.push({
|
|
353222
|
+
col: 0,
|
|
353223
|
+
row: rows.length,
|
|
353224
|
+
colSpan: 3,
|
|
353225
|
+
alignment: "center"
|
|
353226
|
+
});
|
|
353227
|
+
rows.push([ok ? source_default.green("SUCCESS") : source_default.red("FAILED"), "", ""]);
|
|
353228
|
+
console.log("\n" + tableWithEmojis(rows, config));
|
|
353229
|
+
}
|
|
353230
|
+
function stringifyAudits(audits2) {
|
|
353231
|
+
return audits2?.map((a) => {
|
|
353232
|
+
if (a.type === "branch") {
|
|
353233
|
+
return `${a.comment} (${a.branch})`;
|
|
353234
|
+
}
|
|
353235
|
+
return a.report.auditor + " " + a.report.revision;
|
|
353236
|
+
}).join(", ") ?? " ";
|
|
353237
|
+
}
|
|
353238
|
+
|
|
353167
353239
|
// src/renderer/cli/Create2Renderer.ts
|
|
353168
353240
|
var Create2Renderer = class extends BaseRenderer {
|
|
353169
353241
|
render(tx) {
|
|
@@ -353232,124 +353304,10 @@ var Create2Renderer = class extends BaseRenderer {
|
|
|
353232
353304
|
if (!verification) {
|
|
353233
353305
|
console.log(source_default.red(`transaction is not verified`));
|
|
353234
353306
|
} else {
|
|
353235
|
-
|
|
353236
|
-
}
|
|
353237
|
-
}
|
|
353238
|
-
#prettyPrintVerification(r) {
|
|
353239
|
-
const rows = [
|
|
353240
|
-
["VERIFICATION RESULTS", "", ""]
|
|
353241
|
-
];
|
|
353242
|
-
const config = {
|
|
353243
|
-
columns: [
|
|
353244
|
-
{
|
|
353245
|
-
width: 10,
|
|
353246
|
-
alignment: "left"
|
|
353247
|
-
},
|
|
353248
|
-
{
|
|
353249
|
-
width: 80,
|
|
353250
|
-
alignment: "left"
|
|
353251
|
-
},
|
|
353252
|
-
{
|
|
353253
|
-
width: 80,
|
|
353254
|
-
alignment: "left"
|
|
353255
|
-
}
|
|
353256
|
-
],
|
|
353257
|
-
spanningCells: [
|
|
353258
|
-
{
|
|
353259
|
-
col: 0,
|
|
353260
|
-
row: 0,
|
|
353261
|
-
colSpan: 3,
|
|
353262
|
-
alignment: "center"
|
|
353263
|
-
}
|
|
353264
|
-
]
|
|
353265
|
-
};
|
|
353266
|
-
let ok = true;
|
|
353267
|
-
if ("error" in r) {
|
|
353268
|
-
ok = false;
|
|
353269
|
-
rows.push([
|
|
353270
|
-
`${escapeEmoji("\u{1F6AB}")} contract ${source_default.yellow(
|
|
353271
|
-
r.contract
|
|
353272
|
-
)} verification failed: ${r.error}`,
|
|
353273
|
-
"",
|
|
353274
|
-
""
|
|
353275
|
-
]);
|
|
353276
|
-
config.spanningCells?.push({
|
|
353277
|
-
col: 0,
|
|
353278
|
-
row: rows.length - 1,
|
|
353279
|
-
colSpan: 3,
|
|
353280
|
-
alignment: "left"
|
|
353281
|
-
});
|
|
353282
|
-
} else {
|
|
353283
|
-
rows.push(["", "", ""]);
|
|
353284
|
-
const contractRow = rows.length - 1;
|
|
353285
|
-
rows.push(["Status", "File", "Audits"]);
|
|
353286
|
-
let auditOk = true;
|
|
353287
|
-
for (const file of r.files) {
|
|
353288
|
-
let status = "";
|
|
353289
|
-
if (file.gearbox && !file.path.startsWith("contracts/interfaces")) {
|
|
353290
|
-
if (file.audits?.length) {
|
|
353291
|
-
status = escapeEmoji("\u2705");
|
|
353292
|
-
} else {
|
|
353293
|
-
auditOk = false;
|
|
353294
|
-
status = escapeEmoji("\u{1F6AB}");
|
|
353295
|
-
ok = false;
|
|
353296
|
-
}
|
|
353297
|
-
}
|
|
353298
|
-
rows.push([
|
|
353299
|
-
status,
|
|
353300
|
-
`${file.repo}/${file.path}`,
|
|
353301
|
-
stringifyAudits(file.audits)
|
|
353302
|
-
]);
|
|
353303
|
-
}
|
|
353304
|
-
if (auditOk) {
|
|
353305
|
-
rows[contractRow] = [
|
|
353306
|
-
`${escapeEmoji("\u2705")} contract ${source_default.green(
|
|
353307
|
-
r.contract
|
|
353308
|
-
)} verified as a ${r.match} match and is fully audited`,
|
|
353309
|
-
"",
|
|
353310
|
-
""
|
|
353311
|
-
];
|
|
353312
|
-
config.spanningCells?.push({
|
|
353313
|
-
col: 0,
|
|
353314
|
-
row: contractRow,
|
|
353315
|
-
colSpan: 3,
|
|
353316
|
-
alignment: "left"
|
|
353317
|
-
});
|
|
353318
|
-
} else {
|
|
353319
|
-
ok = false;
|
|
353320
|
-
rows[contractRow] = [
|
|
353321
|
-
`${escapeEmoji("\u{1F6AB}")} contract ${source_default.yellow(
|
|
353322
|
-
r.contract
|
|
353323
|
-
)} verified as a ${r.match} match, but has missing audits`,
|
|
353324
|
-
"",
|
|
353325
|
-
""
|
|
353326
|
-
];
|
|
353327
|
-
config.spanningCells?.push({
|
|
353328
|
-
col: 0,
|
|
353329
|
-
row: contractRow,
|
|
353330
|
-
colSpan: 3,
|
|
353331
|
-
alignment: "left"
|
|
353332
|
-
});
|
|
353333
|
-
}
|
|
353307
|
+
prettyPrintVerification(verification);
|
|
353334
353308
|
}
|
|
353335
|
-
config.spanningCells?.push({
|
|
353336
|
-
col: 0,
|
|
353337
|
-
row: rows.length,
|
|
353338
|
-
colSpan: 3,
|
|
353339
|
-
alignment: "center"
|
|
353340
|
-
});
|
|
353341
|
-
rows.push([ok ? source_default.green("SUCCESS") : source_default.red("FAILED"), "", ""]);
|
|
353342
|
-
console.log("\n" + tableWithEmojis(rows, config));
|
|
353343
353309
|
}
|
|
353344
353310
|
};
|
|
353345
|
-
function stringifyAudits(audits2) {
|
|
353346
|
-
return audits2?.map((a) => {
|
|
353347
|
-
if (a.type === "branch") {
|
|
353348
|
-
return `${a.comment} (${a.branch})`;
|
|
353349
|
-
}
|
|
353350
|
-
return a.report.auditor + " " + a.report.revision;
|
|
353351
|
-
}).join(", ") ?? " ";
|
|
353352
|
-
}
|
|
353353
353311
|
|
|
353354
353312
|
// src/renderer/cli/CliRenderer.ts
|
|
353355
353313
|
var CliRenderer = class {
|
|
@@ -353524,6 +353482,101 @@ function getTldr({ transactions }) {
|
|
|
353524
353482
|
return Object.entries(stats).map(([k, v]) => v > 1 ? `${k} x${v}` : k).sort().join(", ");
|
|
353525
353483
|
}
|
|
353526
353484
|
|
|
353485
|
+
// src/commands/audit.ts
|
|
353486
|
+
function audit() {
|
|
353487
|
+
return new Command().name("audit").description("prints verification + audit info for gearbox address").addArgument(new Argument("<address>", "address to check")).addOption(
|
|
353488
|
+
new Option("--rpc-url <url>", "rpc provider url").default("https://rpc.ankr.com/eth").env("RPC_URL")
|
|
353489
|
+
).action(async (address, opts) => {
|
|
353490
|
+
const verifier = new EtherscanVerifier(opts);
|
|
353491
|
+
await verifier.init();
|
|
353492
|
+
const info = await verifier.verify(address);
|
|
353493
|
+
if (!info.verified) {
|
|
353494
|
+
throw new Error(`contract ${address} is not verified on etherscan`);
|
|
353495
|
+
}
|
|
353496
|
+
const auditor = new Auditor(opts);
|
|
353497
|
+
await auditor.setup();
|
|
353498
|
+
const auditedFiles = [];
|
|
353499
|
+
for (const contract of info.data) {
|
|
353500
|
+
const audits2 = await auditor.auditEtherscanVerified(contract);
|
|
353501
|
+
auditedFiles.push(...audits2);
|
|
353502
|
+
}
|
|
353503
|
+
prettyPrintVerification({
|
|
353504
|
+
contract: info.data[0].ContractName,
|
|
353505
|
+
match: "etherscan",
|
|
353506
|
+
files: auditedFiles
|
|
353507
|
+
});
|
|
353508
|
+
});
|
|
353509
|
+
}
|
|
353510
|
+
|
|
353511
|
+
// src/commands/launch-forks.ts
|
|
353512
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
353513
|
+
import { request } from "node:https";
|
|
353514
|
+
function launchForks() {
|
|
353515
|
+
return new Command().name("launch-forks").description("launches anvil-manager test forks from template json file").addOption(
|
|
353516
|
+
new Option(
|
|
353517
|
+
"--endpoint <url>",
|
|
353518
|
+
"Endpoint to call for fork creation"
|
|
353519
|
+
).default("https://anvil.gearbox.foundation/api/forks")
|
|
353520
|
+
).addOption(new Option("--no-wait", "Ignore response")).addOption(new Option("--api-key <key>", "anvil-manager api key")).addOption(
|
|
353521
|
+
new Option(
|
|
353522
|
+
"--template <json_file>",
|
|
353523
|
+
"Json file with POST requests payloads"
|
|
353524
|
+
)
|
|
353525
|
+
).addOption(
|
|
353526
|
+
new Option(
|
|
353527
|
+
"--release [version]",
|
|
353528
|
+
"release name to interpolate inside json files"
|
|
353529
|
+
).default("")
|
|
353530
|
+
).action(async (opts) => {
|
|
353531
|
+
const { endpoint, apiKey, release, template } = opts;
|
|
353532
|
+
let raw = await readFile7(template, "utf-8");
|
|
353533
|
+
raw = raw.replace(/%release/g, release);
|
|
353534
|
+
const requests = JSON.parse(raw);
|
|
353535
|
+
if (!Array.isArray(requests)) {
|
|
353536
|
+
throw new Error("template must contain array of requets");
|
|
353537
|
+
}
|
|
353538
|
+
if (opts.wait) {
|
|
353539
|
+
await Promise.all(
|
|
353540
|
+
requests.map(
|
|
353541
|
+
(r) => fetch(endpoint, {
|
|
353542
|
+
method: "POST",
|
|
353543
|
+
headers: {
|
|
353544
|
+
"Content-Type": "application/json",
|
|
353545
|
+
Authorization: `Bearer ${apiKey}`
|
|
353546
|
+
},
|
|
353547
|
+
body: JSON.stringify(r)
|
|
353548
|
+
})
|
|
353549
|
+
)
|
|
353550
|
+
);
|
|
353551
|
+
} else {
|
|
353552
|
+
requests.forEach((r) => {
|
|
353553
|
+
post(endpoint, apiKey, { ...r, noWait: true });
|
|
353554
|
+
});
|
|
353555
|
+
}
|
|
353556
|
+
});
|
|
353557
|
+
}
|
|
353558
|
+
function post(endpoint, apiKey, payload) {
|
|
353559
|
+
const postData = JSON.stringify(payload);
|
|
353560
|
+
const url = new URL(endpoint);
|
|
353561
|
+
const options = {
|
|
353562
|
+
hostname: url.hostname,
|
|
353563
|
+
port: url.port,
|
|
353564
|
+
path: url.pathname + url.search,
|
|
353565
|
+
method: "POST",
|
|
353566
|
+
headers: {
|
|
353567
|
+
"Content-Type": "application/json",
|
|
353568
|
+
Authorization: `Bearer ${apiKey}`,
|
|
353569
|
+
"Content-Length": Buffer.byteLength(postData)
|
|
353570
|
+
}
|
|
353571
|
+
};
|
|
353572
|
+
const req = request(options);
|
|
353573
|
+
req.write(postData);
|
|
353574
|
+
req.end();
|
|
353575
|
+
}
|
|
353576
|
+
|
|
353577
|
+
// src/commands/parse.ts
|
|
353578
|
+
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
353579
|
+
|
|
353527
353580
|
// src/renderer/html/HtmlRenderer.tsx
|
|
353528
353581
|
var import_react = __toESM(require_react(), 1);
|
|
353529
353582
|
var import_server = __toESM(require_server_node(), 1);
|
|
@@ -353565,7 +353618,7 @@ function getRenderer(opts) {
|
|
|
353565
353618
|
}
|
|
353566
353619
|
|
|
353567
353620
|
// package.json
|
|
353568
|
-
var version3 = "4.
|
|
353621
|
+
var version3 = "4.18.0";
|
|
353569
353622
|
|
|
353570
353623
|
// src/version.ts
|
|
353571
353624
|
var version_default = version3;
|
|
@@ -354038,11 +354091,6 @@ function verifyEtherscan() {
|
|
|
354038
354091
|
"--addresses-file [json]",
|
|
354039
354092
|
"json file where keys are addresses to verify, e.g. gearbox contracts tree"
|
|
354040
354093
|
)
|
|
354041
|
-
).addOption(
|
|
354042
|
-
new Option(
|
|
354043
|
-
"--network <network_type>",
|
|
354044
|
-
"NetworkType supported by sdk-gov"
|
|
354045
|
-
).default("Mainnet")
|
|
354046
354094
|
).addOption(new Option("--addresses [addr...]", "addresses to verify")).action(async (opts) => {
|
|
354047
354095
|
if (!opts.addresses?.length && !opts.addressesFile) {
|
|
354048
354096
|
throw new Error("please specify addresses or addresses file");
|
|
@@ -354055,7 +354103,9 @@ function verifyEtherscan() {
|
|
|
354055
354103
|
if (!addresses.length) {
|
|
354056
354104
|
throw new Error("no addresses provided");
|
|
354057
354105
|
}
|
|
354058
|
-
|
|
354106
|
+
const verifier = new EtherscanVerifier(opts);
|
|
354107
|
+
await verifier.init();
|
|
354108
|
+
await verifier.verifyMany(addresses);
|
|
354059
354109
|
});
|
|
354060
354110
|
}
|
|
354061
354111
|
|
|
@@ -354101,6 +354151,7 @@ function zeroLT() {
|
|
|
354101
354151
|
var program2 = new Command();
|
|
354102
354152
|
program2.name("deploy-tools").description("gearbox deploy tools").version(version_default);
|
|
354103
354153
|
program2.addCommand(addressTree());
|
|
354154
|
+
program2.addCommand(audit());
|
|
354104
354155
|
program2.addCommand(launchForks());
|
|
354105
354156
|
program2.addCommand(parse());
|
|
354106
354157
|
program2.addCommand(printSafeTx());
|