Skip to content

Commit 3c9eef2

Browse files
dckcmichaelfig
authored andcommitted
feat(vats): put RUN, BLD issuer, brand in agoricNames
1 parent ee4e2fb commit 3c9eef2

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

packages/vats/decentral-core-config.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,8 @@
7070
},
7171
"makeBLDKit": {
7272
"consume": {
73-
"bankManager": true
74-
},
75-
"produce": {
76-
"BLDKit": true
73+
"bankManager": true,
74+
"nameAdmins": true
7775
}
7876
}
7977
}

packages/vats/src/core/behaviors.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const makeVatsFromBundles = ({
8484
* consume: {
8585
* vatAdminSvc: ERef<VatAdminSvc>,
8686
* loadVat: ERef<VatLoader<ZoeVat>>,
87+
* nameAdmins: ERef<Record<string, NameAdmin>>,
8788
* client: ERef<ClientConfig>
8889
* },
8990
* produce: { zoe: Producer<ZoeService>, feeMintAccess: Producer<FeeMintAccess> },
@@ -92,14 +93,19 @@ const makeVatsFromBundles = ({
9293
* @typedef {ERef<ReturnType<import('../vat-zoe.js').buildRootObject>>} ZoeVat
9394
*/
9495
const buildZoe = async ({
95-
consume: { vatAdminSvc, loadVat, client },
96+
consume: { vatAdminSvc, loadVat, client, nameAdmins },
9697
produce: { zoe, feeMintAccess },
9798
}) => {
9899
const { zoeService, feeMintAccess: fma } = await E(
99100
E(loadVat)('zoe'),
100101
).buildZoe(vatAdminSvc, feeIssuerConfig);
101102

102103
zoe.resolve(zoeService);
104+
const runIssuer = await E(zoeService).getFeeIssuer();
105+
const runBrand = await E(runIssuer).getBrand();
106+
E(E(nameAdmins).get('issuer')).update('RUN', runIssuer);
107+
E(E(nameAdmins).get('brand')).update('RUN', runBrand);
108+
103109
feeMintAccess.resolve(fma);
104110
E(client).assignBundle({ zoe: _addr => zoeService });
105111
};
@@ -158,6 +164,9 @@ const makeAddressNameHubs = async ({ consume: { client }, produce }) => {
158164
if (nm === 'uiConfig') {
159165
// Reserve the Vault Factory's config until we've populated it.
160166
nameAdmin.reserve('vaultFactory');
167+
} else if (['issuer', 'brand'].includes(nm)) {
168+
nameAdmin.reserve('BLD');
169+
nameAdmin.reserve('RUN');
161170
}
162171
},
163172
),
@@ -254,24 +263,21 @@ const makeClientBanks = async ({
254263
/**
255264
* @param {{
256265
* consume: {
257-
* bankManager: Promise<BankManager>
266+
* bankManager: Promise<BankManager>,
267+
* nameAdmins: Promise<Record<string, NameAdmin>>,
258268
* },
259-
* produce: {
260-
* BLDKit: Producer<{ brand: Brand, issuer: Issuer }>
261-
* }
262269
* }} powers
263270
* @typedef {*} BankManager // TODO
264271
*/
265-
const makeBLDKit = async ({
266-
consume: { bankManager },
267-
produce: { BLDKit },
268-
}) => {
272+
const makeBLDKit = async ({ consume: { bankManager, nameAdmins } }) => {
269273
const [issuerName, { bankDenom, bankPurse, issuerArgs }] = BLD_ISSUER_ENTRY;
270274
assert(issuerArgs);
271275
const kit = makeIssuerKit(issuerName, ...issuerArgs); // TODO: should this live in another vat???
272276
await E(bankManager).addAsset(bankDenom, issuerName, bankPurse, kit);
277+
// How to be clear that this "kit" has no mint? Do we have a name for brand and issuer?
273278
const { brand, issuer } = kit;
274-
BLDKit.resolve({ brand, issuer });
279+
E(E(nameAdmins).get('issuer')).update('BLD', issuer);
280+
E(E(nameAdmins).get('brand')).update('BLD', brand);
275281
};
276282

277283
/**

0 commit comments

Comments
 (0)