Skip to content

Commit

Permalink
fix: rename from FarClass to ExoClass, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Nov 5, 2022
1 parent 1a31c32 commit e3dfc91
Show file tree
Hide file tree
Showing 21 changed files with 137 additions and 152 deletions.
4 changes: 2 additions & 2 deletions packages/ERTP/src/payment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { initEmpty } from '@agoric/store';
import { vivifyFarClass } from '@agoric/vat-data';
import { vivifyExoClass } from '@agoric/vat-data';

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

Expand All @@ -12,7 +12,7 @@ import { vivifyFarClass } from '@agoric/vat-data';
* @returns {() => Payment<K>}
*/
export const vivifyPaymentKind = (issuerBaggage, name, brand, PaymentI) => {
const makePayment = vivifyFarClass(
const makePayment = vivifyExoClass(
issuerBaggage,
`${name} payment`,
PaymentI,
Expand Down
11 changes: 4 additions & 7 deletions packages/ERTP/src/paymentLedger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
import { isPromise } from '@endo/promise-kit';
import { assertCopyArray } from '@endo/marshal';
import { fit, M } from '@agoric/store';
import {
provideDurableWeakMapStore,
vivifyFarInstance,
} from '@agoric/vat-data';
import { provideDurableWeakMapStore, vivifyExo } from '@agoric/vat-data';
import { AmountMath } from './amountMath.js';
import { vivifyPaymentKind } from './payment.js';
import { vivifyPurseKind } from './purse.js';
Expand Down Expand Up @@ -86,7 +83,7 @@ export const vivifyPaymentLedger = (
optShutdownWithFailure = undefined,
) => {
/** @type {Brand} */
const brand = vivifyFarInstance(issuerBaggage, `${name} brand`, BrandI, {
const brand = vivifyExo(issuerBaggage, `${name} brand`, BrandI, {
isMyIssuer(allegedIssuer) {
// BrandI delays calling this method until `allegedIssuer` is a Remotable
return allegedIssuer === issuer;
Expand Down Expand Up @@ -385,7 +382,7 @@ export const vivifyPaymentLedger = (
);

/** @type {Issuer} */
const issuer = vivifyFarInstance(issuerBaggage, `${name} issuer`, IssuerI, {
const issuer = vivifyExo(issuerBaggage, `${name} issuer`, IssuerI, {
getBrand() {
return brand;
},
Expand Down Expand Up @@ -483,7 +480,7 @@ export const vivifyPaymentLedger = (
});

/** @type {Mint} */
const mint = vivifyFarInstance(issuerBaggage, `${name} mint`, MintI, {
const mint = vivifyExo(issuerBaggage, `${name} mint`, MintI, {
getIssuer() {
return issuer;
},
Expand Down
4 changes: 2 additions & 2 deletions packages/ERTP/src/purse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vivifyFarClassKit, makeScalarBigSetStore } from '@agoric/vat-data';
import { vivifyExoClassKit, makeScalarBigSetStore } from '@agoric/vat-data';
import { AmountMath } from './amountMath.js';
import { makeTransientNotifierKit } from './transientNotifier.js';

Expand Down Expand Up @@ -28,7 +28,7 @@ export const vivifyPurseKind = (
// that created depositFacet as needed. But this approach ensures a constant
// identity for the facet and exercises the multi-faceted object style.
const { depositInternal, withdrawInternal } = purseMethods;
const makePurseKit = vivifyFarClassKit(
const makePurseKit = vivifyExoClassKit(
issuerBaggage,
`${name} Purse`,
PurseIKit,
Expand Down
8 changes: 4 additions & 4 deletions packages/governance/src/binaryVoteCounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Far } from '@endo/marshal';
import { makePromiseKit } from '@endo/promise-kit';
import { makeHeapFarInstance, keyEQ, makeStore } from '@agoric/store';
import { makeHeapExo, keyEQ, makeStore } from '@agoric/store';
import { E } from '@endo/eventual-send';

import {
Expand Down Expand Up @@ -149,7 +149,7 @@ const makeBinaryVoteCounter = (
});
};

const closeFacet = makeHeapFarInstance(
const closeFacet = makeHeapExo(
'BinaryVoteCounter close',
BinaryVoteCounterCloseI,
{
Expand All @@ -160,7 +160,7 @@ const makeBinaryVoteCounter = (
},
);

const creatorFacet = makeHeapFarInstance(
const creatorFacet = makeHeapExo(
'BinaryVoteCounter creator',
BinaryVoteCounterAdminI,
{
Expand All @@ -183,7 +183,7 @@ const makeBinaryVoteCounter = (
},
);

const publicFacet = makeHeapFarInstance(
const publicFacet = makeHeapExo(
'BinaryVoteCounter public',
BinaryVoteCounterPublicI,
{
Expand Down
66 changes: 29 additions & 37 deletions packages/governance/src/committee.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import { makeStoredPublishKit } from '@agoric/notifier';
import { makeStore, makeHeapFarInstance, M } from '@agoric/store';
import { makeStore, makeHeapExo, M } from '@agoric/store';
import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js';
import { E } from '@endo/eventual-send';

Expand Down Expand Up @@ -81,27 +81,23 @@ const start = (zcf, privateArgs) => {
// Ensure that the voter can't get access to the unwrapped voteCap, and
// has no control over the voteHandle or weight
return harden({
voter: makeHeapFarInstance(`voter${index}`, VoterI, {
voter: makeHeapExo(`voter${index}`, VoterI, {
castBallotFor(questionHandle, positions) {
const { voteCap } = allQuestions.get(questionHandle);
return E(voteCap).submitVote(voterHandle, positions, 1n);
},
}),
invitationMakers: makeHeapFarInstance(
'invitation makers',
InvitationMakerI,
{
makeVoteInvitation(positions, questionHandle) {
const continuingVoteHandler = cSeat => {
cSeat.exit();
const { voteCap } = allQuestions.get(questionHandle);
return E(voteCap).submitVote(voterHandle, positions, 1n);
};

return zcf.makeInvitation(continuingVoteHandler, 'vote');
},
invitationMakers: makeHeapExo('invitation makers', InvitationMakerI, {
makeVoteInvitation(positions, questionHandle) {
const continuingVoteHandler = cSeat => {
cSeat.exit();
const { voteCap } = allQuestions.get(questionHandle);
return E(voteCap).submitVote(voterHandle, positions, 1n);
};

return zcf.makeInvitation(continuingVoteHandler, 'vote');
},
),
}),
});
};

Expand All @@ -118,29 +114,25 @@ const start = (zcf, privateArgs) => {
[...Array(committeeSize).keys()].map(makeCommitteeVoterInvitation),
);

const publicFacet = makeHeapFarInstance(
'Committee publicFacet',
ElectoratePublicI,
{
getQuestionSubscriber() {
return questionsSubscriber;
},
getOpenQuestions() {
return getOpenQuestions(allQuestions);
},
getName() {
return committeeName;
},
getInstance() {
return zcf.getInstance();
},
getQuestion(handleP) {
return getQuestion(handleP, allQuestions);
},
const publicFacet = makeHeapExo('Committee publicFacet', ElectoratePublicI, {
getQuestionSubscriber() {
return questionsSubscriber;
},
);
getOpenQuestions() {
return getOpenQuestions(allQuestions);
},
getName() {
return committeeName;
},
getInstance() {
return zcf.getInstance();
},
getQuestion(handleP) {
return getQuestion(handleP, allQuestions);
},
});

const creatorFacet = makeHeapFarInstance(
const creatorFacet = makeHeapExo(
'Committee creatorFacet',
ElectorateCreatorI,
{
Expand Down
6 changes: 3 additions & 3 deletions packages/governance/src/noActionElectorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { makePublishKit } from '@agoric/notifier';
import { makePromiseKit } from '@endo/promise-kit';
import { makeHeapFarInstance } from '@agoric/store';
import { makeHeapExo } from '@agoric/store';

import { ElectoratePublicI, ElectorateCreatorI } from './typeGuards.js';

Expand All @@ -15,7 +15,7 @@ import { ElectoratePublicI, ElectorateCreatorI } from './typeGuards.js';
const start = zcf => {
const { subscriber } = makePublishKit();

const publicFacet = makeHeapFarInstance('publicFacet', ElectoratePublicI, {
const publicFacet = makeHeapExo('publicFacet', ElectoratePublicI, {
getQuestionSubscriber() {
return subscriber;
},
Expand All @@ -37,7 +37,7 @@ const start = zcf => {
},
});

const creatorFacet = makeHeapFarInstance('creatorFacet', ElectorateCreatorI, {
const creatorFacet = makeHeapExo('creatorFacet', ElectorateCreatorI, {
getPoserInvitation() {
return zcf.makeInvitation(() => {},
`noActionElectorate doesn't allow posing questions`);
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/question.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

import { makeHeapFarInstance, fit, keyEQ, M } from '@agoric/store';
import { makeHeapExo, fit, keyEQ, M } from '@agoric/store';
import { makeHandle } from '@agoric/zoe/src/makeHandle.js';

import { QuestionI, QuestionSpecShape } from './typeGuards.js';
Expand Down Expand Up @@ -82,7 +82,7 @@ const buildUnrankedQuestion = (questionSpec, counterInstance) => {
const questionHandle = makeHandle('Question');

/** @type {Question} */
return makeHeapFarInstance('question details', QuestionI, {
return makeHeapExo('question details', QuestionI, {
getVoteCounter() {
return counterInstance;
},
Expand Down
4 changes: 2 additions & 2 deletions packages/inter-protocol/src/psm/psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
ParamTypes,
publicMixinAPI,
} from '@agoric/governance';
import { M, provide, vivifyFarInstance } from '@agoric/vat-data';
import { M, provide, vivifyExo } from '@agoric/vat-data';
import { AmountMath } from '@agoric/ertp';

import { makeMakeCollectFeesInvitation } from '../collectFees.js';
Expand Down Expand Up @@ -296,7 +296,7 @@ export const start = async (zcf, privateArgs, baggage) => {
},
...publicMixin,
};
const publicFacet = vivifyFarInstance(
const publicFacet = vivifyExo(
baggage,
'Parity Stability Module',
PSMI,
Expand Down
16 changes: 6 additions & 10 deletions packages/inter-protocol/src/psm/psmCharter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check

import '@agoric/governance/src/exported.js';
import { makeScalarMapStore, M, makeHeapFarInstance, fit } from '@agoric/store';
import { makeScalarMapStore, M, makeHeapExo, fit } from '@agoric/store';
import '@agoric/zoe/exported.js';
import '@agoric/zoe/src/contracts/exported.js';
import { InstanceHandleShape } from '@agoric/zoe/src/typeGuards.js';
Expand Down Expand Up @@ -90,14 +90,10 @@ export const start = async zcf => {
TimestampShape,
).returns(M.promise()),
});
const invitationMakers = makeHeapFarInstance(
'PSM Invitation Makers',
MakerShape,
{
VoteOnParamChange: makeParamInvitation,
VoteOnPauseOffers: makeOfferFilterInvitation,
},
);
const invitationMakers = makeHeapExo('PSM Invitation Makers', MakerShape, {
VoteOnParamChange: makeParamInvitation,
VoteOnPauseOffers: makeOfferFilterInvitation,
});

const charterMemberHandler = seat => {
seat.exit();
Expand All @@ -111,7 +107,7 @@ export const start = async zcf => {
makeCharterMemberInvitation: M.call().returns(M.promise()),
});

const creatorFacet = makeHeapFarInstance(
const creatorFacet = makeHeapExo(
'PSM Charter creatorFacet',
psmCharterCreatorI,
{
Expand Down
4 changes: 2 additions & 2 deletions packages/smart-wallet/src/smartWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@agoric/notifier';
import { fit, M, makeScalarMapStore } from '@agoric/store';
import {
defineVirtualFarClassKit,
defineVirtualExoClassKit,
makeScalarBigMapStore,
pickFacet,
} from '@agoric/vat-data';
Expand Down Expand Up @@ -538,7 +538,7 @@ const finish = ({ state, facets }) => {
});
};

const SmartWalletKit = defineVirtualFarClassKit(
const SmartWalletKit = defineVirtualExoClassKit(
'SmartWallet',
behaviorGuards,
initState,
Expand Down
6 changes: 3 additions & 3 deletions packages/smart-wallet/src/walletFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { BridgeId, WalletName } from '@agoric/internal';
import { fit, M, makeHeapFarInstance } from '@agoric/store';
import { fit, M, makeHeapExo } from '@agoric/store';
import { makeAtomicProvider } from '@agoric/store/src/stores/store-utils.js';
import { makeScalarBigMapStore } from '@agoric/vat-data';
import { makeMyAddressNameAdminKit } from '@agoric/vats/src/core/basic-behaviors.js';
Expand Down Expand Up @@ -75,7 +75,7 @@ export const start = async (zcf, privateArgs) => {
const walletsByAddress = makeScalarBigMapStore('walletsByAddress');
const provider = makeAtomicProvider(walletsByAddress);

const handleWalletAction = makeHeapFarInstance(
const handleWalletAction = makeHeapExo(
'walletActionHandler',
M.interface('walletActionHandlerI', {
fromBridge: M.call(M.string(), shape.WalletBridgeMsg).returns(
Expand Down Expand Up @@ -131,7 +131,7 @@ export const start = async (zcf, privateArgs) => {
zoe,
});

const creatorFacet = makeHeapFarInstance(
const creatorFacet = makeHeapExo(
'walletFactoryCreator',
M.interface('walletFactoryCreatorI', {
provideSmartWallet: M.callWhen(
Expand Down
6 changes: 3 additions & 3 deletions packages/store/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export {
export {
defendPrototype,
initEmpty,
defineHeapFarClass,
defineHeapFarClassKit,
makeHeapFarInstance,
defineHeapExoClass,
defineHeapExoClassKit,
makeHeapExo,
} from './patterns/interface-tools.js';

export { compareRank, isRankSorted, sortByRank } from './patterns/rankOrder.js';
Expand Down
Loading

0 comments on commit e3dfc91

Please sign in to comment.