From 076a2f0747786757891830909fe8f3379f455efa Mon Sep 17 00:00:00 2001 From: anilhelvaci Date: Thu, 25 Jan 2024 18:12:28 +0300 Subject: [PATCH] chore(liquidationVisibility): #4 test for scenario 2a passed --- .../test-liquidationVisibility.js.md | 206 +++++++++++------- .../test-liquidationVisibility.js.snap | Bin 1502 -> 1542 bytes .../test-liquidationVisibility.js | 28 +-- 3 files changed, 138 insertions(+), 96 deletions(-) diff --git a/packages/inter-protocol/test/liquidationVisibility/snapshots/test-liquidationVisibility.js.md b/packages/inter-protocol/test/liquidationVisibility/snapshots/test-liquidationVisibility.js.md index d66565465dd..8394cbe6d06 100644 --- a/packages/inter-protocol/test/liquidationVisibility/snapshots/test-liquidationVisibility.js.md +++ b/packages/inter-protocol/test/liquidationVisibility/snapshots/test-liquidationVisibility.js.md @@ -11,107 +11,157 @@ Generated by [AVA](https://avajs.dev). > > See also board marshalling conventions (_to appear_). - [] + [ + [ + 'published.vaultFactory.managers.manager0.liquidations.3600.auctionResult', + { + collateralForReserve: { + brand: Object @Alleged: aEth brand {}, + value: 0n, + }, + collateralOffered: { + brand: Object @Alleged: aEth brand {}, + value: 700n, + }, + collateralRemaining: { + brand: Object @Alleged: aEth brand {}, + value: 0n, + }, + collateralSold: { + brand: Object @Alleged: aEth brand {}, + value: 700n, + }, + endTime: { + absValue: 3614n, + timerBrand: Object @Alleged: timerBrand {}, + }, + istTarget: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 5250n, + }, + mintedProceeds: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 3185n, + }, + shortfallToReserve: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 2065n, + }, + }, + ], + [ + 'published.vaultFactory.managers.manager0.liquidations.3600.vaults.postAuction', + [], + ], + [ + 'published.vaultFactory.managers.manager0.liquidations.3600.vaults.preAuction', + [ + [ + 'vault0', + { + collateralAmount: { + brand: Object @Alleged: aEth brand {}, + value: 700n, + }, + debtAmount: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 5250n, + }, + }, + ], + ], + ], + ] -## test liquidate vault with snapshot +## liq-result-scenario-3 -> Under "published", the "auction" node is delegated to the auctioneer contract. +> Scenario 3 Liquidation Visibility Snapshot > The example below illustrates the schema of the data published there. > > See also board marshalling conventions (_to appear_). [ [ - 'published.auction.book0', + 'published.vaultFactory.managers.manager0.liquidations.3600.auctionResult', { - collateralAvailable: { + collateralForReserve: { brand: Object @Alleged: aEth brand {}, - value: 0n, + value: 12n, }, - currentPriceLevel: null, - proceedsRaised: undefined, - remainingProceedsGoal: null, - startCollateral: { + collateralOffered: { brand: Object @Alleged: aEth brand {}, - value: 0n, + value: 63n, + }, + collateralRemaining: { + brand: Object @Alleged: aEth brand {}, + value: 5n, + }, + collateralSold: { + brand: Object @Alleged: aEth brand {}, + value: 8n, + }, + endTime: { + absValue: 3614n, + timerBrand: Object @Alleged: timerBrand {}, + }, + istTarget: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 258n, + }, + mintedProceeds: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 34n, + }, + shortfallToReserve: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 66n, }, - startPrice: null, - startProceedsGoal: null, }, ], [ - 'published.auction.governance', - { - current: { - AuctionStartDelay: { - type: 'relativeTime', - value: { - relValue: 10n, - timerBrand: Object @Alleged: timerBrand {}, + 'published.vaultFactory.managers.manager0.liquidations.3600.vaults.postAuction', + [ + [ + 'vault1', + { + Collateral: { + brand: Object @Alleged: aEth brand {}, + value: 43n, }, + phase: 'active', }, - ClockStep: { - type: 'relativeTime', - value: { - relValue: 2n, - timerBrand: Object @Alleged: timerBrand {}, + ], + ], + ], + [ + 'published.vaultFactory.managers.manager0.liquidations.3600.vaults.preAuction', + [ + [ + 'vault0', + { + collateralAmount: { + brand: Object @Alleged: aEth brand {}, + value: 15n, }, - }, - DiscountStep: { - type: 'nat', - value: 2000n, - }, - Electorate: { - type: 'invitation', - value: { - brand: Object @Alleged: Zoe Invitation brand {}, - value: [ - { - description: 'questionPoser', - handle: Object @Alleged: InvitationHandle {}, - installation: Object @Alleged: BundleInstallation {}, - instance: Object @Alleged: InstanceHandle {}, - }, - ], + debtAmount: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 100n, }, }, - LowestRate: { - type: 'nat', - value: 5500n, - }, - PriceLockPeriod: { - type: 'relativeTime', - value: { - relValue: 3n, - timerBrand: Object @Alleged: timerBrand {}, + ], + [ + 'vault1', + { + collateralAmount: { + brand: Object @Alleged: aEth brand {}, + value: 48n, }, - }, - StartFrequency: { - type: 'relativeTime', - value: { - relValue: 3600n, - timerBrand: Object @Alleged: timerBrand {}, + debtAmount: { + brand: Object @Alleged: ZDEFAULT brand {}, + value: 158n, }, }, - StartingRate: { - type: 'nat', - value: 10500n, - }, - }, - }, - ], - [ - 'published.auction.schedule', - { - activeStartTime: null, - nextDescendingStepTime: { - absValue: 7210n, - timerBrand: Object @Alleged: timerBrand {}, - }, - nextStartTime: { - absValue: 7210n, - timerBrand: Object @Alleged: timerBrand {}, - }, - }, + ], + ], ], ] diff --git a/packages/inter-protocol/test/liquidationVisibility/snapshots/test-liquidationVisibility.js.snap b/packages/inter-protocol/test/liquidationVisibility/snapshots/test-liquidationVisibility.js.snap index 386cc36aaea9e9b2a879f5f9a1df016d84311d0e..514bb3fe77913462b80c828c4d6c854c6b4310e8 100644 GIT binary patch literal 1542 zcmV+h2Ko6xRzV|6XIMEXLv}F)upo$W+1=?NtY7S6?yrg5 zh8{)ikspf)00000000B+ms@BYRUF3m>}0c-rrm6kHf@bMzKEh-cC$%ZszK6A6q_1t zV#Q!7XLnDsV`q1^GqbTl@ct0`Pztp^6d!B_qtI5ULJ>`UkUof_K2)IyK1fmepcO1d zYZ1Shy`4Fe&1Os=R1Eoc&+PgA&;QK1%{Rv<)2f!)XS{TRnTn~hlB(?ApfjVSnj4G^ zD^Ok0HuNe+ffkLNW*RS^$Y!ZYpA5e)`GP*{kAz4|AHFw3+n`aXleET2U`W^L3?bE0 zG#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fSx1juL5H5n}@ z&_97FMXcVUgjN&i7?54itc-3aQIekq)n)}@+MSF7~E4OBay*z zo6|$ldW{_<_^zHt1hb{y>&9@;btCW}{I7PdK`)iUi&ge@JiP^d16}vumZb_=lcGAWN^o}1rib*=D1Shg06XE|LgVrZ^9Zq#>x-? E00a5rp8x;= diff --git a/packages/inter-protocol/test/liquidationVisibility/test-liquidationVisibility.js b/packages/inter-protocol/test/liquidationVisibility/test-liquidationVisibility.js index 532442152cd..0a6d709c47e 100644 --- a/packages/inter-protocol/test/liquidationVisibility/test-liquidationVisibility.js +++ b/packages/inter-protocol/test/liquidationVisibility/test-liquidationVisibility.js @@ -435,7 +435,7 @@ test('liq-result-scenario-2', async t => { // TODO: Snapshot here await documentStorageSchema(t, chainStorage, { note: 'Scenario 2 Liquidation Visibility Snapshot', - node: `vaultFactory.managers.manager0.liquidations.${now1.toString()}`, + node: `vaultFactory.managers.manager0.liquidations.${now1.absValue.toString()}`, }); }); @@ -456,7 +456,6 @@ test('liq-result-scenario-3', async t => { aeth.make(1n), manualTimer, ONE_WEEK, - 500n, { StartFrequency: ONE_HOUR }, ); @@ -583,7 +582,7 @@ test('liq-result-scenario-3', async t => { await assertStorageData({ t, storageRoot: chainStorage, - path: `vaultFactory.managers.manager0.liquidations.${time}.preAuction`, // time is the nominal start time + path: `vaultFactory.managers.manager0.liquidations.${time.absValue.toString()}.vaults.preAuction`, // time is the nominal start time expected: [ [ 'vault0', // Alice's vault @@ -595,8 +594,8 @@ test('liq-result-scenario-3', async t => { [ 'vault1', // Bob's vault { - collateral: bobCollateralAmount, - debt: await E(bobVault).getCurrentDebt(), + collateralAmount: bobCollateralAmount, + debtAmount: await E(bobVault).getCurrentDebt(), }, ], ], @@ -672,21 +671,12 @@ test('liq-result-scenario-3', async t => { await assertStorageData({ t, storageRoot: chainStorage, - path: `vaultFactory.managers.manager0.liquidations.${time}.postAuction`, // time is the nominal start time + path: `vaultFactory.managers.manager0.liquidations.${time.absValue.toString()}.vaults.postAuction`, // time is the nominal start time expected: [ - [ - 'vault0', // Alice got liquidated - { - collateral: aeth.makeEmpty(), - debt: run.makeEmpty(), - phase: Phase.LIQUIDATED, - }, - ], [ 'vault1', // Bob got reinstated { - collateral: recoveredBobCollateral, - debt: run.make(158n), + Collateral: recoveredBobCollateral, phase: Phase.ACTIVE, }, ], @@ -697,8 +687,10 @@ test('liq-result-scenario-3', async t => { await assertStorageData({ t, storageRoot: chainStorage, - path: `vaultFactory.managers.manager0.liquidations.${time}.auctionResult`, // now1 is the nominal start time + path: `vaultFactory.managers.manager0.liquidations.${time.absValue.toString()}.auctionResult`, // now1 is the nominal start time expected: { + collateralOffered: aeth.make(63n), + istTarget: run.make(258n), collateralForReserve: aeth.make(12n), shortfallToReserve: run.make(66n), mintedProceeds: run.make(34n), @@ -711,6 +703,6 @@ test('liq-result-scenario-3', async t => { // TODO: Snapshot here await documentStorageSchema(t, chainStorage, { note: 'Scenario 3 Liquidation Visibility Snapshot', - node: `vaultFactory.managers.manager0.liquidations.${time}`, + node: `vaultFactory.managers.manager0.liquidations.${time.absValue.toString()}`, }); });