@agoric/zoe 0.26.3-upgrade-18a-dev-4ee0508.0 → 0.27.0-u19.1

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 (85) hide show
  1. package/bundles/bundle-contractFacet-js-meta.json +243 -238
  2. package/bundles/bundle-contractFacet.js +1 -1
  3. package/package.json +30 -30
  4. package/src/contractFacet/offerHandlerStorage.d.ts.map +1 -1
  5. package/src/contractFacet/offerHandlerStorage.js +5 -0
  6. package/src/contractFacet/reallocate.d.ts.map +1 -1
  7. package/src/contractFacet/reallocate.js +4 -0
  8. package/src/contractFacet/types-ambient.d.ts +4 -66
  9. package/src/contractFacet/zcfMint.d.ts +1 -1
  10. package/src/contractFacet/zcfMint.d.ts.map +1 -1
  11. package/src/contractFacet/zcfMint.js +2 -14
  12. package/src/contractFacet/zcfSeat.d.ts.map +1 -1
  13. package/src/contractFacet/zcfSeat.js +12 -188
  14. package/src/contractFacet/zcfZygote.d.ts.map +1 -1
  15. package/src/contractFacet/zcfZygote.js +10 -4
  16. package/src/contractSupport/durability.d.ts +1 -0
  17. package/src/contractSupport/durability.d.ts.map +1 -1
  18. package/src/contractSupport/durability.js +4 -0
  19. package/src/contractSupport/priceQuote.d.ts +1 -0
  20. package/src/contractSupport/priceQuote.d.ts.map +1 -1
  21. package/src/contractSupport/priceQuote.js +6 -1
  22. package/src/contractSupport/recorder.d.ts +8 -24
  23. package/src/contractSupport/recorder.d.ts.map +1 -1
  24. package/src/contractSupport/recorder.js +6 -0
  25. package/src/contractSupport/zoeHelpers.d.ts +5 -1
  26. package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
  27. package/src/contractSupport/zoeHelpers.js +6 -2
  28. package/src/contracts/coveredCall.d.ts.map +1 -1
  29. package/src/contracts/coveredCall.js +1 -6
  30. package/src/contracts/priceAggregator.d.ts.map +1 -1
  31. package/src/contracts/priceAggregator.js +5 -4
  32. package/src/internal-types.d.ts +0 -1
  33. package/src/internal-types.d.ts.map +1 -1
  34. package/src/internal-types.js +0 -1
  35. package/src/issuerStorage.d.ts.map +1 -1
  36. package/src/issuerStorage.js +4 -0
  37. package/src/typeGuards.d.ts +2 -1
  38. package/src/typeGuards.d.ts.map +1 -1
  39. package/src/typeGuards.js +3 -2
  40. package/src/zoeService/escrowStorage.d.ts.map +1 -1
  41. package/src/zoeService/escrowStorage.js +4 -0
  42. package/src/zoeService/installationStorage.d.ts +1 -3
  43. package/src/zoeService/installationStorage.d.ts.map +1 -1
  44. package/src/zoeService/installationStorage.js +6 -3
  45. package/src/zoeService/instanceAdminStorage.d.ts +1 -0
  46. package/src/zoeService/instanceAdminStorage.d.ts.map +1 -1
  47. package/src/zoeService/instanceAdminStorage.js +4 -0
  48. package/src/zoeService/internal-types.d.ts +1 -2
  49. package/src/zoeService/internal-types.d.ts.map +1 -1
  50. package/src/zoeService/internal-types.js +1 -7
  51. package/src/zoeService/makeInvitation.d.ts.map +1 -1
  52. package/src/zoeService/makeInvitation.js +0 -1
  53. package/src/zoeService/offer/burnInvitation.d.ts +1 -1
  54. package/src/zoeService/offer/burnInvitation.d.ts.map +1 -1
  55. package/src/zoeService/offer/burnInvitation.js +3 -2
  56. package/src/zoeService/originalZoeSeat.d.ts.map +1 -1
  57. package/src/zoeService/originalZoeSeat.js +6 -3
  58. package/src/zoeService/startInstance.d.ts +1 -1
  59. package/src/zoeService/startInstance.d.ts.map +1 -1
  60. package/src/zoeService/startInstance.js +5 -2
  61. package/src/zoeService/types-ambient.d.ts +11 -5
  62. package/src/zoeService/types-ambient.d.ts.map +1 -1
  63. package/src/zoeService/types-ambient.js +9 -5
  64. package/src/zoeService/utils.d.ts +5 -5
  65. package/src/zoeService/zoeSeat.d.ts +1 -4
  66. package/src/zoeService/zoeSeat.d.ts.map +1 -1
  67. package/src/zoeService/zoeSeat.js +5 -2
  68. package/tools/fakePriceAuthority.d.ts +3 -2
  69. package/tools/fakePriceAuthority.d.ts.map +1 -1
  70. package/tools/fakePriceAuthority.js +9 -6
  71. package/tools/fakeVatAdmin.d.ts +2 -3
  72. package/tools/fakeVatAdmin.d.ts.map +1 -1
  73. package/tools/fakeVatAdmin.js +5 -2
  74. package/tools/manualPriceAuthority.d.ts +3 -2
  75. package/tools/manualPriceAuthority.d.ts.map +1 -1
  76. package/tools/manualPriceAuthority.js +7 -6
  77. package/tools/scriptedOracle.d.ts +1 -1
  78. package/tools/scriptedPriceAuthority.d.ts.map +1 -1
  79. package/tools/scriptedPriceAuthority.js +6 -5
  80. package/tools/test-utils.d.ts +9 -5
  81. package/tools/test-utils.d.ts.map +1 -1
  82. package/tools/test-utils.js +5 -1
  83. package/tools/types.d.ts +4 -0
  84. package/tools/types.d.ts.map +1 -1
  85. package/tools/types.js +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/zoe",
