Skip to content

Commit

Permalink
chore(liquidationVisibility): #4 test for scenario 2a passed
Browse files Browse the repository at this point in the history
  • Loading branch information
anilhelvaci committed Feb 16, 2024
1 parent 6efea84 commit 076a2f0
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {},
},
},
],
],
],
]
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`,
});
});

Expand All @@ -456,7 +456,6 @@ test('liq-result-scenario-3', async t => {
aeth.make(1n),
manualTimer,
ONE_WEEK,
500n,
{ StartFrequency: ONE_HOUR },
);

Expand Down Expand Up @@ -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
Expand All @@ -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(),
},
],
],
Expand Down Expand Up @@ -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,
},
],
Expand All @@ -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),
Expand All @@ -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()}`,
});
});

0 comments on commit 076a2f0

Please sign in to comment.