Skip to content

Commit

Permalink
fix for priceAuthorityInitial
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Mar 28, 2024
1 parent f9b13c1 commit f7caf03
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/inter-protocol/src/proposals/upgrade-vaults.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { E } from '@endo/far';
import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
import { AmountMath } from '@agoric/ertp/src/index.js';
import { makeScalarMapStore } from '@agoric/store/src/index.js';
import { makeTracer } from '@agoric/internal';
import { E } from '@endo/far';

const trace = makeTracer('UpgradeVaults', true);

// stand-in for Promise.any() which isn't available at this point.
const any = promises =>
Expand Down Expand Up @@ -76,20 +77,21 @@ export const upgradeVaults = async (powers, { options }) => {

const params = {};
for (const kwd of Object.keys(vaultBrands)) {
const b = vaultBrands[kwd];
const collateralBrand = vaultBrands[kwd];
const subscription = E(directorPF).getSubscription({
collateralBrand: b,
collateralBrand,
});
const notifier = makeNotifierFromAsyncIterable(subscription);
const { value } = await notifier.getUpdateSince();
const pubRecord = await E(subscription).subscribeAfter(0n);
const { current } = pubRecord.head.value;
trace(kwd, 'params at', pubRecord.publishCount, 'are', current);
params[kwd] = harden({
brand: b,
debtLimit: value.current.DebtLimit.value,
interestRate: value.current.InterestRate.value,
liquidationMargin: value.current.LiquidationMargin.value,
liquidationPadding: value.current.LiquidationPadding.value,
liquidationPenalty: value.current.LiquidationPenalty.value,
mintFee: value.current.MintFee.value,
brand: collateralBrand,
debtLimit: current.DebtLimit.value,
interestRate: current.InterestRate.value,
liquidationMargin: current.LiquidationMargin.value,
liquidationPadding: current.LiquidationPadding.value,
liquidationPenalty: current.LiquidationPenalty.value,
mintFee: current.MintFee.value,
});
}
return params;
Expand Down

0 comments on commit f7caf03

Please sign in to comment.