@agoric/builders 0.1.1-upgrade-18-dev-6ddbef0.0 → 0.1.1-upgrade-19-dev-2a71f04.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.
Files changed (33) hide show
  1. package/package.json +31 -29
  2. package/scripts/fast-usdc/add-operators.build.js +83 -0
  3. package/scripts/fast-usdc/fast-usdc-fees.build.js +75 -0
  4. package/scripts/fast-usdc/fast-usdc-update.build.js +65 -0
  5. package/scripts/fast-usdc/start-fast-usdc.build.js +207 -0
  6. package/scripts/inter-protocol/replace-feeDistributor-combo.js +82 -0
  7. package/scripts/inter-protocol/replace-feeDistributor.js +36 -0
  8. package/scripts/inter-protocol/updatePriceFeeds.js +11 -1
  9. package/scripts/orchestration/init-basic-flows.js +42 -2
  10. package/scripts/testing/add-USD-LEMONS.js +19 -0
  11. package/scripts/testing/add-USD-OLIVES.js +19 -0
  12. package/scripts/testing/init-auto-stake-it.js +73 -0
  13. package/scripts/testing/init-send-anywhere.js +67 -0
  14. package/scripts/testing/provokeBOYD.js +54 -0
  15. package/scripts/testing/publish-test-info.js +79 -0
  16. package/scripts/testing/recorded-retired-instances.js +81 -0
  17. package/scripts/testing/register-interchain-bank-assets.js +199 -0
  18. package/scripts/testing/replace-feeDistributor-short.js +33 -0
  19. package/scripts/testing/test-upgraded-board.js +15 -0
  20. package/scripts/testing/{fix-buggy-sendAnywhere.js → upgrade-send-anywhere.js} +14 -18
  21. package/scripts/testing/upgrade-vaultFactory.js +21 -0
  22. package/scripts/vats/terminate-governor-instance.js +134 -0
  23. package/scripts/vats/upgrade-agoricNames.js +21 -0
  24. package/scripts/vats/upgrade-asset-reserve.js +21 -0
  25. package/scripts/vats/upgrade-bank.js +2 -2
  26. package/scripts/vats/upgrade-board.js +20 -0
  27. package/scripts/vats/upgrade-mintHolder.js +105 -0
  28. package/scripts/vats/{upgrade-orch-core.js → upgrade-orchestration.js} +5 -2
  29. package/scripts/vats/upgrade-paRegistry.js +21 -0
  30. package/scripts/vats/upgrade-psm.js +19 -0
  31. package/scripts/testing/start-auto-stake-it.js +0 -128
  32. package/scripts/testing/start-buggy-sendAnywhere.js +0 -143
  33. package/scripts/testing/start-send-anywhere.js +0 -136
@@ -1,8 +1,22 @@
1
1
  import { makeHelpers } from '@agoric/deploy-script-support';
2
2
  import { startBasicFlows } from '@agoric/orchestration/src/proposals/start-basic-flows.js';
3
+ import { parseArgs } from 'node:util';
4
+
5
+ /**
6
+ * @import {ParseArgsConfig} from 'node:util'
7
+ */
8
+
9
+ /** @type {ParseArgsConfig['options']} */
10
+ const parserOpts = {
11
+ chainInfo: { type: 'string' },
12
+ assetInfo: { type: 'string' },
13
+ };
3
14
 
4
15
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
5
- export const defaultProposalBuilder = async ({ publishRef, install }) => {
16
+ export const defaultProposalBuilder = async (
17
+ { publishRef, install },
18
+ options,
19
+ ) => {
6
20
  return harden({
7
21
  sourceSpec: '@agoric/orchestration/src/proposals/start-basic-flows.js',
8
22
  getManifestCall: [
@@ -15,6 +29,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
15
29
  ),
16
30
  ),
17
31
  },
32
+ options,
18
33
  },
19
34
  ],
20
35
  });
@@ -22,6 +37,31 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
22
37
 
23
38
  /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
