From 4b2f52cd9eacbb0707af1300a7643bda6308ff82 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 12 Apr 2023 11:51:34 -0700 Subject: [PATCH] refactor: extract @agoric/contracts package --- .../src/kernel/state/storageHelper.js | 12 +++++ packages/contracts/README.md | 5 ++ packages/contracts/jsconfig.build.json | 12 +++++ packages/contracts/jsconfig.json | 17 +++++++ packages/contracts/package.json | 49 +++++++++++++++++++ .../src/contractSupport/atomicTransfer.js | 17 +------ .../src/contractSupport/bondingCurves.js | 0 .../src/contractSupport/durability.js | 0 .../src/contractSupport/index.js | 22 +-------- .../src/contractSupport/priceAuthority.js | 0 .../src/contractSupport/priceQuote.js | 0 .../src/contractSupport/ratio.js | 0 .../src/contractSupport/recorder.js | 0 .../src/contractSupport/safeMath.js | 0 .../src/contractSupport/stateMachine.js | 0 .../src/contractSupport/statistics.js | 0 .../src/contractSupport/topics.js | 0 .../src/contractSupport/types.js | 0 .../src/contractSupport/zoeHelpers.js | 2 +- packages/contracts/src/index.js | 4 ++ packages/governance/src/committee.js | 2 +- .../src/contractGovernance/assertions.js | 2 +- .../test/unitTests/test-buildParamManager.js | 2 +- .../unitTests/test-paramChangePositions.js | 2 +- .../test/unitTests/test-typedParamManager.js | 2 +- packages/inter-protocol/package.json | 1 + .../inter-protocol/src/auction/auctionBook.js | 2 +- .../inter-protocol/src/auction/auctioneer.js | 6 +-- .../src/auction/scheduleMath.js | 2 +- .../src/auction/sortedOffers.js | 5 +- packages/inter-protocol/src/auction/util.js | 2 +- packages/inter-protocol/src/clientSupport.js | 2 +- packages/inter-protocol/src/collectFees.js | 2 +- packages/inter-protocol/src/interest-math.js | 2 +- packages/inter-protocol/src/interest.js | 8 +-- .../src/price/fluxAggregator.js | 2 +- .../inter-protocol/src/price/roundsManager.js | 5 +- .../src/proposals/addAssetToVault.js | 4 +- .../src/proposals/econ-behaviors.js | 2 +- .../src/proposals/price-feed-proposal.js | 2 +- .../inter-protocol/src/proposals/startPSM.js | 2 +- packages/inter-protocol/src/psm/psm.js | 2 +- .../src/reserve/assetReserve.js | 2 +- .../src/stakeFactory/attestation.js | 2 +- .../src/stakeFactory/stakeFactory.js | 4 +- .../src/stakeFactory/stakeFactoryKit.js | 10 ++-- .../src/stakeFactory/stakeFactoryManager.js | 6 +-- .../src/vaultFactory/liquidation.js | 4 +- .../inter-protocol/src/vaultFactory/math.js | 6 +-- .../inter-protocol/src/vaultFactory/params.js | 2 +- .../src/vaultFactory/prioritizedVaults.js | 2 +- .../src/vaultFactory/storeUtils.js | 6 +-- .../inter-protocol/src/vaultFactory/types.js | 2 +- .../inter-protocol/src/vaultFactory/vault.js | 8 +-- .../src/vaultFactory/vaultDirector.js | 10 ++-- .../src/vaultFactory/vaultFactory.js | 2 +- .../src/vaultFactory/vaultHolder.js | 4 +- .../src/vaultFactory/vaultKit.js | 2 +- .../src/vaultFactory/vaultManager.js | 23 +++++---- .../test/auction/test-auctionBook.js | 5 +- .../test/auction/test-auctionContract.js | 5 +- .../test/auction/test-sortedOffers.js | 6 +-- packages/inter-protocol/test/psm/test-psm.js | 2 +- .../test/stakeFactory/test-stakeFactory.js | 2 +- packages/inter-protocol/test/supports.js | 2 +- .../inter-protocol/test/test-clientSupport.js | 2 +- .../test/test-interest-labeled.js | 2 +- .../inter-protocol/test/test-interest-math.js | 2 +- packages/inter-protocol/test/test-interest.js | 5 +- .../test/vaultFactory/driver.js | 5 +- .../test/vaultFactory/faucet.js | 2 +- .../test/vaultFactory/interestSupport.js | 5 +- .../test/vaultFactory/test-collatRatio.js | 2 +- .../vaultFactory/test-prioritizedVaults.js | 5 +- .../test/vaultFactory/test-vaultFactory.js | 5 +- .../vaultFactory/test-vaultLiquidation.js | 2 +- .../vaultFactory/vault-contract-wrapper.js | 20 ++++---- .../test/vaultFactory/vaultFactoryUtils.js | 2 +- packages/pegasus/src/pegasus.js | 5 +- packages/smart-wallet/src/smartWallet.js | 2 +- packages/smart-wallet/src/walletFactory.js | 2 +- packages/smart-wallet/test/supports.js | 2 +- packages/vats/src/core/demoIssuers.js | 5 +- packages/vats/test/test-provisionPool.js | 2 +- packages/zoe/package.json | 1 + packages/zoe/src/contracts/atomicSwap.js | 2 +- .../src/contracts/auction/firstPriceLogic.js | 2 +- packages/zoe/src/contracts/auction/index.js | 2 +- .../src/contracts/auction/secondPriceLogic.js | 2 +- packages/zoe/src/contracts/autoswap.js | 2 +- packages/zoe/src/contracts/barterExchange.js | 2 +- .../contracts/callSpread/calculateShares.js | 2 +- .../contracts/callSpread/fundedCallSpread.js | 2 +- .../src/contracts/callSpread/payoffHandler.js | 2 +- .../zoe/src/contracts/callSpread/percent.js | 2 +- .../contracts/callSpread/pricedCallSpread.js | 2 +- .../zoe/src/contracts/coveredCall-durable.js | 2 +- packages/zoe/src/contracts/coveredCall.js | 2 +- .../zoe/src/contracts/loan/addCollateral.js | 5 +- packages/zoe/src/contracts/loan/borrow.js | 2 +- packages/zoe/src/contracts/loan/close.js | 5 +- packages/zoe/src/contracts/loan/index.js | 5 +- packages/zoe/src/contracts/loan/lend.js | 2 +- packages/zoe/src/contracts/loan/liquidate.js | 2 +- .../src/contracts/loan/scheduleLiquidation.js | 6 +-- packages/zoe/src/contracts/loan/updateDebt.js | 2 +- packages/zoe/src/contracts/oracle.js | 2 +- packages/zoe/src/contracts/otcDesk.js | 2 +- packages/zoe/src/contracts/priceAggregator.js | 4 +- .../priceAuthorityInitial.js | 4 +- .../priceAuthorityTransform.js | 0 .../zoe/src/contracts/scaledPriceAuthority.js | 10 ++-- packages/zoe/src/contracts/sellItems.js | 2 +- packages/zoe/src/contracts/simpleExchange.js | 2 +- packages/zoe/src/typeGuards.js | 5 ++ packages/zoe/test/autoswapJig.js | 2 +- .../brokenContracts/crashingAutoRefund.js | 2 +- .../coveredCall-durable-V3.js | 2 +- packages/zoe/test/unitTests/bounty.js | 5 +- .../contractSupport/test-bondingCurves.js | 2 +- .../contractSupport/test-depositTo.js | 2 +- .../unitTests/contractSupport/test-offerTo.js | 2 +- .../contractSupport/test-percentSupport.js | 2 +- .../unitTests/contractSupport/test-ratio.js | 2 +- .../contractSupport/test-stateMachine.js | 2 +- .../contractSupport/test-withdrawFrom.js | 5 +- .../contractSupport/test-zoeHelpers.js | 6 +-- .../test/unitTests/contracts/escrowToVote.js | 2 +- .../test/unitTests/contracts/loan/helpers.js | 2 +- .../contracts/loan/test-addCollateral.js | 2 +- .../unitTests/contracts/loan/test-borrow.js | 2 +- .../unitTests/contracts/loan/test-lend.js | 2 +- .../contracts/loan/test-liquidate.js | 2 +- .../unitTests/contracts/loan/test-loan-e2e.js | 2 +- .../contracts/loan/test-updateDebt.js | 2 +- .../contracts/test-callSpread-calculation.js | 5 +- .../contracts/test-priceAggregator.js | 2 +- .../contracts/test-scaledPriceAuthority.js | 2 +- .../unitTests/contracts/test-sellTickets.js | 2 +- .../contracts/throwInOfferHandler.js | 2 +- .../test/unitTests/contracts/useObjExample.js | 5 +- .../zoe/test/unitTests/test-blockedOffers.js | 5 +- .../test/unitTests/test-fakePriceAuthority.js | 12 ++--- .../test/unitTests/zcf/test-zoeHelpersWZcf.js | 2 +- packages/zoe/tools/fakePriceAuthority.js | 2 +- packages/zoe/tools/manualPriceAuthority.js | 2 +- packages/zoe/tools/scriptedPriceAuthority.js | 5 +- packages/zoe/tools/types-ambient.js | 9 ++++ 148 files changed, 297 insertions(+), 290 deletions(-) create mode 100644 packages/contracts/README.md create mode 100644 packages/contracts/jsconfig.build.json create mode 100644 packages/contracts/jsconfig.json create mode 100755 packages/contracts/package.json rename packages/{zoe => contracts}/src/contractSupport/atomicTransfer.js (92%) rename packages/{zoe => contracts}/src/contractSupport/bondingCurves.js (100%) rename packages/{zoe => contracts}/src/contractSupport/durability.js (100%) rename packages/{zoe => contracts}/src/contractSupport/index.js (73%) rename packages/{zoe => contracts}/src/contractSupport/priceAuthority.js (100%) rename packages/{zoe => contracts}/src/contractSupport/priceQuote.js (100%) rename packages/{zoe => contracts}/src/contractSupport/ratio.js (100%) rename packages/{zoe => contracts}/src/contractSupport/recorder.js (100%) rename packages/{zoe => contracts}/src/contractSupport/safeMath.js (100%) rename packages/{zoe => contracts}/src/contractSupport/stateMachine.js (100%) rename packages/{zoe => contracts}/src/contractSupport/statistics.js (100%) rename packages/{zoe => contracts}/src/contractSupport/topics.js (100%) rename packages/{zoe => contracts}/src/contractSupport/types.js (100%) rename packages/{zoe => contracts}/src/contractSupport/zoeHelpers.js (99%) create mode 100644 packages/contracts/src/index.js rename packages/zoe/src/{contractSupport => contracts}/priceAuthorityInitial.js (97%) rename packages/zoe/src/{contractSupport => contracts}/priceAuthorityTransform.js (100%) diff --git a/packages/SwingSet/src/kernel/state/storageHelper.js b/packages/SwingSet/src/kernel/state/storageHelper.js index 835153c785e7..01c7f7450560 100644 --- a/packages/SwingSet/src/kernel/state/storageHelper.js +++ b/packages/SwingSet/src/kernel/state/storageHelper.js @@ -26,6 +26,10 @@ export function* enumeratePrefixedKeys(kvStore, prefix, exclusiveEnd) { } } +/** + * @param {KVStore} kvStore + * @param {string} prefix + */ // NOTE: awkward naming: the thing that returns a stream of keys is named // "enumerate..." while the thing that returns a stream of values is named // "get..." @@ -43,12 +47,20 @@ function* enumerateNumericPrefixedKeys(kvStore, prefix) { } } +/** + * @param {KVStore} kvStore + * @param {string} prefix + */ export function* getPrefixedValues(kvStore, prefix) { for (const key of enumerateNumericPrefixedKeys(kvStore, prefix)) { yield kvStore.get(key) || Fail`enumerate ensures get`; } } +/** + * @param {KVStore} kvStore + * @param {string} prefix + */ export function deletePrefixedKeys(kvStore, prefix) { // this is kind of like a deleteRange() would be, but can be implemented // efficiently without backend DB support because it only looks at numeric diff --git a/packages/contracts/README.md b/packages/contracts/README.md new file mode 100644 index 000000000000..06d36083f319 --- /dev/null +++ b/packages/contracts/README.md @@ -0,0 +1,5 @@ +# Contracts Support + +This package contains utilities that contracts tend to need. + +It also includes sample contracts to learn from and play with. diff --git a/packages/contracts/jsconfig.build.json b/packages/contracts/jsconfig.build.json new file mode 100644 index 000000000000..3bce4b5b5173 --- /dev/null +++ b/packages/contracts/jsconfig.build.json @@ -0,0 +1,12 @@ +{ + "extends": "./jsconfig.json", + "compilerOptions": { + "noEmit": false, + "declaration": true, + "emitDeclarationOnly": true, + "declarationMap": true + }, + "exclude": [ + "test/" + ] +} diff --git a/packages/contracts/jsconfig.json b/packages/contracts/jsconfig.json new file mode 100644 index 000000000000..f4bccfe777f0 --- /dev/null +++ b/packages/contracts/jsconfig.json @@ -0,0 +1,17 @@ +// This file can contain .js-specific Typescript compiler config. +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + // Disable b/c @endo/init can't pass noImplicitAny + "checkJs": false, + "noImplicitAny": true, + }, + "include": [ + "*.js", + "*.ts", + "src/**/*.js", + "src/**/*.ts", + "test/**/*.js", + "test/**/*.ts" + ] +} diff --git a/packages/contracts/package.json b/packages/contracts/package.json new file mode 100755 index 000000000000..f345d530d7d5 --- /dev/null +++ b/packages/contracts/package.json @@ -0,0 +1,49 @@ +{ + "name": "@agoric/contracts", + "version": "0.0.1", + "description": "Utilities and sample contracts to support contract development", + "type": "module", + "main": "src/index.js", + "engines": { + "node": ">=14.15.0" + }, + "scripts": { + "build": "exit 0", + "prepack": "tsc --build jsconfig.build.json", + "postpack": "git clean -f '*.d.ts*'", + "test": "ava", + "test:nyc": "exit 0", + "test:xs": "exit 0", + "lint-fix": "yarn lint:eslint --fix", + "lint": "run-s --continue-on-error lint:*", + "lint:eslint": "eslint .", + "lint:types": "tsc -p jsconfig.json" + }, + "dependencies": { + "@agoric/assert": "^0.5.1", + "@agoric/ertp": "^0.15.3", + "@agoric/internal": "^0.2.1", + "@agoric/notifier": "^0.5.1", + "@agoric/store": "^0.8.3", + "@agoric/vat-data": "^0.4.3", + "@agoric/zoe": "^0.25.3", + "@endo/eventual-send": "^0.16.8", + "@endo/marshal": "^0.8.1", + "@endo/nat": "^4.1.0", + "@endo/promise-kit": "^0.2.52", + "anylogger": "^0.21.0", + "jessie.js": "^0.3.2" + }, + "devDependencies": { + "@endo/init": "^0.5.52", + "ava": "^5.2.0" + }, + "author": "Agoric", + "license": "Apache-2.0", + "files": [ + "src" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/zoe/src/contractSupport/atomicTransfer.js b/packages/contracts/src/contractSupport/atomicTransfer.js similarity index 92% rename from packages/zoe/src/contractSupport/atomicTransfer.js rename to packages/contracts/src/contractSupport/atomicTransfer.js index fa27fe8adc7a..8ad9140377b4 100644 --- a/packages/zoe/src/contractSupport/atomicTransfer.js +++ b/packages/contracts/src/contractSupport/atomicTransfer.js @@ -1,23 +1,8 @@ import { mustMatch, M } from '@agoric/store'; -import { assertRightsConserved } from '../contractFacet/rightsConservation.js'; -import { AmountKeywordRecordShape, SeatShape } from '../typeGuards.js'; +import { assertRightsConserved } from '@agoric/zoe/src/contractFacet/rightsConservation.js'; const { Fail, quote: q } = assert; -export const TransferPartShape = M.splitArray( - harden([M.opt(SeatShape), M.opt(SeatShape), M.opt(AmountKeywordRecordShape)]), - harden([M.opt(AmountKeywordRecordShape)]), -); - -/** - * @typedef {[ - * fromSeat?: ZCFSeat, - * toSeat?: ZCFSeat, - * fromAmounts?: AmountKeywordRecord, - * toAmounts?: AmountKeywordRecord - * ]} TransferPart - */ - /** * Asks Zoe (via zcf) to rearrange the allocations among the seats * mentioned. This is a set of changes to allocations that must satisfy diff --git a/packages/zoe/src/contractSupport/bondingCurves.js b/packages/contracts/src/contractSupport/bondingCurves.js similarity index 100% rename from packages/zoe/src/contractSupport/bondingCurves.js rename to packages/contracts/src/contractSupport/bondingCurves.js diff --git a/packages/zoe/src/contractSupport/durability.js b/packages/contracts/src/contractSupport/durability.js similarity index 100% rename from packages/zoe/src/contractSupport/durability.js rename to packages/contracts/src/contractSupport/durability.js diff --git a/packages/zoe/src/contractSupport/index.js b/packages/contracts/src/contractSupport/index.js similarity index 73% rename from packages/zoe/src/contractSupport/index.js rename to packages/contracts/src/contractSupport/index.js index ca7d654ca7a6..edfe14e2838f 100644 --- a/packages/zoe/src/contractSupport/index.js +++ b/packages/contracts/src/contractSupport/index.js @@ -32,28 +32,10 @@ export { offerTo, } from './zoeHelpers.js'; -export { - makeRatio, - makeRatioFromAmounts, - floorMultiplyBy, - floorDivideBy, - ceilMultiplyBy, - ceilDivideBy, - assertIsRatio, - invertRatio, - oneMinus, - addRatios, - multiplyRatios, - ratiosSame, - quantize, - ratioGTE, - subtractRatios, - ratioToNumber, -} from './ratio.js'; - export * from './durability.js'; export * from './priceAuthority.js'; export * from './priceQuote.js'; -export * from './statistics.js'; +export * from './ratio.js'; export * from './recorder.js'; +export * from './statistics.js'; export * from './topics.js'; diff --git a/packages/zoe/src/contractSupport/priceAuthority.js b/packages/contracts/src/contractSupport/priceAuthority.js similarity index 100% rename from packages/zoe/src/contractSupport/priceAuthority.js rename to packages/contracts/src/contractSupport/priceAuthority.js diff --git a/packages/zoe/src/contractSupport/priceQuote.js b/packages/contracts/src/contractSupport/priceQuote.js similarity index 100% rename from packages/zoe/src/contractSupport/priceQuote.js rename to packages/contracts/src/contractSupport/priceQuote.js diff --git a/packages/zoe/src/contractSupport/ratio.js b/packages/contracts/src/contractSupport/ratio.js similarity index 100% rename from packages/zoe/src/contractSupport/ratio.js rename to packages/contracts/src/contractSupport/ratio.js diff --git a/packages/zoe/src/contractSupport/recorder.js b/packages/contracts/src/contractSupport/recorder.js similarity index 100% rename from packages/zoe/src/contractSupport/recorder.js rename to packages/contracts/src/contractSupport/recorder.js diff --git a/packages/zoe/src/contractSupport/safeMath.js b/packages/contracts/src/contractSupport/safeMath.js similarity index 100% rename from packages/zoe/src/contractSupport/safeMath.js rename to packages/contracts/src/contractSupport/safeMath.js diff --git a/packages/zoe/src/contractSupport/stateMachine.js b/packages/contracts/src/contractSupport/stateMachine.js similarity index 100% rename from packages/zoe/src/contractSupport/stateMachine.js rename to packages/contracts/src/contractSupport/stateMachine.js diff --git a/packages/zoe/src/contractSupport/statistics.js b/packages/contracts/src/contractSupport/statistics.js similarity index 100% rename from packages/zoe/src/contractSupport/statistics.js rename to packages/contracts/src/contractSupport/statistics.js diff --git a/packages/zoe/src/contractSupport/topics.js b/packages/contracts/src/contractSupport/topics.js similarity index 100% rename from packages/zoe/src/contractSupport/topics.js rename to packages/contracts/src/contractSupport/topics.js diff --git a/packages/zoe/src/contractSupport/types.js b/packages/contracts/src/contractSupport/types.js similarity index 100% rename from packages/zoe/src/contractSupport/types.js rename to packages/contracts/src/contractSupport/types.js diff --git a/packages/zoe/src/contractSupport/zoeHelpers.js b/packages/contracts/src/contractSupport/zoeHelpers.js similarity index 99% rename from packages/zoe/src/contractSupport/zoeHelpers.js rename to packages/contracts/src/contractSupport/zoeHelpers.js index 19dfd1ac4fc2..63cfe3b43858 100644 --- a/packages/zoe/src/contractSupport/zoeHelpers.js +++ b/packages/contracts/src/contractSupport/zoeHelpers.js @@ -3,7 +3,7 @@ import { E } from '@endo/eventual-send'; import { makePromiseKit } from '@endo/promise-kit'; import { AssetKind } from '@agoric/ertp'; import { fromUniqueEntries } from '@agoric/internal'; -import { satisfiesWant } from '../contractFacet/offerSafety.js'; +import { satisfiesWant } from '@agoric/zoe/src/contractFacet/offerSafety.js'; import { atomicRearrange, atomicTransfer, diff --git a/packages/contracts/src/index.js b/packages/contracts/src/index.js new file mode 100644 index 000000000000..bb8d082b0933 --- /dev/null +++ b/packages/contracts/src/index.js @@ -0,0 +1,4 @@ +// XXX get ambients +import '@agoric/zoe/tools/types-ambient.js'; + +export * from './contractSupport/index.js'; diff --git a/packages/governance/src/committee.js b/packages/governance/src/committee.js index 44c1477110be..c6de447f179a 100644 --- a/packages/governance/src/committee.js +++ b/packages/governance/src/committee.js @@ -1,6 +1,6 @@ import { makeStoredPublishKit } from '@agoric/notifier'; import { makeScalarMapStore, makeExo, M } from '@agoric/store'; -import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; +import { natSafeMath } from '@agoric/contracts'; import { E } from '@endo/eventual-send'; import { makeHandle } from '@agoric/zoe/src/makeHandle.js'; diff --git a/packages/governance/src/contractGovernance/assertions.js b/packages/governance/src/contractGovernance/assertions.js index 1e2ede685bb3..7a3f14599f1f 100644 --- a/packages/governance/src/contractGovernance/assertions.js +++ b/packages/governance/src/contractGovernance/assertions.js @@ -1,5 +1,5 @@ import { isRemotable } from '@endo/marshal'; -import { assertIsRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { assertIsRatio } from '@agoric/contracts'; import { mustMatch } from '@agoric/store'; import { RelativeTimeRecordShape, TimestampRecordShape } from '@agoric/time'; diff --git a/packages/governance/test/unitTests/test-buildParamManager.js b/packages/governance/test/unitTests/test-buildParamManager.js index fdbcf42be8f0..9275359607ca 100644 --- a/packages/governance/test/unitTests/test-buildParamManager.js +++ b/packages/governance/test/unitTests/test-buildParamManager.js @@ -4,7 +4,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; import { makeStoredPublisherKit } from '@agoric/notifier'; import { keyEQ } from '@agoric/store'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { makeHandle } from '@agoric/zoe/src/makeHandle.js'; import { setupZCFTest } from '@agoric/zoe/test/unitTests/zcf/setupZcfTest.js'; import { E } from '@endo/eventual-send'; diff --git a/packages/governance/test/unitTests/test-paramChangePositions.js b/packages/governance/test/unitTests/test-paramChangePositions.js index ebdba172c662..b8e7b81af64b 100644 --- a/packages/governance/test/unitTests/test-paramChangePositions.js +++ b/packages/governance/test/unitTests/test-paramChangePositions.js @@ -1,7 +1,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import '@agoric/zoe/exported.js'; import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { makeHandle } from '@agoric/zoe/src/makeHandle.js'; import { makeParamChangePositions } from '../../src/index.js'; diff --git a/packages/governance/test/unitTests/test-typedParamManager.js b/packages/governance/test/unitTests/test-typedParamManager.js index 1f7fd7f637a4..7cf49924eaf1 100644 --- a/packages/governance/test/unitTests/test-typedParamManager.js +++ b/packages/governance/test/unitTests/test-typedParamManager.js @@ -1,7 +1,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { makeIssuerKit, AmountMath } from '@agoric/ertp'; import { makeStoredPublisherKit } from '@agoric/notifier'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { setupZCFTest } from '@agoric/zoe/test/unitTests/zcf/setupZcfTest.js'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; diff --git a/packages/inter-protocol/package.json b/packages/inter-protocol/package.json index a94c1b05b156..d563cc54ff92 100644 --- a/packages/inter-protocol/package.json +++ b/packages/inter-protocol/package.json @@ -30,6 +30,7 @@ "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { "@agoric/assert": "^0.5.1", + "@agoric/contracts": "^0.0.1", "@agoric/ertp": "^0.15.3", "@agoric/governance": "^0.9.1", "@agoric/internal": "^0.2.1", diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js index fcbb1efbf440..b04c61e06e39 100644 --- a/packages/inter-protocol/src/auction/auctionBook.js +++ b/packages/inter-protocol/src/auction/auctionBook.js @@ -14,7 +14,7 @@ import { makeRatioFromAmounts, multiplyRatios, ratioGTE, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import { E } from '@endo/captp'; import { observeNotifier, diff --git a/packages/inter-protocol/src/auction/auctioneer.js b/packages/inter-protocol/src/auction/auctioneer.js index c20eadcff213..9d4e27b6fdcd 100644 --- a/packages/inter-protocol/src/auction/auctioneer.js +++ b/packages/inter-protocol/src/auction/auctioneer.js @@ -18,7 +18,7 @@ import { provideEmptySeat, ceilMultiplyBy, ceilDivideBy, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import { FullProposalShape } from '@agoric/zoe/src/typeGuards.js'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; @@ -84,7 +84,7 @@ const distributeProportionalShares = ( const collShare = makeRatioFromAmounts(collateralReturn, totalCollDeposited); const currShare = makeRatioFromAmounts(currencyRaised, totalCollDeposited); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = []; let currencyLeft = currencyRaised; let collateralLeft = collateralReturn; @@ -237,7 +237,7 @@ export const distributeProportionalSharesWithLimits = ( // collateral to reach their share. Then see what's left, and allocate it // among the remaining depositors. Escape to distributeProportionalShares if // anything doesn't work. - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = []; let currencyLeft = currencyRaised; let collateralLeft = collateralReturn; diff --git a/packages/inter-protocol/src/auction/scheduleMath.js b/packages/inter-protocol/src/auction/scheduleMath.js index 73a61c6795fa..31496c6c87b7 100644 --- a/packages/inter-protocol/src/auction/scheduleMath.js +++ b/packages/inter-protocol/src/auction/scheduleMath.js @@ -1,5 +1,5 @@ import { TimeMath } from '@agoric/time'; -import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; +import { natSafeMath } from '@agoric/contracts'; import { makeTracer } from '@agoric/internal'; const { subtract, multiply, floorDivide } = natSafeMath; diff --git a/packages/inter-protocol/src/auction/sortedOffers.js b/packages/inter-protocol/src/auction/sortedOffers.js index 40b4264925eb..028894b2a472 100644 --- a/packages/inter-protocol/src/auction/sortedOffers.js +++ b/packages/inter-protocol/src/auction/sortedOffers.js @@ -1,7 +1,4 @@ -import { - makeRatio, - ratioToNumber, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio, ratioToNumber } from '@agoric/contracts'; import { M, mustMatch } from '@agoric/store'; import { RatioShape } from '@agoric/ertp'; diff --git a/packages/inter-protocol/src/auction/util.js b/packages/inter-protocol/src/auction/util.js index fdaba3561287..e0c066380513 100644 --- a/packages/inter-protocol/src/auction/util.js +++ b/packages/inter-protocol/src/auction/util.js @@ -2,7 +2,7 @@ import { makeRatioFromAmounts, multiplyRatios, ratioGTE, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; /** * Constants for Auction State. diff --git a/packages/inter-protocol/src/clientSupport.js b/packages/inter-protocol/src/clientSupport.js index b93cf1eeb8d9..3b9128957b37 100644 --- a/packages/inter-protocol/src/clientSupport.js +++ b/packages/inter-protocol/src/clientSupport.js @@ -3,7 +3,7 @@ import { Fail } from '@agoric/assert'; import { AmountMath } from '@agoric/ertp'; import { assertAllDefined } from '@agoric/internal'; -import { parseRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { parseRatio } from '@agoric/contracts'; // XXX support other decimal places const COSMOS_UNIT = 1_000_000n; diff --git a/packages/inter-protocol/src/collectFees.js b/packages/inter-protocol/src/collectFees.js index f94bce2ec567..40b1451bfda4 100644 --- a/packages/inter-protocol/src/collectFees.js +++ b/packages/inter-protocol/src/collectFees.js @@ -1,4 +1,4 @@ -import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js'; +import { atomicTransfer } from '@agoric/contracts'; /** * Provide shared support for providing access to fees from a service contract. diff --git a/packages/inter-protocol/src/interest-math.js b/packages/inter-protocol/src/interest-math.js index b977cbe9b642..46a51028c367 100644 --- a/packages/inter-protocol/src/interest-math.js +++ b/packages/inter-protocol/src/interest-math.js @@ -4,7 +4,7 @@ import { invertRatio, multiplyRatios, ratiosSame, -} from '@agoric/zoe/src/contractSupport/ratio.js'; +} from '@agoric/contracts'; /** * diff --git a/packages/inter-protocol/src/interest.js b/packages/inter-protocol/src/interest.js index 7cb01b939443..a163aa6bf056 100644 --- a/packages/inter-protocol/src/interest.js +++ b/packages/inter-protocol/src/interest.js @@ -1,11 +1,11 @@ -import { AmountMath } from '@agoric/ertp'; -import { natSafeMath } from '@agoric/zoe/src/contractSupport/index.js'; +import { Fail } from '@agoric/assert'; import { makeRatio, multiplyRatios, + natSafeMath, quantize, -} from '@agoric/zoe/src/contractSupport/ratio.js'; -import { Fail } from '@agoric/assert'; +} from '@agoric/contracts'; +import { AmountMath } from '@agoric/ertp'; import { TimeMath } from '@agoric/time'; /** diff --git a/packages/inter-protocol/src/price/fluxAggregator.js b/packages/inter-protocol/src/price/fluxAggregator.js index c213e463a424..a98f50eab6d9 100644 --- a/packages/inter-protocol/src/price/fluxAggregator.js +++ b/packages/inter-protocol/src/price/fluxAggregator.js @@ -15,7 +15,7 @@ import { makeScalarBigMapStore } from '@agoric/vat-data'; import { makeOnewayPriceAuthorityKit, makeStorageNodePathProvider, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makeOracleAdminKit } from './priceOracleKit.js'; diff --git a/packages/inter-protocol/src/price/roundsManager.js b/packages/inter-protocol/src/price/roundsManager.js index e1dd64cd1013..97d43d6c28b0 100644 --- a/packages/inter-protocol/src/price/roundsManager.js +++ b/packages/inter-protocol/src/price/roundsManager.js @@ -8,10 +8,7 @@ import { makeKindHandle, makeScalarBigMapStore, } from '@agoric/vat-data'; -import { - calculateMedian, - natSafeMath, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { calculateMedian, natSafeMath } from '@agoric/contracts'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { UnguardedHelperI } from '../typeGuards.js'; diff --git a/packages/inter-protocol/src/proposals/addAssetToVault.js b/packages/inter-protocol/src/proposals/addAssetToVault.js index 78d508955ebf..a2a1e9e74504 100644 --- a/packages/inter-protocol/src/proposals/addAssetToVault.js +++ b/packages/inter-protocol/src/proposals/addAssetToVault.js @@ -1,9 +1,9 @@ import { AmountMath, AssetKind } from '@agoric/ertp'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { deeplyFulfilledObject } from '@agoric/internal'; import { Stable } from '@agoric/vats/src/tokens.js'; import { E } from '@endo/far'; -import { parseRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { parseRatio } from '@agoric/contracts'; import { reserveThenGetNames } from './utils.js'; export * from './startPSM.js'; diff --git a/packages/inter-protocol/src/proposals/econ-behaviors.js b/packages/inter-protocol/src/proposals/econ-behaviors.js index 55d3aba88b47..db0ef6fd297f 100644 --- a/packages/inter-protocol/src/proposals/econ-behaviors.js +++ b/packages/inter-protocol/src/proposals/econ-behaviors.js @@ -7,7 +7,7 @@ import '@agoric/vats/exported.js'; import '@agoric/vats/src/core/types.js'; import { Stable, Stake } from '@agoric/vats/src/tokens.js'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { E } from '@endo/far'; import { LienBridgeId, makeStakeReporter } from '../my-lien.js'; import { makeReserveTerms } from '../reserve/params.js'; diff --git a/packages/inter-protocol/src/proposals/price-feed-proposal.js b/packages/inter-protocol/src/proposals/price-feed-proposal.js index 36b46115a731..fbb864a7f6da 100644 --- a/packages/inter-protocol/src/proposals/price-feed-proposal.js +++ b/packages/inter-protocol/src/proposals/price-feed-proposal.js @@ -7,7 +7,7 @@ import { } from '@agoric/internal/src/lib-chainStorage.js'; import { deeplyFulfilledObject, makeTracer } from '@agoric/internal'; -import { unitAmount } from '@agoric/zoe/src/contractSupport/priceQuote.js'; +import { unitAmount } from '@agoric/contracts'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; import { reserveThenDeposit, reserveThenGetNames } from './utils.js'; diff --git a/packages/inter-protocol/src/proposals/startPSM.js b/packages/inter-protocol/src/proposals/startPSM.js index 10e3be72de06..9e796b128a26 100644 --- a/packages/inter-protocol/src/proposals/startPSM.js +++ b/packages/inter-protocol/src/proposals/startPSM.js @@ -1,7 +1,7 @@ import { AmountMath, AssetKind } from '@agoric/ertp'; import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance'; import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { E } from '@endo/far'; import { Stable } from '@agoric/vats/src/tokens.js'; import { deeplyFulfilledObject } from '@agoric/internal'; diff --git a/packages/inter-protocol/src/psm/psm.js b/packages/inter-protocol/src/psm/psm.js index bbd586f06589..a2ac90235032 100644 --- a/packages/inter-protocol/src/psm/psm.js +++ b/packages/inter-protocol/src/psm/psm.js @@ -8,7 +8,7 @@ import { floorDivideBy, floorMultiplyBy, atomicRearrange, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import { Far } from '@endo/marshal'; import { handleParamGovernance, diff --git a/packages/inter-protocol/src/reserve/assetReserve.js b/packages/inter-protocol/src/reserve/assetReserve.js index 5a6cb7f7f618..676103b2ca17 100644 --- a/packages/inter-protocol/src/reserve/assetReserve.js +++ b/packages/inter-protocol/src/reserve/assetReserve.js @@ -1,7 +1,7 @@ import { E, Far } from '@endo/far'; import { AmountMath } from '@agoric/ertp'; import { handleParamGovernance } from '@agoric/governance'; -import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js'; +import { atomicTransfer } from '@agoric/contracts'; import { provideDurableMapStore, prepareKindMulti } from '@agoric/vat-data'; import { makeTracer } from '@agoric/internal'; diff --git a/packages/inter-protocol/src/stakeFactory/attestation.js b/packages/inter-protocol/src/stakeFactory/attestation.js index 47f9118fa743..b504f28d6e0e 100644 --- a/packages/inter-protocol/src/stakeFactory/attestation.js +++ b/packages/inter-protocol/src/stakeFactory/attestation.js @@ -9,7 +9,7 @@ import { makeScalarMapStore, provideLazy, } from '@agoric/store'; -import { assertProposalShape } from '@agoric/zoe/src/contractSupport/index.js'; +import { assertProposalShape } from '@agoric/contracts'; import { AttKW as KW } from './constants.js'; import { makeAttestationTool } from './attestationTool.js'; diff --git a/packages/inter-protocol/src/stakeFactory/stakeFactory.js b/packages/inter-protocol/src/stakeFactory/stakeFactory.js index 5cbc901fbac0..5040b5931b70 100644 --- a/packages/inter-protocol/src/stakeFactory/stakeFactory.js +++ b/packages/inter-protocol/src/stakeFactory/stakeFactory.js @@ -1,7 +1,7 @@ // @jessie-check import { AmountMath } from '@agoric/ertp'; import { handleParamGovernance, ParamTypes } from '@agoric/governance'; -import { atomicRearrange } from '@agoric/zoe/src/contractSupport/atomicTransfer.js'; +import { atomicRearrange } from '@agoric/contracts'; import { E, Far } from '@endo/far'; import { makeMakeCollectFeesInvitation } from '../collectFees.js'; import { makeAttestationFacets } from './attestation.js'; @@ -132,7 +132,7 @@ export const start = async ( const mintAndTransfer = (mintReceiver, toMint, fee, nonMintTransfers) => { const kept = AmountMath.subtract(toMint, fee); debtMint.mintGains(harden({ [KW.Debt]: toMint }), mintSeat); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = [ ...nonMintTransfers, [mintSeat, rewardPoolSeat, { [KW.Debt]: fee }], diff --git a/packages/inter-protocol/src/stakeFactory/stakeFactoryKit.js b/packages/inter-protocol/src/stakeFactory/stakeFactoryKit.js index d14220bd1026..98d03ee6de11 100644 --- a/packages/inter-protocol/src/stakeFactory/stakeFactoryKit.js +++ b/packages/inter-protocol/src/stakeFactory/stakeFactoryKit.js @@ -1,14 +1,14 @@ // @jessie-check +import { + assertProposalShape, + atomicRearrange, + ceilMultiplyBy, +} from '@agoric/contracts'; import { AmountMath, AssetKind } from '@agoric/ertp'; import { bindAllMethods, makeTracer } from '@agoric/internal'; import { makePublishKit } from '@agoric/notifier'; import { M, matches } from '@agoric/store'; import { defineKindMulti } from '@agoric/vat-data'; -import { - assertProposalShape, - atomicRearrange, -} from '@agoric/zoe/src/contractSupport/index.js'; -import { ceilMultiplyBy } from '@agoric/zoe/src/contractSupport/ratio.js'; import { addSubtract, assertOnlyKeys } from '../contractSupport.js'; import { calculateCurrentDebt, reverseInterest } from '../interest-math.js'; import { ManagerKW as KW } from './constants.js'; diff --git a/packages/inter-protocol/src/stakeFactory/stakeFactoryManager.js b/packages/inter-protocol/src/stakeFactory/stakeFactoryManager.js index 6ddb2306c57e..a066e14e636f 100644 --- a/packages/inter-protocol/src/stakeFactory/stakeFactoryManager.js +++ b/packages/inter-protocol/src/stakeFactory/stakeFactoryManager.js @@ -3,8 +3,8 @@ import { AmountMath } from '@agoric/ertp'; import { makePublishKit, observeNotifier } from '@agoric/notifier'; import { mustMatch, getCopyBagEntries, M } from '@agoric/store'; import { defineKindMulti } from '@agoric/vat-data'; -import { floorMultiplyBy } from '@agoric/zoe/src/contractSupport/index.js'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { floorMultiplyBy } from '@agoric/contracts'; +import { makeRatio } from '@agoric/contracts'; import { E } from '@endo/far'; import { makeTracer } from '@agoric/internal'; import { checkDebtLimit } from '../contractSupport.js'; @@ -246,7 +246,7 @@ const manager = { * @param {ZCFSeat} seat * @param {Amount<'nat'>} toMint * @param {Amount<'nat'>} fee - * @param {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} transfers + * @param {TransferPart[]} transfers * @returns {void} */ mintAndReallocate: ({ state }, seat, toMint, fee, transfers) => { diff --git a/packages/inter-protocol/src/vaultFactory/liquidation.js b/packages/inter-protocol/src/vaultFactory/liquidation.js index 7b9a90d0e21d..d2b9043d8e72 100644 --- a/packages/inter-protocol/src/vaultFactory/liquidation.js +++ b/packages/inter-protocol/src/vaultFactory/liquidation.js @@ -4,7 +4,7 @@ import { E } from '@endo/eventual-send'; import { AmountMath } from '@agoric/ertp'; import { makeTracer } from '@agoric/internal'; import { TimeMath } from '@agoric/time'; -import { atomicRearrange } from '@agoric/zoe/src/contractSupport/index.js'; +import { atomicRearrange } from '@agoric/contracts'; import { makeScalarMapStore } from '@agoric/store'; import { AUCTION_START_DELAY, PRICE_LOCK_PERIOD } from '../auction/params.js'; @@ -127,7 +127,7 @@ const getLiquidatableVaults = ( const { zcfSeat: liqSeat } = zcf.makeEmptySeatKit(); let totalDebt = AmountMath.makeEmpty(debtBrand); let totalCollateral = AmountMath.makeEmpty(collateralBrand); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = []; for (const vault of vaultsToLiquidate.values()) { diff --git a/packages/inter-protocol/src/vaultFactory/math.js b/packages/inter-protocol/src/vaultFactory/math.js index 4bef3188390a..a1234ce9645c 100644 --- a/packages/inter-protocol/src/vaultFactory/math.js +++ b/packages/inter-protocol/src/vaultFactory/math.js @@ -3,13 +3,13 @@ * See also ../interest-math.js */ -import { AmountMath } from '@agoric/ertp'; -import { getAmountOut } from '@agoric/zoe/src/contractSupport/priceQuote.js'; import { addRatios, ceilMultiplyBy, floorDivideBy, -} from '@agoric/zoe/src/contractSupport/ratio.js'; + getAmountOut, +} from '@agoric/contracts'; +import { AmountMath } from '@agoric/ertp'; import { addSubtract } from '../contractSupport.js'; /** diff --git a/packages/inter-protocol/src/vaultFactory/params.js b/packages/inter-protocol/src/vaultFactory/params.js index feb45ad7d365..823200d94852 100644 --- a/packages/inter-protocol/src/vaultFactory/params.js +++ b/packages/inter-protocol/src/vaultFactory/params.js @@ -7,7 +7,7 @@ import { } from '@agoric/governance'; import { M } from '@agoric/store'; import { TimeMath } from '@agoric/time'; -import { subtractRatios } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { subtractRatios } from '@agoric/contracts'; import { amountPattern, ratioPattern } from '../contractSupport.js'; export const CHARGING_PERIOD_KEY = 'ChargingPeriod'; diff --git a/packages/inter-protocol/src/vaultFactory/prioritizedVaults.js b/packages/inter-protocol/src/vaultFactory/prioritizedVaults.js index f7b0492cb2ba..f2577d0dbeed 100644 --- a/packages/inter-protocol/src/vaultFactory/prioritizedVaults.js +++ b/packages/inter-protocol/src/vaultFactory/prioritizedVaults.js @@ -1,7 +1,7 @@ // @jessie-check import { makeTracer } from '@agoric/internal'; -import { makeRatioFromAmounts } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatioFromAmounts } from '@agoric/contracts'; import { AmountMath } from '@agoric/ertp'; import { Far } from '@endo/marshal'; import { M } from '@agoric/vat-data'; diff --git a/packages/inter-protocol/src/vaultFactory/storeUtils.js b/packages/inter-protocol/src/vaultFactory/storeUtils.js index 4893709ea11c..47d5fd65efb1 100644 --- a/packages/inter-protocol/src/vaultFactory/storeUtils.js +++ b/packages/inter-protocol/src/vaultFactory/storeUtils.js @@ -9,11 +9,7 @@ import { makeDecodePassable, makeEncodePassable, } from '@endo/marshal/src/encodePassable.js'; -import { - getAmountIn, - getAmountOut, - natSafeMath, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { getAmountIn, getAmountOut, natSafeMath } from '@agoric/contracts'; import { makeTracer } from '@agoric/internal'; const { multiply } = natSafeMath; diff --git a/packages/inter-protocol/src/vaultFactory/types.js b/packages/inter-protocol/src/vaultFactory/types.js index 1a5eb7636502..fb08f6b2f365 100644 --- a/packages/inter-protocol/src/vaultFactory/types.js +++ b/packages/inter-protocol/src/vaultFactory/types.js @@ -66,7 +66,7 @@ * @param {ZCFSeat} mintReceiver * @param {Amount<'nat'>} toMint * @param {Amount<'nat'>} fee - * @param {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} transfers + * @param {TransferPart[]} transfers * @returns {void} */ diff --git a/packages/inter-protocol/src/vaultFactory/vault.js b/packages/inter-protocol/src/vaultFactory/vault.js index bc49c9898db4..a33a797d63f8 100644 --- a/packages/inter-protocol/src/vaultFactory/vault.js +++ b/packages/inter-protocol/src/vaultFactory/vault.js @@ -5,7 +5,7 @@ import { atomicTransfer, floorMultiplyBy, makeRatioFromAmounts, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import { SeatShape } from '@agoric/zoe/src/typeGuards.js'; import { addSubtract, @@ -113,7 +113,7 @@ const validTransitions = { * interestSnapshot: Ratio, * phase: VaultPhase, * debtSnapshot: Amount<'nat'>, - * outerUpdater: import('@agoric/zoe/src/contractSupport/recorder.js').Recorder | null, + * outerUpdater: import('@agoric/contracts').Recorder | null, * }} MutableState */ @@ -176,7 +176,7 @@ export const VaultI = M.interface('Vault', { /** * @param {import('@agoric/ertp').Baggage} baggage - * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit + * @param {import('@agoric/contracts').MakeRecorderKit} makeRecorderKit * @param {ZCF} zcf */ export const prepareVault = (baggage, makeRecorderKit, zcf) => { @@ -626,7 +626,7 @@ export const prepareVault = (baggage, makeRecorderKit, zcf) => { const giveMintedTaken = AmountMath.subtract(fp.give.Minted, surplus); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = harden([ [clientSeat, vaultSeat, { Collateral: fp.give.Collateral }], [vaultSeat, clientSeat, { Collateral: fp.want.Collateral }], diff --git a/packages/inter-protocol/src/vaultFactory/vaultDirector.js b/packages/inter-protocol/src/vaultFactory/vaultDirector.js index c2c084f6acd8..46b4719d6c50 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultDirector.js +++ b/packages/inter-protocol/src/vaultFactory/vaultDirector.js @@ -26,7 +26,7 @@ import { provideChildBaggage, provideEmptySeat, unitAmount, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makeMakeCollectFeesInvitation } from '../collectFees.js'; @@ -83,8 +83,8 @@ const shortfallInvitationKey = 'shortfallInvitation'; * @param {ERef} auctioneer * @param {ERef} storageNode * @param {ERef} marshaller - * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit - * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeERecorderKit} makeERecorderKit + * @param {import('@agoric/contracts').MakeRecorderKit} makeRecorderKit + * @param {import('@agoric/contracts').MakeERecorderKit} makeERecorderKit */ export const prepareVaultDirector = ( baggage, @@ -117,7 +117,7 @@ export const prepareVaultDirector = ( const metricsKit = makeERecorderKit( metricsNode, - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/contracts').TypedMatcher} */ ( M.any() ), ); @@ -331,7 +331,7 @@ export const prepareVaultDirector = ( ) => { const kept = AmountMath.subtract(toMint, fee); debtMint.mintGains(harden({ Minted: toMint }), mintSeat); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = [ ...nonMintTransfers, [mintSeat, rewardPoolSeat, { Minted: fee }], diff --git a/packages/inter-protocol/src/vaultFactory/vaultFactory.js b/packages/inter-protocol/src/vaultFactory/vaultFactory.js index e1a41eda25c7..ef8aab044e92 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultFactory.js +++ b/packages/inter-protocol/src/vaultFactory/vaultFactory.js @@ -23,7 +23,7 @@ import { makeParamManagerFromTerms } from '@agoric/governance/src/contractGovern import { assertAllDefined } from '@agoric/internal'; import { makeStoredSubscription, makeSubscriptionKit } from '@agoric/notifier'; import { E } from '@endo/eventual-send'; -import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js'; +import { prepareRecorderKitMakers } from '@agoric/contracts'; import { SHORTFALL_INVITATION_KEY, vaultDirectorParamTypes } from './params.js'; import { prepareVaultDirector } from './vaultDirector.js'; diff --git a/packages/inter-protocol/src/vaultFactory/vaultHolder.js b/packages/inter-protocol/src/vaultFactory/vaultHolder.js index cab595d138df..cd3524dece43 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultHolder.js +++ b/packages/inter-protocol/src/vaultFactory/vaultHolder.js @@ -10,7 +10,7 @@ const { Fail } = assert; /** * @typedef {{ - * topicKit: import('@agoric/zoe/src/contractSupport/recorder.js').RecorderKit, + * topicKit: import('@agoric/contracts').RecorderKit, * vault: Vault | null, * }} State */ @@ -34,7 +34,7 @@ const PUBLIC_TOPICS = { /** * * @param {import('@agoric/ertp').Baggage} baggage - * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit + * @param {import('@agoric/contracts').MakeRecorderKit} makeRecorderKit */ export const prepareVaultHolder = (baggage, makeRecorderKit) => { const makeVaultHolderKit = prepareExoClassKit( diff --git a/packages/inter-protocol/src/vaultFactory/vaultKit.js b/packages/inter-protocol/src/vaultFactory/vaultKit.js index 5e49c507d2b4..7c5d38cb49d6 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultKit.js +++ b/packages/inter-protocol/src/vaultFactory/vaultKit.js @@ -9,7 +9,7 @@ const trace = makeTracer('VK', false); * Wrap the VaultHolder duration object in a record suitable for the result of an invitation. * * @param {import('@agoric/ertp').Baggage} baggage - * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit + * @param {import('@agoric/contracts').MakeRecorderKit} makeRecorderKit */ export const prepareVaultKit = (baggage, makeRecorderKit) => { trace('prepareVaultKit', [...baggage.keys()]); diff --git a/packages/inter-protocol/src/vaultFactory/vaultManager.js b/packages/inter-protocol/src/vaultFactory/vaultManager.js index fa470cf15d45..ead9af08390d 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultManager.js +++ b/packages/inter-protocol/src/vaultFactory/vaultManager.js @@ -38,7 +38,11 @@ import { provideDurableMapStore, provideDurableSetStore, } from '@agoric/vat-data'; -import { TransferPartShape } from '@agoric/zoe/src/contractSupport/atomicTransfer.js'; +import { + TransferPartShape, + PriceQuoteShape, + SeatShape, +} from '@agoric/zoe/src/typeGuards.js'; import { atomicRearrange, ceilMultiplyBy, @@ -52,8 +56,7 @@ import { multiplyRatios, offerTo, provideEmptySeat, -} from '@agoric/zoe/src/contractSupport/index.js'; -import { PriceQuoteShape, SeatShape } from '@agoric/zoe/src/typeGuards.js'; +} from '@agoric/contracts'; import { E } from '@endo/eventual-send'; import { AuctionPFShape } from '../auction/auctioneer.js'; import { checkDebtLimit, makeNatAmountShape } from '../contractSupport.js'; @@ -141,8 +144,8 @@ const quoteAsRatio = quoteAmount => * @param {import('@agoric/ertp').Baggage} baggage * @param {import('./vaultFactory.js').VaultFactoryZCF} zcf * @param {ERef} marshaller - * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeRecorderKit} makeRecorderKit - * @param {import('@agoric/zoe/src/contractSupport/recorder.js').MakeERecorderKit} makeERecorderKit + * @param {import('@agoric/contracts').MakeRecorderKit} makeRecorderKit + * @param {import('@agoric/contracts').MakeERecorderKit} makeERecorderKit * @param {Readonly<{ * debtMint: ZCFMint<'nat'>, * collateralBrand: Brand<'nat'>, @@ -185,7 +188,7 @@ export const prepareVaultManagerKit = ( const assetKit = makeRecorderKit( storageNode, - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/contracts').TypedMatcher} */ ( M.any() ), ); @@ -199,7 +202,7 @@ export const prepareVaultManagerKit = ( const metricsTopicKit = makeERecorderKit( E(storageNode).makeChildNode('metrics'), - /** @type {import('@agoric/zoe/src/contractSupport/recorder.js').TypedMatcher} */ ( + /** @type {import('@agoric/contracts').TypedMatcher} */ ( M.any() ), ); @@ -622,7 +625,7 @@ export const prepareVaultManagerKit = ( totalCollateral, ); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = []; let collatRemaining = distributableCollateral; @@ -686,7 +689,7 @@ export const prepareVaultManagerKit = ( distributable, totalCollateral, ); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = []; // iterate from best to worst returning remaining funds to vaults @@ -748,7 +751,7 @@ export const prepareVaultManagerKit = ( const debtPortion = makeRatioFromAmounts(totalPenalty, totalDebt); let collatRemaining = distributableCollateral; let debtRemaining = totalDebt; - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = []; let liquidated = 0; /** @type {MapStore} */ diff --git a/packages/inter-protocol/test/auction/test-auctionBook.js b/packages/inter-protocol/test/auction/test-auctionBook.js index e49f9a06603e..ee23f69a4d20 100644 --- a/packages/inter-protocol/test/auction/test-auctionBook.js +++ b/packages/inter-protocol/test/auction/test-auctionBook.js @@ -3,10 +3,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { AmountMath } from '@agoric/ertp'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { setupZCFTest } from '@agoric/zoe/test/unitTests/zcf/setupZcfTest.js'; -import { - makeRatio, - makeRatioFromAmounts, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio, makeRatioFromAmounts } from '@agoric/contracts'; import { makeOffer } from '@agoric/zoe/test/unitTests/makeOffer.js'; import { buildManualTimer } from '@agoric/swingset-vat/tools/manual-timer.js'; import { makeManualPriceAuthority } from '@agoric/zoe/tools/manualPriceAuthority.js'; diff --git a/packages/inter-protocol/test/auction/test-auctionContract.js b/packages/inter-protocol/test/auction/test-auctionContract.js index e63921331537..a2e638eeacc5 100644 --- a/packages/inter-protocol/test/auction/test-auctionContract.js +++ b/packages/inter-protocol/test/auction/test-auctionContract.js @@ -8,10 +8,7 @@ import { eventLoopIteration } from '@agoric/notifier/tools/testSupports.js'; import { buildManualTimer } from '@agoric/swingset-vat/tools/manual-timer.js'; import { makeScalarMapStore } from '@agoric/vat-data/src/index.js'; import { makeBoard } from '@agoric/vats/src/lib-board.js'; -import { - makeRatio, - makeRatioFromAmounts, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio, makeRatioFromAmounts } from '@agoric/contracts'; import { assertPayoutAmount } from '@agoric/zoe/test/zoeTestHelpers.js'; import { makeManualPriceAuthority } from '@agoric/zoe/tools/manualPriceAuthority.js'; import { makePriceAuthorityRegistry } from '@agoric/zoe/tools/priceAuthorityRegistry.js'; diff --git a/packages/inter-protocol/test/auction/test-sortedOffers.js b/packages/inter-protocol/test/auction/test-sortedOffers.js index 260aac808503..cd77d17072fa 100644 --- a/packages/inter-protocol/test/auction/test-sortedOffers.js +++ b/packages/inter-protocol/test/auction/test-sortedOffers.js @@ -1,10 +1,6 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { - ratiosSame, - makeRatioFromAmounts, - quantize, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { ratiosSame, makeRatioFromAmounts, quantize } from '@agoric/contracts'; import { setup } from '@agoric/zoe/test/unitTests/setupBasicMints.js'; import { fromPriceOfferKey, diff --git a/packages/inter-protocol/test/psm/test-psm.js b/packages/inter-protocol/test/psm/test-psm.js index 7bb8a84a9c4a..ce8d56eab980 100644 --- a/packages/inter-protocol/test/psm/test-psm.js +++ b/packages/inter-protocol/test/psm/test-psm.js @@ -14,7 +14,7 @@ import { floorMultiplyBy, makeRatio, natSafeMath as NatMath, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import centralSupplyBundle from '@agoric/vats/bundles/bundle-centralSupply.js'; import { E } from '@endo/eventual-send'; import { NonNullish } from '@agoric/assert'; diff --git a/packages/inter-protocol/test/stakeFactory/test-stakeFactory.js b/packages/inter-protocol/test/stakeFactory/test-stakeFactory.js index dc66880b8d84..e3b1f3d28b75 100644 --- a/packages/inter-protocol/test/stakeFactory/test-stakeFactory.js +++ b/packages/inter-protocol/test/stakeFactory/test-stakeFactory.js @@ -12,7 +12,7 @@ import mintHolderBundle from '@agoric/vats/bundles/bundle-mintHolder.js'; import { makeAgoricNamesAccess, makePromiseSpace } from '@agoric/vats'; import { makeBoard } from '@agoric/vats/src/lib-board.js'; import { Stable } from '@agoric/vats/src/tokens.js'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import buildManualTimer from '@agoric/zoe/tools/manualTimer.js'; import { E, Far } from '@endo/far'; import { deeplyFulfilled } from '@endo/marshal'; diff --git a/packages/inter-protocol/test/supports.js b/packages/inter-protocol/test/supports.js index 33d4a2955bc8..7522af04bbb7 100644 --- a/packages/inter-protocol/test/supports.js +++ b/packages/inter-protocol/test/supports.js @@ -9,7 +9,7 @@ import { makeBoard } from '@agoric/vats/src/lib-board.js'; import { Stable } from '@agoric/vats/src/tokens.js'; import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js'; import { makeZoeKit } from '@agoric/zoe'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { makeRatio } from '@agoric/contracts'; import { eventLoopIteration } from '@agoric/zoe/tools/eventLoopIteration.js'; import { makeFakeVatAdmin } from '@agoric/zoe/tools/fakeVatAdmin.js'; import buildManualTimer from '@agoric/zoe/tools/manualTimer.js'; diff --git a/packages/inter-protocol/test/test-clientSupport.js b/packages/inter-protocol/test/test-clientSupport.js index 07eaf8b8a6d5..e1a87a4baf93 100644 --- a/packages/inter-protocol/test/test-clientSupport.js +++ b/packages/inter-protocol/test/test-clientSupport.js @@ -1,7 +1,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { makeIssuerKit } from '@agoric/ertp'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { makeRatio } from '@agoric/contracts'; import { makeParseAmount } from 'agoric/src/lib/wallet.js'; import { withAmountUtils } from './supports.js'; import { Offers } from '../src/clientSupport.js'; diff --git a/packages/inter-protocol/test/test-interest-labeled.js b/packages/inter-protocol/test/test-interest-labeled.js index 15d79e14256c..8ac8b34f3484 100644 --- a/packages/inter-protocol/test/test-interest-labeled.js +++ b/packages/inter-protocol/test/test-interest-labeled.js @@ -2,7 +2,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import '@agoric/zoe/exported.js'; import { makeIssuerKit } from '@agoric/ertp'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { makeRatio } from '@agoric/contracts'; import { Far } from '@endo/marshal'; import { TimeMath } from '@agoric/time'; diff --git a/packages/inter-protocol/test/test-interest-math.js b/packages/inter-protocol/test/test-interest-math.js index d6f851c13bbe..06a475b31cd7 100644 --- a/packages/inter-protocol/test/test-interest-math.js +++ b/packages/inter-protocol/test/test-interest-math.js @@ -2,7 +2,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { makeIssuerKit, AmountMath } from '@agoric/ertp'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { makeRatio } from '@agoric/contracts'; import { calculateCurrentDebt, reverseInterest } from '../src/interest-math.js'; const brand = makeIssuerKit('foo').brand; diff --git a/packages/inter-protocol/test/test-interest.js b/packages/inter-protocol/test/test-interest.js index 2604e18798ff..b9ac3f27cc1d 100644 --- a/packages/inter-protocol/test/test-interest.js +++ b/packages/inter-protocol/test/test-interest.js @@ -2,10 +2,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import '@agoric/zoe/exported.js'; import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; -import { - ceilMultiplyBy, - makeRatio, -} from '@agoric/zoe/src/contractSupport/ratio.js'; +import { ceilMultiplyBy, makeRatio } from '@agoric/contracts'; import { Far } from '@endo/marshal'; import { makeIssuerRecord } from '@agoric/zoe/src/issuerRecord.js'; import { diff --git a/packages/inter-protocol/test/vaultFactory/driver.js b/packages/inter-protocol/test/vaultFactory/driver.js index ed07670e9c6e..5d887f9b1865 100644 --- a/packages/inter-protocol/test/vaultFactory/driver.js +++ b/packages/inter-protocol/test/vaultFactory/driver.js @@ -4,10 +4,7 @@ import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; import { allValues, makeTracer, objectMap } from '@agoric/internal'; import { makeNotifierFromSubscriber } from '@agoric/notifier'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; -import { - ceilMultiplyBy, - makeRatioFromAmounts, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { ceilMultiplyBy, makeRatioFromAmounts } from '@agoric/contracts'; import { makeManualPriceAuthority } from '@agoric/zoe/tools/manualPriceAuthority.js'; import buildManualTimer from '@agoric/zoe/tools/manualTimer.js'; import { E } from '@endo/eventual-send'; diff --git a/packages/inter-protocol/test/vaultFactory/faucet.js b/packages/inter-protocol/test/vaultFactory/faucet.js index e3a51a7cc9f8..6192638d4d8e 100644 --- a/packages/inter-protocol/test/vaultFactory/faucet.js +++ b/packages/inter-protocol/test/vaultFactory/faucet.js @@ -1,5 +1,5 @@ import { Far } from '@endo/marshal'; -import { assertProposalShape } from '@agoric/zoe/src/contractSupport/index.js'; +import { assertProposalShape } from '@agoric/contracts'; /** * A Faucet providing Minted so we can provide initial liquidity where it's diff --git a/packages/inter-protocol/test/vaultFactory/interestSupport.js b/packages/inter-protocol/test/vaultFactory/interestSupport.js index 2c607f727f38..ec41488cb557 100644 --- a/packages/inter-protocol/test/vaultFactory/interestSupport.js +++ b/packages/inter-protocol/test/vaultFactory/interestSupport.js @@ -1,8 +1,5 @@ import { AmountMath } from '@agoric/ertp'; -import { - floorMultiplyBy, - makeRatio, -} from '@agoric/zoe/src/contractSupport/ratio.js'; +import { floorMultiplyBy, makeRatio } from '@agoric/contracts'; import { Far } from '@endo/marshal'; import { reverseInterest } from '../../src/interest-math.js'; diff --git a/packages/inter-protocol/test/vaultFactory/test-collatRatio.js b/packages/inter-protocol/test/vaultFactory/test-collatRatio.js index 84ef644b888c..589a886fe5a3 100644 --- a/packages/inter-protocol/test/vaultFactory/test-collatRatio.js +++ b/packages/inter-protocol/test/vaultFactory/test-collatRatio.js @@ -3,7 +3,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { makeIssuerKit } from '@agoric/ertp'; import { Far } from '@endo/marshal'; -import { makeRatioFromAmounts } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatioFromAmounts } from '@agoric/contracts'; import { normalizedCollRatio } from '../../src/vaultFactory/storeUtils.js'; import { withAmountUtils } from '../supports.js'; diff --git a/packages/inter-protocol/test/vaultFactory/test-prioritizedVaults.js b/packages/inter-protocol/test/vaultFactory/test-prioritizedVaults.js index 766e103aa28c..441e88d03afb 100644 --- a/packages/inter-protocol/test/vaultFactory/test-prioritizedVaults.js +++ b/packages/inter-protocol/test/vaultFactory/test-prioritizedVaults.js @@ -2,10 +2,7 @@ import '@agoric/zoe/exported.js'; import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { AmountMath, makeIssuerKit } from '@agoric/ertp'; -import { - makeRatio, - makeRatioFromAmounts, -} from '@agoric/zoe/src/contractSupport/ratio.js'; +import { makeRatio, makeRatioFromAmounts } from '@agoric/contracts'; import { makeScalarBigMapStore } from '@agoric/vat-data'; import { diff --git a/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js b/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js index b36ad0eb7c82..0f914e1acb38 100644 --- a/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js +++ b/packages/inter-protocol/test/vaultFactory/test-vaultFactory.js @@ -7,10 +7,7 @@ import { allValues, makeTracer, objectMap } from '@agoric/internal'; import { makeNotifierFromAsyncIterable } from '@agoric/notifier'; import { M, matches } from '@agoric/store'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; -import { - ceilMultiplyBy, - makeRatio, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { ceilMultiplyBy, makeRatio } from '@agoric/contracts'; import { assertAmountsEqual, assertPayoutAmount, diff --git a/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js b/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js index ea5913b23eea..48310d3018a2 100644 --- a/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js +++ b/packages/inter-protocol/test/vaultFactory/test-vaultLiquidation.js @@ -8,7 +8,7 @@ import { ceilMultiplyBy, makeRatio, makeRatioFromAmounts, -} from '@agoric/zoe/src/contractSupport/index.js'; +} from '@agoric/contracts'; import { eventLoopIteration } from '@agoric/zoe/tools/eventLoopIteration.js'; import { buildManualTimer } from '@agoric/swingset-vat/tools/manual-timer.js'; import { E } from '@endo/eventual-send'; diff --git a/packages/inter-protocol/test/vaultFactory/vault-contract-wrapper.js b/packages/inter-protocol/test/vaultFactory/vault-contract-wrapper.js index 007b8f0c03ba..6f3a56c1554e 100644 --- a/packages/inter-protocol/test/vaultFactory/vault-contract-wrapper.js +++ b/packages/inter-protocol/test/vaultFactory/vault-contract-wrapper.js @@ -2,22 +2,20 @@ import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; import { assert } from '@agoric/assert'; -import { makePublishKit, observeNotifier } from '@agoric/notifier'; -import { - makeFakeMarshaller, - makeFakeStorage, -} from '@agoric/notifier/tools/testSupports.js'; import { atomicRearrange, - prepareRecorderKit, - unitAmount, -} from '@agoric/zoe/src/contractSupport/index.js'; -import { floorDivideBy, makeRatio, multiplyBy, multiplyRatios, -} from '@agoric/zoe/src/contractSupport/ratio.js'; + prepareRecorderKit, + unitAmount, +} from '@agoric/contracts'; +import { makePublishKit, observeNotifier } from '@agoric/notifier'; +import { + makeFakeMarshaller, + makeFakeStorage, +} from '@agoric/notifier/tools/testSupports.js'; import { makeFakePriceAuthority } from '@agoric/zoe/tools/fakePriceAuthority.js'; import buildManualTimer from '@agoric/zoe/tools/manualTimer.js'; import { E } from '@endo/eventual-send'; @@ -102,7 +100,7 @@ export async function start(zcf, privateArgs, baggage) { const mintAndTransfer = (mintReceiver, toMint, fee, nonMintTransfers) => { const kept = AmountMath.subtract(toMint, fee); runMint.mintGains(harden({ Minted: toMint }), mintSeat); - /** @type {import('@agoric/zoe/src/contractSupport/atomicTransfer.js').TransferPart[]} */ + /** @type {TransferPart[]} */ const transfers = [ ...nonMintTransfers, [mintSeat, vaultFactorySeat, { Minted: fee }], diff --git a/packages/inter-protocol/test/vaultFactory/vaultFactoryUtils.js b/packages/inter-protocol/test/vaultFactory/vaultFactoryUtils.js index 196bd1d0a042..e9711919ed12 100644 --- a/packages/inter-protocol/test/vaultFactory/vaultFactoryUtils.js +++ b/packages/inter-protocol/test/vaultFactory/vaultFactoryUtils.js @@ -2,7 +2,7 @@ import '@agoric/zoe/exported.js'; import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp'; import { makeNotifierFromSubscriber } from '@agoric/notifier'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { makeManualPriceAuthority } from '@agoric/zoe/tools/manualPriceAuthority.js'; import { makeScriptedPriceAuthority } from '@agoric/zoe/tools/scriptedPriceAuthority.js'; diff --git a/packages/pegasus/src/pegasus.js b/packages/pegasus/src/pegasus.js index 81f384167619..6acb008bfe22 100644 --- a/packages/pegasus/src/pegasus.js +++ b/packages/pegasus/src/pegasus.js @@ -3,10 +3,7 @@ import { assert, details as X, Fail } from '@agoric/assert'; import { makeLegacyWeakMap, makeLegacyMap } from '@agoric/store'; import { E, Far } from '@endo/far'; -import { - assertProposalShape, - atomicTransfer, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { assertProposalShape, atomicTransfer } from '@agoric/contracts'; import { makeSubscriptionKit } from '@agoric/notifier'; import '@agoric/vats/exported.js'; diff --git a/packages/smart-wallet/src/smartWallet.js b/packages/smart-wallet/src/smartWallet.js index f8dc6967a262..5ca04abb0384 100644 --- a/packages/smart-wallet/src/smartWallet.js +++ b/packages/smart-wallet/src/smartWallet.js @@ -18,7 +18,7 @@ import { import { M, mustMatch } from '@agoric/store'; import { appendToStoredArray } from '@agoric/store/src/stores/store-utils.js'; import { makeScalarBigMapStore, prepareExoClassKit } from '@agoric/vat-data'; -import { makeStorageNodePathProvider } from '@agoric/zoe/src/contractSupport/durability.js'; +import { makeStorageNodePathProvider } from '@agoric/contracts'; import { E } from '@endo/far'; import { makeInvitationsHelper } from './invitations.js'; import { makeOfferExecutor } from './offers.js'; diff --git a/packages/smart-wallet/src/walletFactory.js b/packages/smart-wallet/src/walletFactory.js index d831d017e4ce..b7edd184be22 100644 --- a/packages/smart-wallet/src/walletFactory.js +++ b/packages/smart-wallet/src/walletFactory.js @@ -10,7 +10,7 @@ import { M, makeExo, makeScalarMapStore, mustMatch } from '@agoric/store'; import { makeAtomicProvider } from '@agoric/store/src/stores/store-utils.js'; import { prepareExo, provideDurableMapStore } from '@agoric/vat-data'; import { makeMyAddressNameAdminKit } from '@agoric/vats/src/core/utils.js'; -import { provideAll } from '@agoric/zoe/src/contractSupport/durability.js'; +import { provideAll } from '@agoric/contracts'; import { E } from '@endo/far'; import { prepareSmartWallet } from './smartWallet.js'; import { shape } from './typeGuards.js'; diff --git a/packages/smart-wallet/test/supports.js b/packages/smart-wallet/test/supports.js index 4a4487d43b77..b5e458c0414f 100644 --- a/packages/smart-wallet/test/supports.js +++ b/packages/smart-wallet/test/supports.js @@ -13,7 +13,7 @@ import { buildRootObject as boardRoot } from '@agoric/vats/src/vat-board.js'; import { buildRootObject as mintsRoot } from '@agoric/vats/src/vat-mints.js'; import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js'; import { makeZoeKit } from '@agoric/zoe'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { makeRatio } from '@agoric/contracts'; import { eventLoopIteration } from '@agoric/zoe/tools/eventLoopIteration.js'; import { makeFakeVatAdmin } from '@agoric/zoe/tools/fakeVatAdmin.js'; import { makeLoopback } from '@endo/captp'; diff --git a/packages/vats/src/core/demoIssuers.js b/packages/vats/src/core/demoIssuers.js index 68eeab7227d4..021d41cc01de 100644 --- a/packages/vats/src/core/demoIssuers.js +++ b/packages/vats/src/core/demoIssuers.js @@ -1,10 +1,7 @@ /* eslint-disable @jessie.js/no-nested-await -- demo file */ import { AmountMath, AssetKind } from '@agoric/ertp'; import { split, splitMany } from '@agoric/ertp/src/legacy-payment-helpers.js'; -import { - makeRatio, - natSafeMath, -} from '@agoric/zoe/src/contractSupport/index.js'; +import { makeRatio, natSafeMath } from '@agoric/contracts'; import { E, Far } from '@endo/far'; import { Nat } from '@endo/nat'; import { notForProductionUse } from '@agoric/internal/src/magic-cookie-test-only.js'; diff --git a/packages/vats/test/test-provisionPool.js b/packages/vats/test/test-provisionPool.js index 19c43c2965d7..090eedba9520 100644 --- a/packages/vats/test/test-provisionPool.js +++ b/packages/vats/test/test-provisionPool.js @@ -12,7 +12,7 @@ import { import { WalletName } from '@agoric/internal'; import { publishDepositFacet } from '@agoric/smart-wallet/src/walletFactory.js'; import { unsafeMakeBundleCache } from '@agoric/swingset-vat/tools/bundleTool.js'; -import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js'; +import { makeRatio } from '@agoric/contracts'; import { eventLoopIteration } from '@agoric/zoe/tools/eventLoopIteration.js'; import { E } from '@endo/far'; import path from 'path'; diff --git a/packages/zoe/package.json b/packages/zoe/package.json index 18525b915bd0..c799332f0099 100644 --- a/packages/zoe/package.json +++ b/packages/zoe/package.json @@ -44,6 +44,7 @@ "homepage": "https://github.com/Agoric/agoric-sdk#readme", "dependencies": { "@agoric/assert": "^0.5.1", + "@agoric/contracts": "^0.0.1", "@agoric/ertp": "^0.15.3", "@agoric/internal": "^0.2.1", "@endo/nat": "^4.1.0", diff --git a/packages/zoe/src/contracts/atomicSwap.js b/packages/zoe/src/contracts/atomicSwap.js index 4dcdda0e584c..82736e55e262 100644 --- a/packages/zoe/src/contracts/atomicSwap.js +++ b/packages/zoe/src/contracts/atomicSwap.js @@ -3,7 +3,7 @@ import { assertIssuerKeywords, swap, assertProposalShape, -} from '../contractSupport/index.js'; +} from '@agoric/contracts'; /** * Trade one item for another. diff --git a/packages/zoe/src/contracts/auction/firstPriceLogic.js b/packages/zoe/src/contracts/auction/firstPriceLogic.js index 4aa8cdee9b1f..a4b3d9dc1147 100644 --- a/packages/zoe/src/contracts/auction/firstPriceLogic.js +++ b/packages/zoe/src/contracts/auction/firstPriceLogic.js @@ -1,5 +1,5 @@ import { AmountMath } from '@agoric/ertp'; -import { atomicRearrange } from '../../contractSupport/index.js'; +import { atomicRearrange } from '@agoric/contracts'; /** * @param {ZCF} zcf diff --git a/packages/zoe/src/contracts/auction/index.js b/packages/zoe/src/contracts/auction/index.js index 129e1e19a80d..2eff6ac9cf7e 100644 --- a/packages/zoe/src/contracts/auction/index.js +++ b/packages/zoe/src/contracts/auction/index.js @@ -7,7 +7,7 @@ import { defaultAcceptanceMsg, assertIssuerKeywords, assertProposalShape, -} from '../../contractSupport/index.js'; +} from '@agoric/contracts'; import * as secondPriceLogic from './secondPriceLogic.js'; import * as firstPriceLogic from './firstPriceLogic.js'; import { assertBidSeat } from './assertBidSeat.js'; diff --git a/packages/zoe/src/contracts/auction/secondPriceLogic.js b/packages/zoe/src/contracts/auction/secondPriceLogic.js index 654a6c1345cf..d193bf82145c 100644 --- a/packages/zoe/src/contracts/auction/secondPriceLogic.js +++ b/packages/zoe/src/contracts/auction/secondPriceLogic.js @@ -1,5 +1,5 @@ import { AmountMath } from '@agoric/ertp'; -import { atomicRearrange } from '../../contractSupport/index.js'; +import { atomicRearrange } from '@agoric/contracts'; /** * @param {ZCF} zcf diff --git a/packages/zoe/src/contracts/autoswap.js b/packages/zoe/src/contracts/autoswap.js index 7697c2ed7490..e2efca162344 100644 --- a/packages/zoe/src/contracts/autoswap.js +++ b/packages/zoe/src/contracts/autoswap.js @@ -12,7 +12,7 @@ import { assertNatAssetKind, calcSecondaryRequired, atomicRearrange, -} from '../contractSupport/index.js'; +} from '@agoric/contracts'; /** * Autoswap is a rewrite of Uniswap. Please see the documentation for diff --git a/packages/zoe/src/contracts/barterExchange.js b/packages/zoe/src/contracts/barterExchange.js index 2ed71f86de19..1368a62f9713 100644 --- a/packages/zoe/src/contracts/barterExchange.js +++ b/packages/zoe/src/contracts/barterExchange.js @@ -1,7 +1,7 @@ import { Far } from '@endo/marshal'; import { makeLegacyMap } from '@agoric/store'; // Eventually will be importable from '@agoric/zoe-contract-support' -import { satisfies, atomicRearrange } from '../contractSupport/index.js'; +import { satisfies, atomicRearrange } from '@agoric/contracts'; /** * This Barter Exchange accepts offers to trade arbitrary goods for other diff --git a/packages/zoe/src/contracts/callSpread/calculateShares.js b/packages/zoe/src/contracts/callSpread/calculateShares.js index fec102785a32..6b9c266c42cd 100644 --- a/packages/zoe/src/contracts/callSpread/calculateShares.js +++ b/packages/zoe/src/contracts/callSpread/calculateShares.js @@ -2,7 +2,7 @@ import './types.js'; import { AmountMath, isNatValue } from '@agoric/ertp'; import { assert } from '@agoric/assert'; -import { makeRatio, oneMinus } from '../../contractSupport/index.js'; +import { makeRatio, oneMinus } from '@agoric/contracts'; import { make100Percent, make0Percent } from './percent.js'; /** diff --git a/packages/zoe/src/contracts/callSpread/fundedCallSpread.js b/packages/zoe/src/contracts/callSpread/fundedCallSpread.js index 28d965687b9f..46d2b1a5d6f4 100644 --- a/packages/zoe/src/contracts/callSpread/fundedCallSpread.js +++ b/packages/zoe/src/contracts/callSpread/fundedCallSpread.js @@ -8,7 +8,7 @@ import { depositToSeat, assertNatAssetKind, atomicRearrange, -} from '../../contractSupport/index.js'; +} from '@agoric/contracts'; import { makePayoffHandler } from './payoffHandler.js'; import { Position } from './position.js'; diff --git a/packages/zoe/src/contracts/callSpread/payoffHandler.js b/packages/zoe/src/contracts/callSpread/payoffHandler.js index 6b1f755ed50a..3dc6a222e416 100644 --- a/packages/zoe/src/contracts/callSpread/payoffHandler.js +++ b/packages/zoe/src/contracts/callSpread/payoffHandler.js @@ -6,7 +6,7 @@ import { getAmountOut, ceilMultiplyBy, atomicTransfer, -} from '../../contractSupport/index.js'; +} from '@agoric/contracts'; import { Position } from './position.js'; import { calculateShares } from './calculateShares.js'; diff --git a/packages/zoe/src/contracts/callSpread/percent.js b/packages/zoe/src/contracts/callSpread/percent.js index b408dd389e9f..b2fd0ed4b369 100644 --- a/packages/zoe/src/contracts/callSpread/percent.js +++ b/packages/zoe/src/contracts/callSpread/percent.js @@ -1,6 +1,6 @@ // some tools to make treating ratios as percents easier -import { makeRatio } from '../../contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; const BASIS_POINTS = 10000n; diff --git a/packages/zoe/src/contracts/callSpread/pricedCallSpread.js b/packages/zoe/src/contracts/callSpread/pricedCallSpread.js index 10add08117a1..498cd016e358 100644 --- a/packages/zoe/src/contracts/callSpread/pricedCallSpread.js +++ b/packages/zoe/src/contracts/callSpread/pricedCallSpread.js @@ -11,7 +11,7 @@ import { makeRatio, ceilMultiplyBy, atomicRearrange, -} from '../../contractSupport/index.js'; +} from '@agoric/contracts'; import { makePayoffHandler } from './payoffHandler.js'; import { Position } from './position.js'; diff --git a/packages/zoe/src/contracts/coveredCall-durable.js b/packages/zoe/src/contracts/coveredCall-durable.js index 1b1615762178..04d380d6ba43 100644 --- a/packages/zoe/src/contracts/coveredCall-durable.js +++ b/packages/zoe/src/contracts/coveredCall-durable.js @@ -1,6 +1,6 @@ import { mustMatch, M } from '@agoric/store'; import { prepareExo, prepareExoClass } from '@agoric/vat-data'; -import { swapExact } from '../contractSupport/index.js'; +import { swapExact } from '@agoric/contracts'; import { isAfterDeadlineExitRule, OfferHandlerI } from '../typeGuards.js'; const { Fail } = assert; diff --git a/packages/zoe/src/contracts/coveredCall.js b/packages/zoe/src/contracts/coveredCall.js index 09228dab326f..1ffa6619dae3 100644 --- a/packages/zoe/src/contracts/coveredCall.js +++ b/packages/zoe/src/contracts/coveredCall.js @@ -1,6 +1,6 @@ import { M, mustMatch } from '@agoric/store'; // Eventually will be importable from '@agoric/zoe-contract-support' -import { swapExact } from '../contractSupport/index.js'; +import { swapExact } from '@agoric/contracts'; import { isAfterDeadlineExitRule } from '../typeGuards.js'; const { Fail, quote: q } = assert; diff --git a/packages/zoe/src/contracts/loan/addCollateral.js b/packages/zoe/src/contracts/loan/addCollateral.js index 959cf142cc02..63395fec9520 100644 --- a/packages/zoe/src/contracts/loan/addCollateral.js +++ b/packages/zoe/src/contracts/loan/addCollateral.js @@ -1,7 +1,4 @@ -import { - assertProposalShape, - atomicTransfer, -} from '../../contractSupport/index.js'; +import { assertProposalShape, atomicTransfer } from '@agoric/contracts'; import { scheduleLiquidation } from './scheduleLiquidation.js'; diff --git a/packages/zoe/src/contracts/loan/borrow.js b/packages/zoe/src/contracts/loan/borrow.js index a50285d6c37e..22f75010b025 100644 --- a/packages/zoe/src/contracts/loan/borrow.js +++ b/packages/zoe/src/contracts/loan/borrow.js @@ -10,7 +10,7 @@ import { ceilMultiplyBy, getTimestamp, atomicRearrange, -} from '../../contractSupport/index.js'; +} from '@agoric/contracts'; import { scheduleLiquidation } from './scheduleLiquidation.js'; import { calculateInterest, makeDebtCalculator } from './updateDebt.js'; diff --git a/packages/zoe/src/contracts/loan/close.js b/packages/zoe/src/contracts/loan/close.js index 2351817758bb..ed980158c0d5 100644 --- a/packages/zoe/src/contracts/loan/close.js +++ b/packages/zoe/src/contracts/loan/close.js @@ -3,10 +3,7 @@ import './types.js'; import { Fail } from '@agoric/assert'; import { AmountMath } from '@agoric/ertp'; -import { - assertProposalShape, - atomicRearrange, -} from '../../contractSupport/index.js'; +import { assertProposalShape, atomicRearrange } from '@agoric/contracts'; // The debt, the amount which must be repaid, is just the amount // loaned plus interest (aka stability fee). All debt must be repaid diff --git a/packages/zoe/src/contracts/loan/index.js b/packages/zoe/src/contracts/loan/index.js index caa76ed5ee40..1b0c95eaf370 100644 --- a/packages/zoe/src/contracts/loan/index.js +++ b/packages/zoe/src/contracts/loan/index.js @@ -1,9 +1,6 @@ import { Nat } from '@endo/nat'; -import { - assertIssuerKeywords, - makeRatio, -} from '../../contractSupport/index.js'; +import { assertIssuerKeywords, makeRatio } from '@agoric/contracts'; import { makeLendInvitation } from './lend.js'; /** diff --git a/packages/zoe/src/contracts/loan/lend.js b/packages/zoe/src/contracts/loan/lend.js index 2cec6e703c73..bd33273fb9ba 100644 --- a/packages/zoe/src/contracts/loan/lend.js +++ b/packages/zoe/src/contracts/loan/lend.js @@ -1,4 +1,4 @@ -import { assertProposalShape } from '../../contractSupport/index.js'; +import { assertProposalShape } from '@agoric/contracts'; import { makeBorrowInvitation } from './borrow.js'; // The lender puts up the amount to be loaned to the borrower, but has diff --git a/packages/zoe/src/contracts/loan/liquidate.js b/packages/zoe/src/contracts/loan/liquidate.js index 03786453f854..b1dcd4a86613 100644 --- a/packages/zoe/src/contracts/loan/liquidate.js +++ b/packages/zoe/src/contracts/loan/liquidate.js @@ -1,7 +1,7 @@ import { E } from '@endo/eventual-send'; import { AmountMath } from '@agoric/ertp'; -import { offerTo } from '../../contractSupport/zoeHelpers.js'; +import { offerTo } from '@agoric/contracts'; export const doLiquidation = async ( zcf, diff --git a/packages/zoe/src/contracts/loan/scheduleLiquidation.js b/packages/zoe/src/contracts/loan/scheduleLiquidation.js index 3c9133f8cfc4..db07c4f67347 100644 --- a/packages/zoe/src/contracts/loan/scheduleLiquidation.js +++ b/packages/zoe/src/contracts/loan/scheduleLiquidation.js @@ -2,11 +2,7 @@ import { E } from '@endo/eventual-send'; import { AmountMath } from '@agoric/ertp'; import { liquidate } from './liquidate.js'; -import { - getAmountIn, - ceilMultiplyBy, - atomicTransfer, -} from '../../contractSupport/index.js'; +import { getAmountIn, ceilMultiplyBy, atomicTransfer } from '@agoric/contracts'; /** @type {ScheduleLiquidation} */ export const scheduleLiquidation = (zcf, configWithBorrower) => { diff --git a/packages/zoe/src/contracts/loan/updateDebt.js b/packages/zoe/src/contracts/loan/updateDebt.js index b2c722922e40..406cbfbf96e2 100644 --- a/packages/zoe/src/contracts/loan/updateDebt.js +++ b/packages/zoe/src/contracts/loan/updateDebt.js @@ -5,7 +5,7 @@ import { AmountMath } from '@agoric/ertp'; import { TimeMath } from '@agoric/time'; import { scheduleLiquidation } from './scheduleLiquidation.js'; -import { ceilMultiplyBy } from '../../contractSupport/index.js'; +import { ceilMultiplyBy } from '@agoric/contracts'; // Update the debt by adding the new interest on every period, as // indicated by the periodNotifier diff --git a/packages/zoe/src/contracts/oracle.js b/packages/zoe/src/contracts/oracle.js index 8d1612bbfbe3..93e48de4fc9f 100644 --- a/packages/zoe/src/contracts/oracle.js +++ b/packages/zoe/src/contracts/oracle.js @@ -3,7 +3,7 @@ import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; import { E } from '@endo/eventual-send'; -import { atomicTransfer } from '../contractSupport/index.js'; +import { atomicTransfer } from '@agoric/contracts'; /** * This contract provides oracle queries for a fee or for free. diff --git a/packages/zoe/src/contracts/otcDesk.js b/packages/zoe/src/contracts/otcDesk.js index 2842b224babd..ebcb656e7859 100644 --- a/packages/zoe/src/contracts/otcDesk.js +++ b/packages/zoe/src/contracts/otcDesk.js @@ -6,7 +6,7 @@ import { saveAllIssuers, assertProposalShape, atomicTransfer, -} from '../contractSupport/index.js'; +} from '@agoric/contracts'; /** * This contract is inspired by the description of an OTC Desk smart diff --git a/packages/zoe/src/contracts/priceAggregator.js b/packages/zoe/src/contracts/priceAggregator.js index 3c8480787001..0c47367d8ee1 100644 --- a/packages/zoe/src/contracts/priceAggregator.js +++ b/packages/zoe/src/contracts/priceAggregator.js @@ -16,7 +16,7 @@ import '../../tools/types-ambient.js'; import { calculateMedian, makeOnewayPriceAuthorityKit, -} from '../contractSupport/index.js'; +} from '@agoric/contracts'; import { addRatios, assertParsableNumber, @@ -28,7 +28,7 @@ import { parseRatio, ratioGTE, ratiosSame, -} from '../contractSupport/ratio.js'; +} from '@agoric/contracts'; import '@agoric/ertp/src/types-ambient.js'; diff --git a/packages/zoe/src/contractSupport/priceAuthorityInitial.js b/packages/zoe/src/contracts/priceAuthorityInitial.js similarity index 97% rename from packages/zoe/src/contractSupport/priceAuthorityInitial.js rename to packages/zoe/src/contracts/priceAuthorityInitial.js index a15cef6b3261..b80247353dac 100644 --- a/packages/zoe/src/contractSupport/priceAuthorityInitial.js +++ b/packages/zoe/src/contracts/priceAuthorityInitial.js @@ -1,11 +1,11 @@ // @ts-check -import { E } from '@endo/far'; +import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { makeNotifier } from '@agoric/notifier'; import { AmountMath } from '@agoric/ertp'; +import { multiplyBy } from '@agoric/contracts'; -import { multiplyBy } from './ratio.js'; import { mintQuote } from './priceAuthorityTransform.js'; /** @template T @typedef {import('@endo/eventual-send').EOnly} EOnly */ diff --git a/packages/zoe/src/contractSupport/priceAuthorityTransform.js b/packages/zoe/src/contracts/priceAuthorityTransform.js similarity index 100% rename from packages/zoe/src/contractSupport/priceAuthorityTransform.js rename to packages/zoe/src/contracts/priceAuthorityTransform.js diff --git a/packages/zoe/src/contracts/scaledPriceAuthority.js b/packages/zoe/src/contracts/scaledPriceAuthority.js index cfaa3d883a14..c05a04a21c61 100644 --- a/packages/zoe/src/contracts/scaledPriceAuthority.js +++ b/packages/zoe/src/contracts/scaledPriceAuthority.js @@ -1,14 +1,14 @@ -import { Far } from '@endo/marshal'; import { AssetKind, makeIssuerKit } from '@agoric/ertp'; +import { Far } from '@endo/marshal'; import { ceilDivideBy, - floorDivideBy, ceilMultiplyBy, + floorDivideBy, floorMultiplyBy, -} from '../contractSupport/index.js'; -import { makePriceAuthorityTransform } from '../contractSupport/priceAuthorityTransform.js'; -import { makeInitialTransform } from '../contractSupport/priceAuthorityInitial.js'; +} from '@agoric/contracts'; +import { makePriceAuthorityTransform } from './priceAuthorityTransform.js'; +import { makeInitialTransform } from './priceAuthorityInitial.js'; /** * @typedef {object} ScaledPriceAuthorityOpts diff --git a/packages/zoe/src/contracts/sellItems.js b/packages/zoe/src/contracts/sellItems.js index 6762ce7e8223..d4ff103f0bdb 100644 --- a/packages/zoe/src/contracts/sellItems.js +++ b/packages/zoe/src/contracts/sellItems.js @@ -12,7 +12,7 @@ import { assertProposalShape, assertNatAssetKind, atomicRearrange, -} from '../contractSupport/index.js'; +} from '@agoric/contracts'; const { Fail } = assert; diff --git a/packages/zoe/src/contracts/simpleExchange.js b/packages/zoe/src/contracts/simpleExchange.js index 9778a61b3a0e..0d9a2c7d1fcc 100644 --- a/packages/zoe/src/contracts/simpleExchange.js +++ b/packages/zoe/src/contracts/simpleExchange.js @@ -6,7 +6,7 @@ import { satisfies, assertProposalShape, assertIssuerKeywords, -} from '../contractSupport/zoeHelpers.js'; +} from '@agoric/contracts'; /** * SimpleExchange is an exchange with a simple matching algorithm, which allows diff --git a/packages/zoe/src/typeGuards.js b/packages/zoe/src/typeGuards.js index fa0bf9b9c14b..60704d35bfe6 100644 --- a/packages/zoe/src/typeGuards.js +++ b/packages/zoe/src/typeGuards.js @@ -383,3 +383,8 @@ export const PriceQuoteShape = harden({ quoteAmount: AmountShape, quotePayment: M.eref(PaymentShape), }); + +export const TransferPartShape = M.splitArray( + harden([M.opt(SeatShape), M.opt(SeatShape), M.opt(AmountKeywordRecordShape)]), + harden([M.opt(AmountKeywordRecordShape)]), +); diff --git a/packages/zoe/test/autoswapJig.js b/packages/zoe/test/autoswapJig.js index 3bcd62756023..69f007e7b502 100644 --- a/packages/zoe/test/autoswapJig.js +++ b/packages/zoe/test/autoswapJig.js @@ -2,7 +2,7 @@ import { E } from '@endo/eventual-send'; import { Remotable } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; -import { natSafeMath } from '../src/contractSupport/index.js'; +import { natSafeMath } from '@agoric/contracts'; import { assertOfferResult, assertPayoutAmount } from './zoeTestHelpers.js'; const { add, subtract, multiply, floorDivide, ceilDivide } = natSafeMath; diff --git a/packages/zoe/test/swingsetTests/brokenContracts/crashingAutoRefund.js b/packages/zoe/test/swingsetTests/brokenContracts/crashingAutoRefund.js index 0222d8f1b81f..3f563906b593 100644 --- a/packages/zoe/test/swingsetTests/brokenContracts/crashingAutoRefund.js +++ b/packages/zoe/test/swingsetTests/brokenContracts/crashingAutoRefund.js @@ -4,7 +4,7 @@ import { swap, assertIssuerKeywords, assertProposalShape, -} from '../../../src/contractSupport/index.js'; +} from '@agoric/contracts'; /** * This is an atomic swap contract to test Zoe handling contract failures. diff --git a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js index 5578028ac41d..a2676fb04241 100644 --- a/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js +++ b/packages/zoe/test/swingsetTests/upgradeCoveredCall/coveredCall-durable-V3.js @@ -2,7 +2,7 @@ import { M, mustMatch } from '@agoric/store'; import '../../../exported.js'; import { prepareExoClass, prepareExo } from '@agoric/vat-data'; -import { swapExact } from '../../../src/contractSupport/index.js'; +import { swapExact } from '@agoric/contracts'; import { InvitationShape, isAfterDeadlineExitRule, diff --git a/packages/zoe/test/unitTests/bounty.js b/packages/zoe/test/unitTests/bounty.js index 0882826b1ee4..a7977109e325 100644 --- a/packages/zoe/test/unitTests/bounty.js +++ b/packages/zoe/test/unitTests/bounty.js @@ -12,10 +12,7 @@ import { AmountMath } from '@agoric/ertp'; * * @type {ContractStartFn} */ -import { - assertProposalShape, - atomicTransfer, -} from '../../src/contractSupport/index.js'; +import { assertProposalShape, atomicTransfer } from '@agoric/contracts'; /** @param {ZCF} zcf */ const start = async zcf => { diff --git a/packages/zoe/test/unitTests/contractSupport/test-bondingCurves.js b/packages/zoe/test/unitTests/contractSupport/test-bondingCurves.js index 7ac9c20dcb11..7ac7bffef1a7 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-bondingCurves.js +++ b/packages/zoe/test/unitTests/contractSupport/test-bondingCurves.js @@ -5,7 +5,7 @@ import { getInputPrice, getOutputPrice, calcLiqValueToMint, -} from '../../../src/contractSupport/index.js'; +} from '@agoric/contracts'; const testGetPrice = ( t, diff --git a/packages/zoe/test/unitTests/contractSupport/test-depositTo.js b/packages/zoe/test/unitTests/contractSupport/test-depositTo.js index 406697b3f0dc..ab0be349d204 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-depositTo.js +++ b/packages/zoe/test/unitTests/contractSupport/test-depositTo.js @@ -10,7 +10,7 @@ import bundleSource from '@endo/bundle-source'; import { setup } from '../setupBasicMints.js'; import { makeZoeKit } from '../../../src/zoeService/zoe.js'; import { makeFakeVatAdmin } from '../../../tools/fakeVatAdmin.js'; -import { depositToSeat } from '../../../src/contractSupport/zoeHelpers.js'; +import { depositToSeat } from '@agoric/contracts'; import { makeOffer } from '../makeOffer.js'; const filename = new URL(import.meta.url).pathname; diff --git a/packages/zoe/test/unitTests/contractSupport/test-offerTo.js b/packages/zoe/test/unitTests/contractSupport/test-offerTo.js index 5ed081fcad8d..6fba7ec877f9 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-offerTo.js +++ b/packages/zoe/test/unitTests/contractSupport/test-offerTo.js @@ -9,7 +9,7 @@ import bundleSource from '@endo/bundle-source'; import { setup } from '../setupBasicMints.js'; import { makeZoeKit } from '../../../src/zoeService/zoe.js'; import { makeFakeVatAdmin } from '../../../tools/fakeVatAdmin.js'; -import { offerTo, swapExact } from '../../../src/contractSupport/zoeHelpers.js'; +import { offerTo, swapExact } from '@agoric/contracts'; import { makeOffer } from '../makeOffer.js'; const filename = new URL(import.meta.url).pathname; diff --git a/packages/zoe/test/unitTests/contractSupport/test-percentSupport.js b/packages/zoe/test/unitTests/contractSupport/test-percentSupport.js index 70525ab1e83b..b9b1e4ff3eb3 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-percentSupport.js +++ b/packages/zoe/test/unitTests/contractSupport/test-percentSupport.js @@ -3,7 +3,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { makeIssuerKit, AmountMath } from '@agoric/ertp'; -import { floorMultiplyBy } from '../../../src/contractSupport/index.js'; +import { floorMultiplyBy } from '@agoric/contracts'; import { make100Percent, make0Percent, diff --git a/packages/zoe/test/unitTests/contractSupport/test-ratio.js b/packages/zoe/test/unitTests/contractSupport/test-ratio.js index 6c843a3da6cc..c37efa60a724 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-ratio.js +++ b/packages/zoe/test/unitTests/contractSupport/test-ratio.js @@ -19,7 +19,7 @@ import { multiplyBy, subtractRatios, parseRatio, -} from '../../../src/contractSupport/ratio.js'; +} from '@agoric/contracts'; /** * diff --git a/packages/zoe/test/unitTests/contractSupport/test-stateMachine.js b/packages/zoe/test/unitTests/contractSupport/test-stateMachine.js index 6987b514c0d9..9ec480643806 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-stateMachine.js +++ b/packages/zoe/test/unitTests/contractSupport/test-stateMachine.js @@ -1,7 +1,7 @@ // eslint-disable-next-line import/no-extraneous-dependencies import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; -import { makeStateMachine } from '../../../src/contractSupport/index.js'; +import { makeStateMachine } from '@agoric/contracts'; test('stateMachine', t => { t.plan(4); diff --git a/packages/zoe/test/unitTests/contractSupport/test-withdrawFrom.js b/packages/zoe/test/unitTests/contractSupport/test-withdrawFrom.js index 86181dde2585..0c1dc846c6a7 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-withdrawFrom.js +++ b/packages/zoe/test/unitTests/contractSupport/test-withdrawFrom.js @@ -7,13 +7,10 @@ import path from 'path'; import { E } from '@endo/eventual-send'; import bundleSource from '@endo/bundle-source'; +import { depositToSeat, withdrawFromSeat } from '@agoric/contracts'; import { setup } from '../setupBasicMints.js'; import { makeZoeKit } from '../../../src/zoeService/zoe.js'; import { makeFakeVatAdmin } from '../../../tools/fakeVatAdmin.js'; -import { - depositToSeat, - withdrawFromSeat, -} from '../../../src/contractSupport/index.js'; import { assertPayoutAmount } from '../../zoeTestHelpers.js'; import { makeOffer } from '../makeOffer.js'; diff --git a/packages/zoe/test/unitTests/contractSupport/test-zoeHelpers.js b/packages/zoe/test/unitTests/contractSupport/test-zoeHelpers.js index fe19438f979d..2caf17dece2c 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-zoeHelpers.js +++ b/packages/zoe/test/unitTests/contractSupport/test-zoeHelpers.js @@ -3,13 +3,9 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { Far } from '@endo/marshal'; import { makeScalarMapStore } from '@agoric/store'; +import { defaultAcceptanceMsg, satisfies } from '@agoric/contracts'; import { setup } from '../setupBasicMints.js'; -import { - defaultAcceptanceMsg, - satisfies, -} from '../../../src/contractSupport/index.js'; - test('ZoeHelpers messages', t => { t.is( defaultAcceptanceMsg, diff --git a/packages/zoe/test/unitTests/contracts/escrowToVote.js b/packages/zoe/test/unitTests/contracts/escrowToVote.js index eb342e1275fc..b4ef446d244a 100644 --- a/packages/zoe/test/unitTests/contracts/escrowToVote.js +++ b/packages/zoe/test/unitTests/contracts/escrowToVote.js @@ -8,7 +8,7 @@ import { assertIssuerKeywords, assertProposalShape, assertNatAssetKind, -} from '../../../src/contractSupport/index.js'; +} from '@agoric/contracts'; const { details: X, quote: q } = assert; diff --git a/packages/zoe/test/unitTests/contracts/loan/helpers.js b/packages/zoe/test/unitTests/contracts/loan/helpers.js index 2b7afad5d793..1c36dfcc460a 100644 --- a/packages/zoe/test/unitTests/contracts/loan/helpers.js +++ b/packages/zoe/test/unitTests/contracts/loan/helpers.js @@ -11,7 +11,7 @@ import bundleSource from '@endo/bundle-source'; import { makeIssuerKit, AmountMath } from '@agoric/ertp'; import { setupZCFTest } from '../../zcf/setupZcfTest.js'; -import { makeRatio } from '../../../../src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { assertAmountsEqual } from '../../../zoeTestHelpers.js'; const filename = new URL(import.meta.url).pathname; diff --git a/packages/zoe/test/unitTests/contracts/loan/test-addCollateral.js b/packages/zoe/test/unitTests/contracts/loan/test-addCollateral.js index c2e8b60d9df0..66b9785fbcce 100644 --- a/packages/zoe/test/unitTests/contracts/loan/test-addCollateral.js +++ b/packages/zoe/test/unitTests/contracts/loan/test-addCollateral.js @@ -15,7 +15,7 @@ import { makeSeatKit, performAddCollateral, } from './helpers.js'; -import { makeRatio } from '../../../../src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; test.todo('makeAddCollateralInvitation - test bad proposal'); diff --git a/packages/zoe/test/unitTests/contracts/loan/test-borrow.js b/packages/zoe/test/unitTests/contracts/loan/test-borrow.js index 155b0237c6f4..9dc500e99be8 100644 --- a/packages/zoe/test/unitTests/contracts/loan/test-borrow.js +++ b/packages/zoe/test/unitTests/contracts/loan/test-borrow.js @@ -25,7 +25,7 @@ import { eventLoopIteration } from '../../../../tools/eventLoopIteration.js'; import { makeBorrowInvitation } from '../../../../src/contracts/loan/borrow.js'; import { makeAddCollateralInvitation } from '../../../../src/contracts/loan/addCollateral.js'; import { makeCloseLoanInvitation } from '../../../../src/contracts/loan/close.js'; -import { makeRatio } from '../../../../src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { assertAmountsEqual } from '../../../zoeTestHelpers.js'; const BASIS_POINTS = 10000n; diff --git a/packages/zoe/test/unitTests/contracts/loan/test-lend.js b/packages/zoe/test/unitTests/contracts/loan/test-lend.js index 645ba68d5935..2dd416802473 100644 --- a/packages/zoe/test/unitTests/contracts/loan/test-lend.js +++ b/packages/zoe/test/unitTests/contracts/loan/test-lend.js @@ -9,7 +9,7 @@ import { AmountMath } from '@agoric/ertp'; import { setupLoanUnitTest, checkDescription } from './helpers.js'; import { makeLendInvitation } from '../../../../src/contracts/loan/lend.js'; -import { makeRatio } from '../../../../src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; test('makeLendInvitation', async t => { const { zcf, zoe, loanKit } = await setupLoanUnitTest(); diff --git a/packages/zoe/test/unitTests/contracts/loan/test-liquidate.js b/packages/zoe/test/unitTests/contracts/loan/test-liquidate.js index 4b559072c034..08be80ee5684 100644 --- a/packages/zoe/test/unitTests/contracts/loan/test-liquidate.js +++ b/packages/zoe/test/unitTests/contracts/loan/test-liquidate.js @@ -12,7 +12,7 @@ import { checkNoNewOffers, checkPayouts, } from './helpers.js'; -import { atomicRearrange } from '../../../../src/contractSupport/atomicTransfer.js'; +import { atomicRearrange } from '@agoric/contracts'; test('test doLiquidation with mocked autoswap', async t => { const { zcf, collateralKit, loanKit } = await setupLoanUnitTest(); diff --git a/packages/zoe/test/unitTests/contracts/loan/test-loan-e2e.js b/packages/zoe/test/unitTests/contracts/loan/test-loan-e2e.js index edf0b7007ad1..889da86efdc4 100644 --- a/packages/zoe/test/unitTests/contracts/loan/test-loan-e2e.js +++ b/packages/zoe/test/unitTests/contracts/loan/test-loan-e2e.js @@ -15,7 +15,7 @@ import { checkDetails, checkPayout } from './helpers.js'; import { setup } from '../../setupBasicMints.js'; import { makeFakePriceAuthority } from '../../../../tools/fakePriceAuthority.js'; import buildManualTimer from '../../../../tools/manualTimer.js'; -import { makeRatio } from '../../../../src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); diff --git a/packages/zoe/test/unitTests/contracts/loan/test-updateDebt.js b/packages/zoe/test/unitTests/contracts/loan/test-updateDebt.js index 245012c7720d..8e740154ae40 100644 --- a/packages/zoe/test/unitTests/contracts/loan/test-updateDebt.js +++ b/packages/zoe/test/unitTests/contracts/loan/test-updateDebt.js @@ -3,7 +3,7 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import '../../../../exported.js'; import { calculateInterest } from '../../../../src/contracts/loan/updateDebt.js'; -import { makeRatio } from '../../../../src/contractSupport/index.js'; +import { makeRatio } from '@agoric/contracts'; import { setup } from '../../setupBasicMints.js'; test('test calculateInterest', async t => { diff --git a/packages/zoe/test/unitTests/contracts/test-callSpread-calculation.js b/packages/zoe/test/unitTests/contracts/test-callSpread-calculation.js index fc8c45d1eb53..4bd368cef9e0 100644 --- a/packages/zoe/test/unitTests/contracts/test-callSpread-calculation.js +++ b/packages/zoe/test/unitTests/contracts/test-callSpread-calculation.js @@ -1,12 +1,9 @@ // eslint-disable-next-line import/no-extraneous-dependencies import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; +import { ceilMultiplyBy, floorMultiplyBy } from '@agoric/contracts'; import { setup } from '../setupBasicMints.js'; import { calculateShares } from '../../../src/contracts/callSpread/calculateShares.js'; -import { - ceilMultiplyBy, - floorMultiplyBy, -} from '../../../src/contractSupport/index.js'; import { make0Percent, make100Percent, diff --git a/packages/zoe/test/unitTests/contracts/test-priceAggregator.js b/packages/zoe/test/unitTests/contracts/test-priceAggregator.js index 6ab1dbb713da..4970538a8809 100644 --- a/packages/zoe/test/unitTests/contracts/test-priceAggregator.js +++ b/packages/zoe/test/unitTests/contracts/test-priceAggregator.js @@ -28,7 +28,7 @@ import { multiplyBy, multiplyRatios, parseRatio, -} from '../../../src/contractSupport/ratio.js'; +} from '@agoric/contracts'; /** * @callback MakeFakePriceOracle diff --git a/packages/zoe/test/unitTests/contracts/test-scaledPriceAuthority.js b/packages/zoe/test/unitTests/contracts/test-scaledPriceAuthority.js index 89bb8d20b6e6..b08004ace1d7 100644 --- a/packages/zoe/test/unitTests/contracts/test-scaledPriceAuthority.js +++ b/packages/zoe/test/unitTests/contracts/test-scaledPriceAuthority.js @@ -9,7 +9,7 @@ import { E } from '@endo/eventual-send'; import { makeIssuerKit, AmountMath } from '@agoric/ertp'; import { makeZoeKit } from '../../../src/zoeService/zoe.js'; -import { makeRatio } from '../../../src/contractSupport/ratio.js'; +import { makeRatio } from '@agoric/contracts'; import { makeFakeVatAdmin } from '../../../tools/fakeVatAdmin.js'; import buildManualTimer from '../../../tools/manualTimer.js'; import { makeManualPriceAuthority } from '../../../tools/manualPriceAuthority.js'; diff --git a/packages/zoe/test/unitTests/contracts/test-sellTickets.js b/packages/zoe/test/unitTests/contracts/test-sellTickets.js index 3e957d8bd0dc..fd2ab2beeb34 100644 --- a/packages/zoe/test/unitTests/contracts/test-sellTickets.js +++ b/packages/zoe/test/unitTests/contracts/test-sellTickets.js @@ -9,10 +9,10 @@ import { makeIssuerKit, AmountMath, isSetValue } from '@agoric/ertp'; import { claim } from '@agoric/ertp/src/legacy-payment-helpers.js'; import { E } from '@endo/eventual-send'; +import { defaultAcceptanceMsg } from '@agoric/contracts'; import { makeFakeVatAdmin } from '../../../tools/fakeVatAdmin.js'; import { makeZoeKit } from '../../../src/zoeService/zoe.js'; -import { defaultAcceptanceMsg } from '../../../src/contractSupport/index.js'; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); diff --git a/packages/zoe/test/unitTests/contracts/throwInOfferHandler.js b/packages/zoe/test/unitTests/contracts/throwInOfferHandler.js index 1c1686bc58b1..bd0ef2f8e8ec 100644 --- a/packages/zoe/test/unitTests/contracts/throwInOfferHandler.js +++ b/packages/zoe/test/unitTests/contracts/throwInOfferHandler.js @@ -1,7 +1,7 @@ import { makeIssuerKit, AmountMath } from '@agoric/ertp'; import { Far } from '@endo/marshal'; -import { depositToSeat } from '../../../src/contractSupport/index.js'; +import { depositToSeat } from '@agoric/contracts'; /** * This is a a broken contact to test that diff --git a/packages/zoe/test/unitTests/contracts/useObjExample.js b/packages/zoe/test/unitTests/contracts/useObjExample.js index 599971e7e5ea..35065fd7e909 100644 --- a/packages/zoe/test/unitTests/contracts/useObjExample.js +++ b/packages/zoe/test/unitTests/contracts/useObjExample.js @@ -2,10 +2,7 @@ import { Far } from '@endo/marshal'; import { AmountMath } from '@agoric/ertp'; // Eventually will be importable from '@agoric/zoe-contract-support' -import { - assertIssuerKeywords, - assertProposalShape, -} from '../../../src/contractSupport/index.js'; +import { assertIssuerKeywords, assertProposalShape } from '@agoric/contracts'; const { details: X } = assert; diff --git a/packages/zoe/test/unitTests/test-blockedOffers.js b/packages/zoe/test/unitTests/test-blockedOffers.js index 52737d5dfd49..f3df66d03f47 100644 --- a/packages/zoe/test/unitTests/test-blockedOffers.js +++ b/packages/zoe/test/unitTests/test-blockedOffers.js @@ -10,10 +10,7 @@ import bundleSource from '@endo/bundle-source'; import { setup } from './setupBasicMints.js'; import { makeZoeKit } from '../../src/zoeService/zoe.js'; import { makeFakeVatAdmin } from '../../tools/fakeVatAdmin.js'; -import { - depositToSeat, - withdrawFromSeat, -} from '../../src/contractSupport/index.js'; +import { depositToSeat, withdrawFromSeat } from '@agoric/contracts'; import { assertPayoutAmount } from '../zoeTestHelpers.js'; import { makeOffer } from './makeOffer.js'; diff --git a/packages/zoe/test/unitTests/test-fakePriceAuthority.js b/packages/zoe/test/unitTests/test-fakePriceAuthority.js index c1f30b871400..1579e8fc0bdc 100644 --- a/packages/zoe/test/unitTests/test-fakePriceAuthority.js +++ b/packages/zoe/test/unitTests/test-fakePriceAuthority.js @@ -4,17 +4,17 @@ import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; import { E } from '@endo/eventual-send'; import { assert } from '@agoric/assert'; import { TimeMath } from '@agoric/time'; -import buildManualTimer from '../../tools/manualTimer.js'; - -import { setup } from './setupBasicMints.js'; -import { makeFakePriceAuthority } from '../../tools/fakePriceAuthority.js'; -import { eventLoopIteration } from '../../tools/eventLoopIteration.js'; import { getAmountOut, getTimestamp, getAmountIn, getPriceDescription, -} from '../../src/contractSupport/index.js'; +} from '@agoric/contracts'; +import buildManualTimer from '../../tools/manualTimer.js'; + +import { setup } from './setupBasicMints.js'; +import { makeFakePriceAuthority } from '../../tools/fakePriceAuthority.js'; +import { eventLoopIteration } from '../../tools/eventLoopIteration.js'; import { assertAmountsEqual } from '../zoeTestHelpers.js'; const makeTestPriceAuthority = (brands, priceList, timer) => diff --git a/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js b/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js index 53624318a6cc..4a1570ff0b95 100644 --- a/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js +++ b/packages/zoe/test/unitTests/zcf/test-zoeHelpersWZcf.js @@ -11,7 +11,7 @@ import { swapExact, assertNatAssetKind, saveAllIssuers, -} from '../../../src/contractSupport/index.js'; +} from '@agoric/contracts'; import { assertPayoutAmount } from '../../zoeTestHelpers.js'; import { setupZCFTest } from './setupZcfTest.js'; import { makeOffer } from '../makeOffer.js'; diff --git a/packages/zoe/tools/fakePriceAuthority.js b/packages/zoe/tools/fakePriceAuthority.js index 396ce9ff82cf..ced3ecf5eb6c 100644 --- a/packages/zoe/tools/fakePriceAuthority.js +++ b/packages/zoe/tools/fakePriceAuthority.js @@ -8,7 +8,7 @@ import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { TimeMath } from '@agoric/time'; -import { natSafeMath } from '../src/contractSupport/index.js'; +import { natSafeMath } from '@agoric/contracts'; import './types-ambient.js'; diff --git a/packages/zoe/tools/manualPriceAuthority.js b/packages/zoe/tools/manualPriceAuthority.js index a5f7c532850d..2e70549796ba 100644 --- a/packages/zoe/tools/manualPriceAuthority.js +++ b/packages/zoe/tools/manualPriceAuthority.js @@ -6,7 +6,7 @@ import { makeOnewayPriceAuthorityKit, floorMultiplyBy, floorDivideBy, -} from '../src/contractSupport/index.js'; +} from '@agoric/contracts'; /** * diff --git a/packages/zoe/tools/scriptedPriceAuthority.js b/packages/zoe/tools/scriptedPriceAuthority.js index f4e3413829e5..560440a48197 100644 --- a/packages/zoe/tools/scriptedPriceAuthority.js +++ b/packages/zoe/tools/scriptedPriceAuthority.js @@ -2,10 +2,7 @@ import { AmountMath, makeIssuerKit, AssetKind } from '@agoric/ertp'; import { E } from '@endo/eventual-send'; import { Far } from '@endo/marshal'; import { observeNotifier } from '@agoric/notifier'; -import { - natSafeMath, - makeOnewayPriceAuthorityKit, -} from '../src/contractSupport/index.js'; +import { natSafeMath, makeOnewayPriceAuthorityKit } from '@agoric/contracts'; export function makeScriptedPriceAuthority(options) { const { diff --git a/packages/zoe/tools/types-ambient.js b/packages/zoe/tools/types-ambient.js index 177aa3e8d035..4011469689e7 100644 --- a/packages/zoe/tools/types-ambient.js +++ b/packages/zoe/tools/types-ambient.js @@ -156,3 +156,12 @@ * @property {Amount<'nat'>} amountOut * The quoted result of trading `amountIn` */ + +/** + * @typedef {[ + * fromSeat?: ZCFSeat, + * toSeat?: ZCFSeat, + * fromAmounts?: AmountKeywordRecord, + * toAmounts?: AmountKeywordRecord + * ]} TransferPart + */