Skip to content

Commit

Permalink
Merge pull request #6803 from Agoric/ta/inter-floating-promises
Browse files Browse the repository at this point in the history
resolve lint warnings in inter-protocol
  • Loading branch information
mergify[bot] authored Jan 16, 2023
2 parents d7652cb + 9721eb8 commit bfbb808
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/inter-protocol/scripts/add-initial-liquidity.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const addInitialLiquidity = async (homeP, { now = () => Date.now() }) => {

const payouts = await E(seat).getPayouts();
console.log('initialLiquidityPayouts', keys(payouts));
E(scratch).set('initialLiquidityPayouts', payouts);
await E(scratch).set('initialLiquidityPayouts', payouts);
};

console.log(
Expand Down
21 changes: 12 additions & 9 deletions packages/inter-protocol/src/price/priceAggregatorChainlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,19 @@ export const start = async (zcf, privateArgs, baggage) => {
});

// for each new quote from the priceAuthority, publish it to off-chain storage
observeNotifier(priceAuthority.makeQuoteNotifier(unitAmountIn, brandOut), {
updateState: quote =>
pricePublisher.publish(priceDescriptionFromQuote(quote)),
fail: reason => {
throw Error(`priceAuthority observer failed: ${reason}`);
void observeNotifier(
priceAuthority.makeQuoteNotifier(unitAmountIn, brandOut),
{
updateState: quote =>
pricePublisher.publish(priceDescriptionFromQuote(quote)),
fail: reason => {
throw Error(`priceAuthority observer failed: ${reason}`);
},
finish: done => {
throw Error(`priceAuthority observer died: ${done}`);
},
},
finish: done => {
throw Error(`priceAuthority observer died: ${done}`);
},
});
);

const creatorFacet = Far('PriceAggregatorChainlinkCreatorFacet', {
/**
Expand Down
1 change: 1 addition & 0 deletions packages/inter-protocol/src/proposals/demoIssuers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @jessie.js/no-nested-await -- demo file */
import { AmountMath, AssetKind } from '@agoric/ertp';
import { objectMap } from '@agoric/internal';
import {
Expand Down
6 changes: 3 additions & 3 deletions packages/inter-protocol/src/proposals/price-feed-proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const createPriceFeed = async (

// Default to an empty Map and home.priceAuthority.
produceAggregators.resolve(new Map());
E(client).assignBundle([_addr => ({ priceAuthority })]);
void E(client).assignBundle([_addr => ({ priceAuthority })]);

const timer = await chainTimerService;

Expand Down Expand Up @@ -168,7 +168,7 @@ export const createPriceFeed = async (
marshaller,
},
);
E(aggregators).set(terms, { aggregator });
await E(aggregators).set(terms, { aggregator });

E(E(agoricNamesAdmin).lookupAdmin('instance')).update(
AGORIC_INSTANCE_NAME,
Expand All @@ -177,7 +177,7 @@ export const createPriceFeed = async (

// Publish price feed in home.priceAuthority.
const forceReplace = true;
E(priceAuthorityAdmin)
void E(priceAuthorityAdmin)
.registerPriceAuthority(
E(aggregator.publicFacet).getPriceAuthority(),
brandIn,
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/src/vaultFactory/liquidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const makeQuote = (priceAuthority, highestDebtRatio, liquidationMargin) => {
* @param {Ratio} liquidationMargin
*/
const updateQuote = (quote, highestDebtRatio, liquidationMargin) => {
E(quote).updateLevel(
void E(quote).updateLevel(
highestDebtRatio.denominator, // collateral
liquidationThreshold(highestDebtRatio, liquidationMargin),
);
Expand Down
10 changes: 6 additions & 4 deletions packages/inter-protocol/test/psm/test-psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ test('limit', async t => {
const actualAnchor = await E(anchor.issuer).getAmountOf(anchorReturn);
t.deepEqual(actualAnchor, give);
// The pool should be unchanged
driver.assertPoolBalance(initialPool);
await driver.assertPoolBalance(initialPool);
});

test('limit is for minted', async t => {
Expand All @@ -354,7 +354,7 @@ test('limit is for minted', async t => {
trace('test going over limit');
const giveTooMuch = anchor.make(MINT_LIMIT);
const seat1 = await driver.swapAnchorForMintedSeat(giveTooMuch);
t.throwsAsync(
await t.throwsAsync(
() => E(seat1).getOfferResult(),
{
message: 'Request would exceed mint limit',
Expand Down Expand Up @@ -482,7 +482,7 @@ test('anchor is 2x minted', async t => {
const actualRun = await E(minted.issuer).getAmountOf(runPayouts.Out);
t.deepEqual(actualRun, expectedRun);

driver.assertPoolBalance(giveAnchor);
await driver.assertPoolBalance(giveAnchor);

const giveRun = AmountMath.make(minted.brand, scale6(100));
trace('get minted ratio', { giveRun, expectedRun, actualRun });
Expand All @@ -497,7 +497,9 @@ test('anchor is 2x minted', async t => {
anchorPerMinted,
);
t.deepEqual(actualAnchor, expectedAnchor);
driver.assertPoolBalance(AmountMath.subtract(giveAnchor, expectedAnchor));
await driver.assertPoolBalance(
AmountMath.subtract(giveAnchor, expectedAnchor),
);
trace('get anchor', { runGive: giveRun, expectedRun, actualAnchor });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const makeTestSpace = async log => {
},
psmParams,
);
psmVatRoot.bootstrap(...mockPsmBootstrapArgs(log));
void psmVatRoot.bootstrap(...mockPsmBootstrapArgs(log));

// TODO mimic the proposals and manifest of price-feed-proposal and price-feed-core
// calling ensureOracleBrands and createPriceFeed
Expand Down Expand Up @@ -237,7 +237,7 @@ test.serial('admin price', async t => {
t.context.consume.chainTimerService
);
// trigger an aggregation (POLL_INTERVAL=1n in context)
E(manualTimer).tickN(1);
await E(manualTimer).tickN(1);

const paPublicFacet = await E(zoe).getPublicFacet(priceAggregator);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const makePsmTestSpace = async log => {
},
psmParams,
);
psmVatRoot.bootstrap(...mockPsmBootstrapArgs(log));
void psmVatRoot.bootstrap(...mockPsmBootstrapArgs(log));

// @ts-expect-error cast
return /** @type {ChainBootstrapSpace} */ (psmVatRoot.getPromiseSpace());
Expand Down

0 comments on commit bfbb808

Please sign in to comment.