Skip to content

Commit

Permalink
fixup(liquidationVisibility): Rebase fixes - type and lint
Browse files Browse the repository at this point in the history
Refs: #35
  • Loading branch information
anilhelvaci committed Jul 15, 2024
1 parent 95f8c8e commit e42c203
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { makeHelpers } from '@agoric/deploy-script-support';
import { makeInstallCache } from '../src/proposals/utils.js';
import { getManifestVaultsUpgrade } from '../src/proposals/vaultsUpgrade.js';
import { makeInstallCache } from '@agoric/inter-protocol/src/proposals/utils.js';
import { getManifestVaultsUpgrade } from '@agoric/inter-protocol/src/proposals/vaultsUpgrade.js';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
export const vaultsUpgradeProposalBuilder = async ({
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/src/proposals/vaultsUpgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const upgradeVaults = async (
console.log('Upgrade Resulted With: ', result);
};

/** @type { import("@agoric/vats/src/core/lib-boot").BootstrapManifest } */
/** @type {import('@agoric/vats/src/core/lib-boot').BootstrapManifest} */
const manifest = {
[upgradeVaults.name]: {
// include rationale for closely-held, high authority capabilities
Expand Down
38 changes: 5 additions & 33 deletions packages/inter-protocol/src/vaultFactory/types-ambient.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

/**
* @typedef {import('./vaultFactory.js').VaultFactoryContract['publicFacet']} VaultFactoryPublicFacet
*
*
* @typedef {import('./liquidation.js').VaultData} VaultData
*
* @typedef {import('./proceeds.js').DistributionPlan} DistributionPlan
* @import {VaultNotification} from './vault.js'
* @import {Vault} from './vault.js'
* @import {VaultKit} from './vaultKit.js'
Expand All @@ -13,39 +18,6 @@
* @import {Timestamp} from '@agoric/time'
* @import {TimestampRecord} from '@agoric/time'
* @import {RelativeTime} from '@agoric/time'
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* @typedef {import('./liquidation.js').VaultData} VaultData
*
* @typedef {import('./proceeds.js').DistributionPlan} DistributionPlan
*/

/**
Expand Down
1 change: 0 additions & 1 deletion packages/inter-protocol/src/vaultFactory/vaultManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ export const prepareVaultManagerKit = (
collateralUnit,
debtBrand,
);
// @ts-expect-error XXX quotes
ephemera.storedQuotesNotifier = makeStoredNotifier(
// @ts-expect-error XXX quotes
quoteNotifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const distributeProportionalShares = (

const collShare = makeRatioFromAmounts(unsoldCollateral, totalCollDeposited);
const currShare = makeRatioFromAmounts(proceeds, totalCollDeposited);
/** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */
/** @type {TransferPart[]} */
const transfers = [];
let proceedsLeft = proceeds;
let collateralLeft = unsoldCollateral;
Expand Down Expand Up @@ -261,7 +261,7 @@ export const distributeProportionalSharesWithLimits = (
// collateral to reach their share. Then see what's left, and allocate it
// among the remaining depositors. Escape to distributeProportionalShares if
// anything doesn't work.
/** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */
/** @type {TransferPart[]} */
const transfers = [];
let proceedsLeft = proceeds;
let collateralLeft = unsoldCollateral;
Expand Down Expand Up @@ -388,7 +388,7 @@ export const distributeProportionalSharesWithLimits = (
* GovernanceTerms<typeof auctioneerParamTypes> & {
* timerService: import('@agoric/time/src/types.js').TimerService;
* reservePublicFacet: AssetReservePublicFacet;
* priceAuthority: PriceAuthority;
* priceAuthority: import('@agoric/zoe/tools/types.js').PriceAuthority;
* }
* >} zcf
* @param {{
Expand Down Expand Up @@ -721,7 +721,7 @@ export const start = async (zcf, privateArgs, baggage) => {

const newBook = await makeAuctionBook(
brands.Bid,
brand,
/** @type {Brand<'nat'>} */ (brand),
priceAuthority,
bNode,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { E } from '@endo/eventual-send';
import '@agoric/notifier/exported.js';
import '@agoric/time';
Expand All @@ -9,7 +8,7 @@ import '../../src/vaultFactory/types.js';
import '@agoric/zoe/exported.js';
import { makeManualPriceAuthority } from '@agoric/zoe/tools/manualPriceAuthority.js';
import { makeScalarBigMapStore } from '@agoric/vat-data/src/index.js';
import { providePriceAuthorityRegistry } from '@agoric/zoe/tools/priceAuthorityRegistry.js';
import { providePriceAuthorityRegistry } from '@agoric/vats/src/priceAuthorityRegistry.js';
import { makeScriptedPriceAuthority } from '@agoric/zoe/tools/scriptedPriceAuthority.js';
import * as utils from '@agoric/vats/src/core/utils.js';
import { makePromiseSpace, makeAgoricNamesAccess } from '@agoric/vats';
Expand All @@ -27,7 +26,6 @@ import {
} from '../../src/proposals/econ-behaviors.js';

/**
*
* @param {ERef<StorageNode>} chainStorageP
* @param {Map<string, Promise>} childrenMap
*/
Expand Down Expand Up @@ -97,8 +95,8 @@ const setupBootstrap = async (t, optTimer) => {

/**
* @typedef {Record<string, any> & {
* aeth: IssuerKit & import('../supports.js').AmountUtils;
* run: IssuerKit & import('../supports.js').AmountUtils;
* aeth: IssuerKit & import('@agoric/zoe/tools/test-utils.js').AmountUtils;
* run: IssuerKit & import('@agoric/zoe/tools/test-utils.js').AmountUtils;
* bundleCache: Awaited<
* ReturnType<
* typeof import('@agoric/swingset-vat/tools/bundleTool.js').unsafeMakeBundleCache
Expand All @@ -118,7 +116,7 @@ const setupBootstrap = async (t, optTimer) => {
* @param {RelativeTime} quoteInterval
* @param {Amount | undefined} unitAmountIn
* @param {Partial<import('../../src/auction/params.js').AuctionParams>} actionParamArgs
* @param {| {
* @param {{
* btc: any;
* btcPrice: Ratio;
* btcAmountIn: any;
Expand Down
15 changes: 7 additions & 8 deletions packages/inter-protocol/test/liquidationVisibility/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export const setupBasics = async (zoe, contractsWrapper) => {

/**
* @typedef {Record<string, any> & {
* aeth: IssuerKit & import('../supports.js').AmountUtils;
* run: IssuerKit & import('../supports.js').AmountUtils;
* aeth: IssuerKit & import('@agoric/zoe/tools/test-utils.js').AmountUtils;
* run: IssuerKit & import('@agoric/zoe/tools/test-utils.js').AmountUtils;
* bundleCache: Awaited<ReturnType<typeof unsafeMakeBundleCache>>;
* rates: VaultManagerParamValues;
* interestTiming: InterestTiming;
Expand All @@ -77,10 +77,10 @@ export const setupBasics = async (zoe, contractsWrapper) => {

/**
* NOTE: called separately by each test so zoe/priceAuthority don't interfere
* This helper function will create economicCommittee, reserve and auctioneer. It will
* start the vaultFactory and open a new vault with the collateral provided in
* the context. The collateral value will be set by the priceAuthority with the
* ratio provided by priceOrList
* This helper function will create economicCommittee, reserve and auctioneer.
* It will start the vaultFactory and open a new vault with the collateral
* provided in the context. The collateral value will be set by the
* priceAuthority with the ratio provided by priceOrList
*
* @param {import('ava').ExecutionContext<Context>} t
* @param {NatValue[] | Ratio} priceOrList
Expand Down Expand Up @@ -281,9 +281,8 @@ export const setClockAndAdvanceNTimes = async (
let currentTime = start;
// first time through is at START, then n TIMES more plus INCR
for (let i = 0; i <= times; i += 1) {
// eslint-disable-next-line no-await-in-loop
await timer.advanceTo(TimeMath.absValue(currentTime));
// eslint-disable-next-line no-await-in-loop

await eventLoopIteration();
currentTime = TimeMath.addAbsRel(currentTime, TimeMath.relValue(incr));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,15 @@ const setupServices = async (

return {
zoe,
timer,
governor: g,
vaultFactory: v,
runKit: { issuer: run.issuer, brand: run.brand },
priceAuthority,
reserveKit,
auctioneerKit,
priceAuthorityAdmin,
aethTestPriceAuthority,
};
};

Expand Down

0 comments on commit e42c203

Please sign in to comment.