diff --git a/packages/zoe/src/contractFacet.js b/packages/zoe/src/contractFacet.js index 69108260394..94045bac707 100644 --- a/packages/zoe/src/contractFacet.js +++ b/packages/zoe/src/contractFacet.js @@ -11,7 +11,7 @@ import { assert, details, q } from '@agoric/assert'; import { E } from '@agoric/eventual-send'; import { isOfferSafe } from './offerSafety'; import { areRightsConserved } from './rightsConservation'; -import { assertKeywordName, cleanProposal, getKeywords } from './cleanProposal'; +import { assertKeywordName, getKeywords } from './cleanProposal'; import { makeContractTables } from './state'; import { filterObj, filterFillAmounts, tuple } from './objArrayConversion'; import { evalContractBundle } from './evalContractCode'; @@ -39,7 +39,7 @@ export function buildRootObject(_vatPowers) { 'brandKeywordRecord', ); /** - * @param {InstanceRecord} instanceRecord + * @param {InstanceRecord & ZcfInstanceRecord} instanceRecord */ const visibleInstanceRecord = instanceRecord => filterObj(instanceRecord, visibleInstanceRecordFields); @@ -56,7 +56,7 @@ export function buildRootObject(_vatPowers) { /** @param {OfferRecord} offerRecord */ const removeAmountsAndNotifier = offerRecord => filterObj(offerRecord, ['handle', 'instanceHandle', 'proposal']); - /** @param {IssuerRecord} issuerRecord */ + /** @param {IssuerRecord&PrivateIssuerRecord} issuerRecord */ const removePurse = issuerRecord => filterObj(issuerRecord, ['issuer', 'brand', 'amountMath']); @@ -172,6 +172,9 @@ export function buildRootObject(_vatPowers) { * Create the contract-facing Zoe facet. * * @param {ZoeService} zoeService + * @param {InstanceRecord & ZcfInstanceRecord} instanceRecord + * @param {Issuer} inviteIssuer + * @param {ZoeForZcf} zoeForZcf * @returns {ContractFacet} */ const makeContractFacet = ( @@ -240,7 +243,7 @@ export function buildRootObject(_vatPowers) { getIssuerForBrand: brand => issuerTable.get(brand).issuer, getBrandForIssuer: issuer => issuerTable.brandFromIssuer(issuer), getAmountMath: getAmountMathForBrand, - getVatAdmin: instanceRecord.adminNode, + getVatAdmin: () => instanceRecord.adminNode, }; return harden(contractFacet); }; @@ -257,16 +260,15 @@ export function buildRootObject(_vatPowers) { finish: () => {}, }); - const cleanedProposal = cleanProposal(getAmountMathForBrand, proposal); const offerRecord = { instanceHandle, - proposal: cleanedProposal, + proposal, currentAllocation: allocation, notifier: undefined, updater: ignoringUpdater, }; - const { exit } = cleanedProposal; + const { exit } = proposal; const [exitKind] = Object.getOwnPropertyNames(exit); /** @type {CompleteObj | undefined} */ diff --git a/packages/zoe/src/internal-types.js b/packages/zoe/src/internal-types.js index 1273f378314..b478d5eb6ee 100644 --- a/packages/zoe/src/internal-types.js +++ b/packages/zoe/src/internal-types.js @@ -17,7 +17,7 @@ * @typedef {Object} ZcfForZoe * The facet ZCF presents to Zoe. * - * @property {(offerHandle: OfferHandle, proposal: Proposal, allocation: Allocation) => (CompleteObj | undefined)} addOffer + * @property {(offerHandle: OfferHandle, proposal: ProposalRecord, allocation: Allocation) => (CompleteObj | undefined)} addOffer * Add a single offer to this contract instance. */ @@ -40,7 +40,7 @@ * @typedef StartContractParams * @property {ZoeService} zoeService - The canonical Zoe service in case the contract wants it * @property {SourceBundle} bundle an object containing source code and moduleFormat - * @property {InstanceRecord} instanceData, fields for the instanceRecord + * @property {InstanceRecord&InternalInstanceRecord} instanceData, fields for the instanceRecord * @property {ZoeForZcf} zoeForZcf - An inner facet of Zoe for the contractFacet's use * @property {Issuer} inviteIssuer, Zoe's inviteIssuer, for the contract to use * @@ -73,6 +73,12 @@ * @property {Promise} zcfForZoe - the inner facet for Zoe to use * @property {Set} offerHandles - the offer handles for this instance * + * @typedef {Object} ZcfInstanceRecord + * @property {VatAdmin} adminNode + * + * @typedef {Object} PrivateIssuerRecord + * @property {Purse} purse + * * @typedef {Object} PrivateOfferRecord * @property {Allocation} currentAllocation - the allocation corresponding to this offer * @property {import('@agoric/notifier').Notifier=} notifier - the notifier for allocation changes diff --git a/packages/zoe/src/state.js b/packages/zoe/src/state.js index 064a85921d8..c9fdda7183c 100644 --- a/packages/zoe/src/state.js +++ b/packages/zoe/src/state.js @@ -182,7 +182,7 @@ const makeIssuerTable = (withPurses = true) => { /** * TODO: make sure this validate function protects against malicious * misshapen objects rather than just a general check. - * @type {Validator} + * @type {Validator} */ const validateSomewhat = makeValidateProperties( withPurses diff --git a/packages/zoe/src/types.js b/packages/zoe/src/types.js index 566d886822d..3f28aea971f 100644 --- a/packages/zoe/src/types.js +++ b/packages/zoe/src/types.js @@ -292,7 +292,7 @@ * when the issuer is added and ready. * @param {Promise|Issuer} issuerP Promise for issuer * @param {Keyword} keyword Keyword for added issuer - * @returns {Promise>} Issuer is added and ready + * @returns {Promise} Issuer is added and ready * * @typedef {Record} PublicAPI * @@ -342,7 +342,6 @@ * @typedef {Object} IssuerRecord * @property {Brand} brand * @property {Issuer} issuer - * @property {Purse} purse * @property {AmountMath} amountMath * * @typedef {Object} InstallationRecord