Skip to content

Commit b2073f6

Browse files
committed
fix: seatbelt formatting patches
bitmap as binary ltv at % lb without -100%
1 parent 165e9f0 commit b2073f6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/govv3/__snapshots__/generatePayloadReport.spec.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ InitializableImmutableAdminUpgradeabilityProxy at \`0xb50201558B00496A145fE76f74
256256
- "0x000000000000000000000000e07e26f316248a2aa14115439a0bd9ea49328dc7"
257257
+ "0x0000000000000000000000008a48ef9287c402c119c14a5f6897f6dfdc12cb45"
258258
@@ \`_eModeCategories\` key \`1.collateralBitmap\` @@
259-
- 0
260-
+ 3
259+
- 0b0
260+
+ 0b11
261261
@@ \`_eModeCategories\` key \`1.borrowableBitmap\` @@
262-
- 0
263-
+ 3
262+
- 0b0
263+
+ 0b11
264264
@@ \`_eModeCategories\` key \`1.collateralBitmap_decoded\` @@
265265
-
266266
+ WETH(id: 0),wstETH(id: 1)

src/govv3/checks/state.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,15 @@ export async function deepDiff({
145145
bitMapToIndexes(BigInt(before.collateralBitmap || 0)),
146146
)
147147
).toString();
148+
before.collateralBitmap = toBinaryString(BigInt(before.collateralBitmap || 0));
148149
after.collateralBitmap_decoded = (
149150
await assetIndexesToAsset(
150151
client,
151152
address,
152153
bitMapToIndexes(BigInt(after.collateralBitmap || 0)),
153154
)
154155
).toString();
156+
after.collateralBitmap = toBinaryString(BigInt(after.collateralBitmap || 0));
155157
}
156158
if (before.borrowableBitmap !== undefined) {
157159
before.borrowableBitmap_decoded = (
@@ -161,13 +163,15 @@ export async function deepDiff({
161163
bitMapToIndexes(BigInt(before.borrowableBitmap || 0)),
162164
)
163165
).toString();
166+
before.borrowableBitmap = toBinaryString(BigInt(before.borrowableBitmap || 0));
164167
after.borrowableBitmap_decoded = (
165168
await assetIndexesToAsset(
166169
client,
167170
address,
168171
bitMapToIndexes(BigInt(after.borrowableBitmap || 0)),
169172
)
170173
).toString();
174+
after.borrowableBitmap = toBinaryString(BigInt(after.borrowableBitmap || 0));
171175
}
172176
}
173177

@@ -262,7 +266,7 @@ async function enhanceValue({
262266
if (key && ['_reserves', '_eModeCategories'].includes(type)) {
263267
if (['liquidityIndex', 'variableBorrowIndex'].includes(key))
264268
return prettifyNumber({decimals: 27, value, showDecimals: true});
265-
if (['liquidationThreshold', 'reserveFactor', 'liquidationProtocolFee'].includes(key))
269+
if (['liquidationThreshold', 'reserveFactor', 'liquidationProtocolFee', 'ltv'].includes(key))
266270
return prettifyNumber({decimals: 2, value, suffix: '%', showDecimals: true});
267271
if (
268272
['currentLiquidityRate', 'currentVariableBorrowRate', 'currentStableBorrowRate'].includes(
@@ -276,7 +280,7 @@ async function enhanceValue({
276280
value,
277281
suffix: '%',
278282
showDecimals: true,
279-
patchedValue: BigInt(value) - BigInt(1e4),
283+
patchedValue: BigInt(value) == 0n ? 0n : BigInt(value) - BigInt(1e4),
280284
});
281285
}
282286
}
@@ -324,3 +328,7 @@ export const checkStateChanges: ProposalCheck<any> = {
324328
return {info, warnings, errors};
325329
},
326330
};
331+
332+
function toBinaryString(value: bigint) {
333+
return `0b` + value.toString(2);
334+
}

0 commit comments

Comments
 (0)