3
- "version": "0.26.3-upgrade-18a-dev-4ee0508.0+4ee0508",
3
+ "version": "0.27.0-u19.1",
4
4
  "description": "Zoe: the Smart Contract Framework for Offer Enforcement",
5
5
  "type": "module",
6
6
  "main": "./src/zoeService/zoe.js",
@@ -43,38 +43,38 @@
43
43
  },
44
44
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
45
45
  "dependencies": {
46
- "@agoric/base-zone": "0.1.1-upgrade-18a-dev-4ee0508.0+4ee0508",
47
- "@agoric/ertp": "0.16.3-upgrade-18a-dev-4ee0508.0+4ee0508",
48
- "@agoric/internal": "0.4.0-upgrade-18a-dev-4ee0508.0+4ee0508",
49
- "@agoric/notifier": "0.7.0-upgrade-18a-dev-4ee0508.0+4ee0508",
50
- "@agoric/store": "0.9.3-upgrade-18a-dev-4ee0508.0+4ee0508",
51
- "@agoric/swingset-liveslots": "0.10.3-upgrade-18a-dev-4ee0508.0+4ee0508",
52
- "@agoric/swingset-vat": "0.33.0-upgrade-18a-dev-4ee0508.0+4ee0508",
53
- "@agoric/time": "0.3.3-upgrade-18a-dev-4ee0508.0+4ee0508",
54
- "@agoric/vat-data": "0.5.3-upgrade-18a-dev-4ee0508.0+4ee0508",
55
- "@agoric/vow": "0.2.0-upgrade-18a-dev-4ee0508.0+4ee0508",
56
- "@agoric/zone": "0.3.0-upgrade-18a-dev-4ee0508.0+4ee0508",
57
- "@endo/bundle-source": "^3.5.0",
58
- "@endo/captp": "^4.4.3",
59
- "@endo/common": "^1.2.8",
60
- "@endo/errors": "^1.2.8",
61
- "@endo/eventual-send": "^1.2.8",
62
- "@endo/exo": "^1.5.7",
63
- "@endo/far": "^1.1.9",
64
- "@endo/import-bundle": "^1.3.2",
65
- "@endo/marshal": "^1.6.2",
66
- "@endo/nat": "^5.0.13",
67
- "@endo/pass-style": "^1.4.7",
68
- "@endo/patterns": "^1.4.7",
69
- "@endo/promise-kit": "^1.1.8",
46
+ "@agoric/base-zone": "^0.1.1-u19.0",
47
+ "@agoric/ertp": "^0.16.3-u19.1",
48
+ "@agoric/internal": "^0.4.0-u19.1",
49
+ "@agoric/notifier": "^0.7.0-u19.1",
50
+ "@agoric/store": "^0.9.3-u19.0",
51
+ "@agoric/swingset-liveslots": "^0.10.3-u19.1",
52
+ "@agoric/swingset-vat": "^0.33.0-u19.1",
53
+ "@agoric/time": "^0.3.3-u19.0",
54
+ "@agoric/vat-data": "^0.5.3-u19.1",
55
+ "@agoric/vow": "^0.2.0-u19.1",
56
+ "@agoric/zone": "^0.3.0-u19.1",
57
+ "@endo/bundle-source": "^3.5.1",
58
+ "@endo/captp": "^4.4.4",
59
+ "@endo/common": "^1.2.9",
60
+ "@endo/errors": "^1.2.9",
61
+ "@endo/eventual-send": "^1.3.0",
62
+ "@endo/exo": "^1.5.8",
63
+ "@endo/far": "^1.1.10",
64
+ "@endo/import-bundle": "^1.3.3",
65
+ "@endo/marshal": "^1.6.3",
66
+ "@endo/nat": "^5.0.14",
67
+ "@endo/pass-style": "^1.4.8",
68
+ "@endo/patterns": "^1.4.8",
69
+ "@endo/promise-kit": "^1.1.9",
70
70
  "yargs-parser": "^21.1.1"
71
71
  },
72
72
  "devDependencies": {
73
- "@agoric/kmarshal": "0.1.1-upgrade-18a-dev-4ee0508.0+4ee0508",
74
- "@endo/init": "^1.1.7",
73
+ "@agoric/kmarshal": "^0.1.1-u19.0",
74
+ "@endo/init": "^1.1.8",
75
75
  "ava": "^5.3.0",
76
76
  "c8": "^10.1.2",
77
- "import-meta-resolve": "^2.2.1",
77
+ "import-meta-resolve": "^4.1.0",
78
78
  "tsd": "^0.31.1"
79
79
  },
80
80
  "files": [
@@ -98,7 +98,7 @@
98
98
  "access": "public"
99
99
  },
100
100
  "typeCoverage": {
101
- "atLeast": 85.06
101
+ "atLeast": 85.11
102
102
  },
