@gearbox-protocol/deploy-tools 1.6.0-next.12 → 1.6.0-next.14

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.
Files changed (2) hide show
  1. package/dist/index.js +66 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -264191,6 +264191,38 @@ var require_cjs2 = __commonJS({
264191
264191
  var require_EtherscanVerifier = __commonJS({
264192
264192
  "../../packages/lib/dist/EtherscanVerifier.js"(exports2) {
264193
264193
  "use strict";
264194
+ var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
264195
+ if (k2 === void 0)
264196
+ k2 = k;
264197
+ var desc = Object.getOwnPropertyDescriptor(m, k);
264198
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
264199
+ desc = { enumerable: true, get: function() {
264200
+ return m[k];
264201
+ } };
264202
+ }
264203
+ Object.defineProperty(o, k2, desc);
264204
+ } : function(o, m, k, k2) {
264205
+ if (k2 === void 0)
264206
+ k2 = k;
264207
+ o[k2] = m[k];
264208
+ });
264209
+ var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
264210
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
264211
+ } : function(o, v) {
264212
+ o["default"] = v;
264213
+ });
264214
+ var __importStar2 = exports2 && exports2.__importStar || function(mod) {
264215
+ if (mod && mod.__esModule)
264216
+ return mod;
264217
+ var result = {};
264218
+ if (mod != null) {
264219
+ for (var k in mod)
264220
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
264221
+ __createBinding2(result, mod, k);
264222
+ }
264223
+ __setModuleDefault2(result, mod);
264224
+ return result;
264225
+ };
264194
264226
  var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
264195
264227
  return mod && mod.__esModule ? mod : { "default": mod };
264196
264228
  };
