Skip to content

Commit

Permalink
fixup(liquidationVisibility): add startTime field to `auctionResult…
Browse files Browse the repository at this point in the history
…s` and update tests accordingly

Refs: #35
  • Loading branch information
anilhelvaci committed Jul 15, 2024
1 parent b5bd27a commit 298aa06
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 229 deletions.
3 changes: 3 additions & 0 deletions packages/inter-protocol/src/vaultFactory/vaultManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export const watchQuoteNotifier = async (notifierP, watcher, ...args) => {
* collateralSold?: Amount<'nat'>;
* collateralRemaining?: Amount<'nat'>;
* endTime?: import('@agoric/time/src/types.js').TimestampRecord | null;
* startTime?: import('@agoric/time/src/types.js').TimestampRecord | null;
* }} AuctionResultState
*
* @typedef {{
Expand Down Expand Up @@ -758,6 +759,8 @@ export const prepareVaultManagerKit = (
collateralRemaining: plan.collatRemaining,
// @ts-expect-error
endTime: auctionSchedule?.liveAuctionSchedule.endTime,
// @ts-expect-error
startTime: auctionSchedule?.liveAuctionSchedule.startTime,
};
return E(
liquidationRecorderKits.auctionResultRecorderKit.recorder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Generated by [AVA](https://avajs.dev).
brand: Object @Alleged: ZDEFAULT brand {},
value: 0n,
},
startTime: {
absValue: 3610n,
timerBrand: Object @Alleged: timerBrand {},
},
},
],
[
Expand Down Expand Up @@ -116,6 +120,10 @@ Generated by [AVA](https://avajs.dev).
brand: Object @Alleged: ZDEFAULT brand {},
value: 0n,
},
startTime: {
absValue: 3610n,
timerBrand: Object @Alleged: timerBrand {},
},
},
],
[
Expand Down Expand Up @@ -183,6 +191,10 @@ Generated by [AVA](https://avajs.dev).
brand: Object @Alleged: ZDEFAULT brand {},
value: 0n,
},
startTime: {
absValue: 3610n,
timerBrand: Object @Alleged: timerBrand {},
},
},
],
[
Expand Down Expand Up @@ -252,6 +264,10 @@ Generated by [AVA](https://avajs.dev).
brand: Object @Alleged: ZDEFAULT brand {},
value: 2065n,
},
startTime: {
absValue: 3610n,
timerBrand: Object @Alleged: timerBrand {},
},
},
],
[
Expand Down Expand Up @@ -321,237 +337,10 @@ Generated by [AVA](https://avajs.dev).
brand: Object @Alleged: ZDEFAULT brand {},
value: 66n,
},
},
],
[
'published.vaultFactory.managers.manager0.liquidations.3600.vaults.postAuction',
[
[
'vault1',
{
Collateral: {
brand: Object @Alleged: aEth brand {},
value: 43n,
},
phase: 'active',
},
],
],
],
[
'published.vaultFactory.managers.manager0.liquidations.3600.vaults.preAuction',
[
[
'vault0',
{
collateralAmount: {
brand: Object @Alleged: aEth brand {},
value: 15n,
},
debtAmount: {
brand: Object @Alleged: ZDEFAULT brand {},
value: 100n,
},
},
],
[
'vault1',
{
collateralAmount: {
brand: Object @Alleged: aEth brand {},
value: 48n,
},
debtAmount: {
brand: Object @Alleged: ZDEFAULT brand {},
value: 158n,
},
},
],
],
],
]

## liq-result-scenario-1

> Scenario 1 Liquidation Visibility Snapshot
> The example below illustrates the schema of the data published there.
>
> 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: 400n,
},
collateralRemaining: {
brand: Object @Alleged: aEth brand {},
value: 0n,
},
collateralSold: {
brand: Object @Alleged: aEth brand {},
value: 400n,
},
endTime: {
absValue: 3614n,
timerBrand: Object @Alleged: timerBrand {},
},
istTarget: {
brand: Object @Alleged: ZDEFAULT brand {},
value: 1680n,
},
mintedProceeds: {
brand: Object @Alleged: ZDEFAULT brand {},
value: 1680n,
},
shortfallToReserve: {
brand: Object @Alleged: ZDEFAULT brand {},
value: 0n,
},
},
],
[
'published.vaultFactory.managers.manager0.liquidations.3600.vaults.postAuction',
[],
],
[
'published.vaultFactory.managers.manager0.liquidations.3600.vaults.preAuction',
[
[
'vault0',
{
collateralAmount: {
brand: Object @Alleged: aEth brand {},
value: 400n,
},
debtAmount: {
brand: Object @Alleged: ZDEFAULT brand {},
value: 1680n,
},
},
],
],
],
]

## liq-result-scenario-2

> Scenario 2 Liquidation Visibility Snapshot
> The example below illustrates the schema of the data published there.
>
> 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,
startTime: {
absValue: 3610n,
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,
},
},
],
],
],
]

## liq-result-scenario-3

> Scenario 3 Liquidation Visibility Snapshot
> The example below illustrates the schema of the data published there.
>
> See also board marshalling conventions (_to appear_).
[
[
'published.vaultFactory.managers.manager0.liquidations.3600.auctionResult',
{
collateralForReserve: {
brand: Object @Alleged: aEth brand {},
value: 12n,
},
collateralOffered: {
brand: Object @Alleged: aEth brand {},
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,
},
},
],
[
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ test('liq-flow-1', async t => {
collateralSold: aeth.make(400n),
collateralRemaining: aeth.makeEmpty(),
endTime,
startTime,
},
});

Expand Down Expand Up @@ -579,6 +580,7 @@ test('liq-flow-1.1', async t => {
collateralSold: aeth.make(400n),
collateralRemaining: aeth.makeEmpty(),
endTime,
startTime,
},
});

Expand All @@ -595,6 +597,7 @@ test('liq-flow-1.1', async t => {
collateralSold: abtc.make(400n),
collateralRemaining: abtc.makeEmpty(),
endTime,
startTime,
},
});

Expand Down Expand Up @@ -842,6 +845,7 @@ test('liq-flow-2a', async t => {
collateralSold: aeth.make(700n),
collateralRemaining: aeth.makeEmpty(),
endTime,
startTime: start1,
},
});

Expand Down Expand Up @@ -1109,6 +1113,7 @@ test('liq-flow-2b', async t => {
collateralSold: aeth.make(8n),
collateralRemaining: aeth.make(5n),
endTime,
startTime,
},
});

Expand Down Expand Up @@ -1367,6 +1372,7 @@ test('liq-rejected-schedule', async t => {
collateralSold: aeth.make(400n),
collateralRemaining: aeth.makeEmpty(),
endTime: undefined,
startTime: undefined,
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ export const checkVisibility = async ({
},
collateralRemaining: { value: 0n },
endTime: { absValue: endTime.absValue },
startTime: { absValue: startTime.absValue },
});

t.log('preAuction', preAuction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ Generated by [AVA](https://avajs.dev).
},
value: 0n,
},
startTime: {
absValue: 3602n,
timerBrand: Object @Alleged: BoardRemotetimerBrand {
getBoardId: Function getBoardId {},
},
},
},
],
]
Binary file not shown.

0 comments on commit 298aa06

Please sign in to comment.