103
- "gitHead": "4ee05088e5ada989a866a11ff65838d395505ce6"
103
+ "gitHead": "a04d2bf43a9753d123954b52c6ba8d35083a3c8f"
104
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"AA6BO;;yCAgCwB,gBAAgB,YAAY,OAAO,KAAK,YAAY;EAsBlF;;;;sBAlEY,MAAM,GAAG,EAAE;mCASX,2BAAiB,eAAe,GAAG,YAAY;oCAL3B,qBAAqB;qCACpB,kBAAkB"}
1
+ {"version":3,"file":"offerHandlerStorage.d.ts","sourceRoot":"","sources":["offerHandlerStorage.js"],"names":[],"mappings":"AAkCO;;yCAgCwB,gBAAgB,YAAY,OAAO,KAAK,YAAY;EAsBlF;;;;sBAlEY,MAAM,GAAG,EAAE;mCASX,2BAAiB,eAAe,GAAG,YAAY;oCAL3B,qBAAqB;qCACpB,kBAAkB"}
@@ -6,6 +6,11 @@ import { canBeDurable, provideDurableWeakMapStore } from '@agoric/vat-data';
6
6
 
7
7
  import { defineDurableHandle } from '../makeHandle.js';
8
8
 
9
+ /**
10
+ * @import {LegacyWeakMap, WeakMapStore} from '@agoric/store';
11
+ * @import {MapStore} from '@agoric/swingset-liveslots';
12
+ */
13
+
9
14
  /**
10
15
  * The following should work. But for some reason, @endo/errors does
11
16
  * not export the type `Details`.
@@ -1 +1 @@
1
- {"version":3,"file":"reallocate.d.ts","sourceRoot":"","sources":["reallocate.js"],"names":[],"mappings":"AAgBO,6CAHI,KAAK,CAAC,YAAY,CAAC,GACjB,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CA8E5C;8BAtFa,KAAK,CAAC,mBAAmB,CAAC"}
1
+ {"version":3,"file":"reallocate.d.ts","sourceRoot":"","sources":["reallocate.js"],"names":[],"mappings":"AAoBO,6CAHI,KAAK,CAAC,YAAY,CAAC,GACjB,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,CA8E5C;8BAtFa,KAAK,CAAC,mBAAmB,CAAC"}
@@ -4,6 +4,10 @@ import { makeScalarMapStore } from '@agoric/vat-data';
4
4
  import { assertRightsConserved } from './rightsConservation.js';
5
5
  import { addToAllocation, subtractFromAllocation } from './allocationMath.js';
6
6
 
7
+ /**
8
+ * @import {MapStore} from '@agoric/swingset-liveslots';
9
+ */
10
+
7
11
  /** @typedef {Array<AmountKeywordRecord>} TransactionList */
8
12
 
9
13
  /**
@@ -19,16 +19,11 @@ type InvitationAmount = Amount<'set', InvitationDetails>;
19
19
  * synchronously from within the contract, and usually is referred to
20
20
  * in code as zcf.
21
21
  */
