@agoric/builders 0.1.1-other-dev-3eb1a1d.0 → 0.1.1-other-dev-fbe72e7.0.fbe72e7

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 (45) hide show
  1. package/package.json +38 -37
  2. package/scripts/inter-protocol/replace-feeDistributor-combo.js +82 -0
  3. package/scripts/inter-protocol/replace-feeDistributor.js +12 -4
  4. package/scripts/inter-protocol/updatePriceFeeds.js +11 -1
  5. package/scripts/inter-protocol/withdraw-reserve.build.js +68 -0
  6. package/scripts/orchestration/axelar-gmp.build.js +81 -0
  7. package/scripts/orchestration/get-chain-config.js +121 -0
  8. package/scripts/orchestration/helpers.js +46 -0
  9. package/scripts/orchestration/hook-localchain-msg-send.js +30 -0
  10. package/scripts/orchestration/init-basic-flows.js +11 -2
  11. package/scripts/orchestration/init-stakeAtom.js +11 -2
  12. package/scripts/orchestration/init-stakeOsmo.js +11 -2
  13. package/scripts/testing/add-USD-LEMONS.js +19 -0
  14. package/scripts/testing/add-USD-OLIVES.js +19 -0
  15. package/scripts/testing/append-chain-info.js +4 -2
  16. package/scripts/testing/init-auto-stake-it.js +42 -0
  17. package/scripts/testing/init-send-anywhere.js +36 -0
  18. package/scripts/testing/init-swap-anything.js +36 -0
  19. package/scripts/testing/provokeBOYD.js +54 -0
  20. package/scripts/testing/publish-test-info.js +79 -0
  21. package/scripts/testing/recorded-retired-instances.js +81 -0
  22. package/scripts/testing/register-interchain-bank-assets.js +199 -0
  23. package/scripts/testing/replace-feeDistributor-short.js +7 -1
  24. package/scripts/testing/restart-axelar-gmp.js +94 -0
  25. package/scripts/testing/start-query-flows.js +43 -23
  26. package/scripts/testing/test-upgraded-board.js +15 -0
  27. package/scripts/testing/tweak-chain-info.js +7 -2
  28. package/scripts/testing/{fix-buggy-sendAnywhere.js → upgrade-send-anywhere.js} +14 -18
  29. package/scripts/testing/upgrade-vaultFactory.js +21 -0
  30. package/scripts/vats/upgrade-agoricNames.js +21 -0
  31. package/scripts/vats/upgrade-asset-reserve.js +21 -0
  32. package/scripts/vats/upgrade-bank.js +2 -2
  33. package/scripts/vats/upgrade-board.js +20 -0
  34. package/scripts/vats/upgrade-mintHolder.js +105 -0
  35. package/scripts/vats/upgrade-orchestration.js +21 -0
  36. package/scripts/vats/upgrade-paRegistry.js +21 -0
  37. package/scripts/vats/upgrade-provisionPool-to-BLD.js +25 -0
  38. package/scripts/vats/upgrade-psm.js +19 -0
  39. package/scripts/vats/upgrade-vats.js +49 -0
  40. package/index.js +0 -0
  41. package/scripts/fast-usdc/init-fast-usdc.js +0 -242
  42. package/scripts/testing/start-auto-stake-it.js +0 -128
  43. package/scripts/testing/start-buggy-sendAnywhere.js +0 -143
  44. package/scripts/testing/start-send-anywhere.js +0 -136
  45. package/scripts/vats/upgrade-orch-core.js +0 -24
