@agoric/zoe 0.26.3-dev-cc6a9e5.0 → 0.26.3-dev-bd50e5e.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.
- package/bundles/bundle-contractFacet-js-meta.json +92 -92
- package/bundles/bundle-contractFacet.js +1 -1
- package/package.json +14 -14
- package/src/cleanProposal.d.ts.map +1 -1
- package/src/cleanProposal.js +3 -1
- package/src/contractFacet/rightsConservation.js +4 -4
- package/src/contractFacet/zcfSeat.d.ts.map +1 -1
- package/src/contractFacet/zcfSeat.js +7 -4
- package/src/contractSupport/zoeHelpers.d.ts.map +1 -1
- package/src/contractSupport/zoeHelpers.js +4 -5
- package/src/contracts/auction/secondPriceLogic.js +4 -4
- package/src/contracts/autoswap.d.ts.map +1 -1
- package/src/contracts/autoswap.js +3 -1
- package/src/contracts/priceAggregator.js +2 -2
- package/src/issuerStorage.d.ts.map +1 -1
- package/src/issuerStorage.js +3 -1
- package/src/zoeService/escrowStorage.js +2 -2
- package/src/zoeService/instanceAdminStorage.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/zoe",
|
|
3
|
-
"version": "0.26.3-dev-
|
|
3
|
+
"version": "0.26.3-dev-bd50e5e.0+bd50e5e",
|
|
4
4
|
"description": "Zoe: the Smart Contract Framework for Offer Enforcement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/zoeService/zoe.js",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@agoric/base-zone": "0.1.1-dev-
|
|
47
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
48
|
-
"@agoric/internal": "0.3.3-dev-
|
|
49
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
50
|
-
"@agoric/store": "0.9.3-dev-
|
|
51
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
52
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
53
|
-
"@agoric/time": "0.3.3-dev-
|
|
54
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
55
|
-
"@agoric/vow": "0.1.1-dev-
|
|
56
|
-
"@agoric/zone": "0.2.3-dev-
|
|
46
|
+
"@agoric/base-zone": "0.1.1-dev-bd50e5e.0+bd50e5e",
|
|
47
|
+
"@agoric/ertp": "0.16.3-dev-bd50e5e.0+bd50e5e",
|
|
48
|
+
"@agoric/internal": "0.3.3-dev-bd50e5e.0+bd50e5e",
|
|
49
|
+
"@agoric/notifier": "0.6.3-dev-bd50e5e.0+bd50e5e",
|
|
50
|
+
"@agoric/store": "0.9.3-dev-bd50e5e.0+bd50e5e",
|
|
51
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-bd50e5e.0+bd50e5e",
|
|
52
|
+
"@agoric/swingset-vat": "0.32.3-dev-bd50e5e.0+bd50e5e",
|
|
53
|
+
"@agoric/time": "0.3.3-dev-bd50e5e.0+bd50e5e",
|
|
54
|
+
"@agoric/vat-data": "0.5.3-dev-bd50e5e.0+bd50e5e",
|
|
55
|
+
"@agoric/vow": "0.1.1-dev-bd50e5e.0+bd50e5e",
|
|
56
|
+
"@agoric/zone": "0.2.3-dev-bd50e5e.0+bd50e5e",
|
|
57
57
|
"@endo/bundle-source": "^3.2.3",
|
|
58
58
|
"@endo/captp": "^4.2.0",
|
|
59
59
|
"@endo/common": "^1.2.2",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"yargs-parser": "^21.1.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
73
|
+
"@agoric/kmarshal": "0.1.1-dev-bd50e5e.0+bd50e5e",
|
|
74
74
|
"@endo/init": "^1.1.2",
|
|
75
75
|
"ava": "^5.3.0",
|
|
76
76
|
"c8": "^9.1.0",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"typeCoverage": {
|
|
144
144
|
"atLeast": 85
|
|
145
145
|
},
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "bd50e5e0a7ed5ce1da8faf901c28ea4328bbe84c"
|
|
147
147
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AAWA,qCAAsC;AAa/B,sDAYN;AAMM,oDAHI;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GACnB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"cleanProposal.d.ts","sourceRoot":"","sources":["cleanProposal.js"],"names":[],"mappings":"AAWA,qCAAsC;AAa/B,sDAYN;AAMM,oDAHI;IAAC,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GACnB,MAAM,EAAE,CAcpB;AAEM,mJAsBN;AAQM,sEAJI,OAAO,uBACP,GAAC,GACC,mBAAmB,CAa/B;AA4CM,wCAJI,QAAQ,uBACR,mBAAmB,GACjB,cAAc,CA6B1B"}
|
package/src/cleanProposal.js
CHANGED
|
@@ -47,7 +47,9 @@ export const cleanKeywords = uncleanKeywordRecord => {
|
|
|
47
47
|
|
|
48
48
|
// Assert all names are ascii identifiers starting with
|
|
49
49
|
// an upper case letter.
|
|
50
|
-
keywords
|
|
50
|
+
for (const keyword of keywords) {
|
|
51
|
+
assertKeywordName(keyword);
|
|
52
|
+
}
|
|
51
53
|
|
|
52
54
|
return /** @type {string[]} */ (keywords);
|
|
53
55
|
};
|
|
@@ -18,7 +18,7 @@ import '../internal-types.js';
|
|
|
18
18
|
const sumByBrand = amounts => {
|
|
19
19
|
/** @type {MapStore<Brand, Amount>} */
|
|
20
20
|
const sumsByBrand = makeScalarMapStore('brand');
|
|
21
|
-
|
|
21
|
+
for (const amount of amounts) {
|
|
22
22
|
const { brand } = amount;
|
|
23
23
|
if (!sumsByBrand.has(brand)) {
|
|
24
24
|
sumsByBrand.init(brand, amount);
|
|
@@ -26,7 +26,7 @@ const sumByBrand = amounts => {
|
|
|
26
26
|
const sumSoFar = sumsByBrand.get(brand);
|
|
27
27
|
sumsByBrand.set(brand, AmountMath.add(sumSoFar, amount));
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
return sumsByBrand;
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -76,11 +76,11 @@ const assertEqualPerBrand = (leftSumsByBrand, rightSumsByBrand) => {
|
|
|
76
76
|
...rightSumsByBrand.keys(),
|
|
77
77
|
]);
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
for (const brand of allBrands) {
|
|
80
80
|
const { leftSum, rightSum } = getSums(brand);
|
|
81
81
|
AmountMath.isEqual(leftSum, rightSum) ||
|
|
82
82
|
Fail`rights were not conserved for brand ${brand} ${leftSum.value} != ${rightSum.value}`;
|
|
83
|
-
}
|
|
83
|
+
}
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zcfSeat.d.ts","sourceRoot":"","sources":["zcfSeat.js"],"names":[],"mappings":"AAoCO,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,
|
|
1
|
+
{"version":3,"file":"zcfSeat.d.ts","sourceRoot":"","sources":["zcfSeat.js"],"names":[],"mappings":"AAoCO,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"}
|
|
@@ -412,8 +412,10 @@ export const createSeatManager = (
|
|
|
412
412
|
}
|
|
413
413
|
},
|
|
414
414
|
reallocate(/** @type {ZCFSeat[]} */ ...seats) {
|
|
415
|
-
seats
|
|
416
|
-
|
|
415
|
+
for (const seat of seats) {
|
|
416
|
+
assertActive(seat);
|
|
417
|
+
assertStagedAllocation(seat);
|
|
418
|
+
}
|
|
417
419
|
|
|
418
420
|
// Ensure that rights are conserved overall.
|
|
419
421
|
const flattenAllocations = allocations =>
|
|
@@ -458,8 +460,9 @@ export const createSeatManager = (
|
|
|
458
460
|
// for each of the seats) and inform Zoe of the
|
|
459
461
|
// newAllocation.
|
|
460
462
|
|
|
461
|
-
seats
|
|
462
|
-
|
|
463
|
+
for (const seat of seats) {
|
|
464
|
+
commitStagedAllocation(seat);
|
|
465
|
+
}
|
|
463
466
|
const seatHandleAllocations = seats.map(seat => {
|
|
464
467
|
const seatHandle = zcfSeatToSeatHandle.get(seat);
|
|
465
468
|
return { seatHandle, allocation: seat.getCurrentAllocation() };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoeHelpers.d.ts","sourceRoot":"","sources":["zoeHelpers.js"],"names":[],"mappings":"AAUA,iIAAkI;AAI3H,oEAON;AAuBM,+BALI,GAAG,QACH,cAAc,UACd,mBAAmB,GACjB,CAAC,GAAC,CAAC,CAOf;AAED,mBAAmB;AACnB,mBADW,IAAI,CAkBb;AAEF,wBAAwB;AACxB,wBADW,SAAS,CAqBlB;AAiBK,uCAHI,OAAO,iBACP,OAAO,QAIgD;AAsB3D,0CAHI,OAAO,YACP,cAAc,
|
|
1
|
+
{"version":3,"file":"zoeHelpers.d.ts","sourceRoot":"","sources":["zoeHelpers.js"],"names":[],"mappings":"AAUA,iIAAkI;AAI3H,oEAON;AAuBM,+BALI,GAAG,QACH,cAAc,UACd,mBAAmB,GACjB,CAAC,GAAC,CAAC,CAOf;AAED,mBAAmB;AACnB,mBADW,IAAI,CAkBb;AAEF,wBAAwB;AACxB,wBADW,SAAS,CAqBlB;AAiBK,uCAHI,OAAO,iBACP,OAAO,QAIgD;AAsB3D,0CAHI,OAAO,YACP,cAAc,QA8BxB;AAGM,+DAGN;AAED,6EAA8E;AAavE,mCANI,GAAG,iBACH,OAAO,WACP,mBAAmB,YACnB,qBAAqB,GACnB,OAAO,CAAC,MAAM,CAAC,CA8B3B;AAYM,sCALI,GAAG,QACH,OAAO,WACP,mBAAmB,GACjB,OAAO,CAAC,qBAAqB,CAAC,CAQ1C;AAWM,oCAJI,GAAG,wBACH,mBAAmB,4EAgB7B;AAED,0BAA0B;AAC1B,0BADW,WAAW,CAYpB;AAiDK,wBAHe,IAAI,kBACJ,MAAM,uBA/BjB,GAAG,cAGH,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,kBAG9B,oBAAoB,GAAG,SAAS,YAKhC,QAAQ,YAGR,OAAO,+DAUL,OAAO,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAAC,CAAC,CA+D1G;;iBAxVa,MAAM,cAAc;0BACpB,MAAM,UAAU"}
|
|
@@ -136,11 +136,10 @@ export const assertProposalShape = (seat, expected) => {
|
|
|
136
136
|
!Array.isArray(expected) || Fail`Expected must be an non-array object`;
|
|
137
137
|
const assertValuesNull = e => {
|
|
138
138
|
if (e !== undefined) {
|
|
139
|
-
Object.values(e)
|
|
140
|
-
value
|
|
141
|
-
value
|
|
142
|
-
|
|
143
|
-
);
|
|
139
|
+
for (const value of Object.values(e)) {
|
|
140
|
+
value === null ||
|
|
141
|
+
Fail`The value of the expected record must be null but was ${value}`;
|
|
142
|
+
}
|
|
144
143
|
}
|
|
145
144
|
};
|
|
146
145
|
|
|
@@ -20,7 +20,7 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
20
20
|
let highestBidSeat = bidSeats[0];
|
|
21
21
|
let activeBidsCount = 0n;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
for (const bidSeat of bidSeats) {
|
|
24
24
|
if (!bidSeat.hasExited()) {
|
|
25
25
|
activeBidsCount += 1n;
|
|
26
26
|
const bid = bidSeat.getAmountAllocated('Bid', bidBrand);
|
|
@@ -35,7 +35,7 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
35
35
|
secondHighestBid = bid;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
|
|
40
40
|
if (activeBidsCount === 0n) {
|
|
41
41
|
throw sellSeat.fail(Error(`Could not close auction. No bids were active`));
|
|
@@ -59,10 +59,10 @@ export const calcWinnerAndClose = (zcf, sellSeat, bidSeats) => {
|
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
sellSeat.exit();
|
|
62
|
-
|
|
62
|
+
for (const bidSeat of bidSeats) {
|
|
63
63
|
if (!bidSeat.hasExited()) {
|
|
64
64
|
bidSeat.exit();
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
67
|
zcf.shutdown('Auction closed.');
|
|
68
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoswap.d.ts","sourceRoot":"","sources":["autoswap.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,GAAG;;
|
|
1
|
+
{"version":3,"file":"autoswap.d.ts","sourceRoot":"","sources":["autoswap.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,2BAFW,GAAG;;GAwVb"}
|
|
@@ -64,7 +64,9 @@ const start = async zcf => {
|
|
|
64
64
|
// In order to get all the brands, we must call zcf.getTerms() after
|
|
65
65
|
// we create the liquidityIssuer
|
|
66
66
|
const { brands } = zcf.getTerms();
|
|
67
|
-
Object.values(brands)
|
|
67
|
+
for (const brand of Object.values(brands)) {
|
|
68
|
+
assertNatAssetKind(zcf, brand);
|
|
69
|
+
}
|
|
68
70
|
/** @type {Map<Brand,Keyword>} */
|
|
69
71
|
const brandToKeyword = new Map(
|
|
70
72
|
Object.entries(brands).map(([keyword, brand]) => [brand, keyword]),
|
|
@@ -146,11 +146,11 @@ const start = async (zcf, privateArgs) => {
|
|
|
146
146
|
async wake(timestamp) {
|
|
147
147
|
// Run all the queriers.
|
|
148
148
|
const querierPs = [];
|
|
149
|
-
|
|
149
|
+
for (const { querier } of oracleRecords) {
|
|
150
150
|
if (querier) {
|
|
151
151
|
querierPs.push(querier(timestamp));
|
|
152
152
|
}
|
|
153
|
-
}
|
|
153
|
+
}
|
|
154
154
|
if (!querierPs.length) {
|
|
155
155
|
// Only have push results, so publish them.
|
|
156
156
|
// eslint-disable-next-line no-use-before-define
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issuerStorage.d.ts","sourceRoot":"","sources":["issuerStorage.js"],"names":[],"mappings":"AAeO,iDAFI,OAAO,kBAAkB,EAAE,OAAO;2DAwHhC,mBAAmB,KACjB,OAAO,CAAC;QAAE,OAAO,EAAE,mBAAmB,CAAC;QACnD,MAA4B,EAAE,kBAAkB,CAAA;KAAE,CAAC;2BAnDzC,IAAI,CAAC,MAAM,CAAC,KACV,OAAO,CAAC,YAAY,CAAC;sCAzBvB,YAAY,KACV,YAAY;;wBAyFA,CAAC,SAAZ,SAAU,UACb,MAAM,CAAC,CAAC,CAAC,KACP,KAAK,CAAC,CAAC,CAAC;wBASI,CAAC,SAAZ,SAAU,SACb,KAAK,CAAC,CAAC,CAAC,KACN,MAAM,CAAC,CAAC,CAAC;gCASX,MAAM,EAAE,KACN,aAAa;;
|
|
1
|
+
{"version":3,"file":"issuerStorage.d.ts","sourceRoot":"","sources":["issuerStorage.js"],"names":[],"mappings":"AAeO,iDAFI,OAAO,kBAAkB,EAAE,OAAO;2DAwHhC,mBAAmB,KACjB,OAAO,CAAC;QAAE,OAAO,EAAE,mBAAmB,CAAC;QACnD,MAA4B,EAAE,kBAAkB,CAAA;KAAE,CAAC;2BAnDzC,IAAI,CAAC,MAAM,CAAC,KACV,OAAO,CAAC,YAAY,CAAC;sCAzBvB,YAAY,KACV,YAAY;;wBAyFA,CAAC,SAAZ,SAAU,UACb,MAAM,CAAC,CAAC,CAAC,KACP,KAAK,CAAC,CAAC,CAAC;wBASI,CAAC,SAAZ,SAAU,SACb,KAAK,CAAC,CAAC,CAAC,KACN,MAAM,CAAC,CAAC,CAAC;gCASX,MAAM,EAAE,KACN,aAAa;;EA2B3B"}
|
package/src/issuerStorage.js
CHANGED
|
@@ -182,7 +182,9 @@ export const provideIssuerStorage = zcfBaggage => {
|
|
|
182
182
|
if (!zcfBaggage.has(STORAGE_INSTANTIATED_KEY)) {
|
|
183
183
|
zcfBaggage.init(STORAGE_INSTANTIATED_KEY, true);
|
|
184
184
|
instantiated = true;
|
|
185
|
-
issuerRecords
|
|
185
|
+
for (const record of issuerRecords) {
|
|
186
|
+
storeIssuerRecord(record);
|
|
187
|
+
}
|
|
186
188
|
}
|
|
187
189
|
};
|
|
188
190
|
|
|
@@ -80,14 +80,14 @@ export const provideEscrowStorage = baggage => {
|
|
|
80
80
|
// Assert that all of the payment keywords are present in the give
|
|
81
81
|
// keywords. Proposal.give keywords that do not have matching payments will
|
|
82
82
|
// be caught in the deposit step.
|
|
83
|
-
|
|
83
|
+
for (const keyword of paymentKeywords) {
|
|
84
84
|
giveKeywords.includes(keyword) ||
|
|
85
85
|
Fail`The ${q(
|
|
86
86
|
keyword,
|
|
87
87
|
)} keyword in the paymentKeywordRecord was not a keyword in proposal.give, which had keywords: ${q(
|
|
88
88
|
giveKeywords,
|
|
89
89
|
)}`;
|
|
90
|
-
}
|
|
90
|
+
}
|
|
91
91
|
|
|
92
92
|
// If any of these deposits hang or fail, then this `await` also
|
|
93
93
|
// hangs or fails, the offer does not succeed, and any funds that
|
|
@@ -138,15 +138,15 @@ const makeInstanceAdminBehavior = (zoeBaggage, makeZoeSeatAdminKit) => {
|
|
|
138
138
|
},
|
|
139
139
|
exitAllSeats: ({ state }, completion) => {
|
|
140
140
|
state.acceptingOffers = false;
|
|
141
|
-
|
|
142
|
-
zoeSeatAdmin.exit(completion)
|
|
143
|
-
|
|
141
|
+
for (const zoeSeatAdmin of state.zoeSeatAdmins.keys()) {
|
|
142
|
+
zoeSeatAdmin.exit(completion);
|
|
143
|
+
}
|
|
144
144
|
},
|
|
145
145
|
failAllSeats: ({ state }, reason) => {
|
|
146
146
|
state.acceptingOffers = false;
|
|
147
|
-
|
|
148
|
-
zoeSeatAdmin.fail(reason)
|
|
149
|
-
|
|
147
|
+
for (const zoeSeatAdmin of state.zoeSeatAdmins.keys()) {
|
|
148
|
+
zoeSeatAdmin.fail(reason);
|
|
149
|
+
}
|
|
150
150
|
},
|
|
151
151
|
stopAcceptingOffers: ({ state }) => {
|
|
152
152
|
state.acceptingOffers = false;
|