Skip to content

Commit

Permalink
refactor(ertp): rename reallyPrepareIssuerKit to prepareIssuerKit (#8504
Browse files Browse the repository at this point in the history
)
  • Loading branch information
erights authored Nov 7, 2023
1 parent d708d81 commit 38a11e0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
20 changes: 4 additions & 16 deletions packages/ERTP/src/issuerKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,6 @@ export const upgradeIssuerKit = (
};
harden(upgradeIssuerKit);

/**
* Confusingly, `prepareIssuerKit` was the original name for `upgradeIssuerKit`,
* even though it is used only to upgrade a predecessor issuerKit. Use
* `makeDurableIssuerKit` to make a new one.
*
* @deprecated Use `upgradeIssuerKit` instead if that's what you want. Or
* `reallyPrepareIssuerKit` if you want the behavior that should have been
* bound to this name.
*/
export const prepareIssuerKit = upgradeIssuerKit;

/**
* Does baggage already have an issuerKit?
*
Expand Down Expand Up @@ -183,9 +172,8 @@ export const makeDurableIssuerKit = (
harden(makeDurableIssuerKit);

/**
* What _should_ have been named `prepareIssuerKit`. Used to either revive a
* predecessor issuerKit, or to make a new durable one if it is absent, and to
* place it in baggage for the next successor.
* Used to either revive a predecessor issuerKit, or to make a new durable one
* if it is absent, and to place it in baggage for the next successor.
*
* @template {AssetKind} K The name becomes part of the brand in asset
* descriptions. The name is useful for debugging and double-checking
Expand Down Expand Up @@ -213,7 +201,7 @@ harden(makeDurableIssuerKit);
* @param {IssuerOptionsRecord} [options]
* @returns {IssuerKit<K>}
*/
export const reallyPrepareIssuerKit = (
export const prepareIssuerKit = (
issuerBaggage,
name,
// @ts-expect-error K could be instantiated with a different subtype of AssetKind
Expand Down Expand Up @@ -244,7 +232,7 @@ export const reallyPrepareIssuerKit = (
return issuerKit;
}
};
harden(reallyPrepareIssuerKit);
harden(prepareIssuerKit);

/**
* Used _only_ to make a new issuerKit that is effectively non-durable. This is
Expand Down
4 changes: 2 additions & 2 deletions packages/inter-protocol/src/price/fluxAggregatorContract.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @jessie-check

import { reallyPrepareIssuerKit } from '@agoric/ertp';
import { prepareIssuerKit } from '@agoric/ertp';
import { handleParamGovernance } from '@agoric/governance';
import { makeTracer, StorageNodeShape } from '@agoric/internal';
import { prepareDurablePublishKit } from '@agoric/notifier';
Expand Down Expand Up @@ -68,7 +68,7 @@ export const start = async (zcf, privateArgs, baggage) => {

// xxx uses contract baggage as issuerBagage, assumes one issuer in this contract
/** @type {import('./roundsManager.js').QuoteKit} */
const quoteIssuerKit = reallyPrepareIssuerKit(
const quoteIssuerKit = prepareIssuerKit(
baggage,
'quote',
'set',
Expand Down
4 changes: 2 additions & 2 deletions packages/vats/src/mintHolder.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
// @jessie-check

import { reallyPrepareIssuerKit } from '@agoric/ertp';
import { prepareIssuerKit } from '@agoric/ertp';

/** @typedef {import('@agoric/vat-data').Baggage} Baggage */

Expand All @@ -23,7 +23,7 @@ import { reallyPrepareIssuerKit } from '@agoric/ertp';
*/
function provideIssuerKit(zcf, baggage) {
const { keyword, assetKind, displayInfo } = zcf.getTerms();
return reallyPrepareIssuerKit(baggage, keyword, assetKind, displayInfo);
return prepareIssuerKit(baggage, keyword, assetKind, displayInfo);
}

/** @type {ContractMeta} */
Expand Down
4 changes: 2 additions & 2 deletions packages/zoe/src/contractSupport/priceAuthorityQuoteMint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AssetKind, reallyPrepareIssuerKit } from '@agoric/ertp';
import { AssetKind, prepareIssuerKit } from '@agoric/ertp';
import { provideDurableMapStore } from '@agoric/vat-data';

/**
Expand All @@ -11,7 +11,7 @@ export const provideQuoteMint = baggage => {
baggage,
'quoteMintIssuerBaggage',
);
const issuerKit = reallyPrepareIssuerKit(
const issuerKit = prepareIssuerKit(
issuerBaggage,
'quote',
AssetKind.SET,
Expand Down
4 changes: 2 additions & 2 deletions packages/zoe/src/zoeService/feeMint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
AssetKind,
IssuerShape,
BrandShape,
reallyPrepareIssuerKit,
prepareIssuerKit,
hasIssuer,
} from '@agoric/ertp';
import { initEmpty, M } from '@agoric/store';
Expand Down Expand Up @@ -43,7 +43,7 @@ const prepareFeeMint = (zoeBaggage, feeIssuerConfig, shutdownZoeVat) => {
}

const feeIssuerKit = /** @type {IssuerKit<'nat'>} */ (
reallyPrepareIssuerKit(
prepareIssuerKit(
mintBaggage,
feeIssuerConfig.name,
feeIssuerConfig.assetKind,
Expand Down
4 changes: 2 additions & 2 deletions packages/zoe/src/zoeService/makeInvitation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Fail, q } from '@agoric/assert';
import { provideDurableMapStore } from '@agoric/vat-data';
import { AssetKind, hasIssuer, reallyPrepareIssuerKit } from '@agoric/ertp';
import { AssetKind, hasIssuer, prepareIssuerKit } from '@agoric/ertp';
import { InvitationElementShape } from '../typeGuards.js';

/**
Expand All @@ -28,7 +28,7 @@ export const prepareInvitationKit = (baggage, shutdownZoeVat = undefined) => {
// Upgrade this legacy state by simply deleting it.
invitationKitBaggage.delete(ZOE_INVITATION_KIT);
}
const invitationKit = reallyPrepareIssuerKit(
const invitationKit = prepareIssuerKit(
invitationKitBaggage,
'Zoe Invitation',
AssetKind.SET,
Expand Down

0 comments on commit 38a11e0

Please sign in to comment.