@aave-dao/aave-helpers-js 1.3.0 → 1.3.2
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 +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.mjs +1 -1
- package/dist/{protocol-diff-v4-D8is4kDx.cjs → protocol-diff-v4-BqIv2trv.cjs} +205 -4
- package/dist/{protocol-diff-v4-DJXB5OyC.mjs → protocol-diff-v4-EkiH1uMz.mjs} +205 -4
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_protocol_diff_v4 = require('./protocol-diff-v4-
|
|
2
|
+
const require_protocol_diff_v4 = require('./protocol-diff-v4-BqIv2trv.cjs');
|
|
3
3
|
let _bgd_labs_toolbox = require("@bgd-labs/toolbox");
|
|
4
4
|
let viem = require("viem");
|
|
5
5
|
let fs = require("fs");
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as diffSnapshots, t as diffV4Snapshots } from "./protocol-diff-v4-
|
|
2
|
+
import { n as diffSnapshots, t as diffV4Snapshots } from "./protocol-diff-v4-EkiH1uMz.mjs";
|
|
3
3
|
import { Aip, IPayloadsController_ABI, cidV0ToBs58, getMdContractName, getPayloadsController, hash, makePayloadExecutableOnTestClient, parseFrontmatterMd, renderTenderlyReport, tenderly_createVnet } from "@bgd-labs/toolbox";
|
|
4
4
|
import { encodeFunctionData, parseAbi, zeroAddress } from "viem";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
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-BqIv2trv.cjs');
|
|
3
3
|
|
|
4
4
|
exports.diff = require_protocol_diff_v4.diff;
|
|
5
5
|
exports.diffSnapshots = require_protocol_diff_v4.diffSnapshots;
|
package/dist/index.d.cts
CHANGED
|
@@ -287,6 +287,11 @@ declare const v4SpokeReserveSchema: z.ZodObject<{
|
|
|
287
287
|
collateralFactor: z.ZodNumber;
|
|
288
288
|
maxLiquidationBonus: z.ZodNumber;
|
|
289
289
|
liquidationFee: z.ZodNumber;
|
|
290
|
+
dynamicConfigs: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
291
|
+
collateralFactor: z.ZodNumber;
|
|
292
|
+
maxLiquidationBonus: z.ZodNumber;
|
|
293
|
+
liquidationFee: z.ZodNumber;
|
|
294
|
+
}, z.core.$strip>>;
|
|
290
295
|
oracleAddress: z.ZodString;
|
|
291
296
|
priceSource: z.ZodString;
|
|
292
297
|
oraclePrice: z.ZodString;
|
|
@@ -344,6 +349,11 @@ declare const aaveV4SnapshotSchema: z.ZodObject<{
|
|
|
344
349
|
collateralFactor: z.ZodNumber;
|
|
345
350
|
maxLiquidationBonus: z.ZodNumber;
|
|
346
351
|
liquidationFee: z.ZodNumber;
|
|
352
|
+
dynamicConfigs: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
353
|
+
collateralFactor: z.ZodNumber;
|
|
354
|
+
maxLiquidationBonus: z.ZodNumber;
|
|
355
|
+
liquidationFee: z.ZodNumber;
|
|
356
|
+
}, z.core.$strip>>;
|
|
347
357
|
oracleAddress: z.ZodString;
|
|
348
358
|
priceSource: z.ZodString;
|
|
349
359
|
oraclePrice: z.ZodString;
|
|
@@ -380,6 +390,13 @@ declare const aaveV4SnapshotSchema: z.ZodObject<{
|
|
|
380
390
|
active: z.ZodBoolean;
|
|
381
391
|
halted: z.ZodBoolean;
|
|
382
392
|
}, z.core.$strip>>;
|
|
393
|
+
positionManagers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodBoolean>>>;
|
|
394
|
+
accessManagerRoles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
395
|
+
label: z.ZodString;
|
|
396
|
+
members: z.ZodArray<z.ZodString>;
|
|
397
|
+
targets: z.ZodArray<z.ZodString>;
|
|
398
|
+
selectors: z.ZodArray<z.ZodString>;
|
|
399
|
+
}, z.core.$strip>>>>;
|
|
383
400
|
raw: z.ZodOptional<z.ZodRecord<z.ZodType<`0x${string}`, unknown, z.core.$ZodTypeInternals<`0x${string}`, unknown>>, z.ZodObject<{
|
|
384
401
|
label: z.ZodNullable<z.ZodString>;
|
|
385
402
|
contract: z.ZodNullable<z.ZodString>;
|
package/dist/index.d.mts
CHANGED
|
@@ -287,6 +287,11 @@ declare const v4SpokeReserveSchema: z.ZodObject<{
|
|
|
287
287
|
collateralFactor: z.ZodNumber;
|
|
288
288
|
maxLiquidationBonus: z.ZodNumber;
|
|
289
289
|
liquidationFee: z.ZodNumber;
|
|
290
|
+
dynamicConfigs: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
291
|
+
collateralFactor: z.ZodNumber;
|
|
292
|
+
maxLiquidationBonus: z.ZodNumber;
|
|
293
|
+
liquidationFee: z.ZodNumber;
|
|
294
|
+
}, z.core.$strip>>;
|
|
290
295
|
oracleAddress: z.ZodString;
|
|
291
296
|
priceSource: z.ZodString;
|
|
292
297
|
oraclePrice: z.ZodString;
|
|
@@ -344,6 +349,11 @@ declare const aaveV4SnapshotSchema: z.ZodObject<{
|
|
|
344
349
|
collateralFactor: z.ZodNumber;
|
|
345
350
|
maxLiquidationBonus: z.ZodNumber;
|
|
346
351
|
liquidationFee: z.ZodNumber;
|
|
352
|
+
dynamicConfigs: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
353
|
+
collateralFactor: z.ZodNumber;
|
|
354
|
+
maxLiquidationBonus: z.ZodNumber;
|
|
355
|
+
liquidationFee: z.ZodNumber;
|
|
356
|
+
}, z.core.$strip>>;
|
|
347
357
|
oracleAddress: z.ZodString;
|
|
348
358
|
priceSource: z.ZodString;
|
|
349
359
|
oraclePrice: z.ZodString;
|
|
@@ -380,6 +390,13 @@ declare const aaveV4SnapshotSchema: z.ZodObject<{
|
|
|
380
390
|
active: z.ZodBoolean;
|
|
381
391
|
halted: z.ZodBoolean;
|
|
382
392
|
}, z.core.$strip>>;
|
|
393
|
+
positionManagers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodBoolean>>>;
|
|
394
|
+
accessManagerRoles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
395
|
+
label: z.ZodString;
|
|
396
|
+
members: z.ZodArray<z.ZodString>;
|
|
397
|
+
targets: z.ZodArray<z.ZodString>;
|
|
398
|
+
selectors: z.ZodArray<z.ZodString>;
|
|
399
|
+
}, z.core.$strip>>>>;
|
|
383
400
|
raw: z.ZodOptional<z.ZodRecord<z.ZodType<`0x${string}`, unknown, z.core.$ZodTypeInternals<`0x${string}`, unknown>>, z.ZodObject<{
|
|
384
401
|
label: z.ZodNullable<z.ZodString>;
|
|
385
402
|
contract: z.ZodNullable<z.ZodString>;
|
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-EkiH1uMz.mjs";
|
|
2
2
|
|
|
3
3
|
export { diff, diffSnapshots, diffV4Snapshots, eventDb, hasChanges, isChange };
|
|
@@ -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
|
|
|
@@ -6995,7 +7038,9 @@ function formatV4Value(section, key, value, ctx) {
|
|
|
6995
7038
|
//#endregion
|
|
6996
7039
|
//#region sections/spoke-reserves.ts
|
|
6997
7040
|
/** All fields in display order. Every field is compared — even identity fields
|
|
6998
|
-
* that "shouldn't" change — so unexpected mutations are never silently missed.
|
|
7041
|
+
* that "shouldn't" change — so unexpected mutations are never silently missed.
|
|
7042
|
+
* `dynamicConfigs` is excluded from this list and rendered separately because
|
|
7043
|
+
* it is a nested record per key, not a single value. */
|
|
6999
7044
|
const FIELD_ORDER$3 = [
|
|
7000
7045
|
"symbol",
|
|
7001
7046
|
"underlying",
|
|
@@ -7015,6 +7060,41 @@ const FIELD_ORDER$3 = [
|
|
|
7015
7060
|
"priceSource",
|
|
7016
7061
|
"oraclePrice"
|
|
7017
7062
|
];
|
|
7063
|
+
const DYNAMIC_CONFIG_FIELDS = [
|
|
7064
|
+
"collateralFactor",
|
|
7065
|
+
"maxLiquidationBonus",
|
|
7066
|
+
"liquidationFee"
|
|
7067
|
+
];
|
|
7068
|
+
function fmtDynamicConfigField(field, value) {
|
|
7069
|
+
if (field === "maxLiquidationBonus") {
|
|
7070
|
+
if (value === 0) return "0.00 % [0]";
|
|
7071
|
+
return `${((value - 1e4) / 100).toFixed(2)} % [${value}]`;
|
|
7072
|
+
}
|
|
7073
|
+
const w = Math.floor(value / 100);
|
|
7074
|
+
const f = value % 100;
|
|
7075
|
+
return `${w}.${f < 10 ? `0${f}` : `${f}`} % [${value}]`;
|
|
7076
|
+
}
|
|
7077
|
+
function renderDynamicConfigsBlock(before, after) {
|
|
7078
|
+
const allKeys = new Set([...Object.keys(before ?? {}), ...Object.keys(after ?? {})]);
|
|
7079
|
+
const rows = [];
|
|
7080
|
+
for (const key of [...allKeys].sort((a, b) => Number(a) - Number(b))) {
|
|
7081
|
+
const b = before?.[key];
|
|
7082
|
+
const a = after?.[key];
|
|
7083
|
+
for (const field of DYNAMIC_CONFIG_FIELDS) {
|
|
7084
|
+
const bv = b?.[field];
|
|
7085
|
+
const av = a?.[field];
|
|
7086
|
+
if (String(bv) === String(av)) continue;
|
|
7087
|
+
const fromFmt = bv === void 0 ? "*missing*" : fmtDynamicConfigField(field, bv);
|
|
7088
|
+
const toFmt = av === void 0 ? "*missing*" : fmtDynamicConfigField(field, av);
|
|
7089
|
+
rows.push(`| key ${key} | ${field} | ${fromFmt} | ${toFmt} |`);
|
|
7090
|
+
}
|
|
7091
|
+
}
|
|
7092
|
+
if (rows.length === 0) return "";
|
|
7093
|
+
let md = "**dynamicConfigs**\n\n";
|
|
7094
|
+
md += "| key | field | before | after |\n| --- | --- | --- | --- |\n";
|
|
7095
|
+
md += rows.join("\n") + "\n\n";
|
|
7096
|
+
return md;
|
|
7097
|
+
}
|
|
7018
7098
|
function reserveHeader(reserve, spokeAddr, reserveId, chainId) {
|
|
7019
7099
|
const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
|
|
7020
7100
|
const underlyingLink = toAddressLink(reserve.underlying, true, client);
|
|
@@ -7026,6 +7106,8 @@ function renderNewReserve(reserve, spokeAddr, reserveId, ctx) {
|
|
|
7026
7106
|
md += "**NEW RESERVE**\n\n";
|
|
7027
7107
|
md += "| description | value |\n| --- | --- |\n";
|
|
7028
7108
|
for (const key of FIELD_ORDER$3) md += `| ${key} | ${formatV4Value("spokeReserve", key, reserve[key], ctx)} |\n`;
|
|
7109
|
+
md += "\n";
|
|
7110
|
+
md += renderDynamicConfigsBlock(void 0, reserve.dynamicConfigs);
|
|
7029
7111
|
return md + "\n";
|
|
7030
7112
|
}
|
|
7031
7113
|
function renderReserveDiff(before, after, spokeAddr, reserveId, ctx) {
|
|
@@ -7038,10 +7120,14 @@ function renderReserveDiff(before, after, spokeAddr, reserveId, ctx) {
|
|
|
7038
7120
|
const toFmt = formatV4Value("spokeReserve", key, aVal, ctx);
|
|
7039
7121
|
rows.push(`| ${key} | ${fromFmt} | ${toFmt} |`);
|
|
7040
7122
|
}
|
|
7041
|
-
|
|
7123
|
+
const dynamicConfigsBlock = renderDynamicConfigsBlock(before.dynamicConfigs, after.dynamicConfigs);
|
|
7124
|
+
if (rows.length === 0 && !dynamicConfigsBlock) return "";
|
|
7042
7125
|
let md = reserveHeader(after, spokeAddr, reserveId, ctx.chainId);
|
|
7043
|
-
|
|
7044
|
-
|
|
7126
|
+
if (rows.length > 0) {
|
|
7127
|
+
md += "| description | value before | value after |\n| --- | --- | --- |\n";
|
|
7128
|
+
md += rows.join("\n") + "\n\n";
|
|
7129
|
+
}
|
|
7130
|
+
md += dynamicConfigsBlock;
|
|
7045
7131
|
return md + "\n";
|
|
7046
7132
|
}
|
|
7047
7133
|
function renderSpokeReservesSection(before, after) {
|
|
@@ -7260,6 +7346,119 @@ function renderSpokeLiquidationSection(before, after) {
|
|
|
7260
7346
|
return `## Spoke Liquidation Config Changes\n\n${body}`;
|
|
7261
7347
|
}
|
|
7262
7348
|
|
|
7349
|
+
//#endregion
|
|
7350
|
+
//#region sections/position-managers.ts
|
|
7351
|
+
/**
|
|
7352
|
+
* Renders the per-spoke position-manager registration diff. Each row is a
|
|
7353
|
+
* (spoke, positionManager) pair whose `active` flag changed.
|
|
7354
|
+
*/
|
|
7355
|
+
function renderPositionManagersSection(before, after) {
|
|
7356
|
+
const beforePm = before.positionManagers ?? {};
|
|
7357
|
+
const afterPm = after.positionManagers ?? {};
|
|
7358
|
+
const allSpokes = new Set([...Object.keys(beforePm), ...Object.keys(afterPm)]);
|
|
7359
|
+
const client = (0, _bgd_labs_toolbox.getClient)(after.chainId, {});
|
|
7360
|
+
const rows = [];
|
|
7361
|
+
for (const spokeAddr of allSpokes) {
|
|
7362
|
+
const beforeSpoke = beforePm[spokeAddr] ?? {};
|
|
7363
|
+
const afterSpoke = afterPm[spokeAddr] ?? {};
|
|
7364
|
+
const allManagers = new Set([...Object.keys(beforeSpoke), ...Object.keys(afterSpoke)]);
|
|
7365
|
+
for (const manager of allManagers) {
|
|
7366
|
+
const bv = beforeSpoke[manager];
|
|
7367
|
+
const av = afterSpoke[manager];
|
|
7368
|
+
if (bv === av) continue;
|
|
7369
|
+
const spokeLink = toAddressLink(spokeAddr, true, client);
|
|
7370
|
+
const managerLink = toAddressLink(manager, true, client);
|
|
7371
|
+
const fromFmt = bv === void 0 ? "*missing*" : boolToMarkdown(bv);
|
|
7372
|
+
const toFmt = av === void 0 ? "*missing*" : boolToMarkdown(av);
|
|
7373
|
+
rows.push(`| ${spokeLink} | ${managerLink} | ${fromFmt} | ${toFmt} |`);
|
|
7374
|
+
}
|
|
7375
|
+
}
|
|
7376
|
+
if (rows.length === 0) return "";
|
|
7377
|
+
let md = "## Position Manager Changes\n\n";
|
|
7378
|
+
md += "| spoke | position manager | active before | active after |\n";
|
|
7379
|
+
md += "| --- | --- | --- | --- |\n";
|
|
7380
|
+
md += rows.join("\n") + "\n\n";
|
|
7381
|
+
return md;
|
|
7382
|
+
}
|
|
7383
|
+
|
|
7384
|
+
//#endregion
|
|
7385
|
+
//#region sections/access-manager-roles.ts
|
|
7386
|
+
function setOf(arr) {
|
|
7387
|
+
return new Set((arr ?? []).map((v) => v.toLowerCase()));
|
|
7388
|
+
}
|
|
7389
|
+
function diffSets(b, a) {
|
|
7390
|
+
const added = [];
|
|
7391
|
+
const removed = [];
|
|
7392
|
+
for (const v of a) if (!b.has(v)) added.push(v);
|
|
7393
|
+
for (const v of b) if (!a.has(v)) removed.push(v);
|
|
7394
|
+
return {
|
|
7395
|
+
added,
|
|
7396
|
+
removed
|
|
7397
|
+
};
|
|
7398
|
+
}
|
|
7399
|
+
function renderAddrList(values, chainId) {
|
|
7400
|
+
if (values.length === 0) return "*(none)*";
|
|
7401
|
+
const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
|
|
7402
|
+
return values.map((v) => toAddressLink(v, true, client)).join(", ");
|
|
7403
|
+
}
|
|
7404
|
+
function diffTargetSelectorPairs(b, a) {
|
|
7405
|
+
const beforePairs = /* @__PURE__ */ new Set();
|
|
7406
|
+
const afterPairs = /* @__PURE__ */ new Set();
|
|
7407
|
+
for (let i = 0; i < (b?.targets.length ?? 0); i++) beforePairs.add(`${b.targets[i].toLowerCase()}|${b.selectors[i]}`);
|
|
7408
|
+
for (let i = 0; i < (a?.targets.length ?? 0); i++) afterPairs.add(`${a.targets[i].toLowerCase()}|${a.selectors[i]}`);
|
|
7409
|
+
const added = [];
|
|
7410
|
+
const removed = [];
|
|
7411
|
+
for (const p of afterPairs) if (!beforePairs.has(p)) added.push(p);
|
|
7412
|
+
for (const p of beforePairs) if (!afterPairs.has(p)) removed.push(p);
|
|
7413
|
+
return {
|
|
7414
|
+
added,
|
|
7415
|
+
removed
|
|
7416
|
+
};
|
|
7417
|
+
}
|
|
7418
|
+
function renderRoleDiff(amAddr, roleId, before, after, chainId) {
|
|
7419
|
+
const members = diffSets(setOf(before?.members), setOf(after?.members));
|
|
7420
|
+
const targetSelectors = diffTargetSelectorPairs(before, after);
|
|
7421
|
+
const labelChanged = (before?.label ?? "") !== (after?.label ?? "");
|
|
7422
|
+
if (!labelChanged && members.added.length === 0 && members.removed.length === 0 && targetSelectors.added.length === 0 && targetSelectors.removed.length === 0) return "";
|
|
7423
|
+
const client = (0, _bgd_labs_toolbox.getClient)(chainId, {});
|
|
7424
|
+
let md = `#### ${toAddressLink(amAddr, true, client)} role ${roleId}`;
|
|
7425
|
+
if ((after ?? before)?.label) md += ` (${(after ?? before).label})`;
|
|
7426
|
+
md += "\n\n";
|
|
7427
|
+
if (labelChanged) md += `- label: "${before?.label ?? ""}" -> "${after?.label ?? ""}"\n`;
|
|
7428
|
+
if (members.added.length > 0) md += `- members added: ${renderAddrList(members.added, chainId)}\n`;
|
|
7429
|
+
if (members.removed.length > 0) md += `- members removed: ${renderAddrList(members.removed, chainId)}\n`;
|
|
7430
|
+
if (targetSelectors.added.length > 0) {
|
|
7431
|
+
md += `- target/selector grants added:\n`;
|
|
7432
|
+
for (const p of targetSelectors.added) {
|
|
7433
|
+
const [t, s] = p.split("|");
|
|
7434
|
+
md += ` - ${toAddressLink(t, true, client)} ${s}\n`;
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7437
|
+
if (targetSelectors.removed.length > 0) {
|
|
7438
|
+
md += `- target/selector grants removed:\n`;
|
|
7439
|
+
for (const p of targetSelectors.removed) {
|
|
7440
|
+
const [t, s] = p.split("|");
|
|
7441
|
+
md += ` - ${toAddressLink(t, true, client)} ${s}\n`;
|
|
7442
|
+
}
|
|
7443
|
+
}
|
|
7444
|
+
md += "\n";
|
|
7445
|
+
return md;
|
|
7446
|
+
}
|
|
7447
|
+
function renderAccessManagerRolesSection(before, after) {
|
|
7448
|
+
const beforeAm = before.accessManagerRoles ?? {};
|
|
7449
|
+
const afterAm = after.accessManagerRoles ?? {};
|
|
7450
|
+
const allAms = new Set([...Object.keys(beforeAm), ...Object.keys(afterAm)]);
|
|
7451
|
+
let body = "";
|
|
7452
|
+
for (const amAddr of allAms) {
|
|
7453
|
+
const beforeRoles = beforeAm[amAddr] ?? {};
|
|
7454
|
+
const afterRoles = afterAm[amAddr] ?? {};
|
|
7455
|
+
const allRoles = new Set([...Object.keys(beforeRoles), ...Object.keys(afterRoles)]);
|
|
7456
|
+
for (const roleId of [...allRoles].sort((a, b) => Number(a) - Number(b))) body += renderRoleDiff(amAddr, roleId, beforeRoles[roleId], afterRoles[roleId], after.chainId);
|
|
7457
|
+
}
|
|
7458
|
+
if (!body) return "";
|
|
7459
|
+
return `## Access Manager Role Changes\n\n${body}`;
|
|
7460
|
+
}
|
|
7461
|
+
|
|
7263
7462
|
//#endregion
|
|
7264
7463
|
//#region protocol-diff-v4.ts
|
|
7265
7464
|
/**
|
|
@@ -7285,6 +7484,8 @@ async function diffV4Snapshots(before, after) {
|
|
|
7285
7484
|
md += renderHubAssetsSection(before, postCopy);
|
|
7286
7485
|
md += renderSpokeConfigsSection(before, postCopy);
|
|
7287
7486
|
md += renderSpokeLiquidationSection(before, postCopy);
|
|
7487
|
+
md += renderPositionManagersSection(before, postCopy);
|
|
7488
|
+
md += renderAccessManagerRolesSection(before, postCopy);
|
|
7288
7489
|
md += await renderLogsSection(logs, after.chainId);
|
|
7289
7490
|
md += renderRawSection(raw, after.chainId);
|
|
7290
7491
|
const preCopy = { ...before };
|
|
@@ -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
|
|
|
@@ -6967,7 +7010,9 @@ function formatV4Value(section, key, value, ctx) {
|
|
|
6967
7010
|
//#endregion
|
|
6968
7011
|
//#region sections/spoke-reserves.ts
|
|
6969
7012
|
/** All fields in display order. Every field is compared — even identity fields
|
|
6970
|
-
* that "shouldn't" change — so unexpected mutations are never silently missed.
|
|
7013
|
+
* that "shouldn't" change — so unexpected mutations are never silently missed.
|
|
7014
|
+
* `dynamicConfigs` is excluded from this list and rendered separately because
|
|
7015
|
+
* it is a nested record per key, not a single value. */
|
|
6971
7016
|
const FIELD_ORDER$3 = [
|
|
6972
7017
|
"symbol",
|
|
6973
7018
|
"underlying",
|
|
@@ -6987,6 +7032,41 @@ const FIELD_ORDER$3 = [
|
|
|
6987
7032
|
"priceSource",
|
|
6988
7033
|
"oraclePrice"
|
|
6989
7034
|
];
|
|
7035
|
+
const DYNAMIC_CONFIG_FIELDS = [
|
|
7036
|
+
"collateralFactor",
|
|
7037
|
+
"maxLiquidationBonus",
|
|
7038
|
+
"liquidationFee"
|
|
7039
|
+
];
|
|
7040
|
+
function fmtDynamicConfigField(field, value) {
|
|
7041
|
+
if (field === "maxLiquidationBonus") {
|
|
7042
|
+
if (value === 0) return "0.00 % [0]";
|
|
7043
|
+
return `${((value - 1e4) / 100).toFixed(2)} % [${value}]`;
|
|
7044
|
+
}
|
|
7045
|
+
const w = Math.floor(value / 100);
|
|
7046
|
+
const f = value % 100;
|
|
7047
|
+
return `${w}.${f < 10 ? `0${f}` : `${f}`} % [${value}]`;
|
|
7048
|
+
}
|
|
7049
|
+
function renderDynamicConfigsBlock(before, after) {
|
|
7050
|
+
const allKeys = new Set([...Object.keys(before ?? {}), ...Object.keys(after ?? {})]);
|
|
7051
|
+
const rows = [];
|
|
7052
|
+
for (const key of [...allKeys].sort((a, b) => Number(a) - Number(b))) {
|
|
7053
|
+
const b = before?.[key];
|
|
7054
|
+
const a = after?.[key];
|
|
7055
|
+
for (const field of DYNAMIC_CONFIG_FIELDS) {
|
|
7056
|
+
const bv = b?.[field];
|
|
7057
|
+
const av = a?.[field];
|
|
7058
|
+
if (String(bv) === String(av)) continue;
|
|
7059
|
+
const fromFmt = bv === void 0 ? "*missing*" : fmtDynamicConfigField(field, bv);
|
|
7060
|
+
const toFmt = av === void 0 ? "*missing*" : fmtDynamicConfigField(field, av);
|
|
7061
|
+
rows.push(`| key ${key} | ${field} | ${fromFmt} | ${toFmt} |`);
|
|
7062
|
+
}
|
|
7063
|
+
}
|
|
7064
|
+
if (rows.length === 0) return "";
|
|
7065
|
+
let md = "**dynamicConfigs**\n\n";
|
|
7066
|
+
md += "| key | field | before | after |\n| --- | --- | --- | --- |\n";
|
|
7067
|
+
md += rows.join("\n") + "\n\n";
|
|
7068
|
+
return md;
|
|
7069
|
+
}
|
|
6990
7070
|
function reserveHeader(reserve, spokeAddr, reserveId, chainId) {
|
|
6991
7071
|
const client = getClient(chainId, {});
|
|
6992
7072
|
const underlyingLink = toAddressLink(reserve.underlying, true, client);
|
|
@@ -6998,6 +7078,8 @@ function renderNewReserve(reserve, spokeAddr, reserveId, ctx) {
|
|
|
6998
7078
|
md += "**NEW RESERVE**\n\n";
|
|
6999
7079
|
md += "| description | value |\n| --- | --- |\n";
|
|
7000
7080
|
for (const key of FIELD_ORDER$3) md += `| ${key} | ${formatV4Value("spokeReserve", key, reserve[key], ctx)} |\n`;
|
|
7081
|
+
md += "\n";
|
|
7082
|
+
md += renderDynamicConfigsBlock(void 0, reserve.dynamicConfigs);
|
|
7001
7083
|
return md + "\n";
|
|
7002
7084
|
}
|
|
7003
7085
|
function renderReserveDiff(before, after, spokeAddr, reserveId, ctx) {
|
|
@@ -7010,10 +7092,14 @@ function renderReserveDiff(before, after, spokeAddr, reserveId, ctx) {
|
|
|
7010
7092
|
const toFmt = formatV4Value("spokeReserve", key, aVal, ctx);
|
|
7011
7093
|
rows.push(`| ${key} | ${fromFmt} | ${toFmt} |`);
|
|
7012
7094
|
}
|
|
7013
|
-
|
|
7095
|
+
const dynamicConfigsBlock = renderDynamicConfigsBlock(before.dynamicConfigs, after.dynamicConfigs);
|
|
7096
|
+
if (rows.length === 0 && !dynamicConfigsBlock) return "";
|
|
7014
7097
|
let md = reserveHeader(after, spokeAddr, reserveId, ctx.chainId);
|
|
7015
|
-
|
|
7016
|
-
|
|
7098
|
+
if (rows.length > 0) {
|
|
7099
|
+
md += "| description | value before | value after |\n| --- | --- | --- |\n";
|
|
7100
|
+
md += rows.join("\n") + "\n\n";
|
|
7101
|
+
}
|
|
7102
|
+
md += dynamicConfigsBlock;
|
|
7017
7103
|
return md + "\n";
|
|
7018
7104
|
}
|
|
7019
7105
|
function renderSpokeReservesSection(before, after) {
|
|
@@ -7232,6 +7318,119 @@ function renderSpokeLiquidationSection(before, after) {
|
|
|
7232
7318
|
return `## Spoke Liquidation Config Changes\n\n${body}`;
|
|
7233
7319
|
}
|
|
7234
7320
|
|
|
7321
|
+
//#endregion
|
|
7322
|
+
//#region sections/position-managers.ts
|
|
7323
|
+
/**
|
|
7324
|
+
* Renders the per-spoke position-manager registration diff. Each row is a
|
|
7325
|
+
* (spoke, positionManager) pair whose `active` flag changed.
|
|
7326
|
+
*/
|
|
7327
|
+
function renderPositionManagersSection(before, after) {
|
|
7328
|
+
const beforePm = before.positionManagers ?? {};
|
|
7329
|
+
const afterPm = after.positionManagers ?? {};
|
|
7330
|
+
const allSpokes = new Set([...Object.keys(beforePm), ...Object.keys(afterPm)]);
|
|
7331
|
+
const client = getClient(after.chainId, {});
|
|
7332
|
+
const rows = [];
|
|
7333
|
+
for (const spokeAddr of allSpokes) {
|
|
7334
|
+
const beforeSpoke = beforePm[spokeAddr] ?? {};
|
|
7335
|
+
const afterSpoke = afterPm[spokeAddr] ?? {};
|
|
7336
|
+
const allManagers = new Set([...Object.keys(beforeSpoke), ...Object.keys(afterSpoke)]);
|
|
7337
|
+
for (const manager of allManagers) {
|
|
7338
|
+
const bv = beforeSpoke[manager];
|
|
7339
|
+
const av = afterSpoke[manager];
|
|
7340
|
+
if (bv === av) continue;
|
|
7341
|
+
const spokeLink = toAddressLink(spokeAddr, true, client);
|
|
7342
|
+
const managerLink = toAddressLink(manager, true, client);
|
|
7343
|
+
const fromFmt = bv === void 0 ? "*missing*" : boolToMarkdown(bv);
|
|
7344
|
+
const toFmt = av === void 0 ? "*missing*" : boolToMarkdown(av);
|
|
7345
|
+
rows.push(`| ${spokeLink} | ${managerLink} | ${fromFmt} | ${toFmt} |`);
|
|
7346
|
+
}
|
|
7347
|
+
}
|
|
7348
|
+
if (rows.length === 0) return "";
|
|
7349
|
+
let md = "## Position Manager Changes\n\n";
|
|
7350
|
+
md += "| spoke | position manager | active before | active after |\n";
|
|
7351
|
+
md += "| --- | --- | --- | --- |\n";
|
|
7352
|
+
md += rows.join("\n") + "\n\n";
|
|
7353
|
+
return md;
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
//#endregion
|
|
7357
|
+
//#region sections/access-manager-roles.ts
|
|
7358
|
+
function setOf(arr) {
|
|
7359
|
+
return new Set((arr ?? []).map((v) => v.toLowerCase()));
|
|
7360
|
+
}
|
|
7361
|
+
function diffSets(b, a) {
|
|
7362
|
+
const added = [];
|
|
7363
|
+
const removed = [];
|
|
7364
|
+
for (const v of a) if (!b.has(v)) added.push(v);
|
|
7365
|
+
for (const v of b) if (!a.has(v)) removed.push(v);
|
|
7366
|
+
return {
|
|
7367
|
+
added,
|
|
7368
|
+
removed
|
|
7369
|
+
};
|
|
7370
|
+
}
|
|
7371
|
+
function renderAddrList(values, chainId) {
|
|
7372
|
+
if (values.length === 0) return "*(none)*";
|
|
7373
|
+
const client = getClient(chainId, {});
|
|
7374
|
+
return values.map((v) => toAddressLink(v, true, client)).join(", ");
|
|
7375
|
+
}
|
|
7376
|
+
function diffTargetSelectorPairs(b, a) {
|
|
7377
|
+
const beforePairs = /* @__PURE__ */ new Set();
|
|
7378
|
+
const afterPairs = /* @__PURE__ */ new Set();
|
|
7379
|
+
for (let i = 0; i < (b?.targets.length ?? 0); i++) beforePairs.add(`${b.targets[i].toLowerCase()}|${b.selectors[i]}`);
|
|
7380
|
+
for (let i = 0; i < (a?.targets.length ?? 0); i++) afterPairs.add(`${a.targets[i].toLowerCase()}|${a.selectors[i]}`);
|
|
7381
|
+
const added = [];
|
|
7382
|
+
const removed = [];
|
|
7383
|
+
for (const p of afterPairs) if (!beforePairs.has(p)) added.push(p);
|
|
7384
|
+
for (const p of beforePairs) if (!afterPairs.has(p)) removed.push(p);
|
|
7385
|
+
return {
|
|
7386
|
+
added,
|
|
7387
|
+
removed
|
|
7388
|
+
};
|
|
7389
|
+
}
|
|
7390
|
+
function renderRoleDiff(amAddr, roleId, before, after, chainId) {
|
|
7391
|
+
const members = diffSets(setOf(before?.members), setOf(after?.members));
|
|
7392
|
+
const targetSelectors = diffTargetSelectorPairs(before, after);
|
|
7393
|
+
const labelChanged = (before?.label ?? "") !== (after?.label ?? "");
|
|
7394
|
+
if (!labelChanged && members.added.length === 0 && members.removed.length === 0 && targetSelectors.added.length === 0 && targetSelectors.removed.length === 0) return "";
|
|
7395
|
+
const client = getClient(chainId, {});
|
|
7396
|
+
let md = `#### ${toAddressLink(amAddr, true, client)} role ${roleId}`;
|
|
7397
|
+
if ((after ?? before)?.label) md += ` (${(after ?? before).label})`;
|
|
7398
|
+
md += "\n\n";
|
|
7399
|
+
if (labelChanged) md += `- label: "${before?.label ?? ""}" -> "${after?.label ?? ""}"\n`;
|
|
7400
|
+
if (members.added.length > 0) md += `- members added: ${renderAddrList(members.added, chainId)}\n`;
|
|
7401
|
+
if (members.removed.length > 0) md += `- members removed: ${renderAddrList(members.removed, chainId)}\n`;
|
|
7402
|
+
if (targetSelectors.added.length > 0) {
|
|
7403
|
+
md += `- target/selector grants added:\n`;
|
|
7404
|
+
for (const p of targetSelectors.added) {
|
|
7405
|
+
const [t, s] = p.split("|");
|
|
7406
|
+
md += ` - ${toAddressLink(t, true, client)} ${s}\n`;
|
|
7407
|
+
}
|
|
7408
|
+
}
|
|
7409
|
+
if (targetSelectors.removed.length > 0) {
|
|
7410
|
+
md += `- target/selector grants removed:\n`;
|
|
7411
|
+
for (const p of targetSelectors.removed) {
|
|
7412
|
+
const [t, s] = p.split("|");
|
|
7413
|
+
md += ` - ${toAddressLink(t, true, client)} ${s}\n`;
|
|
7414
|
+
}
|
|
7415
|
+
}
|
|
7416
|
+
md += "\n";
|
|
7417
|
+
return md;
|
|
7418
|
+
}
|
|
7419
|
+
function renderAccessManagerRolesSection(before, after) {
|
|
7420
|
+
const beforeAm = before.accessManagerRoles ?? {};
|
|
7421
|
+
const afterAm = after.accessManagerRoles ?? {};
|
|
7422
|
+
const allAms = new Set([...Object.keys(beforeAm), ...Object.keys(afterAm)]);
|
|
7423
|
+
let body = "";
|
|
7424
|
+
for (const amAddr of allAms) {
|
|
7425
|
+
const beforeRoles = beforeAm[amAddr] ?? {};
|
|
7426
|
+
const afterRoles = afterAm[amAddr] ?? {};
|
|
7427
|
+
const allRoles = new Set([...Object.keys(beforeRoles), ...Object.keys(afterRoles)]);
|
|
7428
|
+
for (const roleId of [...allRoles].sort((a, b) => Number(a) - Number(b))) body += renderRoleDiff(amAddr, roleId, beforeRoles[roleId], afterRoles[roleId], after.chainId);
|
|
7429
|
+
}
|
|
7430
|
+
if (!body) return "";
|
|
7431
|
+
return `## Access Manager Role Changes\n\n${body}`;
|
|
7432
|
+
}
|
|
7433
|
+
|
|
7235
7434
|
//#endregion
|
|
7236
7435
|
//#region protocol-diff-v4.ts
|
|
7237
7436
|
/**
|
|
@@ -7257,6 +7456,8 @@ async function diffV4Snapshots(before, after) {
|
|
|
7257
7456
|
md += renderHubAssetsSection(before, postCopy);
|
|
7258
7457
|
md += renderSpokeConfigsSection(before, postCopy);
|
|
7259
7458
|
md += renderSpokeLiquidationSection(before, postCopy);
|
|
7459
|
+
md += renderPositionManagersSection(before, postCopy);
|
|
7460
|
+
md += renderAccessManagerRolesSection(before, postCopy);
|
|
7260
7461
|
md += await renderLogsSection(logs, after.chainId);
|
|
7261
7462
|
md += renderRawSection(raw, after.chainId);
|
|
7262
7463
|
const preCopy = { ...before };
|