@@ -15,35 +15,47 @@ const trace = makeTracer('NewAuction', true);
15
15
/**
16
16
* @param {import('./econ-behaviors.js').EconomyBootstrapPowers &
17
17
* interlockPowers} powers
18
+ * @param {{ options: { auctionsRef: { bundleID: string } } } } options
18
19
*/
19
- export const addAuction = async ( {
20
- consume : {
21
- zoe,
22
- board,
23
- chainTimerService,
24
- priceAuthority,
25
- chainStorage,
26
- economicCommitteeCreatorFacet : electorateCreatorFacet ,
27
- auctioneerKit : legacyKitP ,
28
- } ,
29
- produce : { newAuctioneerKit, auctionsUpgradeComplete } ,
30
- instance : {
31
- consume : { reserve : reserveInstance } ,
32
- } ,
33
- installation : {
20
+ export const addAuction = async (
21
+ {
34
22
consume : {
35
- auctioneer : auctionInstallation ,
36
- contractGovernor : contractGovernorInstallation ,
23
+ zoe,
24
+ board,
25
+ chainTimerService,
26
+ priceAuthority,
27
+ chainStorage,
28
+ economicCommitteeCreatorFacet : electorateCreatorFacet ,
29
+ auctioneerKit : legacyKitP ,
30
+ } ,
31
+ produce : { auctioneerKit : produceAuctioneerKit , auctionsUpgradeComplete } ,
32
+ instance : {
33
+ consume : { reserve : reserveInstance } ,
34
+ } ,
35
+ installation : {
36
+ consume : { contractGovernor : contractGovernorInstallation } ,
37
+ produce : { auctioneer : produceInstallation } ,
38
+ } ,
39
+ issuer : {
40
+ consume : { [ Stable . symbol ] : stableIssuerP } ,
37
41
} ,
38
42
} ,
39
- issuer : {
40
- consume : { [ Stable . symbol ] : stableIssuerP } ,
41
- } ,
42
- } ) => {
43
- trace ( 'addAuction start' ) ;
43
+ { options } ,
44
+ ) => {
45
+ trace ( 'addAuction start' , options ) ;
44
46
const STORAGE_PATH = 'auction' ;
47
+ const { auctionsRef } = options ;
45
48
46
49
const poserInvitationP = E ( electorateCreatorFacet ) . getPoserInvitation ( ) ;
50
+ const bundleID = auctionsRef . bundleID ;
51
+ /**
52
+ * @type {Promise<
53
+ * Installation<import('../../src/auction/auctioneer.js')['start']>
54
+ * >}
55
+ */
56
+ const installationP = E ( zoe ) . installBundleID ( bundleID ) ;
57
+ produceInstallation . reset ( ) ;
58
+ produceInstallation . resolve ( installationP ) ;
47
59
48
60
const [
49
61
initialPoserInvitation ,
@@ -89,10 +101,12 @@ export const addAuction = async ({
89
101
} ,
90
102
) ;
91
103
104
+ const installation = await installationP ;
105
+
92
106
const governorTerms = await deeplyFulfilledObject (
93
107
harden ( {
94
108
timer : chainTimerService ,
95
- governedContractInstallation : auctionInstallation ,
109
+ governedContractInstallation : installation ,
96
110
governed : {
97
111
terms : auctionTerms ,
98
112
issuerKeywordRecord : { Bid : stableIssuer } ,
@@ -103,7 +117,7 @@ export const addAuction = async ({
103
117
} ) ,
104
118
) ;
105
119
106
- /** @type {GovernorStartedInstallationKit<typeof auctionInstallation > } */
120
+ /** @type {GovernorStartedInstallationKit<typeof installationP > } */
107
121
const governorStartResult = await E ( zoe ) . startInstance (
108
122
contractGovernorInstallation ,
109
123
undefined ,
@@ -137,7 +151,8 @@ export const addAuction = async ({
137
151
) ,
138
152
) ;
139
153
140
- newAuctioneerKit . resolve (
154
+ produceAuctioneerKit . reset ( ) ;
155
+ produceAuctioneerKit . resolve (
141
156
harden ( {
142
157
label : 'auctioneer' ,
143
158
creatorFacet : governedCreatorFacet ,
@@ -168,25 +183,33 @@ export const ADD_AUCTION_MANIFEST = harden({
168
183
auctioneerKit : true ,
169
184
} ,
170
185
produce : {
171
- newAuctioneerKit : true ,
186
+ auctioneerKit : true ,
172
187
auctionsUpgradeComplete : true ,
173
188
} ,
174
189
instance : {
175
190
consume : { reserve : true } ,
176
191
} ,
177
192
installation : {
178
193
consume : {
179
- auctioneer : true ,
180
194
contractGovernor : true ,
181
195
} ,
196
+ produce : { auctioneer : true } ,
182
197
} ,
183
198
issuer : {
184
199
consume : { [ Stable . symbol ] : true } ,
185
200
} ,
186
201
} ,
187
202
} ) ;
188
203
189
- /* Add a new auction to a chain that already has one. */
190
- export const getManifestForAddAuction = async ( ) => {
191
- return { manifest : ADD_AUCTION_MANIFEST } ;
204
+ /**
205
+ * Add a new auction to a chain that already has one.
206
+ *
207
+ * @param {object } _ign
208
+ * @param {any } addAuctionOptions
209
+ */
210
+ export const getManifestForAddAuction = async ( _ign , addAuctionOptions ) => {
211
+ return {
212
+ manifest : ADD_AUCTION_MANIFEST ,
213
+ options : addAuctionOptions ,
214
+ } ;
192
215
} ;
0 commit comments