diff --git a/packages/inter-protocol/src/vaultFactory/vaultManager.js b/packages/inter-protocol/src/vaultFactory/vaultManager.js index ed3addfb1561..5865f001b9e7 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultManager.js +++ b/packages/inter-protocol/src/vaultFactory/vaultManager.js @@ -1094,6 +1094,7 @@ export const prepareVaultManagerKit = ( state.lockedQuote = undefined; if (vaultData.getSize() === 0) { + void helper.writeMetrics(); return; } trace( diff --git a/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js b/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js index 284e68c8a917..b117352b3cbe 100644 --- a/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js +++ b/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js @@ -939,8 +939,17 @@ test('liquidate two loans', async t => { manualTimer, ); - totalDebt += 7n; + totalDebt += 6n; await aethVaultMetrics.assertChange({ + lockedQuote: null, + totalDebt: { value: totalDebt }, + }); + totalDebt += 1n; + await aethVaultMetrics.assertChange({ + lockedQuote: makeRatioFromAmounts( + aeth.make(1_000_000n), + run.make(7_000_000n), + ), totalDebt: { value: totalDebt }, }); totalDebt += 6n; @@ -3146,7 +3155,13 @@ test('Bug 7796 missing lockedPrice', async t => { const penaltyAeth = 309_850n; await aethVaultMetrics.assertChange({ - lockedQuote: { denominator: { value: 9_990_000n } }, + lockedQuote: null, + }); + await aethVaultMetrics.assertChange({ + lockedQuote: makeRatioFromAmounts( + aeth.make(1_000_000n), + run.make(9_990_000n), + ) }); await aethVaultMetrics.assertChange({ liquidatingDebt: { value: totalDebt }, @@ -3336,7 +3351,13 @@ test('Bug 7851 & no bidders', async t => { ); await aethVaultMetrics.assertChange({ - lockedQuote: { denominator: { value: 9_990_000n } }, + lockedQuote: null, + }); + await aethVaultMetrics.assertChange({ + lockedQuote: makeRatioFromAmounts( + aeth.make(1_000_000n), + run.make(9_990_000n), + ), }); await aethVaultMetrics.assertChange({ liquidatingDebt: { value: aliceDebt },