@agoric/zoe 0.26.3-upgrade-14-dev-c8f9e7b.0 → 0.26.3-upgrade-16-fi-dev-8879538.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/README.md +7 -7
  2. package/bundles/bundle-contractFacet-js-meta.json +622 -313
  3. package/bundles/bundle-contractFacet.d.ts +3 -3
  4. package/bundles/bundle-contractFacet.js +1 -1
  5. package/exported.js +1 -12
  6. package/package.json +75 -60
  7. package/src/cleanProposal.d.ts +2 -2
  8. package/src/cleanProposal.d.ts.map +1 -1
  9. package/src/cleanProposal.js +15 -12
  10. package/src/contractFacet/exit.d.ts.map +1 -1
  11. package/src/contractFacet/exit.js +1 -0
  12. package/src/contractFacet/internal-types.d.ts +2 -2
  13. package/src/contractFacet/internal-types.d.ts.map +1 -1
  14. package/src/contractFacet/internal-types.js +1 -1
  15. package/src/contractFacet/offerHandlerStorage.d.ts +4 -1
  16. package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -1
  17. package/src/contractFacet/offerHandlerStorage.js +11 -3
  18. package/src/contractFacet/reallocate.d.ts +3 -0
  19. package/src/contractFacet/reallocate.d.ts.map +1 -0
  20. package/src/contractFacet/reallocate.js +94 -0
  21. package/src/contractFacet/rightsConservation.d.ts.map +1 -1
  22. package/src/contractFacet/rightsConservation.js +3 -0
  23. package/src/contractFacet/types-ambient.d.ts +259 -0
  24. package/src/contractFacet/types-ambient.js +1 -0
  25. package/src/contractFacet/vatRoot.d.ts +4 -4
  26. package/src/contractFacet/vatRoot.d.ts.map +1 -1
  27. package/src/contractFacet/zcfMint.d.ts +5 -3
  28. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  29. package/src/contractFacet/zcfMint.js +4 -4
  30. package/src/contractFacet/zcfSeat.d.ts +4 -2
  31. package/src/contractFacet/zcfSeat.d.ts.map +1 -1
  32. package/src/contractFacet/zcfSeat.js +125 -5
  33. package/src/contractFacet/zcfZygote.d.ts +1 -2
  34. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  35. package/src/contractFacet/zcfZygote.js +95 -42
  36. package/src/contractSupport/atomicTransfer.d.ts +0 -6
  37. package/src/contractSupport/atomicTransfer.d.ts.map +1 -1
  38. package/src/contractSupport/atomicTransfer.js +5 -90
  39. package/src/contractSupport/bondingCurves.js +2 -2
  40. package/src/contractSupport/durability.d.ts +3 -3
  41. package/src/contractSupport/durability.d.ts.map +1 -1
  42. package/src/contractSupport/durability.js +5 -5
  43. package/src/contractSupport/index.d.ts +1 -0
  44. package/src/contractSupport/index.js +1 -0
  45. package/src/contractSupport/prepare-ownable.d.ts +11 -0
  46. package/src/contractSupport/prepare-ownable.d.ts.map +1 -0
  47. package/src/contractSupport/prepare-ownable.js +100 -0
  48. package/src/contractSupport/priceAuthority.d.ts +23 -15
  49. package/src/contractSupport/priceAuthority.d.ts.map +1 -1
  50. package/src/contractSupport/priceAuthority.js +32 -17
  51. package/src/contractSupport/priceAuthorityInitial.d.ts +3 -2
  52. package/src/contractSupport/priceAuthorityInitial.d.ts.map +1 -1
  53. package/src/contractSupport/priceAuthorityInitial.js +5 -2
  54. package/src/contractSupport/priceAuthorityQuoteMint.d.ts +2 -1
  55. package/src/contractSupport/priceAuthorityQuoteMint.d.ts.map +1 -1
  56. package/src/contractSupport/priceAuthorityQuoteMint.js +23 -27
  57. package/src/contractSupport/priceAuthorityTransform.d.ts +14 -12
  58. package/src/contractSupport/priceAuthorityTransform.d.ts.map +1 -1
  59. package/src/contractSupport/priceAuthorityTransform.js +10 -8
  60. package/src/contractSupport/priceQuote.d.ts +7 -5
  61. package/src/contractSupport/priceQuote.d.ts.map +1 -1
  62. package/src/contractSupport/priceQuote.js +5 -1
  63. package/src/contractSupport/ratio.d.ts +2 -2
  64. package/src/contractSupport/ratio.d.ts.map +1 -1
  65. package/src/contractSupport/ratio.js +19 -15
  66. package/src/contractSupport/recorder.d.ts +31 -117
  67. package/src/contractSupport/recorder.d.ts.map +1 -1
  68. package/src/contractSupport/recorder.js +21 -10
  69. package/src/contractSupport/safeMath.d.ts +7 -7
  70. package/src/contractSupport/safeMath.d.ts.map +1 -1
  71. package/src/contractSupport/statistics.d.ts +1 -1
  72. package/src/contractSupport/statistics.d.ts.map +1 -1
  73. package/src/contractSupport/topics.d.ts +1 -1
  74. package/src/contractSupport/topics.d.ts.map +1 -1
  75. package/src/contractSupport/{types.d.ts → types-ambient.d.ts} +4 -4
  76. package/src/contractSupport/types-ambient.d.ts.map +1 -0
  77. package/src/contractSupport/{types.js → types-ambient.js} +1 -1
  78. package/src/contractSupport/zoeHelpers.d.ts +1 -1
  79. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  80. package/src/contractSupport/zoeHelpers.js +5 -11
  81. package/src/contracts/auction/firstPriceLogic.d.ts.map +1 -1
  82. package/src/contracts/auction/firstPriceLogic.js +5 -8
  83. package/src/contracts/auction/index.d.ts +10 -10
  84. package/src/contracts/auction/index.d.ts.map +1 -1
  85. package/src/contracts/auction/index.js +2 -1
  86. package/src/contracts/auction/secondPriceLogic.d.ts.map +1 -1
  87. package/src/contracts/auction/secondPriceLogic.js +1 -4
  88. package/src/contracts/automaticRefund.d.ts +1 -1
  89. package/src/contracts/automaticRefund.d.ts.map +1 -1
  90. package/src/contracts/autoswap.d.ts.map +1 -1
  91. package/src/contracts/autoswap.js +8 -9
  92. package/src/contracts/barterExchange.d.ts +1 -1
  93. package/src/contracts/barterExchange.d.ts.map +1 -1
  94. package/src/contracts/barterExchange.js +2 -3
  95. package/src/contracts/callSpread/calculateShares.d.ts +1 -8
  96. package/src/contracts/callSpread/calculateShares.d.ts.map +1 -1
  97. package/src/contracts/callSpread/calculateShares.js +1 -1
  98. package/src/contracts/callSpread/fundedCallSpread.d.ts +4 -0
  99. package/src/contracts/callSpread/fundedCallSpread.d.ts.map +1 -1
  100. package/src/contracts/callSpread/fundedCallSpread.js +6 -4
  101. package/src/contracts/callSpread/payoffHandler.d.ts.map +1 -1
  102. package/src/contracts/callSpread/payoffHandler.js +2 -1
  103. package/src/contracts/callSpread/percent.d.ts +2 -4
  104. package/src/contracts/callSpread/percent.d.ts.map +1 -1
  105. package/src/contracts/callSpread/position.d.ts +2 -2
  106. package/src/contracts/callSpread/pricedCallSpread.d.ts +6 -5
  107. package/src/contracts/callSpread/pricedCallSpread.d.ts.map +1 -1
  108. package/src/contracts/callSpread/pricedCallSpread.js +8 -4
  109. package/src/contracts/callSpread/{types.d.ts → types-ambient.d.ts} +3 -3
  110. package/src/contracts/callSpread/types-ambient.d.ts.map +1 -0
  111. package/src/contracts/coveredCall-durable.d.ts +2 -4
  112. package/src/contracts/coveredCall-durable.d.ts.map +1 -1
  113. package/src/contracts/exported.js +3 -3
  114. package/src/contracts/loan/borrow.d.ts.map +1 -1
  115. package/src/contracts/loan/borrow.js +7 -4
  116. package/src/contracts/loan/close.d.ts.map +1 -1
  117. package/src/contracts/loan/close.js +3 -7
  118. package/src/contracts/loan/index.d.ts +5 -1
  119. package/src/contracts/loan/index.d.ts.map +1 -1
  120. package/src/contracts/loan/index.js +4 -0
  121. package/src/contracts/loan/liquidate.d.ts +1 -12
  122. package/src/contracts/loan/liquidate.d.ts.map +1 -1
  123. package/src/contracts/loan/liquidate.js +4 -2
  124. package/src/contracts/loan/scheduleLiquidation.d.ts.map +1 -1
  125. package/src/contracts/loan/scheduleLiquidation.js +1 -0
  126. package/src/contracts/loan/{types.d.ts → types-ambient.d.ts} +16 -17
  127. package/src/contracts/loan/types-ambient.d.ts.map +1 -0
  128. package/src/contracts/loan/{types.js → types-ambient.js} +11 -18
  129. package/src/contracts/loan/updateDebt.js +1 -1
  130. package/src/contracts/mintAndSellNFT.d.ts.map +1 -1
  131. package/src/contracts/mintPayments.d.ts +14 -6
  132. package/src/contracts/mintPayments.d.ts.map +1 -1
  133. package/src/contracts/mintPayments.js +1 -1
  134. package/src/contracts/oracle.d.ts +25 -3
  135. package/src/contracts/oracle.d.ts.map +1 -1
  136. package/src/contracts/oracle.js +7 -0
  137. package/src/contracts/otcDesk.d.ts +3 -3
  138. package/src/contracts/otcDesk.d.ts.map +1 -1
  139. package/src/contracts/otcDesk.js +1 -1
  140. package/src/contracts/priceAggregator.d.ts +112 -18
  141. package/src/contracts/priceAggregator.d.ts.map +1 -1
  142. package/src/contracts/priceAggregator.js +16 -18
  143. package/src/contracts/priceAggregatorTypes.d.ts +2 -2
  144. package/src/contracts/priceAggregatorTypes.d.ts.map +1 -1
  145. package/src/contracts/scaledPriceAuthority.d.ts +4 -5
  146. package/src/contracts/scaledPriceAuthority.d.ts.map +1 -1
  147. package/src/contracts/scaledPriceAuthority.js +6 -0
  148. package/src/contracts/sellItems.d.ts +2 -2
  149. package/src/contracts/sellItems.d.ts.map +1 -1
  150. package/src/contracts/sellItems.js +2 -3
  151. package/src/contracts/simpleExchange.d.ts +3 -3
  152. package/src/contracts/{types.d.ts → types-ambient.d.ts} +1 -1
  153. package/src/contracts/types-ambient.d.ts.map +1 -0
  154. package/src/handleWarning.d.ts.map +1 -1
  155. package/src/instanceRecordStorage.d.ts +1 -1
  156. package/src/instanceRecordStorage.d.ts.map +1 -1
  157. package/src/internal-types.d.ts +20 -32
  158. package/src/internal-types.d.ts.map +1 -1
  159. package/src/internal-types.js +18 -58
  160. package/src/issuerRecord.d.ts +2 -2
  161. package/src/issuerRecord.d.ts.map +1 -1
  162. package/src/issuerStorage.d.ts +4 -4
  163. package/src/issuerStorage.d.ts.map +1 -1
  164. package/src/issuerStorage.js +12 -28
  165. package/src/makeHandle.d.ts +2 -2
  166. package/src/makeHandle.d.ts.map +1 -1
  167. package/src/makeHandle.js +1 -1
  168. package/src/typeGuards.d.ts +119 -20
  169. package/src/typeGuards.d.ts.map +1 -1
  170. package/src/typeGuards.js +18 -9
  171. package/src/types-ambient.d.ts +41 -0
  172. package/src/types-ambient.d.ts.map +1 -0
  173. package/src/{types.js → types-ambient.js} +6 -14
  174. package/src/zoeService/escrowStorage.d.ts +1 -1
  175. package/src/zoeService/escrowStorage.d.ts.map +1 -1
  176. package/src/zoeService/escrowStorage.js +20 -27
  177. package/src/zoeService/feeMint.d.ts +9 -16
  178. package/src/zoeService/feeMint.d.ts.map +1 -1
  179. package/src/zoeService/feeMint.js +21 -15
  180. package/src/zoeService/installationStorage.d.ts +5 -20
  181. package/src/zoeService/installationStorage.d.ts.map +1 -1
  182. package/src/zoeService/installationStorage.js +11 -7
  183. package/src/zoeService/instanceAdminStorage.d.ts +22 -42
  184. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
  185. package/src/zoeService/instanceAdminStorage.js +1 -0
  186. package/src/zoeService/internal-types.d.ts +16 -16
  187. package/src/zoeService/internal-types.d.ts.map +1 -1
  188. package/src/zoeService/internal-types.js +6 -6
  189. package/src/zoeService/invitationQueries.d.ts.map +1 -1
  190. package/src/zoeService/invitationQueries.js +7 -5
  191. package/src/zoeService/makeInvitation.d.ts +3 -3
  192. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  193. package/src/zoeService/makeInvitation.js +25 -21
  194. package/src/zoeService/offer/burnInvitation.d.ts.map +1 -1
  195. package/src/zoeService/offer/offer.d.ts.map +1 -1
  196. package/src/zoeService/offer/offer.js +2 -5
  197. package/src/zoeService/originalZoeSeat.d.ts +34 -0
  198. package/src/zoeService/originalZoeSeat.d.ts.map +1 -0
  199. package/src/zoeService/originalZoeSeat.js +353 -0
  200. package/src/zoeService/startInstance.d.ts +3 -3
  201. package/src/zoeService/startInstance.d.ts.map +1 -1
  202. package/src/zoeService/startInstance.js +17 -11
  203. package/src/zoeService/{types.d.ts → types-ambient.d.ts} +26 -31
  204. package/src/zoeService/types-ambient.d.ts.map +1 -0
  205. package/src/zoeService/{types.js → types-ambient.js} +19 -32
  206. package/src/zoeService/utils.d.ts +54 -58
  207. package/src/zoeService/utils.test-d.d.ts +2 -0
  208. package/src/zoeService/utils.test-d.d.ts.map +1 -0
  209. package/src/zoeService/utils.test-d.ts +33 -0
  210. package/src/zoeService/zoe.d.ts +9 -13
  211. package/src/zoeService/zoe.d.ts.map +1 -1
  212. package/src/zoeService/zoe.js +7 -7
  213. package/src/zoeService/zoeSeat.d.ts +15 -45
  214. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  215. package/src/zoeService/zoeSeat.js +214 -114
  216. package/src/zoeService/zoeStorageManager.d.ts +9 -43
  217. package/src/zoeService/zoeStorageManager.d.ts.map +1 -1
  218. package/src/zoeService/zoeStorageManager.js +8 -6
  219. package/tools/fakePriceAuthority.d.ts +9 -8
  220. package/tools/fakePriceAuthority.d.ts.map +1 -1
  221. package/tools/fakePriceAuthority.js +21 -17
  222. package/tools/fakeVatAdmin.d.ts +10 -10
  223. package/tools/manualPriceAuthority.d.ts +11 -6
  224. package/tools/manualPriceAuthority.d.ts.map +1 -1
  225. package/tools/manualPriceAuthority.js +15 -2
  226. package/tools/manualTimer.d.ts +21 -40
  227. package/tools/manualTimer.d.ts.map +1 -1
  228. package/tools/manualTimer.js +30 -16
  229. package/tools/prepare-test-env.js +1 -1
  230. package/tools/scriptedOracle.d.ts +3 -3
  231. package/tools/scriptedOracle.d.ts.map +1 -1
  232. package/tools/scriptedOracle.js +1 -1
  233. package/tools/scriptedPriceAuthority.d.ts +4 -0
  234. package/tools/scriptedPriceAuthority.d.ts.map +1 -1
  235. package/tools/scriptedPriceAuthority.js +6 -1
  236. package/tools/setup-zoe.d.ts +8 -9
  237. package/tools/setup-zoe.d.ts.map +1 -1
  238. package/tools/setup-zoe.js +16 -1
  239. package/tools/test-utils.d.ts +20 -0
  240. package/tools/test-utils.d.ts.map +1 -0
  241. package/tools/test-utils.js +26 -0
  242. package/tools/types.d.ts +21 -21
  243. package/tools/types.d.ts.map +1 -1
  244. package/tools/types.js +10 -10
  245. package/CHANGELOG.md +0 -1203
  246. package/src/contractFacet/types.d.ts +0 -191
  247. package/src/contractFacet/types.d.ts.map +0 -1
  248. package/src/contractFacet/types.js +0 -256
  249. package/src/contractSupport/types.d.ts.map +0 -1
  250. package/src/contracts/callSpread/types.d.ts.map +0 -1
  251. package/src/contracts/loan/types.d.ts.map +0 -1
  252. package/src/contracts/types.d.ts.map +0 -1
  253. package/src/objArrayConversion.d.ts +0 -5
  254. package/src/objArrayConversion.d.ts.map +0 -1
  255. package/src/objArrayConversion.js +0 -35
  256. package/src/types.d.ts +0 -45
  257. package/src/types.d.ts.map +0 -1
  258. package/src/zoeService/types.d.ts.map +0 -1
  259. package/tools/internal-types.d.ts +0 -12
  260. package/tools/internal-types.d.ts.map +0 -1
  261. package/tools/internal-types.js +0 -14
  262. package/tools/priceAuthorityRegistry.d.ts +0 -20
  263. package/tools/priceAuthorityRegistry.d.ts.map +0 -1
  264. package/tools/priceAuthorityRegistry.js +0 -209
  265. package/tools/types-ambient.d.ts +0 -142
  266. package/tools/types-ambient.d.ts.map +0 -1
  267. package/tools/types-ambient.js +0 -160
  268. /package/src/contracts/callSpread/{types.js → types-ambient.js} +0 -0
  269. /package/src/contracts/{types.js → types-ambient.js} +0 -0