@@ -0,0 +1,49 @@
1
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
2
+ export const upgradeVatsProposalBuilder = async (
3
+ { publishRef, install },
4
+ vatNameToEntrypoint,
5
+ ) => {
6
+ if (!vatNameToEntrypoint) {
7
+ throw Error('Missing vatNameToEntrypoint');
8
+ }
9
+ return harden({
10
+ sourceSpec: '@agoric/vats/src/proposals/upgrade-vats-generic-proposal.js',
11
+ getManifestCall: [
12
+ 'getManifestForUpgradingVats',
13
+ {
14
+ bundleRefs: Object.fromEntries(
15
+ Object.entries(vatNameToEntrypoint).map(
16
+ ([name, entrypoint]) =>
17
+ /** @type {const} */ ([name, publishRef(install(entrypoint))]),
18
+ ),
19
+ ),
20
+ },
21
+ ],
22
+ });
23
+ };
24
+
25
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
26
+ export const upgradeZoeContractsProposalBuilder = async (
27
+ { publishRef, install },
28
+ contractKitSpecs,
29
+ ) => {
30
+ if (!contractKitSpecs) {
31
+ throw Error('Missing contractKitSpecs');
32
+ }
33
+ return harden({
34
+ sourceSpec: '@agoric/vats/src/proposals/upgrade-vats-generic-proposal.js',
35
+ getManifestCall: [
36
+ 'getManifestForUpgradingZoeContractKits',
37
+ {
38
+ contractKitSpecs,
39
+ /** @type {{ [bundleName: string]: VatSourceRef }} */
40
+ installationBundleRefs: Object.fromEntries(
41
+ contractKitSpecs.map(({ bundleName, entrypoint }) => [
42
+ bundleName,
43
+ publishRef(install(entrypoint)),
44
+ ]),
45
+ ),
46
+ },
47
+ ],
48
+ });
49
+ };
package/index.js DELETED
File without changes
@@ -1,242 +0,0 @@
1
- // @ts-check
2
- import { makeHelpers } from '@agoric/deploy-script-support';
3
- import { AmountMath } from '@agoric/ertp';
4
- import {
5
- FastUSDCConfigShape,
6
- getManifestForFastUSDC,
7
- } from '@agoric/fast-usdc/src/fast-usdc.start.js';
8
- import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
9
- import {
10
- multiplyBy,
11
- parseRatio,
12
- } from '@agoric/zoe/src/contractSupport/ratio.js';
13
- import { Far } from '@endo/far';
14
- import { parseArgs } from 'node:util';
15
-
16
- /**
17
- * @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js'
18
- * @import {ParseArgsConfig} from 'node:util'
19
- * @import {FastUSDCConfig} from '@agoric/fast-usdc/src/fast-usdc.start.js'
20
- */
21
-
22
- const { keys } = Object;
23
-
24
- /**
25
- * @type {Record<string, Pick<FastUSDCConfig, 'oracles' | 'feedPolicy'>>}
26
- *
27
- * TODO: determine OCW operator addresses
28
- * meanwhile, use price oracle addresses (from updatePriceFeeds.js).
29
- */
30
- const configurations = {
31
- A3P_INTEGRATION: {
32
- oracles: {
33
- gov1: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
34
- gov2: 'agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277',
35
- gov3: 'agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq',
36
- },
37
- feedPolicy: {
38
- nobleAgoricChannelId: 'TODO',
39
- nobleDomainId: 4,
40
- chainPolicies: {
41
- Arbitrum: {
42
- cctpTokenMessengerAddress:
43
- '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
44
- chainId: 42161,
45
- confirmations: 2,
46
- nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
47
- },
48
- },
49
- },
50
- },
51
- MAINNET: {
52
- oracles: {
53
- DSRV: 'agoric144rrhh4m09mh7aaffhm6xy223ym76gve2x7y78',
54
- Stakin: 'agoric19d6gnr9fyp6hev4tlrg87zjrzsd5gzr5qlfq2p',
55
- '01node': 'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8',
56
- 'Simply Staking': 'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr',
57
- P2P: 'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj',
58
- },
59
- feedPolicy: {
60
- nobleAgoricChannelId: 'channel-21',
61
- nobleDomainId: 4,
62
- chainPolicies: {
63
- Arbitrum: {
64
- cctpTokenMessengerAddress:
65
- '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
66
- chainId: 42161,
67
- confirmations: 2,
68
- nobleContractAddress: '0x19330d10D9Cc8751218eaf51E8885D058642E08A',
69
- },
70
- },
71
- },
72
- },
73
- DEVNET: {
74
- oracles: {
75
- DSRV: 'agoric1lw4e4aas9q84tq0q92j85rwjjjapf8dmnllnft',
76
- Stakin: 'agoric1zj6vrrrjq4gsyr9lw7dplv4vyejg3p8j2urm82',
77
- '01node': 'agoric1ra0g6crtsy6r3qnpu7ruvm7qd4wjnznyzg5nu4',
78
- 'Simply Staking': 'agoric1qj07c7vfk3knqdral0sej7fa6eavkdn8vd8etf',
79
- P2P: 'agoric10vjkvkmpp9e356xeh6qqlhrny2htyzp8hf88fk',
80
- },
81
- feedPolicy: {
82
- nobleAgoricChannelId: 'TODO',
83
- nobleDomainId: 4,
84
- chainPolicies: {
85
- Arbitrum: {
86
- cctpTokenMessengerAddress: '0xTODO',
87
- chainId: 421614,
88
- confirmations: 2,
89
- nobleContractAddress: '0xTODO',
90
- },
91
- },
92
- },
93
- },
94
- EMERYNET: {
95
- oracles: {
96
- gov1: 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce',
97
- gov2: 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang',
98
- },
99
- feedPolicy: {
100
- nobleAgoricChannelId: 'TODO',
101
- nobleDomainId: 4,
102
- chainPolicies: {
103
- Arbitrum: {
104
- cctpTokenMessengerAddress: '0xTODO',
105
- chainId: 421614,
106
- confirmations: 2,
107
- nobleContractAddress: '0xTODO',
108
- },
109
- },
110
- },
111
- },
112
- };
113
-
114
- /** @type {ParseArgsConfig['options']} */
115
- const options = {
116
- flatFee: { type: 'string', default: '0.01' },
117
- variableRate: { type: 'string', default: '0.01' },
118
- maxVariableFee: { type: 'string', default: '5' },
119
- contractRate: { type: 'string', default: '0.2' },
120
- net: { type: 'string' },
121
- oracle: { type: 'string', multiple: true },
122
- usdcDenom: {
123
- type: 'string',
124
- default:
125
- 'ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9',
126
- },
127
- };
128
- const oraclesUsage = 'use --oracle name:address ...';
129
-
130
- const feedPolicyUsage = 'use --feedPolicy <policy> ...';
131
-
132
- /**
133
- * @typedef {{
134
- * flatFee: string;
135
- * variableRate: string;
136
- * maxVariableFee: string;
137
- * contractRate: string;
138
- * net?: string;
139
- * oracle?: string[];
140
- * usdcDenom: string;
141
- * feedPolicy?: string;
142
- * }} FastUSDCOpts
143
- */
144
-
145
- const crossVatContext = /** @type {const} */ ({
146
- /** @type {Brand<'nat'>} */
147
- USDC: Far('USDC Brand'),
148
- });
149
- const { USDC } = crossVatContext;
150
- const USDC_DECIMALS = 6;
151
- const unit = AmountMath.make(USDC, 10n ** BigInt(USDC_DECIMALS));
152
-
153
- /** @type {CoreEvalBuilder} */
154
- export const defaultProposalBuilder = async (
155
- { publishRef, install },
156
- /** @type {FastUSDCConfig} */ config,
157
- ) => {
158
- return harden({
159
- sourceSpec: '@agoric/fast-usdc/src/fast-usdc.start.js',
160
- /** @type {[string, Parameters<typeof getManifestForFastUSDC>[1]]} */
161
- getManifestCall: [
162
- getManifestForFastUSDC.name,
163
- {
164
- options: toExternalConfig(config, crossVatContext, FastUSDCConfigShape),
165
- installKeys: {
166
- fastUsdc: publishRef(
167
- install('@agoric/fast-usdc/src/fast-usdc.contract.js'),
168
- ),
169
- },
170
- },
171
- ],
172
- });
173
- };
174
-
175
- /** @type {DeployScriptFunction} */
176
- export default async (homeP, endowments) => {
177
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
178
- const { scriptArgs } = endowments;
179
-
180
- /** @type {{ values: FastUSDCOpts }} */
181
- // @ts-expect-error ensured by options
182
- const {
183
- values: { oracle: oracleArgs, net, usdcDenom, feedPolicy, ...fees },
184
- } = parseArgs({ args: scriptArgs, options });
185
-
186
- const parseFeedPolicy = () => {
187
- if (net) {
188
- if (!(net in configurations)) {
189
- throw Error(`${net} not in ${keys(configurations)}`);
190
- }
191
- return configurations[net].feedPolicy;
192
- }
193
- if (!feedPolicy) throw Error(feedPolicyUsage);
194
- return JSON.parse(feedPolicy);
195
- };
196
-
197
- const parseOracleArgs = () => {
198
- if (net) {
199
- if (!(net in configurations)) {
200
- throw Error(`${net} not in ${keys(configurations)}`);
201
- }
202
- return configurations[net].oracles;
203
- }
204
- if (!oracleArgs) throw Error(oraclesUsage);
205
- return Object.fromEntries(
206
- oracleArgs.map(arg => {
207
- const result = arg.match(/(?<name>[^:]+):(?<address>.+)/);
208
- if (!(result && result.groups)) throw Error(oraclesUsage);
209
- const { name, address } = result.groups;
210
- return [name, address];
211
- }),
212
- );
213
- };
214
-
215
- /** @param {string} numeral */
216
- const toAmount = numeral => multiplyBy(unit, parseRatio(numeral, USDC));
217
- /** @param {string} numeral */
218
- const toRatio = numeral => parseRatio(numeral, USDC);
219
- const parseFeeConfigArgs = () => {
220
- const { flatFee, variableRate, maxVariableFee, contractRate } = fees;
221
- return {
222
- flat: toAmount(flatFee),
223
- variableRate: toRatio(variableRate),
224
- maxVariable: toAmount(maxVariableFee),
225
- contractRate: toRatio(contractRate),
226
- };
227
- };
228
-
229
- /** @type {FastUSDCConfig} */
230
- const config = harden({
231
- oracles: parseOracleArgs(),
232
- terms: {
233
- usdcDenom,
234
- },
235
- feeConfig: parseFeeConfigArgs(),
236
- feedPolicy: parseFeedPolicy(),
237
- });
238
-
239
- await writeCoreEval('start-fast-usdc', utils =>
240
- defaultProposalBuilder(utils, config),
241
- );
242
- };
@@ -1,128 +0,0 @@
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 { makeTracer } from '@agoric/internal';
8
- import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
9
- import { E } from '@endo/far';
10
- import { deeplyFulfilled } from '@endo/marshal';
11
-
12
- /**
13
- * @import {AutoStakeItSF} from '@agoric/orchestration/src/examples/auto-stake-it.contract.js';
14
- */
15
-
16
- const contractName = 'autoAutoStakeIt';
17
- const trace = makeTracer(contractName, true);
18
-
19
- /**
20
- * @param {BootstrapPowers} powers
21
- */
22
- export const startAutoStakeIt = async ({
23
- consume: {
24
- agoricNames,
25
- board,
26
- chainStorage,
27
- chainTimerService,
28
- cosmosInterchainService,
29
- localchain,
30
- startUpgradable,
31
- },
32
- installation: {
33
- // @ts-expect-error not a WellKnownName
34
- consume: { [contractName]: installation },
35
- },
36
- instance: {
37
- // @ts-expect-error not a WellKnownName
38
- produce: { [contractName]: produceInstance },
39
- },
40
- }) => {
41
- trace(`start ${contractName}`);
42
- await null;
43
-
44
- const storageNode = await makeStorageNodeChild(chainStorage, contractName);
45
- const marshaller = await E(board).getPublishingMarshaller();
46
-
47
- /** @type {StartUpgradableOpts<AutoStakeItSF>} */
48
- const startOpts = {
49
- label: 'autoAutoStakeIt',
50
- installation,
51
- terms: undefined,
52
- privateArgs: await deeplyFulfilled(
53
- // @ts-expect-error
54
- harden({
55
- agoricNames,
56
- orchestrationService: cosmosInterchainService,
57
- localchain,
58
- storageNode,
59
- marshaller,
60
- timerService: chainTimerService,
61
- }),
62
- ),
63
- };
64
-
65
- const { instance } = await E(startUpgradable)(startOpts);
66
- produceInstance.resolve(instance);
67
- };
68
- harden(startAutoStakeIt);
69
-
70
- export const getManifestForContract = (
71
- { restoreRef },
72
- { installKeys, ...options },
73
- ) => {
74
- return {
75
- manifest: {
76
- [startAutoStakeIt.name]: {
77
- consume: {
78
- agoricNames: true,
79
- board: true,
80
- chainStorage: true,
81
- chainTimerService: true,
82
- cosmosInterchainService: true,
83
- localchain: true,
84
- startUpgradable: true,
85
- },
86
- installation: {
87
- consume: { [contractName]: true },
88
- },
89
- instance: {
90
- produce: { [contractName]: true },
91
- },
92
- },
93
- },
94
- installations: {
95
- [contractName]: restoreRef(installKeys[contractName]),
96
- },
97
- options,
98
- };
99
- };
100
-
101
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
102
- export const defaultProposalBuilder = async ({ publishRef, install }) => {
103
- return harden({
104
- // Somewhat unorthodox, source the exports from this builder module
105
- sourceSpec: '@agoric/builders/scripts/testing/start-auto-stake-it.js',
106
- getManifestCall: [
107
- 'getManifestForContract',
108
- {
109
- installKeys: {
110
- autoAutoStakeIt: publishRef(
111
- install(
112
- '@agoric/orchestration/src/examples/auto-stake-it.contract.js',
113
- ),
114
- ),
115
- },
116
- },
117
- ],
118
- });
119
- };
120
-
121
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
122
- export default async (homeP, endowments) => {
123
- // import dynamically so the module can work in CoreEval environment
124
- const dspModule = await import('@agoric/deploy-script-support');
125
- const { makeHelpers } = dspModule;
126
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
127
- await writeCoreEval(startAutoStakeIt.name, defaultProposalBuilder);
128
- };
@@ -1,143 +0,0 @@
1
- /**
2
- * @file This is for use in tests in a3p-integration
3
- * Unlike most builder scripts, this one includes the proposal exports as well.
4
- */
5
- import {
6
- deeplyFulfilledObject,
7
- makeTracer,
8
- NonNullish,
9
- } from '@agoric/internal';
10
- import { E, Far } from '@endo/far';
11
-
12
- /// <reference types="@agoric/vats/src/core/types-ambient"/>
13
- /**
14
- * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
15
- */
16
-
17
- const trace = makeTracer('StartBuggySA', true);
18
-
19
- /**
20
- * @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
21
- */
22
-
23
- /**
24
- * @param {BootstrapPowers & {
25
- * installation: {
26
- * consume: {
27
- * sendAnywhere: Installation<StartFn>;
28
- * };
29
- * };
30
- * }} powers
31
- */
32
- export const startSendAnywhere = async ({
33
- consume: {
34
- agoricNames,
35
- board,
36
- chainStorage,
37
- chainTimerService,
38
- cosmosInterchainService,
39
- localchain,
40
- startUpgradable,
41
- },
42
- installation: {
43
- consume: { sendAnywhere },
44
- },
45
- instance: {
46
- // @ts-expect-error unknown instance
47
- produce: { sendAnywhere: produceInstance },
48
- },
49
- }) => {
50
- trace(startSendAnywhere.name);
51
-
52
- const marshaller = await E(board).getReadonlyMarshaller();
53
-
54
- const privateArgs = await deeplyFulfilledObject(
55
- harden({
56
- agoricNames,
57
- localchain,
58
- marshaller,
59
- orchestrationService: cosmosInterchainService,
60
- storageNode: E(NonNullish(await chainStorage)).makeChildNode(
61
- 'sendAnywhere',
62
- ),
63
- timerService: chainTimerService,
64
- }),
65
- );
66
-
67
- /** @type {import('@agoric/vats').NameHub} */
68
- // @ts-expect-error intentional fake
69
- const agoricNamesHangs = Far('agoricNames that hangs', {
70
- lookup: async () => {
71
- trace('agoricNames.lookup being called that will never resolve');
72
- // BUG: this never resolves
73
- return new Promise(() => {});
74
- },
75
- });
76
-
77
- const { instance } = await E(startUpgradable)({
78
- label: 'sendAnywhere',
79
- installation: sendAnywhere,
80
- privateArgs: {
81
- ...privateArgs,
82
- agoricNames: agoricNamesHangs,
83
- },
84
- });
85
- produceInstance.resolve(instance);
86
- trace('done');
87
- };
88
- harden(startSendAnywhere);
89
-
90
- export const getManifestForValueVow = ({ restoreRef }, { sendAnywhereRef }) => {
91
- trace('sendAnywhereRef', sendAnywhereRef);
92
- return {
93
- manifest: {
94
- [startSendAnywhere.name]: {
95
- consume: {
96
- agoricNames: true,
97
- board: true,
98
- chainStorage: true,
99
- chainTimerService: true,
100
- cosmosInterchainService: true,
101
- localchain: true,
102
-
103
- startUpgradable: true,
104
- },
105
- installation: {
106
- consume: { sendAnywhere: true },
107
- },
108
- instance: {
109
- produce: { sendAnywhere: true },
110
- },
111
- },
112
- },
113
- installations: {
114
- sendAnywhere: restoreRef(sendAnywhereRef),
115
- },
116
- };
117
- };
118
-
119
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
120
- export const defaultProposalBuilder = async ({ publishRef, install }) =>
121
- harden({
122
- // Somewhat unorthodox, source the exports from this builder module
123
- sourceSpec: '@agoric/builders/scripts/testing/start-buggy-sendAnywhere.js',
124
- getManifestCall: [
125
- 'getManifestForValueVow',
126
- {
127
- sendAnywhereRef: publishRef(
128
- install(
129
- '@agoric/orchestration/src/examples/send-anywhere.contract.js',
130
- ),
131
- ),
132
- },
133
- ],
134
- });
135
-
136
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
137
- export default async (homeP, endowments) => {
138
- // import dynamically so the module can work in CoreEval environment
139
- const dspModule = await import('@agoric/deploy-script-support');
140
- const { makeHelpers } = dspModule;
141
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
142
- await writeCoreEval(startSendAnywhere.name, defaultProposalBuilder);
143
- };
@@ -1,136 +0,0 @@
1
- /**
2
- * @file This is for use in tests in a3p-integration
3
- * Unlike most builder scripts, this one includes the proposal exports as well.
4
- */
5
- import {
6
- deeplyFulfilledObject,
7
- makeTracer,
8
- NonNullish,
9
- } from '@agoric/internal';
10
- import { E } from '@endo/far';
11
-
12
- /// <reference types="@agoric/vats/src/core/types-ambient"/>
13
- /**
14
- * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
15
- */
16
-
17
- const trace = makeTracer('StartSA', true);
18
-
19
- /**
20
- * @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
21
- */
22
-
23
- /**
24
- * @param {BootstrapPowers & {
25
- * installation: {
26
- * consume: {
27
- * sendAnywhere: Installation<StartFn>;
28
- * };
29
- * };
30
- * }} powers
31
- */
32
- export const startSendAnywhere = async ({
33
- consume: {
34
- agoricNames,
35
- board,
36
- chainStorage,
37
- chainTimerService,
38
- cosmosInterchainService,
39
- localchain,
40
- startUpgradable,
41
- },
42
- installation: {
43
- consume: { sendAnywhere },
44
- },
45
- instance: {
46
- // @ts-expect-error unknown instance
47
- produce: { sendAnywhere: produceInstance },
48
- },
49
- issuer: {
50
- consume: { IST },
51
- },
52
- }) => {
53
- trace(startSendAnywhere.name);
54
-
55
- const marshaller = await E(board).getReadonlyMarshaller();
56
-
57
- const privateArgs = await deeplyFulfilledObject(
58
- harden({
59
- agoricNames,
60
- localchain,
61
- marshaller,
62
- orchestrationService: cosmosInterchainService,
63
- storageNode: E(NonNullish(await chainStorage)).makeChildNode(
64
- 'send-anywhere',
65
- ),
66
- timerService: chainTimerService,
67
- }),
68
- );
69
-
70
- const { instance } = await E(startUpgradable)({
71
- label: 'send-anywhere',
72
- installation: sendAnywhere,
73
- issuerKeywordRecord: { Stable: await IST },
74
- privateArgs,
75
- });
76
- produceInstance.resolve(instance);
77
- trace('done');
78
- };
79
- harden(startSendAnywhere);
80
-
81
- export const getManifest = ({ restoreRef }, { installationRef }) => {
82
- return {
83
- manifest: {
84
- [startSendAnywhere.name]: {
85
- consume: {
86
- agoricNames: true,
87
- board: true,
88
- chainStorage: true,
89
- chainTimerService: true,
90
- cosmosInterchainService: true,
91
- localchain: true,
92
-
93
- startUpgradable: true,
94
- },
95
- installation: {
96
- consume: { sendAnywhere: true },
97
- },
98
- instance: {
99
- produce: { sendAnywhere: true },
100
- },
101
- issuer: {
102
- consume: { IST: true },
103
- },
104
- },
105
- },
106
- installations: {
107
- sendAnywhere: restoreRef(installationRef),
108
- },
109
- };
110
- };
111
-
112
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
113
- export const defaultProposalBuilder = async ({ publishRef, install }) =>
114
- harden({
115
- // Somewhat unorthodox, source the exports from this builder module
116
- sourceSpec: '@agoric/builders/scripts/testing/start-send-anywhere.js',
117
- getManifestCall: [
118
- getManifest.name,
119
- {
120
- installationRef: publishRef(
121
- install(
122
- '@agoric/orchestration/src/examples/send-anywhere.contract.js',
123
- ),
124
- ),
125
- },
126
- ],
127
- });
128
-
129
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
130
- export default async (homeP, endowments) => {
131
- // import dynamically so the module can work in CoreEval environment
132
- const dspModule = await import('@agoric/deploy-script-support');
133
- const { makeHelpers } = dspModule;
134
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
135
- await writeCoreEval(startSendAnywhere.name, defaultProposalBuilder);
136
- };