Skip to content

Commit

Permalink
fix: reset lockedQuote even when nothing will be auctioned
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Jul 19, 2023
1 parent 6f740a4 commit 332c5b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/inter-protocol/src/vaultFactory/vaultManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ export const prepareVaultManagerKit = (
state.lockedQuote = undefined;

if (vaultData.getSize() === 0) {
void helper.writeMetrics();
return;
}
trace(
Expand Down
27 changes: 24 additions & 3 deletions packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -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 },
Expand Down

0 comments on commit 332c5b3

Please sign in to comment.