@@ -1,36 +1,36 @@
1
- import { E } from '@endo/eventual-send';
2
- import { passStyleOf, Remotable } from '@endo/marshal';
1
+ /* eslint @typescript-eslint/no-floating-promises: "warn" */
3
2
  import { AssetKind } from '@agoric/ertp';
4
- import { makePromiseKit } from '@endo/promise-kit';
5
3
  import { assertPattern, mustMatch } from '@agoric/store';
6
4
  import {
7
5
  canBeDurable,
8
6
  M,
9
7
  makeScalarBigMapStore,
10
- provideDurableMapStore,
11
8
  prepareExo,
12
9
  prepareExoClass,
10
+ provideDurableMapStore,
13
11
  } from '@agoric/vat-data';
12
+ import { E } from '@endo/eventual-send';
13
+ import { passStyleOf, Remotable } from '@endo/marshal';
14
+ import { makePromiseKit } from '@endo/promise-kit';
14
15
 
15
16
  import { objectMap } from '@agoric/internal';
16
17
  import { cleanProposal } from '../cleanProposal.js';
18
+ import { handlePKitWarning } from '../handleWarning.js';
19
+ import { makeInstanceRecordStorage } from '../instanceRecordStorage.js';
20
+ import { provideIssuerStorage } from '../issuerStorage.js';
21
+ import { defineDurableHandle } from '../makeHandle.js';
17
22
  import { evalContractBundle } from './evalContractCode.js';
