diff --git a/contract/src/offer-up-proposal.js b/contract/src/offer-up-proposal.js index 98ec425..df6cdf3 100644 --- a/contract/src/offer-up-proposal.js +++ b/contract/src/offer-up-proposal.js @@ -12,9 +12,6 @@ const BOARD_AUX = 'boardAux'; const marshalData = makeMarshal(_val => Fail`data only`); -const IST_UNIT = 1_000_000n; -const CENT = IST_UNIT / 100n; - /** * Make a storage node for auxilliary data for a value on the board. * @@ -47,16 +44,19 @@ export const startOfferUpContract = async permittedPowers => { consume: { board, chainStorage, startUpgradable, zoe }, brand: { consume: { IST: istBrandP }, + // @ts-expect-error dynamic extension to promise space produce: { Item: produceItemBrand }, }, issuer: { consume: { IST: istIssuerP }, + // @ts-expect-error dynamic extension to promise space produce: { Item: produceItemIssuer }, }, installation: { consume: { offerUp: offerUpInstallationP }, }, instance: { + // @ts-expect-error dynamic extension to promise space produce: { offerUp: produceInstance }, }, } = permittedPowers; @@ -64,7 +64,7 @@ export const startOfferUpContract = async permittedPowers => { const istIssuer = await istIssuerP; const istBrand = await istBrandP; - const subscriptionTerms = { + const terms = { subscriptionPrice: AmountMath.make(istBrand, 500n), }; @@ -75,7 +75,7 @@ export const startOfferUpContract = async permittedPowers => { installation, issuerKeywordRecord: { Price: istIssuer }, label: 'offerUp', - terms: subscriptionTerms, + terms, }); console.log('CoreEval script: started contract', instance); const { diff --git a/contract/src/offer-up.contract.js b/contract/src/offer-up.contract.js index 3bcfecd..bf605fc 100644 --- a/contract/src/offer-up.contract.js +++ b/contract/src/offer-up.contract.js @@ -20,30 +20,11 @@ // @ts-check import { Far } from '@endo/far'; -import { M, getCopyBagEntries } from '@endo/patterns'; import { AmountMath, AssetKind } from '@agoric/ertp/src/amountMath.js'; -import { makeCopyBag } from '@endo/patterns'; -import { AmountShape } from '@agoric/ertp/src/typeGuards.js'; +import { makeCopyBag, M } from '@endo/patterns'; import { atomicRearrange } from '@agoric/zoe/src/contractSupport/atomicTransfer.js'; -import { makeIssuerKit } from '@agoric/ertp'; import '@agoric/zoe/exported.js'; -const { Fail, quote: q } = assert; - -// #region bag utilities -/** @type { (xs: bigint[]) => bigint } */ -const sum = xs => xs.reduce((acc, x) => acc + x, 0n); - -/** - * @param {import('@endo/patterns').CopyBag} bag - * @returns {bigint[]} - */ -const bagCounts = bag => { - const entries = getCopyBagEntries(bag); - return entries.map(([_k, ct]) => ct); -}; -// #endregion - /** * In addition to the standard `issuers` and `brands` terms, * this contract is parameterized by terms for price and, @@ -75,8 +56,8 @@ const bagCounts = bag => { export const start = async zcf => { const { subscriptionPrice, - subscriptionPeriod = 'MONTHLY', - serviceToAvail = 'NETFLIX', + // subscriptionPeriod = 'MONTHLY', + // serviceToAvail = 'NETFLIX', } = zcf.getTerms(); /**