@gearbox-protocol/deploy-tools 5.2.1 → 5.2.3
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 +118 -110
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -363871,7 +363871,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
363871
363871
|
networkType
|
|
363872
363872
|
});
|
|
363873
363873
|
logger2?.debug(
|
|
363874
|
-
{ networkType, chainId, addressProvider },
|
|
363874
|
+
{ networkType, chainId, addressProvider, marketConfigurators },
|
|
363875
363875
|
"attaching gearbox sdk"
|
|
363876
363876
|
);
|
|
363877
363877
|
return new _GearboxSDK({
|
|
@@ -382250,7 +382250,7 @@ var container = new Container();
|
|
|
382250
382250
|
|
|
382251
382251
|
// ../../packages/node/dist/EtherscanVerifier.js
|
|
382252
382252
|
import { mkdirSync as mkdirSync2 } from "node:fs";
|
|
382253
|
-
import { readFile as
|
|
382253
|
+
import { readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
|
|
382254
382254
|
import path4 from "node:path";
|
|
382255
382255
|
|
|
382256
382256
|
// ../../packages/shared/dist/etherscan.js
|
|
@@ -388273,7 +388273,7 @@ async function pRetry(input, options) {
|
|
|
388273
388273
|
}
|
|
388274
388274
|
|
|
388275
388275
|
// ../../packages/node/dist/ProviderBase.js
|
|
388276
|
-
import { readFile as
|
|
388276
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
388277
388277
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
388278
388278
|
|
|
388279
388279
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/dev/index.mjs
|
|
@@ -388420,6 +388420,7 @@ function privateKeyToAccount(privateKey, options = {}) {
|
|
|
388420
388420
|
}
|
|
388421
388421
|
|
|
388422
388422
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/dev/index.mjs
|
|
388423
|
+
import { writeFile as writeFile2, readFile as readFile3 } from "node:fs/promises";
|
|
388423
388424
|
function createAnvilClient({
|
|
388424
388425
|
chain,
|
|
388425
388426
|
transport
|
|
@@ -388733,6 +388734,94 @@ var AccountOpener = class {
|
|
|
388733
388734
|
return this.#service.sdk;
|
|
388734
388735
|
}
|
|
388735
388736
|
};
|
|
388737
|
+
var SDKExample = class {
|
|
388738
|
+
#sdk;
|
|
388739
|
+
#logger;
|
|
388740
|
+
constructor(logger2) {
|
|
388741
|
+
this.#logger = logger2;
|
|
388742
|
+
}
|
|
388743
|
+
async run(opts) {
|
|
388744
|
+
const {
|
|
388745
|
+
addressProvider: ap,
|
|
388746
|
+
addressProviderJson,
|
|
388747
|
+
marketConfigurator: mc,
|
|
388748
|
+
marketConfiguratorJson,
|
|
388749
|
+
anvilUrl = "http://127.0.0.1:8545",
|
|
388750
|
+
outFile
|
|
388751
|
+
} = opts;
|
|
388752
|
+
const addressProvider = await this.#readConfigAddress(
|
|
388753
|
+
"addressProvider",
|
|
388754
|
+
ap,
|
|
388755
|
+
addressProviderJson
|
|
388756
|
+
);
|
|
388757
|
+
const marketConfigurator = await this.#readConfigAddress(
|
|
388758
|
+
"marketConfigurator",
|
|
388759
|
+
mc,
|
|
388760
|
+
marketConfiguratorJson
|
|
388761
|
+
);
|
|
388762
|
+
this.#sdk = await GearboxSDK.attach({
|
|
388763
|
+
rpcURLs: [anvilUrl],
|
|
388764
|
+
timeout: 48e4,
|
|
388765
|
+
addressProvider,
|
|
388766
|
+
logger: this.#logger,
|
|
388767
|
+
ignoreUpdateablePrices: true,
|
|
388768
|
+
marketConfigurators: [marketConfigurator]
|
|
388769
|
+
});
|
|
388770
|
+
const puTx = await this.#sdk.priceFeeds.getUpdatePriceFeedsTx([
|
|
388771
|
+
marketConfigurator
|
|
388772
|
+
]);
|
|
388773
|
+
const updater = createWalletClient({
|
|
388774
|
+
account: privateKeyToAccount(
|
|
388775
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
|
388776
|
+
// well-known anvil private key
|
|
388777
|
+
),
|
|
388778
|
+
transport: http(anvilUrl)
|
|
388779
|
+
});
|
|
388780
|
+
const publicClient = createPublicClient({
|
|
388781
|
+
transport: http(anvilUrl)
|
|
388782
|
+
});
|
|
388783
|
+
const hash2 = await sendRawTx(updater, { tx: puTx });
|
|
388784
|
+
await publicClient.waitForTransactionReceipt({ hash: hash2 });
|
|
388785
|
+
await this.#sdk.marketRegister.loadMarkets([marketConfigurator], true);
|
|
388786
|
+
this.#logger?.info("attached sdk");
|
|
388787
|
+
if (outFile) {
|
|
388788
|
+
try {
|
|
388789
|
+
await writeFile2(
|
|
388790
|
+
outFile,
|
|
388791
|
+
json_stringify(this.#sdk.stateHuman()),
|
|
388792
|
+
"utf-8"
|
|
388793
|
+
);
|
|
388794
|
+
} catch (e) {
|
|
388795
|
+
this.#logger?.error(`failed to write to ${outFile}: ${e}`);
|
|
388796
|
+
}
|
|
388797
|
+
}
|
|
388798
|
+
}
|
|
388799
|
+
async #readConfigAddress(name, value, file) {
|
|
388800
|
+
let result = value;
|
|
388801
|
+
if (!result) {
|
|
388802
|
+
if (!file) {
|
|
388803
|
+
throw new Error(`${name} is not specified`);
|
|
388804
|
+
}
|
|
388805
|
+
this.#logger?.debug(`reading ${name} json ${file}`);
|
|
388806
|
+
const apFile = await readFile3(file, "utf-8").then(JSON.parse);
|
|
388807
|
+
result = apFile[name];
|
|
388808
|
+
}
|
|
388809
|
+
if (!result) {
|
|
388810
|
+
throw new Error(`${name} is not specified`);
|
|
388811
|
+
}
|
|
388812
|
+
if (!isAddress(result)) {
|
|
388813
|
+
throw new Error(`${name} is not a valid address: ${result}`);
|
|
388814
|
+
}
|
|
388815
|
+
this.#logger?.info(`using ${name} ${result}`);
|
|
388816
|
+
return result;
|
|
388817
|
+
}
|
|
388818
|
+
get sdk() {
|
|
388819
|
+
if (!this.#sdk) {
|
|
388820
|
+
throw new Error("sdk is not attached");
|
|
388821
|
+
}
|
|
388822
|
+
return this.#sdk;
|
|
388823
|
+
}
|
|
388824
|
+
};
|
|
388736
388825
|
var iaclAbi2 = [
|
|
388737
388826
|
{
|
|
388738
388827
|
type: "function",
|
|
@@ -390248,7 +390337,7 @@ var ProviderBase = class {
|
|
|
390248
390337
|
if (this.#options.addressProviderJson) {
|
|
390249
390338
|
try {
|
|
390250
390339
|
this.logger.debug(`reading address provider json ${this.#options.addressProviderJson}`);
|
|
390251
|
-
const gov = await
|
|
390340
|
+
const gov = await readFile4(this.#options.addressProviderJson, "utf-8").then(JSON.parse);
|
|
390252
390341
|
if (gov.network !== this.#network) {
|
|
390253
390342
|
throw new NetworkMismatchError(this.#network, gov.network);
|
|
390254
390343
|
}
|
|
@@ -390267,7 +390356,7 @@ var ProviderBase = class {
|
|
|
390267
390356
|
if (this.#options.governanceJson) {
|
|
390268
390357
|
try {
|
|
390269
390358
|
this.logger.debug(`reading governance json ${this.#options.governanceJson}`);
|
|
390270
|
-
const gov = await
|
|
390359
|
+
const gov = await readFile4(this.#options.governanceJson, "utf-8").then(JSON.parse);
|
|
390271
390360
|
if (gov.network !== this.#network) {
|
|
390272
390361
|
throw new NetworkMismatchError(this.#network, gov.network);
|
|
390273
390362
|
}
|
|
@@ -390444,7 +390533,7 @@ var EtherscanVerifier = class extends ProviderBase {
|
|
|
390444
390533
|
async #getCached(address) {
|
|
390445
390534
|
try {
|
|
390446
390535
|
const cacheFile = path4.resolve(this.cacheDir, `${address.toLowerCase()}.json`);
|
|
390447
|
-
const content = await
|
|
390536
|
+
const content = await readFile5(cacheFile, "utf8");
|
|
390448
390537
|
const resp = json_parse(content);
|
|
390449
390538
|
this.#logger.trace(`cache hit for ${address}`);
|
|
390450
390539
|
return resp;
|
|
@@ -390457,7 +390546,7 @@ var EtherscanVerifier = class extends ProviderBase {
|
|
|
390457
390546
|
}
|
|
390458
390547
|
async #saveCached(address, result) {
|
|
390459
390548
|
const cacheFile = path4.resolve(this.cacheDir, `${address.toLowerCase()}.json`);
|
|
390460
|
-
await
|
|
390549
|
+
await writeFile3(cacheFile, json_stringify(result));
|
|
390461
390550
|
}
|
|
390462
390551
|
async #fetch(address) {
|
|
390463
390552
|
const url = `${this.etherscanBase}/api?module=contract&action=getsourcecode&address=${address}&apikey=${this.etherscanApiKey}`;
|
|
@@ -390493,7 +390582,7 @@ var EtherscanVerifier = class extends ProviderBase {
|
|
|
390493
390582
|
|
|
390494
390583
|
// ../../packages/node/dist/tree/GearboxAddressTree.js
|
|
390495
390584
|
import { mkdirSync as mkdirSync3 } from "node:fs";
|
|
390496
|
-
import { readFile as
|
|
390585
|
+
import { readFile as readFile6, writeFile as writeFile4 } from "node:fs/promises";
|
|
390497
390586
|
import path5 from "node:path";
|
|
390498
390587
|
|
|
390499
390588
|
// ../../packages/types/dist/addresses.js
|
|
@@ -392840,7 +392929,7 @@ var GearboxAddressTree = class _GearboxAddressTree extends ProviderBase {
|
|
|
392840
392929
|
return [];
|
|
392841
392930
|
}
|
|
392842
392931
|
try {
|
|
392843
|
-
const content = await
|
|
392932
|
+
const content = await readFile6(this.outFile, "utf-8").then(json_parse);
|
|
392844
392933
|
if (content.version !== _GearboxAddressTree.version) {
|
|
392845
392934
|
this.logger.warn(`ignoring cache file because it has version ${content.version}, but we need ${_GearboxAddressTree.version}`);
|
|
392846
392935
|
return [];
|
|
@@ -392865,7 +392954,7 @@ var GearboxAddressTree = class _GearboxAddressTree extends ProviderBase {
|
|
|
392865
392954
|
version: _GearboxAddressTree.version,
|
|
392866
392955
|
tree: Object.fromEntries(this.#visited)
|
|
392867
392956
|
};
|
|
392868
|
-
await
|
|
392957
|
+
await writeFile4(this.outFile, json_stringify(content), "utf-8");
|
|
392869
392958
|
this.logger.trace(`saved to ${this.#outFile}`);
|
|
392870
392959
|
}
|
|
392871
392960
|
async #process(entry, block) {
|
|
@@ -392951,7 +393040,7 @@ import path7 from "node:path";
|
|
|
392951
393040
|
|
|
392952
393041
|
// ../../packages/node/dist/meta/MetaRepo.js
|
|
392953
393042
|
import { mkdirSync as mkdirSync4 } from "node:fs";
|
|
392954
|
-
import { readFile as
|
|
393043
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
392955
393044
|
import path6 from "node:path";
|
|
392956
393045
|
var META_REPO = "deploy-v3";
|
|
392957
393046
|
var MetaRepo = class {
|
|
@@ -392993,7 +393082,7 @@ var MetaRepo = class {
|
|
|
392993
393082
|
for (const f of files) {
|
|
392994
393083
|
const fname = path6.basename(f, `.json`);
|
|
392995
393084
|
if (isAddress(fname)) {
|
|
392996
|
-
const meta2 = await
|
|
393085
|
+
const meta2 = await readFile7(path6.resolve(metaRoot, f), "utf-8").then(json_parse);
|
|
392997
393086
|
if (!meta2.encodedConstructorArgs.startsWith("0x")) {
|
|
392998
393087
|
throw new Error(`expect encodedConstructorArgs for ${fname} to start with '0x'`);
|
|
392999
393088
|
}
|
|
@@ -395890,6 +395979,7 @@ var ZeroLT = class extends ProviderBase {
|
|
|
395890
395979
|
for (const cm of cms) {
|
|
395891
395980
|
await setLTZero(this.client, {
|
|
395892
395981
|
...cm,
|
|
395982
|
+
// fake v3.0 to v3.1 compatibility
|
|
395893
395983
|
baseParams: {
|
|
395894
395984
|
addr: cm.addr
|
|
395895
395985
|
}
|
|
@@ -396977,100 +397067,6 @@ function audit() {
|
|
|
396977
397067
|
// src/commands/open-accounts.ts
|
|
396978
397068
|
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
396979
397069
|
import path8 from "node:path";
|
|
396980
|
-
|
|
396981
|
-
// src/commands/sdk/SdkExample.ts
|
|
396982
|
-
import { readFile as readFile7, writeFile as writeFile4 } from "node:fs/promises";
|
|
396983
|
-
var SdkExample = class {
|
|
396984
|
-
#sdk;
|
|
396985
|
-
async run(opts) {
|
|
396986
|
-
let {
|
|
396987
|
-
addressProvider,
|
|
396988
|
-
addressProviderJson,
|
|
396989
|
-
marketConfiguratorJson,
|
|
396990
|
-
anvilUrl = "http://127.0.0.1:8545",
|
|
396991
|
-
outFile
|
|
396992
|
-
} = opts;
|
|
396993
|
-
let marketConfigurator;
|
|
396994
|
-
try {
|
|
396995
|
-
const mc = await readFile7(marketConfiguratorJson, "utf-8").then(
|
|
396996
|
-
JSON.parse
|
|
396997
|
-
);
|
|
396998
|
-
marketConfigurator = mc.marketConfigurator;
|
|
396999
|
-
if (!isAddress(marketConfigurator)) {
|
|
397000
|
-
throw new Error("marketConfigurator is not a valid address");
|
|
397001
|
-
}
|
|
397002
|
-
log_default.info(`market configurator from json: ${marketConfigurator}`);
|
|
397003
|
-
} catch (e) {
|
|
397004
|
-
throw new Error(
|
|
397005
|
-
`cannot read market configurator json ${marketConfiguratorJson}: ${e}`
|
|
397006
|
-
);
|
|
397007
|
-
}
|
|
397008
|
-
if (!addressProvider) {
|
|
397009
|
-
if (!addressProviderJson) {
|
|
397010
|
-
throw new Error("addressProvider is not specified");
|
|
397011
|
-
}
|
|
397012
|
-
log_default.debug(`reading address provider json ${addressProviderJson}`);
|
|
397013
|
-
const apFile = await readFile7(addressProviderJson, "utf-8").then(
|
|
397014
|
-
JSON.parse
|
|
397015
|
-
);
|
|
397016
|
-
addressProvider = apFile.addressProvider;
|
|
397017
|
-
}
|
|
397018
|
-
if (!addressProvider) {
|
|
397019
|
-
throw new Error("addressProvider is not specified");
|
|
397020
|
-
}
|
|
397021
|
-
log_default.info(`using address provider ${addressProvider}`);
|
|
397022
|
-
if (!isAddress(addressProvider)) {
|
|
397023
|
-
throw new Error("addressProvider is not a valid address");
|
|
397024
|
-
}
|
|
397025
|
-
this.#sdk = await GearboxSDK.attach({
|
|
397026
|
-
rpcURLs: [anvilUrl],
|
|
397027
|
-
timeout: 48e4,
|
|
397028
|
-
addressProvider,
|
|
397029
|
-
logger: log_default,
|
|
397030
|
-
ignoreUpdateablePrices: true,
|
|
397031
|
-
marketConfigurators: [marketConfigurator]
|
|
397032
|
-
});
|
|
397033
|
-
const puTx = await this.#sdk.priceFeeds.getUpdatePriceFeedsTx(
|
|
397034
|
-
GEARBOX_RISK_CURATORS[this.#sdk.provider.networkType]
|
|
397035
|
-
);
|
|
397036
|
-
const updater = createWalletClient({
|
|
397037
|
-
account: privateKeyToAccount(
|
|
397038
|
-
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
|
397039
|
-
// well-known anvil private key
|
|
397040
|
-
),
|
|
397041
|
-
transport: http(anvilUrl)
|
|
397042
|
-
});
|
|
397043
|
-
const publicClient = createPublicClient({
|
|
397044
|
-
transport: http(anvilUrl)
|
|
397045
|
-
});
|
|
397046
|
-
const hash2 = await sendRawTx(updater, { tx: puTx });
|
|
397047
|
-
await publicClient.waitForTransactionReceipt({ hash: hash2 });
|
|
397048
|
-
await this.#sdk.marketRegister.loadMarkets(
|
|
397049
|
-
GEARBOX_RISK_CURATORS[this.#sdk.provider.networkType],
|
|
397050
|
-
true
|
|
397051
|
-
);
|
|
397052
|
-
log_default.info("attached sdk");
|
|
397053
|
-
if (outFile) {
|
|
397054
|
-
try {
|
|
397055
|
-
await writeFile4(
|
|
397056
|
-
outFile,
|
|
397057
|
-
json_stringify(this.#sdk.stateHuman()),
|
|
397058
|
-
"utf-8"
|
|
397059
|
-
);
|
|
397060
|
-
} catch (e) {
|
|
397061
|
-
log_default.error(`failed to write to ${outFile}: ${e}`);
|
|
397062
|
-
}
|
|
397063
|
-
}
|
|
397064
|
-
}
|
|
397065
|
-
get sdk() {
|
|
397066
|
-
if (!this.#sdk) {
|
|
397067
|
-
throw new Error("sdk is not attached");
|
|
397068
|
-
}
|
|
397069
|
-
return this.#sdk;
|
|
397070
|
-
}
|
|
397071
|
-
};
|
|
397072
|
-
|
|
397073
|
-
// src/commands/open-accounts.ts
|
|
397074
397070
|
function openAccounts() {
|
|
397075
397071
|
return newCommand().name("open-accounts").description("Script to open accounts in v3.1").addOption(
|
|
397076
397072
|
new Option(
|
|
@@ -397091,7 +397087,7 @@ function openAccounts() {
|
|
|
397091
397087
|
anvilUrl = "http://127.0.0.1:8545",
|
|
397092
397088
|
sharedDir = "."
|
|
397093
397089
|
} = opts;
|
|
397094
|
-
const sdkExample2 = new
|
|
397090
|
+
const sdkExample2 = new SDKExample(log_default);
|
|
397095
397091
|
await sdkExample2.run({
|
|
397096
397092
|
addressProvider,
|
|
397097
397093
|
addressProviderJson,
|
|
@@ -397203,7 +397199,7 @@ function getRenderer(opts) {
|
|
|
397203
397199
|
var package_default = {
|
|
397204
397200
|
name: "@gearbox-protocol/deploy-tools",
|
|
397205
397201
|
description: "Gearbox deploy tools",
|
|
397206
|
-
version: "5.2.
|
|
397202
|
+
version: "5.2.3",
|
|
397207
397203
|
homepage: "https://gearbox.fi",
|
|
397208
397204
|
keywords: [
|
|
397209
397205
|
"gearbox"
|
|
@@ -397246,7 +397242,7 @@ var package_default = {
|
|
|
397246
397242
|
"@gearbox-protocol/deploy-tools-node": "0.0.0",
|
|
397247
397243
|
"@gearbox-protocol/deploy-tools-shared": "0.0.0",
|
|
397248
397244
|
"@gearbox-protocol/deploy-tools-types": "0.0.0",
|
|
397249
|
-
"@gearbox-protocol/sdk": "^3.0.0-vfour.
|
|
397245
|
+
"@gearbox-protocol/sdk": "^3.0.0-vfour.134",
|
|
397250
397246
|
"@gearbox-protocol/sdk-gov": "^2.33.1",
|
|
397251
397247
|
"@types/lodash-es": "^4.17.12",
|
|
397252
397248
|
"@types/node": "^22.10.2",
|
|
@@ -397346,6 +397342,7 @@ function printSafeTx() {
|
|
|
397346
397342
|
}
|
|
397347
397343
|
|
|
397348
397344
|
// src/commands/sdk-example.ts
|
|
397345
|
+
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
397349
397346
|
import path10 from "node:path";
|
|
397350
397347
|
function sdkExample() {
|
|
397351
397348
|
return newCommand().name("sdk-example").description("SDK example for v3.1").addOption(
|
|
@@ -397367,7 +397364,7 @@ function sdkExample() {
|
|
|
397367
397364
|
anvilUrl = "http://127.0.0.1:8545",
|
|
397368
397365
|
sharedDir = "."
|
|
397369
397366
|
} = opts;
|
|
397370
|
-
const sdkExample2 = new
|
|
397367
|
+
const sdkExample2 = new SDKExample(log_default);
|
|
397371
397368
|
await sdkExample2.run({
|
|
397372
397369
|
addressProvider,
|
|
397373
397370
|
addressProviderJson,
|
|
@@ -397382,6 +397379,17 @@ function sdkExample() {
|
|
|
397382
397379
|
"stateAfter.human.json"
|
|
397383
397380
|
)
|
|
397384
397381
|
});
|
|
397382
|
+
try {
|
|
397383
|
+
const marketsState = sdkExample2.sdk.marketRegister.markets.map(
|
|
397384
|
+
(m) => m.state
|
|
397385
|
+
);
|
|
397386
|
+
await writeFile7(
|
|
397387
|
+
path10.resolve(sharedDir, "deploy-state", "markets.json"),
|
|
397388
|
+
json_stringify(marketsState),
|
|
397389
|
+
"utf-8"
|
|
397390
|
+
);
|
|
397391
|
+
} catch {
|
|
397392
|
+
}
|
|
397385
397393
|
log_default.info("done");
|
|
397386
397394
|
});
|
|
397387
397395
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/deploy-tools",
|
|
3
3
|
"description": "Gearbox deploy tools",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.3",
|
|
5
5
|
"homepage": "https://gearbox.fi",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"gearbox"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@gearbox-protocol/deploy-tools-node": "0.0.0",
|
|
45
45
|
"@gearbox-protocol/deploy-tools-shared": "0.0.0",
|
|
46
46
|
"@gearbox-protocol/deploy-tools-types": "0.0.0",
|
|
47
|
-
"@gearbox-protocol/sdk": "^3.0.0-vfour.
|
|
47
|
+
"@gearbox-protocol/sdk": "^3.0.0-vfour.134",
|
|
48
48
|
"@gearbox-protocol/sdk-gov": "^2.33.1",
|
|
49
49
|
"@types/lodash-es": "^4.17.12",
|
|
50
50
|
"@types/node": "^22.10.2",
|