18
23
  import { makeMakeExiter } from './exit.js';
19
- import { defineDurableHandle } from '../makeHandle.js';
20
- import { provideIssuerStorage } from '../issuerStorage.js';
21
- import { createSeatManager } from './zcfSeat.js';
22
- import { makeInstanceRecordStorage } from '../instanceRecordStorage.js';
23
- import { handlePKitWarning } from '../handleWarning.js';
24
24
  import { makeOfferHandlerStorage } from './offerHandlerStorage.js';
25
+ import { createSeatManager } from './zcfSeat.js';
25
26
 
26
- import '../internal-types.js';
27
- import './internal-types.js';
28
-
29
- import '@agoric/swingset-vat/src/types-ambient.js';
30
27
  import { HandleOfferI, InvitationHandleShape } from '../typeGuards.js';
31
28
  import { prepareZcMint } from './zcfMint.js';
32
29
 
33
- /** @typedef {import('@agoric/ertp').IssuerOptionsRecord} IssuerOptionsRecord */
30
+ /// <reference path="../internal-types.js" />
31
+ /// <reference path="./internal-types.js" />
32
+
33
+ /** @import {IssuerOptionsRecord} from '@agoric/ertp' */
34
34
 
35
35
  const { Fail } = assert;
36
36
 
@@ -76,7 +76,7 @@ export const makeZCFZygote = async (
76
76
  instantiate: instantiateIssuerStorage,
77
77
  } = provideIssuerStorage(zcfBaggage);
