@aave-dao/aave-helpers-js 1.3.1 → 1.3.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/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- const require_protocol_diff_v4 = require('./protocol-diff-v4-BVmy9cTR.cjs');
3
- let _bgd_labs_toolbox = require("@bgd-labs/toolbox");
2
+ const require_protocol_diff_v4 = require('./protocol-diff-v4-DjXSe_sS.cjs');
3
+ let _aave_dao_toolbox = require("@aave-dao/toolbox");
4
4
  let viem = require("viem");
5
5
  let fs = require("fs");
6
6
  let path = require("path");
@@ -54,8 +54,8 @@ program.command("ipfs").description("generates the ipfs hash for specified sourc
54
54
  const filePath = (0, path.join)(process.cwd(), source);
55
55
  if (!(0, fs.existsSync)(filePath)) throw new Error("FILE_NOT_FOUND");
56
56
  const content = (0, fs.readFileSync)(filePath, "utf8");
57
- (0, _bgd_labs_toolbox.Aip)((0, _bgd_labs_toolbox.parseFrontmatterMd)(content).data);
58
- const bs58Hash = await (0, _bgd_labs_toolbox.cidV0ToBs58)(await (0, _bgd_labs_toolbox.hash)(content));
57
+ (0, _aave_dao_toolbox.Aip)((0, _aave_dao_toolbox.parseFrontmatterMd)(content).data);
58
+ const bs58Hash = await (0, _aave_dao_toolbox.cidV0ToBs58)(await (0, _aave_dao_toolbox.hash)(content));
59
59
  if (upload) {
60
60
  const [pinata, thegraph] = await Promise.all([uploadToPinata(content), uploadToTheGraph(content)]);
61
61
  if (verbose) {
@@ -69,7 +69,7 @@ function flagAsKnown(value, reference) {
69
69
  return `${value} [:ghost:](https://github.com/aave-dao/aave-address-book "${reference}")`;
70
70
  }
71
71
  program.command("seatbelt-report").description("generates a seatbelt report for the payload").addOption(new commander.Option("-c,--chainId <number>").makeOptionMandatory()).addOption(new commander.Option("--pi,--payloadId <number>")).addOption(new commander.Option("--pa, --payloadAddress <address>")).addOption(new commander.Option("--pb,--payloadBytecode <hex>")).addOption(new commander.Option("--pcd,--payloadCalldata <hex>")).addOption(new commander.Option("--pc, --payloadsController <address>").makeOptionMandatory()).addOption(new commander.Option("-o, --output <output path>").default("./reports/seatbelt/")).addOption(new commander.Option("-t, --tenderlyAccessToken <string>", "defaults to env.TENDERLY_ACCESS_TOKEN")).addOption(new commander.Option("-a, --tenderlyAccountSlug <string>", "defaults to env.TENDERLY_ACCOUNT_SLUG")).addOption(new commander.Option("-p, --tenderlyProjectSlug <string>", "defaults to env.TENDERLY_PROJECT_SLUG")).addOption(new commander.Option("-e, --etherscanApiKey <string>", "defaults to env.ETHERSCAN_API_KEY")).action(async ({ chainId, tenderlyAccessToken, tenderlyAccountSlug, tenderlyProjectSlug, output, payloadId, payloadAddress, payloadBytecode, payloadCalldata, payloadsController }) => {
72
- const vnet = await (0, _bgd_labs_toolbox.tenderly_createVnet)({
72
+ const vnet = await (0, _aave_dao_toolbox.tenderly_createVnet)({
73
73
  baseChainId: Number(chainId),
74
74
  forkChainId: 3030,
75
75
  slug: `${Math.floor(Math.random() * 1e3)}acli-aave-dao-vnet-${chainId}`,
@@ -79,7 +79,7 @@ program.command("seatbelt-report").description("generates a seatbelt report for
79
79
  accountSlug: tenderlyAccountSlug || process.env.TENDERLY_ACCOUNT_SLUG,
80
80
  projectSlug: tenderlyProjectSlug || process.env.TENDERLY_PROJECT_SLUG
81
81
  });
82
- const controllerContract = (0, _bgd_labs_toolbox.getPayloadsController)(vnet.walletClient, payloadsController);
82
+ const controllerContract = (0, _aave_dao_toolbox.getPayloadsController)(vnet.walletClient, payloadsController);
83
83
  let currentId = 0;
84
84
  let sender = viem.zeroAddress;
85
85
  try {
@@ -121,13 +121,13 @@ program.command("seatbelt-report").description("generates a seatbelt report for
121
121
  chain: vnet.walletClient.chain
122
122
  });
123
123
  }
124
- await (0, _bgd_labs_toolbox.makePayloadExecutableOnTestClient)(vnet.testClient, payloadsController, currentId);
124
+ await (0, _aave_dao_toolbox.makePayloadExecutableOnTestClient)(vnet.testClient, payloadsController, currentId);
125
125
  const simResult = await vnet.simulate({
126
126
  network_id: chainId.toString(),
127
127
  from: sender,
128
128
  to: payloadsController,
129
129
  input: (0, viem.encodeFunctionData)({
130
- abi: _bgd_labs_toolbox.IPayloadsController_ABI,
130
+ abi: _aave_dao_toolbox.IPayloadsController_ABI,
131
131
  functionName: "executePayload",
132
132
  args: [currentId]
133
133
  }),
@@ -145,7 +145,7 @@ program.command("seatbelt-report").description("generates a seatbelt report for
145
145
  account: (0, viem_accounts.toAccount)(sender),
146
146
  chain: vnet.walletClient.chain
147
147
  });
148
- const report = await (0, _bgd_labs_toolbox.renderTenderlyReport)({
148
+ const report = await (0, _aave_dao_toolbox.renderTenderlyReport)({
149
149
  client: vnet.walletClient,
150
150
  sim: simResult,
151
151
  payloadId: currentId,
@@ -154,8 +154,8 @@ program.command("seatbelt-report").description("generates a seatbelt report for
154
154
  config: { etherscanApiKey: process.env.ETHERSCAN_API_KEY },
155
155
  getContractName: (sim, address) => {
156
156
  const references = (0, _aave_dao_aave_address_book_utils.getAddressBookReferences)(address, Number(sim.simulation.network_id));
157
- if (references.length > 0) return flagAsKnown((0, _bgd_labs_toolbox.getMdContractName)(sim.contracts, address), references[0]);
158
- return (0, _bgd_labs_toolbox.getMdContractName)(sim.contracts, address);
157
+ if (references.length > 0) return flagAsKnown((0, _aave_dao_toolbox.getMdContractName)(sim.contracts, address), references[0]);
158
+ return (0, _aave_dao_toolbox.getMdContractName)(sim.contracts, address);
159
159
  }
160
160
  });
161
161
  const filePath = `${output}/${chainId}_${payloadsController}`;
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { n as diffSnapshots, t as diffV4Snapshots } from "./protocol-diff-v4-7huxoHpS.mjs";
3
- import { Aip, IPayloadsController_ABI, cidV0ToBs58, getMdContractName, getPayloadsController, hash, makePayloadExecutableOnTestClient, parseFrontmatterMd, renderTenderlyReport, tenderly_createVnet } from "@bgd-labs/toolbox";
2
+ import { n as diffSnapshots, t as diffV4Snapshots } from "./protocol-diff-v4-BOP7s2hK.mjs";
3
+ import { Aip, IPayloadsController_ABI, cidV0ToBs58, getMdContractName, getPayloadsController, hash, makePayloadExecutableOnTestClient, parseFrontmatterMd, renderTenderlyReport, tenderly_createVnet } from "@aave-dao/toolbox";
4
4
  import { encodeFunctionData, parseAbi, zeroAddress } from "viem";
5
5
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
6
6
  import { dirname, join } from "path";
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_protocol_diff_v4 = require('./protocol-diff-v4-BVmy9cTR.cjs');
2
+ const require_protocol_diff_v4 = require('./protocol-diff-v4-DjXSe_sS.cjs');
3
3
 
4
4
  exports.diff = require_protocol_diff_v4.diff;
5
5
  exports.diffSnapshots = require_protocol_diff_v4.diffSnapshots;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as hasChanges, i as diff, n as diffSnapshots, o as isChange, r as eventDb, t as diffV4Snapshots } from "./protocol-diff-v4-7huxoHpS.mjs";
1
+ import { a as hasChanges, i as diff, n as diffSnapshots, o as isChange, r as eventDb, t as diffV4Snapshots } from "./protocol-diff-v4-BOP7s2hK.mjs";
2
2
 
3
3
  export { diff, diffSnapshots, diffV4Snapshots, eventDb, hasChanges, isChange };
@@ -1,4 +1,4 @@
1
- import { bitmapToIndexes, enhanceLogs, getClient, parseLogs } from "@bgd-labs/toolbox";
1
+ import { bitmapToIndexes, enhanceLogs, getClient, parseLogs } from "@aave-dao/toolbox";
2
2
  import { formatUnits, getAddress } from "viem";
3
3
  import * as addresses from "@aave-dao/aave-address-book";
4
4
  import { findObjectPaths } from "find-object-paths";
@@ -6756,6 +6756,49 @@ const eventDb = [
6756
6756
  }],
6757
6757
  name: "UpdateReserveSource",
6758
6758
  type: "event"
6759
+ },
6760
+ {
6761
+ anonymous: false,
6762
+ inputs: [
6763
+ {
6764
+ indexed: true,
6765
+ internalType: "address",
6766
+ name: "hub",
6767
+ type: "address"
6768
+ },
6769
+ {
6770
+ indexed: true,
6771
+ internalType: "uint256",
6772
+ name: "assetId",
6773
+ type: "uint256"
6774
+ },
6775
+ {
6776
+ indexed: false,
6777
+ internalType: "uint256",
6778
+ name: "optimalUsageRatio",
6779
+ type: "uint256"
6780
+ },
6781
+ {
6782
+ indexed: false,
6783
+ internalType: "uint256",
6784
+ name: "baseDrawnRate",
6785
+ type: "uint256"
6786
+ },
6787
+ {
6788
+ indexed: false,
6789
+ internalType: "uint256",
6790
+ name: "rateGrowthBeforeOptimal",
6791
+ type: "uint256"
6792
+ },
6793
+ {
6794
+ indexed: false,
6795
+ internalType: "uint256",
6796
+ name: "rateGrowthAfterOptimal",
6797
+ type: "uint256"
6798
+ }
6799
+ ],
6800
+ name: "UpdateInterestRateData",
6801
+ type: "event"
6759
6802
  }
6760
6803
  ];
6761
6804
 
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- let _bgd_labs_toolbox = require("@bgd-labs/toolbox");
28
+ let _aave_dao_toolbox = require("@aave-dao/toolbox");
29
29
  let viem = require("viem");
30
30
  let _aave_dao_aave_address_book = require("@aave-dao/aave-address-book");
31
31
  _aave_dao_aave_address_book = __toESM(_aave_dao_aave_address_book);
@@ -100,7 +100,7 @@ function boolToMarkdown(value) {
100
100
  //#endregion
101
101
  //#region formatters.ts
102
102
  function getExplorerClient$1(chainId) {
103
- return (0, _bgd_labs_toolbox.getClient)(chainId, {});
103
+ return (0, _aave_dao_toolbox.getClient)(chainId, {});
104
104
  }
105
105
  function addressLink$1(value, chainId) {
106
106
  return toAddressLink(value, true, getExplorerClient$1(chainId));
@@ -172,7 +172,7 @@ emodeFormatters["ltv"] = (value) => `${(0, viem.formatUnits)(BigInt(value), 2)}
172
172
  emodeFormatters["liquidationThreshold"] = (value) => `${(0, viem.formatUnits)(BigInt(value), 2)} %`;
173
173
  emodeFormatters["liquidationBonus"] = (value) => value === 0 ? "0 %" : `${(value - 1e4) / 100} % [${value}]`;
174
174
  emodeFormatters["borrowableBitmap"] = (value, ctx) => {
175
- const indexes = (0, _bgd_labs_toolbox.bitmapToIndexes)(BigInt(value));
175
+ const indexes = (0, _aave_dao_toolbox.bitmapToIndexes)(BigInt(value));
176
176
  if (!ctx.snapshot) return indexes.join(", ");
177
177
  const reserveKeys = Object.keys(ctx.snapshot.reserves);
178
178
  return indexes.map((i) => {
@@ -350,7 +350,7 @@ function sortKeys$1(keys) {
350
350
  });
351
351
  }
352
352
  function reserveHeadline(reserve, chainId) {
353
- const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
353
+ const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
354
354
  const link = toAddressLink(reserve.underlying, true, client);
355
355
  return `#### ${reserve.symbol} (${link})\n\n`;
356
356
  }
@@ -531,7 +531,7 @@ function renderPoolConfigSection(diffResult, chainId) {
531
531
  const configDiff = diffResult.poolConfig;
532
532
  const changedKeys = Object.keys(configDiff).filter((key) => isChange(configDiff[key]));
533
533
  if (!changedKeys.length) return "";
534
- const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
534
+ const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
535
535
  let md = "## Pool config changes\n\n";
536
536
  md += "| description | value before | value after |\n| --- | --- | --- |\n";
537
537
  for (const key of changedKeys) {
@@ -6784,6 +6784,49 @@ const eventDb = [
6784
6784
  }],
6785
6785
  name: "UpdateReserveSource",
6786
6786
  type: "event"
6787
+ },
6788
+ {
6789
+ anonymous: false,
6790
+ inputs: [
6791
+ {
6792
+ indexed: true,
6793
+ internalType: "address",
6794
+ name: "hub",
6795
+ type: "address"
6796
+ },
6797
+ {
6798
+ indexed: true,
6799
+ internalType: "uint256",
6800
+ name: "assetId",
6801
+ type: "uint256"
6802
+ },
6803
+ {
6804
+ indexed: false,
6805
+ internalType: "uint256",
6806
+ name: "optimalUsageRatio",
6807
+ type: "uint256"
6808
+ },
6809
+ {
6810
+ indexed: false,
6811
+ internalType: "uint256",
6812
+ name: "baseDrawnRate",
6813
+ type: "uint256"
6814
+ },
6815
+ {
6816
+ indexed: false,
6817
+ internalType: "uint256",
6818
+ name: "rateGrowthBeforeOptimal",
6819
+ type: "uint256"
6820
+ },
6821
+ {
6822
+ indexed: false,
6823
+ internalType: "uint256",
6824
+ name: "rateGrowthAfterOptimal",
6825
+ type: "uint256"
6826
+ }
6827
+ ],
6828
+ name: "UpdateInterestRateData",
6829
+ type: "event"
6787
6830
  }
6788
6831
  ];
6789
6832
 
@@ -6791,7 +6834,7 @@ const eventDb = [
6791
6834
  //#region sections/logs.ts
6792
6835
  async function renderLogsSection(logs, chainId) {
6793
6836
  if (!logs || !logs.length) return "";
6794
- const parsed = (0, _bgd_labs_toolbox.parseLogs)({
6837
+ const parsed = (0, _aave_dao_toolbox.parseLogs)({
6795
6838
  logs: logs.map((log) => ({
6796
6839
  topics: log.topics,
6797
6840
  data: log.data,
@@ -6799,7 +6842,7 @@ async function renderLogsSection(logs, chainId) {
6799
6842
  })),
6800
6843
  eventDb
6801
6844
  });
6802
- const entries = (await (0, _bgd_labs_toolbox.enhanceLogs)((0, _bgd_labs_toolbox.getClient)(chainId, {}), parsed)).map((log, i) => {
6845
+ const entries = (await (0, _aave_dao_toolbox.enhanceLogs)((0, _aave_dao_toolbox.getClient)(chainId, {}), parsed)).map((log, i) => {
6803
6846
  const emitter = logs[i].emitter;
6804
6847
  let event;
6805
6848
  if (log.eventName) {
@@ -6888,7 +6931,7 @@ async function diffSnapshots(before, after) {
6888
6931
  //#endregion
6889
6932
  //#region formatters-v4.ts
6890
6933
  function getExplorerClient(chainId) {
6891
- return (0, _bgd_labs_toolbox.getClient)(chainId, {});
6934
+ return (0, _aave_dao_toolbox.getClient)(chainId, {});
6892
6935
  }
6893
6936
  function addressLink(value, chainId) {
6894
6937
  return toAddressLink(value, true, getExplorerClient(chainId));
@@ -7053,7 +7096,7 @@ function renderDynamicConfigsBlock(before, after) {
7053
7096
  return md;
7054
7097
  }
7055
7098
  function reserveHeader(reserve, spokeAddr, reserveId, chainId) {
7056
- const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
7099
+ const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
7057
7100
  const underlyingLink = toAddressLink(reserve.underlying, true, client);
7058
7101
  const spokeLink = toAddressLink(spokeAddr, true, client);
7059
7102
  return `### ${reserve.symbol} (${underlyingLink}) on Spoke ${spokeLink} [reserveId: ${reserveId}]\n\n`;
@@ -7130,7 +7173,7 @@ const FIELD_ORDER$2 = [
7130
7173
  "premiumOffsetRay"
7131
7174
  ];
7132
7175
  function hubAssetHeader(asset, hubAddr, assetId, chainId) {
7133
- const hubLink = toAddressLink(hubAddr, true, (0, _bgd_labs_toolbox.getClient)(chainId, {}));
7176
+ const hubLink = toAddressLink(hubAddr, true, (0, _aave_dao_toolbox.getClient)(chainId, {}));
7134
7177
  return `### ${asset.symbol} (assetId: ${assetId}) on Hub ${hubLink}\n\n`;
7135
7178
  }
7136
7179
  function renderNewHubAsset(asset, hubAddr, assetId, ctx) {
@@ -7201,7 +7244,7 @@ function parseConfigKey(key) {
7201
7244
  };
7202
7245
  }
7203
7246
  function configHeader(cfg, hubAddr, assetId, spokeAddr, chainId) {
7204
- const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
7247
+ const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
7205
7248
  const hubLink = toAddressLink(hubAddr, true, client);
7206
7249
  const spokeLink = toAddressLink(spokeAddr, true, client);
7207
7250
  return `### ${cfg.assetSymbol} (assetId: ${assetId}) on Hub ${hubLink} / Spoke ${spokeLink}\n\n`;
@@ -7263,7 +7306,7 @@ const FIELD_ORDER = [
7263
7306
  "maxUserReservesLimit"
7264
7307
  ];
7265
7308
  function spokeHeader(spokeAddr, chainId) {
7266
- return `### Spoke ${toAddressLink(spokeAddr, true, (0, _bgd_labs_toolbox.getClient)(chainId, {}))}\n\n`;
7309
+ return `### Spoke ${toAddressLink(spokeAddr, true, (0, _aave_dao_toolbox.getClient)(chainId, {}))}\n\n`;
7267
7310
  }
7268
7311
  function renderNewSpokeLiq(config, spokeAddr, ctx) {
7269
7312
  let md = spokeHeader(spokeAddr, ctx.chainId);
@@ -7313,7 +7356,7 @@ function renderPositionManagersSection(before, after) {
7313
7356
  const beforePm = before.positionManagers ?? {};
7314
7357
  const afterPm = after.positionManagers ?? {};
7315
7358
  const allSpokes = new Set([...Object.keys(beforePm), ...Object.keys(afterPm)]);
7316
- const client = (0, _bgd_labs_toolbox.getClient)(after.chainId, {});
7359
+ const client = (0, _aave_dao_toolbox.getClient)(after.chainId, {});
7317
7360
  const rows = [];
7318
7361
  for (const spokeAddr of allSpokes) {
7319
7362
  const beforeSpoke = beforePm[spokeAddr] ?? {};
@@ -7355,7 +7398,7 @@ function diffSets(b, a) {
7355
7398
  }
7356
7399
  function renderAddrList(values, chainId) {
7357
7400
  if (values.length === 0) return "*(none)*";
7358
- const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
7401
+ const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
7359
7402
  return values.map((v) => toAddressLink(v, true, client)).join(", ");
7360
7403
  }
7361
7404
  function diffTargetSelectorPairs(b, a) {
@@ -7377,7 +7420,7 @@ function renderRoleDiff(amAddr, roleId, before, after, chainId) {
7377
7420
  const targetSelectors = diffTargetSelectorPairs(before, after);
7378
7421
  const labelChanged = (before?.label ?? "") !== (after?.label ?? "");
7379
7422
  if (!labelChanged && members.added.length === 0 && members.removed.length === 0 && targetSelectors.added.length === 0 && targetSelectors.removed.length === 0) return "";
7380
- const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
7423
+ const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
7381
7424
  let md = `#### ${toAddressLink(amAddr, true, client)} role ${roleId}`;
7382
7425
  if ((after ?? before)?.label) md += ` (${(after ?? before).label})`;
7383
7426
  md += "\n\n";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aave-dao/aave-helpers-js",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,8 +28,8 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@aave-dao/aave-address-book": "^4.52.5",
32
- "@bgd-labs/toolbox": "^0.2.24",
31
+ "@aave-dao/aave-address-book": "^4.55.0",
32
+ "@aave-dao/toolbox": "^0.5.0",
33
33
  "commander": "^14.0.3",
34
34
  "find-object-paths": "^1.1.0",
35
35
  "viem": "^2.45.3",