22
- type ZCF<CT extends unknown = Record<string, unknown>> = {
22
+ type ZCF<CT = Record<string, unknown>> = {
23
23
  /**
24
24
  * - atomically reallocate amounts among seats.
25
25
  */
26
26
  atomicRearrange: (transfers: TransferPart[]) => void;
27
- /**
28
- * - reallocate amounts among seats.
29
- * @deprecated Use atomicRearrange instead.
30
- */
31
- reallocate: Reallocate;
32
27
  /**
33
28
  * - check
34
29
  * whether a keyword is valid and unique and could be added in
@@ -86,34 +81,6 @@ type ZCF<CT extends unknown = Record<string, unknown>> = {
86
81
  getInstance: () => Instance;
87
82
  };
88
83
 
89
- /**
90
- * @deprecated Use atomicRearrange instead
91
- *
92
- * The contract can reallocate over seats, which commits the staged
93
- * allocation for each seat. On commit, the staged allocation becomes
94
- * the current allocation and the staged allocation is deleted.
95
- *
96
- * The reallocation will only succeed if the reallocation 1) conserves
97
- * rights (the amounts specified have the same total value as the
98
- * current total amount), and 2) is 'offer-safe' for all parties
99
- * involved. All seats that have staged allocations must be included
100
- * as arguments to `reallocate`, or an error is thrown. Additionally,
101
- * an error is thrown if any seats included in `reallocate` do not
102
- * have a staged allocation.
103
- *
104
- * The reallocation is partial, meaning that it applies only to the
105
- * seats passed in as arguments. By induction, if rights conservation
106
- * and offer safety hold before, they will hold after a safe
107
- * reallocation, even though we only re-validate for the seats whose
108
- * allocations will change. Since rights are conserved for the change,
109
- * overall rights will be unchanged, and a reallocation can only
110
- * effect offer safety for seats whose allocations change.
111
- */
112
- type Reallocate = (
113
- seat1: ZCFSeat,
114
- seat2: ZCFSeat,
115
- ...seatRest: Array<ZCFSeat>
116
- ) => void;
117
84
  type TransferPart = [
118
85
  fromSeat?: ZCFSeat,
119
86
  toSeat?: ZCFSeat,
@@ -184,38 +151,14 @@ type ZCFSeat = import('@endo/pass-style').RemotableObject & {
184
151
  brand?: B,
185
152
  ) => B extends Brand<infer K> ? Amount<K> : Amount;
186
153
  getCurrentAllocation: () => Allocation;
187
- /**
188
- * @deprecated Use atomicRearrange instead
189
- */
190
- getStagedAllocation: () => Allocation;
191
- /**
192
- * @deprecated Use atomicRearrange instead
193
- */
194
- hasStagedAllocation: () => boolean;
195
154
  isOfferSafe: (newAllocation: Allocation) => boolean;
196
- /**
197
- * @deprecated Use atomicRearrange instead
198
- */
199
- incrementBy: (
200
- amountKeywordRecord: AmountKeywordRecord,
201
- ) => AmountKeywordRecord;
202
- /**
203
- * @deprecated Use atomicRearrange instead
204
- */
205
- decrementBy: (
206
- amountKeywordRecord: AmountKeywordRecord,
207
- ) => AmountKeywordRecord;
208
- /**
209
- * @deprecated Use atomicRearrange instead
210
- */
211
- clear: () => void;
212
155
  };
213
156
  type ZcfSeatKit = {
214
157
  zcfSeat: ZCFSeat;
215
158
  userSeat: Promise<UserSeat>;
216
159
  };
217
- type HandleOffer<OR extends unknown, OA> = (seat: ZCFSeat, offerArgs: OA) => OR;
218
- type OfferHandler<OR extends unknown = unknown, OA = never> =
160
+ type HandleOffer<OR, OA> = (seat: ZCFSeat, offerArgs: OA) => OR;
161
+ type OfferHandler<OR = unknown, OA = never> =
219
162
  | HandleOffer<OR, OA>
220
163
  | {
221
164
  handle: HandleOffer<OR, OA>;
@@ -241,12 +184,7 @@ type ContractMeta<
241
184
  *
242
185
  * CAVEAT: assumes synchronous
243
186
  */
244
- type ContractStartFn<
245
- PF extends unknown = any,
246
- CF extends unknown = any,
247
- CT extends unknown = any,
248
- PA extends unknown = any,
249
- > = (
187
+ type ContractStartFn<PF = any, CF = any, CT = any, PA = any> = (
250
188
  zcf: ZCF<CT>,
251
189
  privateArgs: PA,
252
190
  baggage: import('@agoric/vat-data').Baggage,
@@ -4,5 +4,5 @@ export function prepareZcMint(zcfBaggage: import("@agoric/vat-data").Baggage, re
4
4
  }, getAssetKindByBrand: GetAssetKindByBrand, makeEmptySeatKit: (exit?: undefined) => {
5
5
  zcfSeat: any;
6
6
  userSeat: Promise<UserSeat>;
7
- }, reallocator: ZcfMintReallocator): <K extends AssetKind>(keyword: string, zoeMintP: ERef<ZoeMint<K>>) => Promise<ZCFMint<K>>;
7
+ }, reallocator: ZcfMintReallocator): (keyword: string, zoeMintP: ERef<ZoeMint<K>>) => Promise<ZCFMint<K>>;
8
8
  //# sourceMappingURL=zcfMint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zcfMint.d.ts","sourceRoot":"","sources":["zcfMint.js"],"names":[],"mappings":"AAmBO,4CAJI,mBAAmB,gBACnB,YAAY,GACV,MAAM,CAYlB;AASM,0CANI,OAAO,kBAAkB,EAAE,OAAO,gBAClC;IAAE,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,uBACvD,mBAAmB,oBACnB,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CAAE,eACnE,kBAAkB,IAiHF,CAAC,SAAZ,SAAU,WACb,MAAM,YACN,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KACd,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAWjC"}
1
+ {"version":3,"file":"zcfMint.d.ts","sourceRoot":"","sources":["zcfMint.js"],"names":[],"mappings":"AAmBO,4CAJI,mBAAmB,gBACnB,YAAY,GACV,MAAM,CAYlB;AASM,0CANI,OAAO,kBAAkB,EAAE,OAAO,gBAClC;IAAE,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,uBACvD,mBAAmB,oBACnB,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CAAE,eACnE,kBAAkB,IA0Gb,SAJH,MAIU,EAAE,UAHZ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAGK,KAFlB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAWjC"}
@@ -87,19 +87,13 @@ export const prepareZcMint = (
87
87
  gains,
88
88
  );
89
89
 
90
- // Increment the stagedAllocation if it exists so that the
91
- // stagedAllocation is kept up to the currentAllocation
92
- if (zcfSeat.hasStagedAllocation()) {
93
- zcfSeat.incrementBy(gains);
94
- }
95
-
96
90
  // Offer safety should never be able to be violated here, as
97
91
  // we are adding assets. However, we keep this check so that
98
92
  // all reallocations are covered by offer safety checks, and
99
93
  // that any bug within Zoe that may affect this is caught.
100
94
  zcfSeat.isOfferSafe(allocationPlusGains) ||
101
95
  Fail`The allocation after minting gains ${allocationPlusGains} for the zcfSeat was not offer safe`;
102
- // No effects above, apart from incrementBy. Note COMMIT POINT within
96
+ // No effects above, Note COMMIT POINT within
103
97
  // reallocator.reallocate(). The following two steps *should* be
104
98
  // committed atomically, but it is not a disaster if they are
105
99
  // not. If we minted only, no one would ever get those
@@ -129,13 +123,7 @@ export const prepareZcMint = (
129
123
  zcfSeat.isOfferSafe(allocationMinusLosses) ||
130
124
  Fail`The allocation after burning losses ${allocationMinusLosses} for the zcfSeat was not offer safe`;
131
125
 
132
- // Decrement the stagedAllocation if it exists so that the
133
- // stagedAllocation is kept up to the currentAllocation
134
- if (zcfSeat.hasStagedAllocation()) {
135
- zcfSeat.decrementBy(losses);
136
- }
137
-
138
- // No effects above, apart from decrementBy. Note COMMIT POINT within
126
+ // No effects above, Note COMMIT POINT within
139
127
  // reallocator.reallocate(). The following two steps *should* be
140
128
  // committed atomically, but it is not a disaster if they are
141
129
  // not. If we only commit the allocationMinusLosses no one would
@@ -1 +1 @@
1
- {"version":3,"file":"zcfSeat.d.ts","sourceRoot":"","sources":["zcfSeat.js"],"names":[],"mappings":"AAmCO,oDANI,IAAI,CAAC,gBAAgB,CAAC,uBACtB,mBAAmB,uBACnB,OAAO,sBAAsB,EAAE,mBAAmB,cAClD,OAAO,kBAAkB,EAAE,OAAO,GAChC;IAAE,WAAW,EAAE,cAAc,CAAC;IAAC,kBAAkB,EAAE,kBAAkB,CAAA;CAAE,CAyenF"}
1
+ {"version":3,"file":"zcfSeat.d.ts","sourceRoot":"","sources":["zcfSeat.js"],"names":[],"mappings":"AAqCO,oDANI,IAAI,CAAC,gBAAgB,CAAC,uBACtB,mBAAmB,uBACnB,OAAO,sBAAsB,EAAE,mBAAmB,cAClD,OAAO,kBAAkB,EAAE,OAAO,GAChC;IAAE,WAAW,EAAE,cAAc,CAAC;IAAC,kBAAkB,EAAE,kBAAkB,CAAA;CAAE,CAuTnF"}
@@ -5,7 +5,6 @@ import {
5
5
  prepareExoClass,
6
6
  prepareExoClassKit,
7
7
  provide,
8
- provideDurableMapStore,
9
8
  provideDurableWeakMapStore,
10
9
  } from '@agoric/vat-data';
11
10
  import { AmountMath } from '@agoric/ertp';
@@ -13,8 +12,6 @@ import { initEmpty, M } from '@agoric/store';
13
12
 
14
13
  import { isOfferSafe } from './offerSafety.js';
15
14
  import { assertRightsConserved } from './rightsConservation.js';
16
- import { addToAllocation, subtractFromAllocation } from './allocationMath.js';
17
- import { coerceAmountKeywordRecord } from '../cleanProposal.js';
18
15
  import {
19
16
  AmountKeywordRecordShape,
20
17
  SeatDataShape,
@@ -23,6 +20,11 @@ import {
23
20
  import { makeAllocationMap } from './reallocate.js';
24
21
  import { TransferPartShape } from '../contractSupport/atomicTransfer.js';
25
22
 
23
+ /**
24
+ * @import {LegacyWeakMap, WeakMapStore} from '@agoric/store';
25
+ * @import {MapStore} from '@agoric/swingset-liveslots';
26
+ */
27
+
26
28
  /**
27
29
  * The SeatManager holds the active zcfSeats and can reallocate and
28
30
  * make new zcfSeats.
@@ -41,11 +43,11 @@ export const createSeatManager = (
41
43
  ) => {
42
44
  /** @type {WeakMapStore<ZCFSeat, Allocation>} */
43
45
  let activeZCFSeats = provideDurableWeakMapStore(zcfBaggage, 'activeZCFSeats');
44
- /** @type {MapStore<ZCFSeat, Allocation>} */
45
- const zcfSeatToStagedAllocations = provideDurableMapStore(
46
- zcfBaggage,
47
- 'zcfSeatToStagedAllocations',
48
- );
46
+
47
+ // Removed. See #6679
48
+ if (zcfBaggage.has('zcfSeatToStagedAllocations')) {
49
+ zcfBaggage.delete('zcfSeatToStagedAllocations');
50
+ }
49
51
 
50
52
  /** @type {WeakMapStore<ZCFSeat, SeatHandle>} */
51
53
  let zcfSeatToSeatHandle = provideDurableWeakMapStore(
@@ -84,64 +86,6 @@ export const createSeatManager = (
84
86
  return activeZCFSeats.get(zcfSeat);
85
87
  };
86
88
 
87
- /**
88
- * @param {ZCFSeat} zcfSeat
89
- * @returns {void}
90
- */
91
- const commitStagedAllocation = zcfSeat => {
92
- // By this point, we have checked that the zcfSeat is a key in
93
- // activeZCFSeats and in zcfSeatToStagedAllocations.
94
- activeZCFSeats.set(zcfSeat, zcfSeat.getStagedAllocation());
95
- zcfSeatToStagedAllocations.delete(zcfSeat);
96
- };
97
-
98
- /**
99
- * @param {ZCFSeat} zcfSeat
100
- * @returns {Allocation}
101
- */
102
- const hasStagedAllocation = zcfSeatToStagedAllocations.has;
103
-
104
- /**
105
- * Get the stagedAllocation. If one does not exist, return the
106
- * currentAllocation. We return the currentAllocation in this case
107
- * so that downstream users do not have to check whether the
108
- * stagedAllocation is defined before adding to it or subtracting
109
- * from it. To check whether a stagedAllocation exists, use
110
- * `hasStagedAllocation`
111
- *
112
- * @param {ZCFSeat} zcfSeat
113
- * @returns {Allocation}
114
- */
115
- const getStagedAllocation = zcfSeat => {
116
- if (zcfSeatToStagedAllocations.has(zcfSeat)) {
117
- return zcfSeatToStagedAllocations.get(zcfSeat);
118
- } else {
119
- return activeZCFSeats.get(zcfSeat);
120
- }
121
- };
122
-
123
- const assertStagedAllocation = zcfSeat => {
124
- hasStagedAllocation(zcfSeat) ||
125
- Fail`Reallocate failed because a seat had no staged allocation. Please add or subtract from the seat and then reallocate.`;
126
- };
127
-
128
- const setStagedAllocation = (zcfSeat, newStagedAllocation) => {
129
- if (zcfSeatToStagedAllocations.has(zcfSeat)) {
130
- zcfSeatToStagedAllocations.set(zcfSeat, newStagedAllocation);
131
- } else {
132
- zcfSeatToStagedAllocations.init(zcfSeat, newStagedAllocation);
133
- }
134
- };
135
-
136
- /** @param {ZCFSeat} zcfSeat */
137
- const assertNoStagedAllocation = zcfSeat => {
138
- if (hasStagedAllocation(zcfSeat)) {
139
- Fail`The seat could not be exited with a staged but uncommitted allocation: ${getStagedAllocation(
140
- zcfSeat,
141
- )}. Please reallocate over this seat or clear the staged allocation.`;
142
- }
143
- };
144
-
145
89
  const ZCFSeatI = M.interface('ZCFSeat', {}, { sloppy: true });
146
90
 
147
91
  const makeZCFSeatInternal = prepareExoClass(
@@ -163,7 +107,6 @@ export const createSeatManager = (
163
107
  exit(completion) {
164
108
  const { self } = this;
165
109
  assertActive(self);
166
- assertNoStagedAllocation(self);
167
110
  doExitSeat(self);
168
111
  void E(zoeInstanceAdmin).exitSeat(
169
112
  zcfSeatToSeatHandle.get(self),
@@ -221,10 +164,6 @@ export const createSeatManager = (
221
164
  const { self } = this;
222
165
  return getCurrentAllocation(self);
223
166
  },
224
- getStagedAllocation() {
225
- const { self } = this;
226
- return getStagedAllocation(self);
227
- },
228
167
  isOfferSafe(newAllocation) {
229
168
  const { state, self } = this;
230
169
  assertActive(self);
@@ -236,53 +175,6 @@ export const createSeatManager = (
236
175
 
237
176
  return isOfferSafe(state.proposal, reallocation);
238
177
  },
239
- /**
240
- * @deprecated switch to zcf.atomicRearrange()
241
- * @param {AmountKeywordRecord} amountKeywordRecord
242
- */
243
- incrementBy(amountKeywordRecord) {
244
- const { self } = this;
245
- assertActive(self);
246
- amountKeywordRecord = coerceAmountKeywordRecord(
247
- amountKeywordRecord,
248
- getAssetKindByBrand,
249
- );
250
- setStagedAllocation(
251
- self,
252
- addToAllocation(getStagedAllocation(self), amountKeywordRecord),
253
- );
254
- return amountKeywordRecord;
255
- },
256
- /**
257
- * @deprecated switch to zcf.atomicRearrange()
258
- * @param {AmountKeywordRecord} amountKeywordRecord
259
- */
260
- decrementBy(amountKeywordRecord) {
261
- const { self } = this;
262
- assertActive(self);
263
- amountKeywordRecord = coerceAmountKeywordRecord(
264
- amountKeywordRecord,
265
- getAssetKindByBrand,
266
- );
267
- setStagedAllocation(
268
- self,
269
- subtractFromAllocation(
270
- getStagedAllocation(self),
271
- amountKeywordRecord,
272
- ),
273
- );
274
- return amountKeywordRecord;
275
- },
276
- clear() {
277
- const { self } = this;
278
- if (zcfSeatToStagedAllocations.has(self)) {
279
- zcfSeatToStagedAllocations.delete(self);
280
- }
281
- },
282
- hasStagedAllocation() {
283
- const { self } = this;
284
- return hasStagedAllocation(self);
285
- },
286
178
  },
287
179
  );
288
180
 
@@ -296,9 +188,6 @@ export const createSeatManager = (
296
188
  seatManager: M.interface('ZcfSeatManager', {
297
189
  makeZCFSeat: M.call(SeatDataShape).returns(M.remotable('zcfSeat')),
298
190
  atomicRearrange: M.call(M.arrayOf(TransferPartShape)).returns(),
299
- reallocate: M.call(M.remotable('zcfSeat'), M.remotable('zcfSeat'))
300
- .rest(M.arrayOf(M.remotable('zcfSeat')))
301
- .returns(),
302
191
  dropAllReferences: M.call().returns(),
303
192
  }),
304
193
  zcfMintReallocator: M.interface('MintReallocator', {
@@ -350,8 +239,6 @@ export const createSeatManager = (
350
239
  // ////// All Seats are active /////////////////////////////////
351
240
  for (const [seat] of newAllocations) {
352
241
  assertActive(seat);
353
- !seat.hasStagedAllocation() ||
354
- Fail`Cannot mix atomicRearrange with seat stagings: ${seat}`;
355
242
  zcfSeatToSeatHandle.has(seat) ||
356
243
  Fail`The seat ${seat} was not recognized`;
357
244
  }
@@ -410,69 +297,6 @@ export const createSeatManager = (
410
297
  throw err;
411
298
  }
412
299
  },
413
- reallocate(/** @type {ZCFSeat[]} */ ...seats) {
414
- for (const seat of seats) {
415
- assertActive(seat);
416
- assertStagedAllocation(seat);
417
- }
418
-
419
- // Ensure that rights are conserved overall.
420
- const flattenAllocations = allocations =>
421
- allocations.flatMap(Object.values);
422
- const previousAllocations = seats.map(seat =>
423
- seat.getCurrentAllocation(),
424
- );
425
- const previousAmounts = flattenAllocations(previousAllocations);
426
- const newAllocations = seats.map(seat => seat.getStagedAllocation());
427
- const newAmounts = flattenAllocations(newAllocations);
428
-
429
- assertRightsConserved(previousAmounts, newAmounts);
430
-
431
- // Ensure that offer safety holds.
432
- for (const seat of seats) {
433
- isOfferSafe(seat.getProposal(), seat.getStagedAllocation()) ||
434
- Fail`Offer safety was violated by the proposed allocation: ${seat.getStagedAllocation()}. Proposal was ${seat.getProposal()}`;
435
- }
436
-
437
- // Keep track of seats used so far in this call, to prevent aliasing.
438
- const zcfSeatsSoFar = new Set();
439
-
440
- for (const seat of seats) {
441
- zcfSeatToSeatHandle.has(seat) ||
442
- Fail`The seat ${seat} was not recognized`;
443
- !zcfSeatsSoFar.has(seat) ||
444
- Fail`Seat (${seat}) was already an argument to reallocate`;
445
- zcfSeatsSoFar.add(seat);
446
- }
447
-
448
- try {
449
- // No side effects above. All conditions checked which could have
450
- // caused us to reject this reallocation.
451
- // COMMIT POINT
452
- // All the effects below must succeed "atomically". Scare quotes because
453
- // the eventual send at the bottom is part of this "atomicity" even
454
- // though its effects happen later. The send occurs in the order of
455
- // updates from zcf to zoe, its effects must occur immediately in zoe
456
- // on reception, and must not fail.
457
- //
458
- // Commit the staged allocations (currentAllocation is replaced
459
- // for each of the seats) and inform Zoe of the
460
- // newAllocation.
461
-
462
- for (const seat of seats) {
463
- commitStagedAllocation(seat);
464
- }
465
- const seatHandleAllocations = seats.map(seat => {
466
- const seatHandle = zcfSeatToSeatHandle.get(seat);
467
- return { seatHandle, allocation: seat.getCurrentAllocation() };
468
- });
469
-
470
- E(zoeInstanceAdmin).replaceAllocations(seatHandleAllocations);
471
- } catch (err) {
472
- shutdownWithFailure(err);
473
- throw err;
474
- }
475
- },
476
300
  dropAllReferences() {
477
301
  activeZCFSeats = replaceDurableWeakMapStore(
478
302
  zcfBaggage,
@@ -485,9 +309,9 @@ export const createSeatManager = (
485
309
  },
486
310
  },
487
311
  zcfMintReallocator: {
488
- // Unlike the zcf.reallocate method, this one does not check
312
+ // Unlike the zcf.atomicRearrange method, this one does not check
489
313
  // conservation, and so can be used internally for reallocations that
490
- // violate conservation.
314
+ // violate conservation, like minting and burning.
491
315
  reallocate(zcfSeat, newAllocation) {
492
316
  try {
493
317
  // COMMIT POINT
@@ -1 +1 @@
1
- {"version":3,"file":"zcfZygote.d.ts","sourceRoot":"","sources":["zcfZygote.js"],"names":[],"mappings":"AAiDO,sCARI,SAAS,cACT,IAAI,CAAC,UAAU,CAAC,oBAChB,MAAM,CAAC,KAAK,CAAC,iBACb,aAAa,qBACb,SAAS,eACT,OAAO,kBAAkB,EAAE,OAAO,GAChC,OAAO,CAAC,SAAS,CAAC,CA8c9B"}
1
+ {"version":3,"file":"zcfZygote.d.ts","sourceRoot":"","sources":["zcfZygote.js"],"names":[],"mappings":"AAiDO,sCARI,SAAS,cACT,IAAI,CAAC,UAAU,CAAC,oBAChB,MAAM,CAAC,KAAK,CAAC,iBACb,aAAa,qBACb,SAAS,eACT,OAAO,kBAAkB,EAAE,OAAO,GAChC,OAAO,CAAC,SAAS,CAAC,CAod9B"}
@@ -283,7 +283,6 @@ export const makeZCFZygote = async (
283
283
  /** @type {ZCF} */
284
284
  const zcf = prepareExo(zcfBaggage, 'zcf', ZcfI, {
285
285
  atomicRearrange: transfers => seatManager.atomicRearrange(transfers),
286
- reallocate: (...seats) => seatManager.reallocate(...seats),
287
286
  assertUniqueKeyword: kwd => getInstanceRecHolder().assertUniqueKeyword(kwd),
288
287
  saveIssuer: async (issuerP, keyword) => {
289
288
  // TODO: The checks of the keyword for uniqueness are
@@ -488,9 +487,16 @@ export const makeZCFZygote = async (
488
487
  publicFacet = undefined,
489
488
  creatorInvitation = undefined,
490
489
  }) => {
491
- const priorCreatorFacet = zcfBaggage.get('creatorFacet');
492
- const priorPublicFacet = zcfBaggage.get('publicFacet');
493
- const priorCreatorInvitation = zcfBaggage.get('creatorInvitation');
490
+ let priorCreatorFacet;
491
+ let priorPublicFacet;
492
+ let priorCreatorInvitation;
493
+ try {
494
+ priorCreatorFacet = zcfBaggage.get('creatorFacet');
495
+ priorPublicFacet = zcfBaggage.get('publicFacet');
496
+ priorCreatorInvitation = zcfBaggage.get('creatorInvitation');
497
+ } catch (e) {
498
+ Fail`restartContract failed: original contract facets were not durable (${e})`;
499
+ }
494
500
 
495
501
  (priorCreatorFacet === creatorFacet &&
496
502
  priorPublicFacet === publicFacet &&
@@ -2,4 +2,5 @@ export function makeEphemeraProvider<E extends {}, K extends WeakKey>(init: (key
2
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
4
  export function provideSingleton<T extends () => ERef<any>>(mapStore: import("@agoric/vat-data").Baggage, key: string, makeValue: T, withValue?: (value: Awaited<ReturnType<T>>) => void): Promise<Awaited<ReturnType<T>>>;
5
+ import type { MapStore } from '@agoric/swingset-liveslots';
5
6
  //# sourceMappingURL=durability.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["durability.js"],"names":[],"mappings":"AAaO,qCAJW,CAAC,SAAN,EAAI,EACM,CAAC,SAAV,OAAQ,QACX,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,eASA,CAAC,CAWxB;AAWM,sCALI,GAAG,WACH,OAAO,4BAA4B,EAAE,OAAO,QAC5C,MAAM,GACJ,OAAO,CAInB;AAiCM,2BALwC,CAAC,SAAlC,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC,CAAE,WACnC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,UACrB,CAAC,GACC,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,CAAC,CAuBlE;AAgBM,iCAPwB,CAAC,SAAnB,MAAO,IAAI,CAAC,GAAG,CAAE,YACnB,OAAO,kBAAkB,EAAE,OAAO,OAClC,MAAM,aACN,CAAC,cACD,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,GACrC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAc3C"}
1
+ {"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["durability.js"],"names":[],"mappings":"AAiBO,qCAJW,CAAC,SAAN,EAAI,EACM,CAAC,SAAV,OAAQ,QACX,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,eASA,CAAC,CAWxB;AAWM,sCALI,GAAG,WACH,OAAO,4BAA4B,EAAE,OAAO,QAC5C,MAAM,GACJ,OAAO,CAInB;AAiCM,2BALwC,CAAC,SAAlC,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC,CAAE,WACnC,SAAS,MAAM,EAAE,GAAG,CAAC,UACrB,CAAC,GACC,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAE,CAAC,CAuBlE;AAgBM,iCAPwB,CAAC,SAAnB,MAAO,IAAI,CAAC,GAAG,CAAE,YACnB,OAAO,kBAAkB,EAAE,OAAO,OAClC,MAAM,aACN,CAAC,cACD,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,GACrC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAc3C;8BA7H0B,4BAA4B"}
@@ -2,6 +2,10 @@ import { allValues, objectMap } from '@agoric/internal';
2
2
  import { provide } from '@agoric/vat-data';
3
3
  import { E } from '@endo/eventual-send';
4
4
 
5
+ /**
6
+ * @import {MapStore} from '@agoric/swingset-liveslots';
7
+ */
8
+
5
9
  /**
6
10
  * SCALE: Only for low cardinality provisioning. Every value from init() will
7
11
  * remain in the map for the lifetime of the heap. If a key object is GCed, its
@@ -4,6 +4,7 @@ export function getAmountOut(quote: PriceQuote): import("@agoric/ertp").NatAmoun
4
4
  /** @type {(quote: PriceQuote) => import('@agoric/time').Timestamp} */
5
5
  export const getTimestamp: (quote: PriceQuote) => import("@agoric/time").Timestamp;
6
6
  export function unitAmount(brand: Brand<"nat">): Promise<import("@agoric/ertp").NatAmount>;
7
+ export function makePriceQuoteIssuer(): IssuerKit<"set", PriceDescription>;
7
8
  import type { PriceQuote } from '@agoric/zoe/tools/types.js';
8
9
  import type { PriceDescription } from '@agoric/zoe/tools/types.js';
9
10
  //# sourceMappingURL=priceQuote.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"priceQuote.d.ts","sourceRoot":"","sources":["priceQuote.js"],"names":[],"mappings":"AAoBO,2CAHI,UAAU,GACR,gBAAgB,CAM5B;AAGM,mCADK,UAAU,oCACiD;AAEhE,oCADK,UAAU,oCACmD;AACzE,sEAAsE;AACtE,2BADW,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,cAAc,EAAE,SAAS,CACQ;AAGnE,kCADK,KAAK,CAAC,KAAK,CAAC,6CAMvB;gCA/B4F,4BAA4B;sCAA5B,4BAA4B"}
1
+ {"version":3,"file":"priceQuote.d.ts","sourceRoot":"","sources":["priceQuote.js"],"names":[],"mappings":"AAoBO,2CAHI,UAAU,GACR,gBAAgB,CAM5B;AAGM,mCADK,UAAU,oCACiD;AAEhE,oCADK,UAAU,oCACmD;AACzE,sEAAsE;AACtE,2BADW,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,cAAc,EAAE,SAAS,CACQ;AAGnE,kCADK,KAAK,CAAC,KAAK,CAAC,6CAMvB;AAGM,wCACM,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAE5C;gCArC0F,4BAA4B;sCAA5B,4BAA4B"}
@@ -3,7 +3,7 @@
3
3
  import { Fail } from '@endo/errors';
4
4
  import { Nat } from '@endo/nat';
5
5
  import { E } from '@endo/eventual-send';
6
- import { AmountMath } from '@agoric/ertp';
6
+ import { AmountMath, AssetKind, makeIssuerKit } from '@agoric/ertp';
7
7
 
8
8
  /**
9
9
  * @import {PriceAuthority, PriceDescription, PriceQuote, PriceQuoteValue, PriceQuery,} from '@agoric/zoe/tools/types.js';
@@ -39,3 +39,8 @@ export const unitAmount = async brand => {
39
39
  return AmountMath.make(brand, 10n ** Nat(decimalPlaces));
40
40
  };
41
41
  harden(unitAmount);
42
+
43
+ export const makePriceQuoteIssuer = () =>
44
+ /** @type {IssuerKit<'set', PriceDescription>} */ (
45
+ makeIssuerKit('quote', AssetKind.SET)
46
+ );