78
78
 
79
- /** @type {ShutdownWithFailure} */
79
+ /** @type {import('@agoric/swingset-vat').ShutdownWithFailure} */
80
80
  const shutdownWithFailure = reason => {
81
81
  E(zoeInstanceAdmin).failAllSeats(reason);
82
82
  seatManager.dropAllReferences();
@@ -210,6 +210,25 @@ export const makeZCFZygote = async (
210
210
  });
211
211
  const handleOfferObj = makeHandleOfferObj(taker);
212
212
 
213
+ /**
214
+ * @type {() => Promise<
215
+ * | {
216
+ * buildRootObject: any;
217
+ * start: undefined;
218
+ * meta: undefined;
219
+ * }
220
+ * | {
221
+ * prepare: ContractStartFn;
222
+ * customTermsShape?: Pick<ContractMeta, 'customTermsShape'>,
223
+ * privateArgsShape?: Pick<ContractMeta, 'privateArgsShape'>,
224
+ * }
225
+ * | {
226
+ * buildRootObject: undefined;
227
+ * start: ContractStartFn;
228
+ * meta?: ContractMeta;
229
+ * }
230
+ * >}
231
+ */
213
232
  const evaluateContract = () => {
214
233
  let bundle;
215
234
  if (passStyleOf(contractBundleCap) === 'remotable') {
@@ -222,22 +241,44 @@ export const makeZCFZygote = async (
222
241
  return evalContractBundle(bundle);
223
242
  };
224
243
  // evaluate the contract (either the first version, or an upgrade)
225
- const {
226
- start,
227
- buildRootObject,
228
- privateArgsShape,
229
- customTermsShape,
230
- prepare,
231
- } = await evaluateContract();
232
-
233
- if (start === undefined && prepare === undefined) {
234
- buildRootObject === undefined ||
235
- Fail`Did you provide a vat bundle instead of a contract bundle?`;
236
- Fail`contract exports missing start/prepare`;
244
+ const bundleResult = await evaluateContract();
245
+
246
+ //#region backwards compatibility with prepare()
247
+ const { start, meta = {} } = (() => {
248
+ if ('prepare' in bundleResult) {
249
+ if ('start' in bundleResult) {
250
+ Fail`contract must provide exactly one of "start" and "prepare"`;
251
+ }
252
+ // A contract must have one expression of upgradability
253
+ if (/** @type {any} */ (bundleResult).meta?.upgradability) {
254
+ Fail`prepare() is deprecated and incompatible with the 'upgradability' indicator`;
255
+ }
256
+ return {
257
+ start: bundleResult.prepare,
258
+ meta: {
259
+ upgradability: 'canUpgrade',
260
+ customTermsShape: bundleResult.customTermsShape,
261
+ privateArgsShape: bundleResult.privateArgsShape,
262
+ },
263
+ };
264
+ }
265
+ // normal behavior
266
+ return bundleResult;
267
+ })();
268
+ //#endregion
269
+
270
+ if (start === undefined) {
271
+ if ('buildRootObject' in bundleResult) {
272
+ // diagnose a common mistake
273
+ throw Fail`Did you provide a vat bundle instead of a contract bundle?`;
274
+ }
275
+ throw Fail`contract exports missing start`;
237
276
  }
238
- !start ||
239
- !prepare ||
240
- Fail`contract must provide exactly one of "start" and "prepare"`;
277
+
278
+ start.length <= 3 || Fail`invalid start parameters`;
279
+ const durabilityRequired =
280
+ meta.upgradability &&
281
+ ['canBeUpgraded', 'canUpgrade'].includes(meta.upgradability);
241
282
 
242
283
  /** @type {ZCF} */
243
284
  // Using Remotable rather than Far because there are too many complications
@@ -245,6 +286,7 @@ export const makeZCFZygote = async (
245
286
  // accept raw functions. assert cannot be a valid passable! (It's a function
246
287
  // and has members.)
247
288
  const zcf = Remotable('Alleged: zcf', undefined, {
289
+ atomicRearrange: transfers => seatManager.atomicRearrange(transfers),
248
290
  reallocate: (...seats) => seatManager.reallocate(...seats),
249
291
  assertUniqueKeyword: kwd => getInstanceRecHolder().assertUniqueKeyword(kwd),
250
292
  saveIssuer: async (issuerP, keyword) => {
@@ -279,7 +321,8 @@ export const makeZCFZygote = async (
279
321
  customDetails,
280
322
  proposalShape,
281
323
  );
282
- return invitationP;
324
+ // rely on the ZCF type signature
325
+ return /** @type {any} */ (invitationP);
283
326
  },
284
327
  // Shutdown the entire vat and give payouts
285
328
  shutdown: completion => {
@@ -300,6 +343,7 @@ export const makeZCFZygote = async (
300
343
  const terms = getInstanceRecHolder().getTerms();
301
344
 
302
345
  // If the contract provided customTermsShape, validate the customTerms.
346
+ const { customTermsShape } = meta;
303
347
  if (customTermsShape) {
304
348
  const { brands: _b, issuers: _i, ...customTerms } = terms;
305
349
  mustMatch(harden(customTerms), customTermsShape, 'customTerms');
@@ -373,13 +417,13 @@ export const makeZCFZygote = async (
373
417
  zcfBaggage.init('instanceRecHolder', instanceRecHolder);
374
418
  zcfBaggage.init('repairedContractCompletionWatcher', true);
375
419
 
376
- const startFn = start || prepare;
420
+ const { privateArgsShape } = meta;
377
421
  if (privateArgsShape) {
378
422
  mustMatch(privateArgs, privateArgsShape, 'privateArgs');
379
423
  }
380
424
  // start a contract for the first time
381
425
  return E.when(
382
- startFn(zcf, privateArgs, contractBaggage),
426
+ start(zcf, privateArgs, contractBaggage),
383
427
  ({
384
428
  creatorFacet = undefined,
385
429
  publicFacet = undefined,
@@ -388,18 +432,16 @@ export const makeZCFZygote = async (
388
432
  }) => {
389
433
  const unexpectedKeys = Object.keys(unexpected);
390
434
  unexpectedKeys.length === 0 ||
391
- Fail`contract ${
392
- prepare ? 'prepare' : 'start'
393
- } returned unrecognized properties ${unexpectedKeys}`;
435
+ Fail`contract "start" returned unrecognized properties ${unexpectedKeys}`;
394
436
 
395
437
  const areDurable = objectMap(
396
438
  { creatorFacet, publicFacet, creatorInvitation },
397
439
  canBeDurable,
398
440
  );
399
441
  const allDurable = Object.values(areDurable).every(Boolean);
400
- if (prepare) {
442
+ if (durabilityRequired) {
401
443
  allDurable ||
402
- Fail`values from prepare() must be durable ${areDurable}`;
444
+ Fail`with ${meta.upgradability}, values from start() must be durable ${areDurable}`;
403
445
  }
404
446
 
405
447
  if (allDurable) {
@@ -419,21 +461,32 @@ export const makeZCFZygote = async (
419
461
  },
420
462
 
421
463
  restartContract: async (privateArgs = undefined) => {
422
- prepare || Fail`prepare must be defined to upgrade a contract`;
464
+ if (meta.upgradability) {
465
+ meta.upgradability === 'canUpgrade' || Fail`contract cannot upgrade`;
466
+ }
423
467
  zoeInstanceAdmin = zcfBaggage.get('zcfInstanceAdmin');
424
468
  instanceRecHolder = zcfBaggage.get('instanceRecHolder');
425
469
  initSeatMgrAndMintKind();
426
470
 
427
471
  await null;
428
472
  if (!zcfBaggage.has('repairedContractCompletionWatcher')) {
429
- await E(zoeInstanceAdmin).repairContractCompletionWatcher();
430
- console.log(`Repaired contract completion watcher`);
473
+ // We don't wait because it's a cross-vat call (to Zoe) that can't be
474
+ // completed during this vat's start-up
475
+ E(zoeInstanceAdmin)
476
+ .repairContractCompletionWatcher()
477
+ .catch(() => {});
478
+
431
479
  zcfBaggage.init('repairedContractCompletionWatcher', true);
432
480
  }
433
481
 
482
+ const { privateArgsShape } = meta;
483
+ if (privateArgsShape) {
484
+ mustMatch(privateArgs, privateArgsShape, 'privateArgs');
485
+ }
486
+
434
487
  // restart an upgradeable contract
435
488
  return E.when(
436
- prepare(zcf, privateArgs, contractBaggage),
489
+ start(zcf, privateArgs, contractBaggage),
437
490
  ({
438
491
  creatorFacet = undefined,
439
492
  publicFacet = undefined,
@@ -3,10 +3,4 @@ export function atomicRearrange(zcf: ZCF, transfers: TransferPart[]): void;
3
3
  export function fromOnly(fromSeat: ZCFSeat, fromAmounts: AmountKeywordRecord): TransferPart;
4
4
  export function toOnly(toSeat: ZCFSeat, toAmounts: AmountKeywordRecord): TransferPart;
5
5
  export function atomicTransfer(zcf: ZCF, fromSeat?: ZCFSeat | undefined, toSeat?: ZCFSeat | undefined, fromAmounts?: AmountKeywordRecord | undefined, toAmounts?: AmountKeywordRecord | undefined): void;
6
- export type TransferPart = [
7
- fromSeat?: ZCFSeat,
8
- toSeat?: ZCFSeat,
9
- fromAmounts?: AmountKeywordRecord,
10
- toAmounts?: AmountKeywordRecord
11
- ];
12
6
  //# sourceMappingURL=atomicTransfer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"atomicTransfer.d.ts","sourceRoot":"","sources":["atomicTransfer.js"],"names":[],"mappings":"AAMA,iEAGE;AAgDK,qCAHI,GAAG,aACH,cAAc,QA+ExB;AAcM,mCAJI,OAAO,eACP,mBAAmB,gBAIc;AAcrC,+BAJI,OAAO,aACP,mBAAmB,gBAIqB;AAW5C,oCANI,GAAG,kKAYiE;2BAzKlE;IACZ,QAAY,CAAC,EAAE,OAAO;IACtB,MAAU,CAAC,EAAE,OAAO;IACpB,WAAe,CAAC,EAAE,mBAAmB;IACrC,SAAa,CAAC,EAAE,mBAAmB;CAChC"}
1
+ {"version":3,"file":"atomicTransfer.d.ts","sourceRoot":"","sources":["atomicTransfer.js"],"names":[],"mappings":"AAGA,iEAGE;AAyCK,qCAHI,GAAG,aACH,YAAY,EAAE,QAIxB;AAcM,mCAJI,OAAO,eACP,mBAAmB,GACjB,YAAY,CAGmB;AAcrC,+BAJI,OAAO,aACP,mBAAmB,GACjB,YAAY,CAG0B;AAW5C,oCANI,GAAG,kKAYgE"}
@@ -1,23 +1,11 @@
1
- import { mustMatch, M } from '@agoric/store';
2
- import { assertRightsConserved } from '../contractFacet/rightsConservation.js';
1
+ import { M } from '@agoric/store';
3
2
  import { AmountKeywordRecordShape, SeatShape } from '../typeGuards.js';
4
3
 
5
- const { Fail, quote: q } = assert;
6
-
7
4
  export const TransferPartShape = M.splitArray(
8
5
  harden([M.opt(SeatShape), M.opt(SeatShape), M.opt(AmountKeywordRecordShape)]),
9
6
  harden([M.opt(AmountKeywordRecordShape)]),
10
7
  );
11
8
 
12
- /**
13
- * @typedef {[
14
- * fromSeat?: ZCFSeat,
15
- * toSeat?: ZCFSeat,
16
- * fromAmounts?: AmountKeywordRecord,
17
- * toAmounts?: AmountKeywordRecord
18
- * ]} TransferPart
19
- */
20
-
21
9
  /**
22
10
  * Asks Zoe (via zcf) to rearrange the allocations among the seats
23
11
  * mentioned. This is a set of changes to allocations that must satisfy
@@ -52,86 +40,13 @@ export const TransferPartShape = M.splitArray(
52
40
  * which will remain helpers. These helper are for convenience
53
41
  * in expressing atomic rearrangements clearly.
54
42
  *
43
+ * @deprecated use the zcf builtin instead
44
+ *
55
45
  * @param {ZCF} zcf
56
46
  * @param {TransferPart[]} transfers
57
47
  */
58
48
  export const atomicRearrange = (zcf, transfers) => {
59
- mustMatch(transfers, M.arrayOf(M.array()), 'transfers');
60
- const uniqueSeatSet = new Set();
61
- for (const [
62
- fromSeat = undefined,
63
- toSeat = undefined,
64
- fromAmounts = undefined,
65
- toAmounts = undefined,
66
- ] of transfers) {
67
- if (fromSeat) {
68
- if (!fromAmounts) {
69
- throw Fail`Transfer from ${fromSeat} must say how much`;
70
- }
71
- uniqueSeatSet.add(fromSeat);
72
- if (toSeat) {
73
- // Conserved transfer between seats
74
- if (toAmounts) {
75
- // distinct amounts, so we check conservation.
76
- assertRightsConserved(
77
- Object.values(fromAmounts),
78
- Object.values(toAmounts),
79
- );
80
- } // else fromAmounts will be used as toAmounts
81
- uniqueSeatSet.add(toSeat);
82
- } else {
83
- // Transfer only from fromSeat
84
- !toAmounts ||
85
- Fail`Transfer without toSeat cannot have toAmounts ${toAmounts}`;
86
- }
87
- } else {
88
- toSeat || Fail`Transfer must have at least one of fromSeat or toSeat`;
89
- // Transfer only to toSeat
90
- !fromAmounts ||
91
- Fail`Transfer without fromSeat cannot have fromAmounts ${fromAmounts}`;
92
- toAmounts || Fail`Transfer to ${toSeat} must say how much`;
93
- uniqueSeatSet.add(toSeat);
94
- }
95
- }
96
-
97
- const uniqueSeats = harden([...uniqueSeatSet.keys()]);
98
- for (const seat of uniqueSeats) {
99
- !seat.hasStagedAllocation() ||
100
- Fail`Cannot mix atomicRearrange with seat stagings: ${seat}`;
101
- }
102
-
103
- // At this point the basic shape has been validated
104
-
105
- try {
106
- for (const [
107
- fromSeat = undefined,
108
- toSeat = undefined,
109
- fromAmounts = undefined,
110
- toAmounts = toSeat && fromAmounts,
111
- ] of transfers) {
112
- if (fromSeat && fromAmounts) {
113
- // testing both just to satisfy the type checker
114
- fromSeat.decrementBy(fromAmounts);
115
- }
116
- if (toSeat && toAmounts) {
117
- // testing both just to satisfy the type checker
118
- toSeat.incrementBy(toAmounts);
119
- }
120
- }
121
-
122
- // Perhaps deprecate this >= 2 restriction?
123
- uniqueSeats.length >= 2 ||
124
- Fail`Can only commit a reallocation among at least 2 seats: ${q(
125
- uniqueSeats.length,
126
- )}`;
127
- // Take it apart and put it back together to satisfy the type checker
128
- const [seat0, seat1, ...restSeats] = uniqueSeats;
129
- zcf.reallocate(seat0, seat1, ...restSeats);
130
- } finally {
131
- for (const seat of uniqueSeats) {
132
- seat.clear();
133
- }
134
- }
49
+ zcf.atomicRearrange(transfers);
135
50
  };
136
51
 
137
52
  /**
@@ -179,4 +94,4 @@ export const atomicTransfer = (
179
94
  toSeat = undefined,
180
95
  fromAmounts = undefined,
181
96
  toAmounts = undefined,
182
- ) => atomicRearrange(zcf, harden([[fromSeat, toSeat, fromAmounts, toAmounts]]));
97
+ ) => zcf.atomicRearrange(harden([[fromSeat, toSeat, fromAmounts, toAmounts]]));
@@ -27,7 +27,7 @@ const BASIS_POINTS = 10000n; // TODO change to 10_000n once tooling copes.
27
27
  * pool of the kind of asset sent in
28
28
  * @param {any} outputReserve - the value in the liquidity
29
29
  * pool of the kind of asset to be sent out
30
- * @param {bigint} [feeBasisPoints=30n] - the fee taken in
30
+ * @param {bigint} [feeBasisPoints] - the fee taken in
31
31
  * basis points. The default is 0.3% or 30 basis points. The fee
32
32
  * is taken from inputValue
33
33
  * @returns {NatValue} outputValue - the current price, in value form
@@ -66,7 +66,7 @@ export const getInputPrice = (
66
66
  * pool of the asset being spent
67
67
  * @param {any} outputReserve - the value in the liquidity
68
68
  * pool of the kind of asset to be sent out
69
- * @param {bigint} [feeBasisPoints=30n] - the fee taken in
69
+ * @param {bigint} [feeBasisPoints] - the fee taken in
70
70
  * basis points. The default is 0.3% or 30 basis points. The fee is taken from
71
71
  * outputValue
72
72
  * @returns {NatValue} inputValue - the value of input required to purchase output
@@ -1,5 +1,5 @@
1
- export function makeEphemeraProvider<E extends {}, K extends {} = any>(init: (key: K) => E): (key: K) => E;
2
- export function provideEmptySeat(zcf: ZCF, baggage: MapStore<string, unknown>, name: string): ZCFSeat;
1
+ export function makeEphemeraProvider<E extends {}, K extends WeakKey>(init: (key: K) => E): (key: K) => E;
2
+ export function provideEmptySeat(zcf: ZCF, baggage: import("@agoric/swingset-liveslots").Baggage, name: string): ZCFSeat;
3
3
  export function provideAll<T extends Record<string, () => ERef<any>>>(baggage: MapStore<string, any>, thunks: T): Promise<{ [K in keyof T]: Awaited<ReturnType<T[K]>>; }>;
4
- export function provideSingleton<T extends () => ERef<any>>(mapStore: MapStore<string, unknown>, key: string, makeValue: T, withValue?: ((value: Awaited<ReturnType<T>>) => void) | undefined): Promise<Awaited<ReturnType<T>>>;
4
+ export function provideSingleton<T extends () => ERef<any>>(mapStore: import("@agoric/vat-data").Baggage, key: string, makeValue: T, withValue?: ((value: Awaited<ReturnType<T>>) => void) | undefined): Promise<Awaited<ReturnType<T>>>;
5
5
  //# sourceMappingURL=durability.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["durability.js"],"names":[],"mappings":"AAaO,2GAkBN;AAWM,sCALI,GAAG,4CAEH,MAAM,GACJ,OAAO,CAInB;AAiCM,0DAL4B,KAAK,GAAG,CAAC,YACjC,SAAS,MAAM,EAAE,GAAG,CAAC,sEAyB/B;AAgBM,iDAPa,KAAK,GAAG,CAAC,4CAElB,MAAM,gEAE6B,IAAI,gDAejD"}
1
+ {"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["durability.js"],"names":[],"mappings":"AAaO,qCAOiB,CAAC,aATR,CAAC,wBAAP,CAAC,GAAG,EAAE,CAAC,KASM,CAAC,AATD,eASA,CAAC,CAWxB;AAWM,sCALI,GAAG,WACH,OAAO,4BAA4B,EAAE,OAAO,QAC5C,MAAM,GACJ,OAAO,CAInB;AAiCM,2BAFmD,CAAC,8BAHxB,IAAI,CAAC,GAAG,CAAC,YACjC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,UAE0B,CAAC,AAD/C,GACC,OAAO,CAAC,GAAG,CAAC,IAAI,MAA6B,CAAC,AAAvB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,CAAC,CAuBlE;AAgBM,iCAFiC,CAAC,eALrB,IAAI,CAAC,GAAG,CAAC,YAClB,OAAO,kBAAkB,EAAE,OAAO,OAClC,MAAM,aAGuB,CAAC,AAF7B,uBACO,OAAO,CAAC,UAAU,CACG,CAAC,AADF,CAAC,CAAC,KAAK,IAAI,gBACrC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAc3C"}
@@ -8,7 +8,7 @@ import { E } from '@endo/eventual-send';
8
8
  * representative also remains.
9
9
  *
10
10
  * @template {{}} E Ephemeral state
11
- * @template {{}} [K=any] key on which to provision
11
+ * @template {WeakKey} K key on which to provision
12
12
  * @param {(key: K) => E} init
13
13
  */
14
14
  export const makeEphemeraProvider = init => {
@@ -36,7 +36,7 @@ harden(makeEphemeraProvider);
36
36
  * Provide an empty ZCF seat.
37
37
  *
38
38
  * @param {ZCF} zcf
39
- * @param {import('@agoric/ertp').Baggage} baggage
39
+ * @param {import('@agoric/swingset-liveslots').Baggage} baggage
40
40
  * @param {string} name
41
41
  * @returns {ZCFSeat}
42
42
  */
@@ -113,9 +113,9 @@ harden(provideAll);
113
113
  * @returns {Promise<Awaited<ReturnType<T>>>}
114
114
  */
115
115
  export const provideSingleton = (mapStore, key, makeValue, withValue) => {
116
- const stored =
117
- mapStore.has(key) ||
118
- E.when(makeValue(), v => mapStore.init(key, harden(v)));
116
+ const stored = mapStore.has(key)
117
+ ? undefined
118
+ : E.when(makeValue(), v => mapStore.init(key, harden(v)));
119
119
 
120
120
  return E.when(stored, () => {
121
121
  const value = mapStore.get(key);
@@ -1,6 +1,7 @@
1
1
  export { natSafeMath } from "./safeMath.js";
2
2
  export { makeStateMachine } from "./stateMachine.js";
3
3
  export * from "./durability.js";
4
+ export * from "./prepare-ownable.js";
4
5
  export * from "./priceAuthority.js";
5
6
  export * from "./priceQuote.js";
6
7
  export * from "./statistics.js";
@@ -54,6 +54,7 @@ export {
54
54
  } from './ratio.js';
55
55
 
56
56
  export * from './durability.js';
57
+ export * from './prepare-ownable.js';
57
58
  export * from './priceAuthority.js';
58
59
  export * from './priceQuote.js';
59
60
  export * from './statistics.js';
@@ -0,0 +1,11 @@
1
+ export function prepareOwnable<MN extends (string | symbol)[]>(zone: import("@agoric/base-zone").Zone, makeInvitation: ZCF["makeInvitation"], uKindName: string, uMethodNames: MN, options?: OwnableOptions | undefined): <U>(underlying: U) => Pick<U, MN[number]> & {
2
+ makeTransferInvitation: () => Invitation<U>;
3
+ };
4
+ export type OwnableOptions = {
5
+ /**
6
+ * The `interfaceName` of the underlying interface guard.
7
+ * Defaults to the `uKindName`.
8
+ */
9
+ uInterfaceName?: string | undefined;
10
+ };
11
+ //# sourceMappingURL=prepare-ownable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare-ownable.d.ts","sourceRoot":"","sources":["prepare-ownable.js"],"names":[],"mappings":"AA0CO,+BAFoC,EAAE,oCAflC,OAAO,mBAAmB,EAAE,IAAI,kBAChC,GAAG,CAAC,gBAAgB,CAAC,aAQrB,MAAM,gBAM0B,EAAE,AAJhC,yCAIA,CAAC,CAAC,EAAE,UAAU,EAAwE,CAAC,AAAtE,KAAK,IAAI,CAA4D,CAAC,AAA3D,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG;IAAC,sBAAsB,EAAE,MAAM,UAAU,CAAC,CAAC,CAAC,CAAA;CAAC,CA0DrG"}
@@ -0,0 +1,100 @@
1
+ import { M } from '@endo/patterns';
2
+ import { prepareRevocableMakerKit } from '@agoric/base-zone/zone-helpers.js';
3
+ import { OfferHandlerI } from '../typeGuards.js';
4
+
5
+ const TransferProposalShape = M.splitRecord({
6
+ give: {},
7
+ want: {},
8
+ exit: {
9
+ onDemand: null,
10
+ },
11
+ });
12
+
13
+ /**
14
+ * @typedef {object} OwnableOptions
15
+ * @property {string} [uInterfaceName]
16
+ * The `interfaceName` of the underlying interface guard.
17
+ * Defaults to the `uKindName`.
18
+ */
19
+
20
+ /**
21
+ * Prepare a kind that wraps an 'ownable' object with a `makeTransferInvitation`
22
+ * ability and delegates to the underlying object methods specified in an
23
+ * allowlist of method names.
24
+ *
25
+ * @template {(string | symbol)[]} MN Method names
26
+ * @param {import('@agoric/base-zone').Zone} zone
27
+ * @param {ZCF['makeInvitation']} makeInvitation
28
+ * A function with the same behavior as `zcf.makeInvitation`.
29
+ * A contract will normally just extract it from its own zcf using the
30
+ * argument expression
31
+ * ```js
32
+ * (...args) => zcf.makeInvitation(...args)
33
+ * ```
34
+ * See ownable-counter.js for the canonical example.
35
+ * @param {string} uKindName
36
+ * The `kindName` of the underlying exo class
37
+ * @param {MN} uMethodNames
38
+ * The method names of the underlying exo class that should be represented
39
+ * by transparently-forwarding methods of the wrapping ownable object.
40
+ * @param {OwnableOptions} [options]
41
+ * @returns {<U>(underlying: U) => Pick<U, MN[number]> & {makeTransferInvitation: () => Invitation<U>}}
42
+ */
43
+ export const prepareOwnable = (
44
+ zone,
45
+ makeInvitation,
46
+ uKindName,
47
+ uMethodNames,
48
+ options = {},
49
+ ) => {
50
+ const { uInterfaceName = uKindName } = options;
51
+ const { revoke, makeRevocable } = prepareRevocableMakerKit(
52
+ zone,
53
+ uKindName,
54
+ uMethodNames,
55
+ {
56
+ uInterfaceName,
57
+ extraMethodGuards: {
58
+ makeTransferInvitation: M.call().returns(M.promise()),
59
+ },
60
+ extraMethods: {
61
+ makeTransferInvitation() {
62
+ const { underlying } = this.state;
63
+ const { revocable } = this.facets;
64
+ const customDetails = underlying.getInvitationCustomDetails();
65
+ // eslint-disable-next-line no-use-before-define
66
+ const transferHandler = makeTransferHandler(underlying);
67
+
68
+ const invitation = makeInvitation(
69
+ transferHandler,
70
+ 'transfer',
71
+ customDetails,
72
+ TransferProposalShape,
73
+ );
74
+ revoke(revocable);
75
+ return invitation;
76
+ },
77
+ },
78
+ },
79
+ );
80
+
81
+ const makeTransferHandler = zone.exoClass(
82
+ 'TransferHandler',
83
+ OfferHandlerI,
84
+ underlying => ({
85
+ underlying,
86
+ }),
87
+ {
88
+ handle(seat) {
89
+ const { underlying } = this.state;
90
+ const revocable = makeRevocable(underlying);
91
+ seat.exit();
92
+ return revocable;
93
+ },
94
+ },
95
+ );
96
+
97
+ const makeOwnable = underlying => makeRevocable(underlying);
98
+ return harden(makeOwnable);
99
+ };
100
+ harden(prepareOwnable);
@@ -1,22 +1,30 @@
1
- /**
2
- * @param {object} opts
3
- * @param {Issuer<'set'>} opts.quoteIssuer
4
- * @param {ERef<Notifier<unknown>>} opts.notifier
5
- * @param {ERef<import('@agoric/time/src/types').TimerService>} opts.timer
6
- * @param {PriceQuoteCreate} opts.createQuote
7
- * @param {Brand<'nat'>} opts.actualBrandIn
8
- * @param {Brand<'nat'>} opts.actualBrandOut
9
- * @returns {PriceAuthorityKit}
10
- */
1
+ export const PriceAuthorityI: import("@endo/patterns").InterfaceGuard<{
2
+ getQuoteIssuer: import("@endo/patterns").MethodGuard;
3
+ getTimerService: import("@endo/patterns").MethodGuard;
4
+ quoteGiven: import("@endo/patterns").MethodGuard;
5
+ quoteWanted: import("@endo/patterns").MethodGuard;
6
+ makeQuoteNotifier: import("@endo/patterns").MethodGuard;
7
+ quoteAtTime: import("@endo/patterns").MethodGuard;
8
+ quoteWhenLT: import("@endo/patterns").MethodGuard;
9
+ quoteWhenLTE: import("@endo/patterns").MethodGuard;
10
+ quoteWhenGTE: import("@endo/patterns").MethodGuard;
11
+ quoteWhenGT: import("@endo/patterns").MethodGuard;
12
+ mutableQuoteWhenLT: import("@endo/patterns").MethodGuard;
13
+ mutableQuoteWhenLTE: import("@endo/patterns").MethodGuard;
14
+ mutableQuoteWhenGTE: import("@endo/patterns").MethodGuard;
15
+ mutableQuoteWhenGT: import("@endo/patterns").MethodGuard;
16
+ }>;
11
17
  export function makeOnewayPriceAuthorityKit(opts: {
12
- quoteIssuer: Issuer<'set'>;
18
+ quoteIssuer: globalThis.Issuer<"set", PriceDescription>;
13
19
  notifier: ERef<Notifier<unknown>>;
14
- timer: ERef<import('@agoric/time/src/types').TimerService>;
20
+ timer: ERef<import("@agoric/time").TimerService>;
15
21
  createQuote: PriceQuoteCreate;
16
- actualBrandIn: Brand<'nat'>;
17
- actualBrandOut: Brand<'nat'>;
22
+ actualBrandIn: Brand<"nat">;
23
+ actualBrandOut: Brand<"nat">;
18
24
  }): PriceAuthorityKit;
19
- export const PriceAuthorityI: import("@endo/patterns").InterfaceGuard;
20
25
  export type CompareAmount = (amount: Amount, amountLimit: Amount) => boolean;
21
26
  export type Trigger = (createInstantQuote: PriceQuoteCreate) => Promise<void>;
27
+ import type { PriceDescription } from '@agoric/zoe/tools/types.js';
28
+ import type { PriceQuoteCreate } from '@agoric/zoe/tools/types.js';
29
+ import type { PriceAuthorityKit } from '@agoric/zoe/tools/types.js';
22
30
  //# sourceMappingURL=priceAuthority.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"priceAuthority.d.ts","sourceRoot":"","sources":["priceAuthority.js"],"names":[],"mappings":"AA6DA;;;;;;;;;GASG;AACH;IAR+B,WAAW,EAA/B,OAAO,KAAK,CAAC;IACiB,QAAQ,EAAtC,KAAK,SAAS,OAAO,CAAC,CAAC;IACmC,KAAK,EAA/D,KAAK,OAAO,wBAAwB,EAAE,YAAY,CAAC;IAC5B,WAAW,EAAlC,gBAAgB;IACG,aAAa,EAAhC,MAAM,KAAK,CAAC;IACO,cAAc,EAAjC,MAAM,KAAK,CAAC;IACV,iBAAiB,CA6S7B;AAxUD,sEAiBG;qCA3CQ,MAAM,eACN,MAAM,KACJ,OAAO;2CAiBT,gBAAgB,KACd,QAAQ,IAAI,CAAC"}
1
+ {"version":3,"file":"priceAuthority.d.ts","sourceRoot":"","sources":["priceAuthority.js"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;GAiBG;AAYI;;cAPI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;WACvB,IAAI,CAAC,OAAO,cAAc,EAAE,YAAY,CAAC;;mBAEzC,KAAK,CAAC,KAAK,CAAC;oBACZ,KAAK,CAAC,KAAK,CAAC;sBAyTtB;qCA7WU,MAAM,eACN,MAAM,KACJ,OAAO;gEAkBP,OAAO,CAAC,IAAI,CAAC;sCA7ByI,4BAA4B;sCAA5B,4BAA4B;uCAA5B,4BAA4B"}