@@ -264199,7 +264231,7 @@ var require_EtherscanVerifier = __commonJS({
264199
264231
  var node_fs_1 = require("fs");
264200
264232
  var promises_1 = require("fs/promises");
264201
264233
  var node_path_1 = __importDefault2(require("path"));
264202
- var axios_1 = __importDefault2(require_axios());
264234
+ var axios_1 = __importStar2(require_axios());
264203
264235
  var axios_retry_1 = __importDefault2(require_cjs2());
264204
264236
  var log_1 = __importDefault2(require_log());
264205
264237
  var _logger, _etherscanApi, _cacheDir, _cachePolicy, _result, _verify, verify_fn, _getCached, getCached_fn, _saveCached, saveCached_fn;
@@ -264228,22 +264260,23 @@ var require_EtherscanVerifier = __commonJS({
264228
264260
  }));
264229
264261
  __privateGet(this, _etherscanApi).interceptors.response.use(async (response) => {
264230
264262
  var _a, _b, _c;
264231
- if (response.status === 200 && ((_a = response.data) == null ? void 0 : _a.status) === "0" && ((_c = (_b = response.data) == null ? void 0 : _b.message) == null ? void 0 : _c.startsWith("Max rate"))) {
264263
+ if (response.status === 200 && ((_a = response.data) == null ? void 0 : _a.status) === "0" && ((_c = (_b = response.data) == null ? void 0 : _b.result) == null ? void 0 : _c.startsWith("Max rate"))) {
264232
264264
  response.status = 429;
264265
+ throw new axios_1.AxiosError("maxrate", "429", response.config, response.request, response);
264233
264266
  }
264234
264267
  return response;
264235
264268
  });
264236
264269
  (0, axios_retry_1.default)(__privateGet(this, _etherscanApi), {
264237
264270
  retries: 5,
264238
264271
  retryCondition: (e) => {
264239
- var _a, _b, _c, _d;
264240
- __privateGet(this, _logger).trace(`Etherscan error, status ${(_a = e.response) == null ? void 0 : _a.status}, msg: ${(_b = e.response) == null ? void 0 : _b.data}`);
264241
- if (((_c = e.response) == null ? void 0 : _c.status) === 429) {
264272
+ var _a, _b, _c, _d, _e;
264273
+ __privateGet(this, _logger).trace(`Etherscan error, status ${(_a = e.response) == null ? void 0 : _a.status}, msg: ${(_c = (_b = e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.result}`);
264274
+ if (((_d = e.response) == null ? void 0 : _d.status) === 429) {
264242
264275
  return true;
264243
264276
  }
264244
264277
  try {
264245
- const resp = (_d = e.response) == null ? void 0 : _d.data;
264246
- return resp.status === "0" && resp.message.startsWith("Max rate");
264278
+ const resp = (_e = e.response) == null ? void 0 : _e.data;
264279
+ return resp.status === "0" && resp.result.startsWith("Max rate");
264247
264280
  } catch {
264248
264281
  }
264249
264282
  return false;
@@ -264307,11 +264340,6 @@ var require_EtherscanVerifier = __commonJS({
264307
264340
  }
264308
264341
  });
264309
264342
  if (resp.data.status === "0") {
264310
- __privateGet(this, _logger).trace({
264311
- data: resp.data,
264312
- status: resp.status,
264313
- statusText: resp.statusText
264314
- });
264315
264343
  throw new Error(`cannot verify address ${address}: ${resp.data.result}`);
264316
264344
  }
264317
264345
  if (resp.data.result.length === 0 || resp.data.result[0].ABI.startsWith("Contract source code not verified")) {
@@ -313868,7 +313896,7 @@ var require_SafeHelper = __commonJS({
313868
313896
  var utils_1 = require_utils33();
313869
313897
  var SIG_EXECUTE = "0x0825f38f";
313870
313898
  var SIG_QUEUE = "0x3a66f901";
313871
- var _pending, _timelockExecutions, _tenderly, _init, init_fn, _impersonateSafe, impersonateSafe_fn, _validateTransaction, validateTransaction_fn, _validateMultisend, validateMultisend_fn, _validateSingle, validateSingle_fn, _execute, execute_fn, _getTimelockExecute, getTimelockExecute_fn;
313899
+ var _pending, _pairedExecutions, _tenderly, _init, init_fn, _impersonateSafe, impersonateSafe_fn, _validateTransaction, validateTransaction_fn, _validateMultisend, validateMultisend_fn, _validateSingle, validateSingle_fn, _execute, execute_fn, _getPairedExecute, getPairedExecute_fn;
313872
313900
  var _SafeHelper = class _SafeHelper extends SafeBase_1.SafeBase {
313873
313901
  constructor(rpcUrl, options) {
313874
313902
  const provider = new ethers_1.ethers.providers.StaticJsonRpcProvider({
@@ -313898,16 +313926,16 @@ var require_SafeHelper = __commonJS({
313898
313926
  * @param eta
313899
313927
  * @returns
313900
313928
  */
313901
- __privateAdd(this, _getTimelockExecute);
313929
+ __privateAdd(this, _getPairedExecute);
313902
313930
  __privateAdd(this, _pending, []);
313903
- __privateAdd(this, _timelockExecutions, []);
313931
+ __privateAdd(this, _pairedExecutions, []);
313904
313932
  __privateAdd(this, _tenderly, void 0);
313905
313933
  __privateSet(this, _tenderly, rpcUrl.includes("tenderly"));
313906
313934
  }
313907
313935
  /**
313908
313936
  * Executes all found pending transactions, returns array of safe tx hashes
313909
313937
  */
313910
- async run() {
313938
+ async run({ disablePairedExecute, alwaysWarpTime } = {}) {
313911
313939
  if (__privateGet(this, _tenderly)) {
313912
313940
  console.log(chalk_1.default.red("running on tenderly"));
313913
313941
  }
@@ -313918,18 +313946,18 @@ var require_SafeHelper = __commonJS({
313918
313946
  const { timestamp } = await this.provider.getBlock("latest");
313919
313947
  const txInfo = __privateMethod(this, _validateTransaction, validateTransaction_fn).call(this, timestamp, tx);
313920
313948
  const { multisend, isExecute, isQueue, eta } = txInfo;
313921
- if (isExecute) {
313922
- hasRealExecute = true;
313949
+ hasRealExecute || (hasRealExecute = isExecute);
313950
+ if (isExecute || alwaysWarpTime) {
313923
313951
  await (0, utils_1.warpTime)(this.provider, eta + 1, __privateGet(this, _tenderly));
313924
313952
  }
313925
313953
  console.log(`Executing ${txType(txInfo)} ${tx.safeTxHash} with nonce ${tx.nonce} and eta ${eta}`);
313926
313954
  await __privateMethod(this, _execute, execute_fn).call(this, tx);
313927
- if (isQueue) {
313928
- __privateGet(this, _timelockExecutions).push(await __privateMethod(this, _getTimelockExecute, getTimelockExecute_fn).call(this, tx, multisend, eta));
313955
+ if (isQueue && !disablePairedExecute) {
313956
+ __privateGet(this, _pairedExecutions).push(await __privateMethod(this, _getPairedExecute, getPairedExecute_fn).call(this, tx, multisend, eta));
313929
313957
  }
313930
313958
  }
313931
313959
  if (!hasRealExecute) {
313932
- for (const tx of __privateGet(this, _timelockExecutions)) {
313960
+ for (const tx of __privateGet(this, _pairedExecutions)) {
313933
313961
  await (0, utils_1.warpTime)(this.provider, tx.eta + 1, __privateGet(this, _tenderly));
313934
313962
  console.log(`Executing fake execute timelock tx with eta ${tx.eta}`);
313935
313963
  await __privateMethod(this, _execute, execute_fn).call(this, tx.tx);
@@ -313939,7 +313967,7 @@ var require_SafeHelper = __commonJS({
313939
313967
  }
313940
313968
  };
313941
313969
  _pending = new WeakMap();
313942
- _timelockExecutions = new WeakMap();
313970
+ _pairedExecutions = new WeakMap();
313943
313971
  _tenderly = new WeakMap();
313944
313972
  _init = new WeakSet();
313945
313973
  init_fn = async function() {
@@ -314054,8 +314082,18 @@ var require_SafeHelper = __commonJS({
314054
314082
  throw new Error("eta parameter not found");
314055
314083
  }
314056
314084
  const eta = parseInt(data.dataDecoded.parameters[4].value, 10);
314057
- if (eta <= timestamp) {
314058
- throw new Error("ETA is outdated");
314085
+ if (isQueue) {
314086
+ if (eta <= timestamp) {
314087
+ throw new Error(`Validation failed: ETA is outdated in ${method} tx: ${eta} <= ${timestamp}`);
314088
+ }
314089
+ } else {
314090
+ if (timestamp < eta) {
314091
+ throw new Error("Validation failed: executeTransaction: Transaction hasn't surpassed time lock.");
314092
+ }
314093
+ const GRACE_PERIOD = 14 * 24 * 60 * 60;
314094
+ if (timestamp > eta + GRACE_PERIOD) {
314095
+ throw new Error("Validation failed: executeTransaction: Transaction is stale");
314096
+ }
314059
314097
  }
314060
314098
  return {
314061
314099
  isQueue,
@@ -314087,8 +314125,8 @@ var require_SafeHelper = __commonJS({
314087
314125
  console.log(`executed safe tx with nonce ${tx.data.nonce}`);
314088
314126
  }
314089
314127
  };
314090
- _getTimelockExecute = new WeakSet();
314091
- getTimelockExecute_fn = async function(data, multisend, eta) {
314128
+ _getPairedExecute = new WeakSet();
314129
+ getPairedExecute_fn = async function(data, multisend, eta) {
314092
314130
  let tx;
314093
314131
  if (multisend) {
314094
314132
  tx = await this.safe.createTransaction({
@@ -414721,7 +414759,7 @@ var require_package3 = __commonJS({
414721
414759
  module2.exports = {
414722
414760
  name: "@gearbox-protocol/deploy-tools",
414723
414761
  description: "Gearbox deploy tools",
414724
- version: "1.6.0-next.11",
414762
+ version: "1.6.0-next.12",
414725
414763
  homepage: "https://gearbox.fi",
414726
414764
  keywords: [
414727
414765
  "gearbox"
@@ -414854,7 +414892,7 @@ function copyMultisig() {
414854
414892
  ).default("http://127.0.0.1:8545").env("DEV_RPC")
414855
414893
  ).action(async ({ rpcUrl, ...safeOptions }) => {
414856
414894
  const safeHelper = new import_lib2.SafeHelper(rpcUrl, safeOptions);
414857
- const executed = await safeHelper.run();
414895
+ const executed = await safeHelper.run(safeOptions);
414858
414896
  try {
414859
414897
  (0, import_core.exportVariable)("EXECUTED_TRANSACTIONS", executed.join(","));
414860
414898
  } catch (e) {
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": "1.6.0-next.12",
4
+ "version": "1.6.0-next.14",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"