Skip to content

Commit

Permalink
feat: puppetGovernor pass the Issuerkeywordrecord through (#8351)
Browse files Browse the repository at this point in the history
closes: #8350
  • Loading branch information
Chris-Hibbert authored Sep 19, 2023
1 parent 376236d commit 9f89f97
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions packages/governance/test/unitTests/test-puppetContractGovernor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import buildManualTimer from '@agoric/zoe/tools/manualTimer.js';
import bundleSource from '@endo/bundle-source';
import { E } from '@endo/eventual-send';
import { resolve as importMetaResolve } from 'import-meta-resolve';
import { AssetKind, makeIssuerKit } from '@agoric/ertp';

import { CONTRACT_ELECTORATE, ParamTypes } from '../../src/index.js';
import { setUpGovernedContract } from '../../tools/puppetGovernance.js';
Expand Down Expand Up @@ -158,3 +159,20 @@ test('call API directly', async t => {
1,
);
});

test('add issuerKeywordRecord', async t => {
const zoe = await makeZoeForTest();
const issuerKit = makeIssuerKit('Food', AssetKind.COPY_BAG);
const timer = buildManualTimer(t.log);
const { governorFacets } = await setUpGovernedContract(
zoe,
E(zoe).install(governedBundleP),
timer,
governedTerms,
{},
{ Food: issuerKit.issuer },
);

const instance = await E(governorFacets.creatorFacet).getInstance();
t.deepEqual(await E(zoe).getIssuers(instance), { Food: issuerKit.issuer });
});
4 changes: 3 additions & 1 deletion packages/governance/tools/puppetGovernance.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ const autoRefundBundleP = makeBundle(
* @param {import('@agoric/swingset-vat/src/vats/timer/vat-timer.js').TimerService} timer
* @param {{ [k: string]: any, governedParams?: Record<string, unknown>, governedApis?: string[] }} termsOfGoverned
* @param {{}} privateArgsOfGoverned
* @param {IssuerKeywordRecord} [issuerKeywordRecord]
*/
export const setUpGovernedContract = async (
zoe,
governedP,
timer,
termsOfGoverned = {},
privateArgsOfGoverned = {},
issuerKeywordRecord = {},
) => {
const [contractGovernorBundle, autoRefundBundle] = await Promise.all([
contractGovernorBundleP,
Expand Down Expand Up @@ -85,7 +87,7 @@ export const setUpGovernedContract = async (
governedContractInstallation: governed,
governed: {
terms: governedTermsWithElectorate,
issuerKeywordRecord: {},
issuerKeywordRecord,
},
};

Expand Down

0 comments on commit 9f89f97

Please sign in to comment.