@aave-dao/aave-helpers-js 1.3.2 → 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 +11 -11
- package/dist/cli.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{protocol-diff-v4-EkiH1uMz.mjs → protocol-diff-v4-BOP7s2hK.mjs} +1 -1
- package/dist/{protocol-diff-v4-BqIv2trv.cjs → protocol-diff-v4-DjXSe_sS.cjs} +15 -15
- package/package.json +3 -3
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-
|
|
3
|
-
let
|
|
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,
|
|
58
|
-
const bs58Hash = await (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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:
|
|
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,
|
|
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,
|
|
158
|
-
return (0,
|
|
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-
|
|
3
|
-
import { Aip, IPayloadsController_ABI, cidV0ToBs58, getMdContractName, getPayloadsController, hash, makePayloadExecutableOnTestClient, parseFrontmatterMd, renderTenderlyReport, tenderly_createVnet } from "@
|
|
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-
|
|
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-
|
|
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 "@
|
|
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";
|
|
@@ -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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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) {
|
|
@@ -6834,7 +6834,7 @@ const eventDb = [
|
|
|
6834
6834
|
//#region sections/logs.ts
|
|
6835
6835
|
async function renderLogsSection(logs, chainId) {
|
|
6836
6836
|
if (!logs || !logs.length) return "";
|
|
6837
|
-
const parsed = (0,
|
|
6837
|
+
const parsed = (0, _aave_dao_toolbox.parseLogs)({
|
|
6838
6838
|
logs: logs.map((log) => ({
|
|
6839
6839
|
topics: log.topics,
|
|
6840
6840
|
data: log.data,
|
|
@@ -6842,7 +6842,7 @@ async function renderLogsSection(logs, chainId) {
|
|
|
6842
6842
|
})),
|
|
6843
6843
|
eventDb
|
|
6844
6844
|
});
|
|
6845
|
-
const entries = (await (0,
|
|
6845
|
+
const entries = (await (0, _aave_dao_toolbox.enhanceLogs)((0, _aave_dao_toolbox.getClient)(chainId, {}), parsed)).map((log, i) => {
|
|
6846
6846
|
const emitter = logs[i].emitter;
|
|
6847
6847
|
let event;
|
|
6848
6848
|
if (log.eventName) {
|
|
@@ -6931,7 +6931,7 @@ async function diffSnapshots(before, after) {
|
|
|
6931
6931
|
//#endregion
|
|
6932
6932
|
//#region formatters-v4.ts
|
|
6933
6933
|
function getExplorerClient(chainId) {
|
|
6934
|
-
return (0,
|
|
6934
|
+
return (0, _aave_dao_toolbox.getClient)(chainId, {});
|
|
6935
6935
|
}
|
|
6936
6936
|
function addressLink(value, chainId) {
|
|
6937
6937
|
return toAddressLink(value, true, getExplorerClient(chainId));
|
|
@@ -7096,7 +7096,7 @@ function renderDynamicConfigsBlock(before, after) {
|
|
|
7096
7096
|
return md;
|
|
7097
7097
|
}
|
|
7098
7098
|
function reserveHeader(reserve, spokeAddr, reserveId, chainId) {
|
|
7099
|
-
const client = (0,
|
|
7099
|
+
const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
|
|
7100
7100
|
const underlyingLink = toAddressLink(reserve.underlying, true, client);
|
|
7101
7101
|
const spokeLink = toAddressLink(spokeAddr, true, client);
|
|
7102
7102
|
return `### ${reserve.symbol} (${underlyingLink}) on Spoke ${spokeLink} [reserveId: ${reserveId}]\n\n`;
|
|
@@ -7173,7 +7173,7 @@ const FIELD_ORDER$2 = [
|
|
|
7173
7173
|
"premiumOffsetRay"
|
|
7174
7174
|
];
|
|
7175
7175
|
function hubAssetHeader(asset, hubAddr, assetId, chainId) {
|
|
7176
|
-
const hubLink = toAddressLink(hubAddr, true, (0,
|
|
7176
|
+
const hubLink = toAddressLink(hubAddr, true, (0, _aave_dao_toolbox.getClient)(chainId, {}));
|
|
7177
7177
|
return `### ${asset.symbol} (assetId: ${assetId}) on Hub ${hubLink}\n\n`;
|
|
7178
7178
|
}
|
|
7179
7179
|
function renderNewHubAsset(asset, hubAddr, assetId, ctx) {
|
|
@@ -7244,7 +7244,7 @@ function parseConfigKey(key) {
|
|
|
7244
7244
|
};
|
|
7245
7245
|
}
|
|
7246
7246
|
function configHeader(cfg, hubAddr, assetId, spokeAddr, chainId) {
|
|
7247
|
-
const client = (0,
|
|
7247
|
+
const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
|
|
7248
7248
|
const hubLink = toAddressLink(hubAddr, true, client);
|
|
7249
7249
|
const spokeLink = toAddressLink(spokeAddr, true, client);
|
|
7250
7250
|
return `### ${cfg.assetSymbol} (assetId: ${assetId}) on Hub ${hubLink} / Spoke ${spokeLink}\n\n`;
|
|
@@ -7306,7 +7306,7 @@ const FIELD_ORDER = [
|
|
|
7306
7306
|
"maxUserReservesLimit"
|
|
7307
7307
|
];
|
|
7308
7308
|
function spokeHeader(spokeAddr, chainId) {
|
|
7309
|
-
return `### Spoke ${toAddressLink(spokeAddr, true, (0,
|
|
7309
|
+
return `### Spoke ${toAddressLink(spokeAddr, true, (0, _aave_dao_toolbox.getClient)(chainId, {}))}\n\n`;
|
|
7310
7310
|
}
|
|
7311
7311
|
function renderNewSpokeLiq(config, spokeAddr, ctx) {
|
|
7312
7312
|
let md = spokeHeader(spokeAddr, ctx.chainId);
|
|
@@ -7356,7 +7356,7 @@ function renderPositionManagersSection(before, after) {
|
|
|
7356
7356
|
const beforePm = before.positionManagers ?? {};
|
|
7357
7357
|
const afterPm = after.positionManagers ?? {};
|
|
7358
7358
|
const allSpokes = new Set([...Object.keys(beforePm), ...Object.keys(afterPm)]);
|
|
7359
|
-
const client = (0,
|
|
7359
|
+
const client = (0, _aave_dao_toolbox.getClient)(after.chainId, {});
|
|
7360
7360
|
const rows = [];
|
|
7361
7361
|
for (const spokeAddr of allSpokes) {
|
|
7362
7362
|
const beforeSpoke = beforePm[spokeAddr] ?? {};
|
|
@@ -7398,7 +7398,7 @@ function diffSets(b, a) {
|
|
|
7398
7398
|
}
|
|
7399
7399
|
function renderAddrList(values, chainId) {
|
|
7400
7400
|
if (values.length === 0) return "*(none)*";
|
|
7401
|
-
const client = (0,
|
|
7401
|
+
const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
|
|
7402
7402
|
return values.map((v) => toAddressLink(v, true, client)).join(", ");
|
|
7403
7403
|
}
|
|
7404
7404
|
function diffTargetSelectorPairs(b, a) {
|
|
@@ -7420,7 +7420,7 @@ function renderRoleDiff(amAddr, roleId, before, after, chainId) {
|
|
|
7420
7420
|
const targetSelectors = diffTargetSelectorPairs(before, after);
|
|
7421
7421
|
const labelChanged = (before?.label ?? "") !== (after?.label ?? "");
|
|
7422
7422
|
if (!labelChanged && members.added.length === 0 && members.removed.length === 0 && targetSelectors.added.length === 0 && targetSelectors.removed.length === 0) return "";
|
|
7423
|
-
const client = (0,
|
|
7423
|
+
const client = (0, _aave_dao_toolbox.getClient)(chainId, {});
|
|
7424
7424
|
let md = `#### ${toAddressLink(amAddr, true, client)} role ${roleId}`;
|
|
7425
7425
|
if ((after ?? before)?.label) md += ` (${(after ?? before).label})`;
|
|
7426
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.
|
|
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.
|
|
32
|
-
"@
|
|
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",
|