@@ -212,6 +212,7 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
212
212
const makeInstanceAdmin = ( ) => {
213
213
/** @type {Set<ZoeSeatAdmin> } */
214
214
const zoeSeatAdmins = new Set ( ) ;
215
+ let hasShutdown = false ;
215
216
216
217
/** @type {InstanceAdmin } */
217
218
return {
@@ -234,8 +235,11 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
234
235
getIssuers : ( ) => instanceRecord . terms . issuers ,
235
236
getBrands : ( ) => instanceRecord . terms . brands ,
236
237
getInstance : ( ) => instance ,
237
- exitAllSeats : ( ) =>
238
- zoeSeatAdmins . forEach ( zoeSeatAdmin => zoeSeatAdmin . exit ( ) ) ,
238
+ hasShutdown : ( ) => hasShutdown ,
239
+ shutdown : ( ) => {
240
+ hasShutdown = true ;
241
+ zoeSeatAdmins . forEach ( zoeSeatAdmin => zoeSeatAdmin . exit ( ) ) ;
242
+ } ,
239
243
} ;
240
244
} ;
241
245
@@ -246,8 +250,8 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
246
250
E ( adminNode )
247
251
. done ( )
248
252
. then (
249
- ( ) => instanceAdmin . exitAllSeats ( ) ,
250
- ( ) => instanceAdmin . exitAllSeats ( ) ,
253
+ ( ) => instanceAdmin . shutdown ( ) ,
254
+ ( ) => instanceAdmin . shutdown ( ) ,
251
255
) ;
252
256
253
257
// Unpack the invitationKit.
@@ -303,7 +307,7 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
303
307
return { userSeat, notifier, zoeSeatAdmin } ;
304
308
} ,
305
309
shutdown : ( ) => {
306
- instanceAdmin . exitAllSeats ( ) ;
310
+ instanceAdmin . shutdown ( ) ;
307
311
E ( adminNode ) . terminate ( ) ;
308
312
} ,
309
313
makeZoeMint,
@@ -368,6 +372,11 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
368
372
invitationAmount . value . length === 1 ,
369
373
'Only one invitation can be redeemed at a time' ,
370
374
) ;
375
+ const {
376
+ value : [ { instance, handle : invitationHandle } ] ,
377
+ } = invitationAmount ;
378
+ const instanceAdmin = instanceToInstanceAdmin . get ( instance ) ;
379
+ assert ( ! instanceAdmin . hasShutdown ( ) , `No further offers are accepted` ) ;
371
380
372
381
const proposal = cleanProposal ( getAmountMath , uncleanProposal ) ;
373
382
const { give, want } = proposal ;
@@ -390,9 +399,6 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
390
399
return getAmountMath ( proposal . want [ keyword ] . brand ) . getEmpty ( ) ;
391
400
}
392
401
} ) ;
393
- const {
394
- value : [ { instance, handle : invitationHandle } ] ,
395
- } = invitationAmount ;
396
402
397
403
return Promise . all ( paymentDepositedPs ) . then ( amountsArray => {
398
404
const initialAllocation = arrayToObj ( amountsArray , proposalKeywords ) ;
@@ -403,7 +409,6 @@ function makeZoe(vatAdminSvc, zcfBundleName = undefined) {
403
409
const exitObjPromiseKit = makePromiseKit ( ) ;
404
410
// Don't trigger Node.js's UnhandledPromiseRejectionWarning
405
411
exitObjPromiseKit . promise . catch ( _ => { } ) ;
406
- const instanceAdmin = instanceToInstanceAdmin . get ( instance ) ;
407
412
const seatHandle = makeHandle ( 'SeatHandle' ) ;
408
413
409
414
const { userSeat, notifier, zoeSeatAdmin } = makeZoeSeatAdminKit (
0 commit comments