24
39
  export default async (homeP, endowments) => {
40
+ const { scriptArgs } = endowments;
41
+
42
+ const {
43
+ values: { chainInfo, assetInfo },
44
+ } = parseArgs({
45
+ args: scriptArgs,
46
+ options: parserOpts,
47
+ });
48
+
49
+ const parseChainInfo = () => {
50
+ if (typeof chainInfo !== 'string') return undefined;
51
+ return JSON.parse(chainInfo);
52
+ };
53
+ const parseAssetInfo = () => {
54
+ if (typeof assetInfo !== 'string') return undefined;
55
+ return JSON.parse(assetInfo);
56
+ };
57
+ const opts = harden({
58
+ chainInfo: parseChainInfo(),
59
+ assetInfo: parseAssetInfo(),
60
+ });
61
+
25
62
  const { writeCoreEval } = await makeHelpers(homeP, endowments);
26
- await writeCoreEval(startBasicFlows.name, defaultProposalBuilder);
63
+
64
+ await writeCoreEval(startBasicFlows.name, utils =>
65
+ defaultProposalBuilder(utils, opts),
66
+ );
27
67
  };
@@ -0,0 +1,19 @@
1
+ import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { psmProposalBuilder } from '../inter-protocol/add-collateral-core.js';
3
+
4
+ const addUsdLemonsProposalBuilder = async powers => {
5
+ return psmProposalBuilder(powers, {
6
+ anchorOptions: {
7
+ denom: 'ibc/000C0AAAEECAFE000',
8
+ keyword: 'USD_LEMONS',
9
+ decimalPlaces: 6,
10
+ proposedName: 'USD_LEMONS',
11
+ },
12
+ });
13
+ };
14
+
15
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
16
+ export default async (homeP, endowments) => {
17
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
18
+ await writeCoreEval('add-LEMONS-PSM', addUsdLemonsProposalBuilder);
19
+ };
@@ -0,0 +1,19 @@
1
+ import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { psmProposalBuilder } from '../inter-protocol/add-collateral-core.js';
3
+
4
+ const addUsdOlivesProposalBuilder = async powers => {
5
+ return psmProposalBuilder(powers, {
6
+ anchorOptions: {
7
+ denom: 'ibc/000C0AAAEECAFE111',
8
+ keyword: 'USD_OLIVES',
9
+ decimalPlaces: 6,
10
+ proposedName: 'USD_OLIVES',
11
+ },
12
+ });
13
+ };
14
+
15
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
16
+ export default async (homeP, endowments) => {
17
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
18
+ await writeCoreEval('add-OLIVES-PSM', addUsdOlivesProposalBuilder);
19
+ };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @file A proposal to start the auto-stake-it contract.
3
+ *
4
+ * AutoStakeIt allows users to to create an auto-forwarding address that
5
+ * transfers and stakes tokens on a remote chain when received.
6
+ */
7
+ import { makeHelpers } from '@agoric/deploy-script-support';
8
+ import { startAutoStakeIt } from '@agoric/orchestration/src/proposals/start-auto-stake-it.js';
9
+ import { parseArgs } from 'node:util';
10
+
11
+ /**
12
+ * @import {ParseArgsConfig} from 'node:util'
13
+ */
14
+
15
+ /** @type {ParseArgsConfig['options']} */
16
+ const parserOpts = {
17
+ chainInfo: { type: 'string' },
18
+ assetInfo: { type: 'string' },
19
+ };
20
+
21
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
22
+ export const defaultProposalBuilder = async (
23
+ { publishRef, install },
24
+ options,
25
+ ) => {
26
+ return harden({
27
+ sourceSpec: '@agoric/orchestration/src/proposals/start-auto-stake-it.js',
28
+ getManifestCall: [
29
+ 'getManifest',
30
+ {
31
+ installKeys: {
32
+ autoAutoStakeIt: publishRef(
33
+ install(
34
+ '@agoric/orchestration/src/examples/auto-stake-it.contract.js',
35
+ ),
36
+ ),
37
+ },
38
+ options,
39
+ },
40
+ ],
41
+ });
42
+ };
43
+
44
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
45
+ export default async (homeP, endowments) => {
46
+ const { scriptArgs } = endowments;
47
+
48
+ const {
49
+ values: { chainInfo, assetInfo },
50
+ } = parseArgs({
51
+ args: scriptArgs,
52
+ options: parserOpts,
53
+ });
54
+
55
+ const parseChainInfo = () => {
56
+ if (typeof chainInfo !== 'string') return undefined;
57
+ return JSON.parse(chainInfo);
58
+ };
59
+ const parseAssetInfo = () => {
60
+ if (typeof assetInfo !== 'string') return undefined;
61
+ return JSON.parse(assetInfo);
62
+ };
63
+ const opts = harden({
64
+ chainInfo: parseChainInfo(),
65
+ assetInfo: parseAssetInfo(),
66
+ });
67
+
68
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
69
+
70
+ await writeCoreEval(startAutoStakeIt.name, utils =>
71
+ defaultProposalBuilder(utils, opts),
72
+ );
73
+ };
@@ -0,0 +1,67 @@
1
+ import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import {
3
+ getManifest,
4
+ startSendAnywhere,
5
+ } from '@agoric/orchestration/src/proposals/start-send-anywhere.js';
6
+ import { parseArgs } from 'node:util';
7
+
8
+ /**
9
+ * @import {ParseArgsConfig} from 'node:util'
10
+ */
11
+
12
+ /** @type {ParseArgsConfig['options']} */
13
+ const parserOpts = {
14
+ chainInfo: { type: 'string' },
15
+ assetInfo: { type: 'string' },
16
+ };
17
+
18
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
19
+ export const defaultProposalBuilder = async (
20
+ { publishRef, install },
21
+ options,
22
+ ) =>
23
+ harden({
24
+ sourceSpec: '@agoric/orchestration/src/proposals/start-send-anywhere.js',
25
+ getManifestCall: [
26
+ getManifest.name,
27
+ {
28
+ installationRef: publishRef(
29
+ install(
30
+ '@agoric/orchestration/src/examples/send-anywhere.contract.js',
31
+ ),
32
+ ),
33
+ options,
34
+ },
35
+ ],
36
+ });
37
+
38
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
39
+ export default async (homeP, endowments) => {
40
+ const { scriptArgs } = endowments;
41
+
42
+ const {
43
+ values: { chainInfo, assetInfo },
44
+ } = parseArgs({
45
+ args: scriptArgs,
46
+ options: parserOpts,
47
+ });
48
+
49
+ const parseChainInfo = () => {
50
+ if (typeof chainInfo !== 'string') return undefined;
51
+ return JSON.parse(chainInfo);
52
+ };
53
+ const parseAssetInfo = () => {
54
+ if (typeof assetInfo !== 'string') return undefined;
55
+ return JSON.parse(assetInfo);
56
+ };
57
+ const opts = harden({
58
+ chainInfo: parseChainInfo(),
59
+ assetInfo: parseAssetInfo(),
60
+ });
61
+
62
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
63
+
64
+ await writeCoreEval(startSendAnywhere.name, utils =>
65
+ defaultProposalBuilder(utils, opts),
66
+ );
67
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @file call getTimerBrand() 300 times in hopes of provoking BOYD. This is
3
+ * intended for tests on mainFork for upgrade-18. If there's a similar need in
4
+ * other tests, it can be included there as well. There would be no value in
5
+ * including it in an upgrade of MainNet; it just spins cycles to provoke
6
+ * garbage collection.
7
+ */
8
+
9
+ import { makeTracer } from '@agoric/internal';
10
+ import { E } from '@endo/far';
11
+
12
+ /// <reference types="@agoric/vats/src/core/types-ambient"/>
13
+ /** @import {Instance} from '@agoric/zoe/src/zoeService/utils.js'; */
14
+
15
+ const trace = makeTracer('provokeBOYD', true);
16
+
17
+ /**
18
+ * @param {BootstrapPowers} powers
19
+ */
20
+ export const provokeBOYD = async ({ consume: { chainTimerService } }) => {
21
+ trace(provokeBOYD.name);
22
+ await null;
23
+
24
+ for (let i = 0; i < 300; i += 1) {
25
+ await E(chainTimerService).getTimerBrand();
26
+ }
27
+ trace('done');
28
+ };
29
+ harden(provokeBOYD);
30
+
31
+ export const getManifestForProvokeBOYD = () => {
32
+ return {
33
+ manifest: {
34
+ [provokeBOYD.name]: {
35
+ consume: { chainTimerService: true },
36
+ },
37
+ },
38
+ };
39
+ };
40
+
41
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
42
+ export const defaultProposalBuilder = async () =>
43
+ harden({
44
+ sourceSpec: '@agoric/builders/scripts/testing/provokeBOYD.js',
45
+ getManifestCall: ['getManifestForProvokeBOYD'],
46
+ });
47
+
48
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
49
+ export default async (homeP, endowments) => {
50
+ const dspModule = await import('@agoric/deploy-script-support');
51
+ const { makeHelpers } = dspModule;
52
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
53
+ await writeCoreEval(provokeBOYD.name, defaultProposalBuilder);
54
+ };
@@ -0,0 +1,79 @@
1
+ import { makeTracer } from '@agoric/internal';
2
+ import { E, Far } from '@endo/far';
3
+ import { makeMarshal } from '@endo/marshal';
4
+
5
+ const trace = makeTracer('PublishTestInfo');
6
+ const { Fail } = assert;
7
+
8
+ /**
9
+ * @param {BootstrapPowers} powers
10
+ */
11
+ export const publishTestInfo = async powers => {
12
+ const {
13
+ consume: { agoricNamesAdmin, chainStorage: chainStorageP },
14
+ } = powers;
15
+
16
+ const chainStorage = await chainStorageP;
17
+ if (!chainStorage) {
18
+ trace('no chain storage, not registering chain info');
19
+ return;
20
+ }
21
+
22
+ trace('publishing testInfo');
23
+ const agoricNamesNode = E(chainStorage).makeChildNode('agoricNames');
24
+ const testInfoNode = E(agoricNamesNode).makeChildNode('testInfo');
25
+ const { nameAdmin } = await E(agoricNamesAdmin).provideChild('testInfo');
26
+
27
+ trace('registering onUpdate...');
28
+ await E(nameAdmin).onUpdate(
29
+ Far('chain info writer', {
30
+ write(entries) {
31
+ const marshalData = makeMarshal(_val => Fail`data only`);
32
+ const value = JSON.stringify(marshalData.toCapData(entries));
33
+ void E(testInfoNode)
34
+ .setValue(value)
35
+ .catch(() =>
36
+ console.log('cannot update vstorage after write to testInfo'),
37
+ );
38
+ },
39
+ }),
40
+ );
41
+
42
+ trace('writing to testInfo...');
43
+ await E(nameAdmin).update('agoric', {
44
+ isAwesome: 'yes',
45
+ tech: ['HardenedJs', 'Orchestration', 'Async_Execution'],
46
+ });
47
+
48
+ trace('Done.');
49
+ };
50
+
51
+ export const getManifestForPublishTestInfo = () => {
52
+ return {
53
+ manifest: {
54
+ [publishTestInfo.name]: {
55
+ consume: {
56
+ agoricNamesAdmin: true,
57
+ chainStorage: true,
58
+ },
59
+ },
60
+ },
61
+ };
62
+ };
63
+
64
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
65
+ export const defaultProposalBuilder = async () =>
66
+ harden({
67
+ // Somewhat unorthodox, source the exports from this builder module
68
+ sourceSpec: '@agoric/builders/scripts/testing/publish-test-info.js',
69
+ getManifestCall: ['getManifestForPublishTestInfo'],
70
+ });
71
+
72
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
73
+ export default async (homeP, endowments) => {
74
+ // import dynamically so the module can work in CoreEval environment
75
+ const dspModule = await import('@agoric/deploy-script-support');
76
+ const { makeHelpers } = dspModule;
77
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
78
+ await writeCoreEval('publish-test-info', defaultProposalBuilder);
79
+ };
@@ -0,0 +1,81 @@
1
+ import { makeTracer } from '@agoric/internal';
2
+ import { E } from '@endo/far';
3
+
4
+ const trace = makeTracer('RecordedRetired', true);
5
+
6
+ /**
7
+ * @param {BootstrapPowers &
8
+ * PromiseSpaceOf<{ retiredContractInstances: MapStore<string, Instance>;
9
+ * }>
10
+ * } powers
11
+ */
12
+ export const testRecordedRetiredInstances = async ({
13
+ consume: {
14
+ contractKits,
15
+ governedContractKits,
16
+ retiredContractInstances: retiredContractInstancesP,
17
+ },
18
+ }) => {
19
+ trace('Start');
20
+ const retiredContractInstances = await retiredContractInstancesP;
21
+
22
+ const auctionIDs = Array.from(retiredContractInstances.keys()).filter(k =>
23
+ k.startsWith('auction'),
24
+ );
25
+ assert(auctionIDs);
26
+ assert(auctionIDs.length === 1);
27
+ const auctionInstance = retiredContractInstances.get(auctionIDs[0]);
28
+ trace({ auctionInstance });
29
+ assert(await E(governedContractKits).get(auctionInstance));
30
+
31
+ const committeeIDs = Array.from(retiredContractInstances.keys()).filter(k =>
32
+ k.startsWith('economicCommittee'),
33
+ );
34
+ assert(committeeIDs);
35
+ assert(committeeIDs.length === 1);
36
+ trace('found committeeIDs', committeeIDs);
37
+
38
+ const committeeInstance = retiredContractInstances.get(committeeIDs[0]);
39
+ assert(await E(contractKits).get(committeeInstance));
40
+
41
+ const charterIDs = [...retiredContractInstances.keys()].filter(k =>
42
+ k.startsWith('econCommitteeCharter'),
43
+ );
44
+ assert(charterIDs);
45
+ assert(charterIDs.length === 1);
46
+ trace('found charterID', charterIDs);
47
+
48
+ trace('done');
49
+ };
50
+ harden(testRecordedRetiredInstances);
51
+
52
+ export const getManifestForRecordedRetiredInstances = () => {
53
+ return {
54
+ manifest: {
55
+ [testRecordedRetiredInstances.name]: {
56
+ consume: {
57
+ contractKits: true,
58
+ governedContractKits: true,
59
+ retiredContractInstances: true,
60
+ },
61
+ },
62
+ },
63
+ };
64
+ };
65
+
66
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
67
+ export const defaultProposalBuilder = async () =>
68
+ harden({
69
+ sourceSpec:
70
+ '@agoric/builders/scripts/testing/recorded-retired-instances.js',
71
+ getManifestCall: ['getManifestForRecordedRetiredInstances', {}],
72
+ });
73
+
74
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
75
+ export default async (homeP, endowments) => {
76
+ // import dynamically so the module can work in CoreEval environment
77
+ const dspModule = await import('@agoric/deploy-script-support');
78
+ const { makeHelpers } = dspModule;
79
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
80
+ await writeCoreEval('recorded-retired', defaultProposalBuilder);
81
+ };
@@ -0,0 +1,199 @@
1
+ /**
2
+ * @file register-interchain-bank-assets.js Core Eval
3
+ *
4
+ * Used to populate vbank in testing environments.
5
+ */
6
+ import { AssetKind } from '@agoric/ertp';
7
+ import { makeTracer } from '@agoric/internal';
8
+ import { E } from '@endo/far';
9
+ import { makeMarshal } from '@endo/marshal';
10
+
11
+ const { Fail } = assert;
12
+
13
+ const trace = makeTracer('RegisterInterchainBankAssets', true);
14
+
15
+ /** @import {Board} from '@agoric/vats'; */
16
+
17
+ /**
18
+ * @typedef {object} InterchainAssetOptions
19
+ * @property {string} denom
20
+ * @property {number} decimalPlaces
21
+ * @property {string} issuerName
22
+ * @property {string} keyword - defaults to `issuerName` if not provided
23
+ * @property {string} [proposedName] - defaults to `issuerName` if not provided
24
+ */
25
+
26
+ // vstorage paths under published.*
27
+ const BOARD_AUX = 'boardAux';
28
+
29
+ const marshalData = makeMarshal(_val => Fail`data only`);
30
+
31
+ /**
32
+ * Make a storage node for auxiliary data for a value on the board.
33
+ *
34
+ * @param {ERef<StorageNode>} chainStorage
35
+ * @param {string} boardId
36
+ */
37
+ const makeBoardAuxNode = async (chainStorage, boardId) => {
38
+ const boardAux = E(chainStorage).makeChildNode(BOARD_AUX);
39
+ return E(boardAux).makeChildNode(boardId);
40
+ };
41
+
42
+ /**
43
+ * see `publishAgoricBrandsDisplayInfo` {@link @agoric/smart-wallet/proposals/upgrade-walletFactory-proposal.js}
44
+ *
45
+ * @param {ERef<StorageNode>} chainStorage
46
+ * @param {ERef<Board>} board
47
+ * @param {Brand<'nat'>} brand
48
+ */
49
+ const publishBrandInfo = async (chainStorage, board, brand) => {
50
+ const [boardId, displayInfo, allegedName] = await Promise.all([
51
+ E(board).getId(brand),
52
+ E(brand).getDisplayInfo(),
53
+ E(brand).getAllegedName(),
54
+ ]);
55
+ const node = makeBoardAuxNode(chainStorage, boardId);
56
+ const aux = marshalData.toCapData(harden({ allegedName, displayInfo }));
57
+ await E(node).setValue(JSON.stringify(aux));
58
+ };
59
+
60
+ /**
61
+ * @param {BootstrapPowers} powers
62
+ * @param {object} config
63
+ * @param {object} config.options
64
+ * @param {InterchainAssetOptions[]} config.options.assets
65
+ */
66
+ export const publishInterchainAssets = async (
67
+ {
68
+ consume: {
69
+ agoricNamesAdmin,
70
+ bankManager,
71
+ board,
72
+ chainStorage,
73
+ startUpgradable,
74
+ },
75
+ brand: { produce: produceBrands },
76
+ issuer: { produce: produceIssuers },
77
+ installation: {
78
+ consume: { mintHolder },
79
+ },
80
+ },
81
+ { options: { assets } },
82
+ ) => {
83
+ trace(`${publishInterchainAssets.name} starting...`);
84
+ trace(assets);
85
+ await null;
86
+ for (const interchainAssetOptions of assets) {
87
+ const {
88
+ denom,
89
+ decimalPlaces,
90
+ issuerName,
91
+ keyword = issuerName,
92
+ proposedName = issuerName,
93
+ } = interchainAssetOptions;
94
+
95
+ trace('interchainAssetOptions', {
96
+ denom,
97
+ decimalPlaces,
98
+ issuerName,
99
+ keyword,
100
+ proposedName,
101
+ });
102
+
103
+ assert.typeof(denom, 'string');
104
+ assert.typeof(decimalPlaces, 'number');
105
+ assert.typeof(keyword, 'string');
106
+ assert.typeof(issuerName, 'string');
107
+ assert.typeof(proposedName, 'string');
108
+
109
+ const terms = {
110
+ keyword: issuerName, // "keyword" is a misnomer in mintHolder terms
111
+ assetKind: AssetKind.NAT,
112
+ displayInfo: {
113
+ decimalPlaces,
114
+ assetKind: AssetKind.NAT,
115
+ },
116
+ };
117
+ const { creatorFacet: mint, publicFacet: issuer } = await E(
118
+ startUpgradable,
119
+ )({
120
+ installation: mintHolder,
121
+ label: issuerName,
122
+ privateArgs: undefined,
123
+ terms,
124
+ });
125
+
126
+ const brand = await E(issuer).getBrand();
127
+ const kit = /** @type {IssuerKit<'nat'>} */ ({ mint, issuer, brand });
128
+
129
+ /**
130
+ * `addAssetToVault.js` will register the issuer with the `reserveKit`,
131
+ * but we don't need to do that here.
132
+ */
133
+
134
+ await Promise.all([
135
+ E(E(agoricNamesAdmin).lookupAdmin('issuer')).update(issuerName, issuer),
136
+ E(E(agoricNamesAdmin).lookupAdmin('brand')).update(issuerName, brand),
137
+ // triggers benign UnhandledPromiseRejection 'Error: keyword "ATOM" must
138
+ // be unique' in provisionPool in testing environments
139
+ E(bankManager).addAsset(denom, issuerName, proposedName, kit),
140
+ ]);
141
+
142
+ // publish brands and issuers to Bootstrap space for use in proposals
143
+ produceBrands[keyword].reset();
144
+ produceIssuers[keyword].reset();
145
+ produceBrands[keyword].resolve(brand);
146
+ produceIssuers[keyword].resolve(issuer);
147
+
148
+ // publish brand info / boardAux for offer legibility
149
+ await publishBrandInfo(
150
+ // @ts-expect-error 'Promise<StorageNode | null>' is not assignable to
151
+ // parameter of type 'ERef<StorageNode>'
152
+ chainStorage,
153
+ board,
154
+ brand,
155
+ );
156
+ }
157
+ trace(`${publishInterchainAssets.name} complete`);
158
+ };
159
+
160
+ /**
161
+ * @param {unknown} _powers
162
+ * @param {{ assets: InterchainAssetOptions[] }} options
163
+ */
164
+ export const getManifestCall = (_powers, options) => {
165
+ /** @type {Record<string, true>} */
166
+ const IssuerKws = options.assets.reduce(
167
+ /**
168
+ * @param {Record<string, true>} acc
169
+ * @param {InterchainAssetOptions} assetOptions
170
+ */
171
+ (acc, { issuerName }) => Object.assign(acc, { [issuerName]: true }),
172
+ {},
173
+ );
174
+ harden(IssuerKws);
175
+
176
+ return {
177
+ manifest: {
178
+ [publishInterchainAssets.name]: {
179
+ consume: {
180
+ agoricNamesAdmin: true,
181
+ bankManager: true,
182
+ board: true,
183
+ chainStorage: true,
184
+ startUpgradable: true,
185
+ },
186
+ brand: {
187
+ produce: IssuerKws,
188
+ },
189
+ issuer: {
190
+ produce: IssuerKws,
191
+ },
192
+ installation: {
193
+ consume: { mintHolder: true },
194
+ },
195
+ },
196
+ },
197
+ options,
198
+ };
199
+ };
@@ -0,0 +1,33 @@
1
+ import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { getManifestForReplaceFeeDistributor } from '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js';
3
+
4
+ /**
5
+ * @file
6
+ * a Variant of ../inter-protocol/replace-feeDistributor.js that shortens the
7
+ * collectionInterval for testing
8
+ */
9
+
10
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
11
+ export const defaultProposalBuilder = async (_, opts) => {
12
+ console.log('feeDist OPTS', opts);
13
+ return harden({
14
+ sourceSpec:
15
+ '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js',
16
+ getManifestCall: [getManifestForReplaceFeeDistributor.name, { ...opts }],
17
+ });
18
+ };
19
+
20
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
21
+ export default async (homeP, endowments) => {
22
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
23
+
24
+ await writeCoreEval('replace-feeDistributor-testing', utils =>
25
+ defaultProposalBuilder(utils, {
26
+ collectionInterval: 30n,
27
+ keywordShares: {
28
+ RewardDistributor: 0n,
29
+ Reserve: 1n,
30
+ },
31
+ }),
32
+ );
33
+ };