@agoric/builders 0.2.0-u19.3 → 0.2.0-u21.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.
- package/CHANGELOG.md +18 -25
- package/package.json +34 -35
- package/scripts/orchestration/axelar-gmp.build.js +74 -0
- package/scripts/orchestration/get-chain-config.js +117 -0
- package/scripts/orchestration/helpers.js +46 -0
- package/scripts/orchestration/init-basic-flows.js +2 -33
- package/scripts/orchestration/init-stakeAtom.js +11 -2
- package/scripts/orchestration/init-stakeOsmo.js +11 -2
- package/scripts/testing/append-chain-info.js +4 -2
- package/scripts/testing/init-auto-stake-it.js +2 -33
- package/scripts/testing/init-send-anywhere.js +2 -33
- package/scripts/testing/init-swap-anything.js +36 -0
- package/scripts/testing/restart-axelar-gmp.js +94 -0
- package/scripts/testing/start-query-flows.js +43 -23
- package/scripts/testing/tweak-chain-info.js +7 -2
- package/scripts/vats/upgrade-mintHolder.js +7 -6
- package/scripts/vats/upgrade-orchestration.js +13 -19
- package/scripts/vats/upgrade-provisionPool-to-BLD.js +25 -0
- package/scripts/vats/upgrade-vats.js +49 -0
- package/scripts/fast-usdc/add-operators.build.js +0 -83
- package/scripts/fast-usdc/fast-usdc-fees.build.js +0 -75
- package/scripts/fast-usdc/fast-usdc-update.build.js +0 -65
- package/scripts/fast-usdc/start-fast-usdc.build.js +0 -207
- package/scripts/vats/terminate-governor-instance.js +0 -134
|
@@ -3,17 +3,7 @@ import {
|
|
|
3
3
|
getManifest,
|
|
4
4
|
startSendAnywhere,
|
|
5
5
|
} from '@agoric/orchestration/src/proposals/start-send-anywhere.js';
|
|
6
|
-
import {
|
|
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
|
-
};
|
|
6
|
+
import { parseChainHubOpts } from '../orchestration/helpers.js';
|
|
17
7
|
|
|
18
8
|
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
19
9
|
export const defaultProposalBuilder = async (
|
|
@@ -38,29 +28,8 @@ export const defaultProposalBuilder = async (
|
|
|
38
28
|
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
39
29
|
export default async (homeP, endowments) => {
|
|
40
30
|
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
|
-
|
|
31
|
+
const opts = parseChainHubOpts(scriptArgs);
|
|
62
32
|
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
63
|
-
|
|
64
33
|
await writeCoreEval(startSendAnywhere.name, utils =>
|
|
65
34
|
defaultProposalBuilder(utils, opts),
|
|
66
35
|
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
import {
|
|
3
|
+
getManifest,
|
|
4
|
+
startSwapAnything,
|
|
5
|
+
} from '@agoric/orchestration/src/proposals/start-swap-anything.js';
|
|
6
|
+
import { parseChainHubOpts } from '../orchestration/helpers.js';
|
|
7
|
+
|
|
8
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
9
|
+
export const defaultProposalBuilder = async (
|
|
10
|
+
{ publishRef, install },
|
|
11
|
+
options,
|
|
12
|
+
) =>
|
|
13
|
+
harden({
|
|
14
|
+
sourceSpec: '@agoric/orchestration/src/proposals/start-swap-anything.js',
|
|
15
|
+
getManifestCall: [
|
|
16
|
+
getManifest.name,
|
|
17
|
+
{
|
|
18
|
+
installationRef: publishRef(
|
|
19
|
+
install(
|
|
20
|
+
'@agoric/orchestration/src/examples/swap-anything.contract.js',
|
|
21
|
+
),
|
|
22
|
+
),
|
|
23
|
+
options,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
29
|
+
export default async (homeP, endowments) => {
|
|
30
|
+
const { scriptArgs } = endowments;
|
|
31
|
+
const opts = parseChainHubOpts(scriptArgs);
|
|
32
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
33
|
+
await writeCoreEval(startSwapAnything.name, utils =>
|
|
34
|
+
defaultProposalBuilder(utils, opts),
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
const trace = makeTracer('StartAxelarGmp', true);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @import {start as StartFn} from '@agoric/orchestration/src/examples/axelar-gmp.contract.js';
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {BootstrapPowers} powers
|
|
22
|
+
*/
|
|
23
|
+
export const restartAxelarGmp = async ({
|
|
24
|
+
consume: {
|
|
25
|
+
agoricNames,
|
|
26
|
+
board,
|
|
27
|
+
chainStorage,
|
|
28
|
+
chainTimerService,
|
|
29
|
+
cosmosInterchainService,
|
|
30
|
+
localchain,
|
|
31
|
+
contractKits,
|
|
32
|
+
},
|
|
33
|
+
instance: instances,
|
|
34
|
+
}) => {
|
|
35
|
+
trace(restartAxelarGmp.name);
|
|
36
|
+
|
|
37
|
+
const marshaller = await E(board).getReadonlyMarshaller();
|
|
38
|
+
const privateArgs = await deeplyFulfilledObject(
|
|
39
|
+
harden({
|
|
40
|
+
agoricNames,
|
|
41
|
+
localchain,
|
|
42
|
+
marshaller,
|
|
43
|
+
orchestrationService: cosmosInterchainService,
|
|
44
|
+
storageNode: E(NonNullish(await chainStorage)).makeChildNode('axelarGmp'),
|
|
45
|
+
timerService: chainTimerService,
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// @ts-expect-error unknown instance
|
|
50
|
+
const instance = await instances.consume.axelarGmp;
|
|
51
|
+
trace('instance', instance);
|
|
52
|
+
/** @type {StartedInstanceKit<StartFn>} */
|
|
53
|
+
const kit = /** @type {any} */ (await E(contractKits).get(instance));
|
|
54
|
+
|
|
55
|
+
await E(kit.adminFacet).restartContract(privateArgs);
|
|
56
|
+
trace('done');
|
|
57
|
+
};
|
|
58
|
+
harden(restartAxelarGmp);
|
|
59
|
+
|
|
60
|
+
export const getManifest = () => {
|
|
61
|
+
return {
|
|
62
|
+
manifest: {
|
|
63
|
+
[restartAxelarGmp.name]: {
|
|
64
|
+
consume: {
|
|
65
|
+
agoricNames: true,
|
|
66
|
+
board: true,
|
|
67
|
+
chainTimerService: true,
|
|
68
|
+
chainStorage: true,
|
|
69
|
+
cosmosInterchainService: true,
|
|
70
|
+
localchain: true,
|
|
71
|
+
contractKits: true,
|
|
72
|
+
},
|
|
73
|
+
instance: {
|
|
74
|
+
consume: { axelarGmp: true },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
82
|
+
export const defaultProposalBuilder = async () =>
|
|
83
|
+
harden({
|
|
84
|
+
sourceSpec: '@agoric/builders/scripts/testing/restart-axelar-gmp.js',
|
|
85
|
+
getManifestCall: [getManifest.name],
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
89
|
+
export default async (homeP, endowments) => {
|
|
90
|
+
const dspModule = await import('@agoric/deploy-script-support');
|
|
91
|
+
const { makeHelpers } = dspModule;
|
|
92
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
93
|
+
await writeCoreEval(restartAxelarGmp.name, defaultProposalBuilder);
|
|
94
|
+
};
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
|
|
8
8
|
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
|
|
9
9
|
import { E } from '@endo/far';
|
|
10
|
+
import { parseChainHubOpts } from '../orchestration/helpers.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
13
|
+
* @import {CosmosChainInfo, Denom, DenomDetail} from '@agoric/orchestration';
|
|
12
14
|
* @import {QueryFlowsSF as StartFn} from '@agoric/orchestration/src/fixtures/query-flows.contract.js';
|
|
13
15
|
*/
|
|
14
16
|
|
|
@@ -28,25 +30,34 @@ const trace = makeTracer(contractName, true);
|
|
|
28
30
|
* };
|
|
29
31
|
* };
|
|
30
32
|
* }} powers
|
|
33
|
+
* @param {{
|
|
34
|
+
* options: {
|
|
35
|
+
* chainInfo: Record<string, CosmosChainInfo>;
|
|
36
|
+
* assetInfo: [Denom, DenomDetail & { brandKey?: string }][];
|
|
37
|
+
* };
|
|
38
|
+
* }} config
|
|
31
39
|
*/
|
|
32
|
-
export const startQueryFlows = async (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
export const startQueryFlows = async (
|
|
41
|
+
{
|
|
42
|
+
consume: {
|
|
43
|
+
agoricNames,
|
|
44
|
+
board,
|
|
45
|
+
chainStorage,
|
|
46
|
+
chainTimerService,
|
|
47
|
+
cosmosInterchainService,
|
|
48
|
+
localchain,
|
|
49
|
+
startUpgradable,
|
|
50
|
+
},
|
|
51
|
+
installation: {
|
|
52
|
+
consume: { [contractName]: installation },
|
|
53
|
+
},
|
|
54
|
+
instance: {
|
|
55
|
+
// @ts-expect-error unknown instance
|
|
56
|
+
produce: { [contractName]: produceInstance },
|
|
57
|
+
},
|
|
48
58
|
},
|
|
49
|
-
|
|
59
|
+
{ options: { chainInfo, assetInfo } },
|
|
60
|
+
) => {
|
|
50
61
|
trace(`start ${contractName}`);
|
|
51
62
|
|
|
52
63
|
const storageNode = await makeStorageNodeChild(chainStorage, contractName);
|
|
@@ -60,6 +71,8 @@ export const startQueryFlows = async ({
|
|
|
60
71
|
privateArgs: await deeplyFulfilledObject(
|
|
61
72
|
harden({
|
|
62
73
|
agoricNames,
|
|
74
|
+
assetInfo,
|
|
75
|
+
chainInfo,
|
|
63
76
|
orchestrationService: cosmosInterchainService,
|
|
64
77
|
localchain,
|
|
65
78
|
storageNode,
|
|
@@ -76,7 +89,7 @@ harden(startQueryFlows);
|
|
|
76
89
|
|
|
77
90
|
export const getManifestForContract = (
|
|
78
91
|
{ restoreRef },
|
|
79
|
-
{ installKeys,
|
|
92
|
+
{ installKeys, options },
|
|
80
93
|
) => {
|
|
81
94
|
return {
|
|
82
95
|
manifest: {
|
|
@@ -106,7 +119,10 @@ export const getManifestForContract = (
|
|
|
106
119
|
};
|
|
107
120
|
|
|
108
121
|
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
109
|
-
export const defaultProposalBuilder = async (
|
|
122
|
+
export const defaultProposalBuilder = async (
|
|
123
|
+
{ publishRef, install },
|
|
124
|
+
options,
|
|
125
|
+
) => {
|
|
110
126
|
return harden({
|
|
111
127
|
// Somewhat unorthodox, source the exports from this builder module
|
|
112
128
|
sourceSpec: '@agoric/builders/scripts/testing/start-query-flows.js',
|
|
@@ -120,6 +136,7 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
|
|
|
120
136
|
),
|
|
121
137
|
),
|
|
122
138
|
},
|
|
139
|
+
options,
|
|
123
140
|
},
|
|
124
141
|
],
|
|
125
142
|
});
|
|
@@ -127,9 +144,12 @@ export const defaultProposalBuilder = async ({ publishRef, install }) => {
|
|
|
127
144
|
|
|
128
145
|
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
129
146
|
export default async (homeP, endowments) => {
|
|
130
|
-
// import dynamically so the
|
|
131
|
-
const
|
|
132
|
-
const {
|
|
147
|
+
// import dynamically so the modules can work in CoreEval environment
|
|
148
|
+
const { makeHelpers } = await import('@agoric/deploy-script-support');
|
|
149
|
+
const { scriptArgs } = endowments;
|
|
150
|
+
const opts = parseChainHubOpts(scriptArgs);
|
|
133
151
|
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
134
|
-
await writeCoreEval(startQueryFlows.name,
|
|
152
|
+
await writeCoreEval(startQueryFlows.name, utils =>
|
|
153
|
+
defaultProposalBuilder(utils, opts),
|
|
154
|
+
);
|
|
135
155
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/// <reference types="ses" />
|
|
2
2
|
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
3
3
|
|
|
4
|
-
/** @type {Record<string, import('@agoric/orchestration
|
|
4
|
+
/** @type {Record<string, import('@agoric/orchestration').ChainInfo>} */
|
|
5
5
|
const chainInfo = {
|
|
6
6
|
agoric: {
|
|
7
|
+
bech32Prefix: 'agoric',
|
|
7
8
|
chainId: 'agoric-4',
|
|
9
|
+
namespace: 'cosmos',
|
|
10
|
+
reference: 'agoric-4',
|
|
8
11
|
},
|
|
9
12
|
hot: {
|
|
10
|
-
|
|
13
|
+
bech32Prefix: 'hot',
|
|
11
14
|
chainId: 'hot-1',
|
|
12
15
|
connections: {
|
|
13
16
|
'cosmoshub-4': {
|
|
@@ -29,6 +32,8 @@ const chainInfo = {
|
|
|
29
32
|
},
|
|
30
33
|
},
|
|
31
34
|
},
|
|
35
|
+
namespace: 'cosmos',
|
|
36
|
+
reference: 'hot-1',
|
|
32
37
|
},
|
|
33
38
|
};
|
|
34
39
|
|
|
@@ -54,15 +54,16 @@ const configurations = {
|
|
|
54
54
|
},
|
|
55
55
|
EMERYNET: {
|
|
56
56
|
labelList: [
|
|
57
|
-
'
|
|
58
|
-
'
|
|
57
|
+
'ATOM',
|
|
58
|
+
'USDT',
|
|
59
59
|
'DAI_axl',
|
|
60
60
|
'DAI_grv',
|
|
61
|
+
'USDC_axl',
|
|
62
|
+
'stOSMO',
|
|
61
63
|
'stATOM',
|
|
62
|
-
'
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
'USDC',
|
|
64
|
+
'stkATOM',
|
|
65
|
+
'stOSMO2',
|
|
66
|
+
'ToyUSD',
|
|
66
67
|
'BLD',
|
|
67
68
|
],
|
|
68
69
|
},
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
import { upgradeVatsProposalBuilder } from './upgrade-vats.js';
|
|
2
3
|
|
|
3
4
|
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
4
|
-
export const defaultProposalBuilder = async
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
orchestration: publishRef(
|
|
16
|
-
install('@agoric/orchestration/src/vat-orchestration.js'),
|
|
17
|
-
),
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
});
|
|
5
|
+
export const defaultProposalBuilder = async powers => {
|
|
6
|
+
const bundleRecord = {
|
|
7
|
+
ibc: '@agoric/vats/src/vat-ibc.js',
|
|
8
|
+
network: '@agoric/vats/src/vat-network.js',
|
|
9
|
+
localchain: '@agoric/vats/src/vat-localchain.js',
|
|
10
|
+
transfer: '@agoric/vats/src/vat-transfer.js',
|
|
11
|
+
orchestration: '@agoric/orchestration/src/vat-orchestration.js',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return upgradeVatsProposalBuilder(powers, bundleRecord);
|
|
15
|
+
};
|
|
22
16
|
|
|
23
17
|
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
24
18
|
export default async (homeP, endowments) => {
|
|
25
19
|
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
26
|
-
await writeCoreProposal('upgrade-
|
|
20
|
+
await writeCoreProposal('upgrade-orchestration', defaultProposalBuilder);
|
|
27
21
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
|
|
3
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
4
|
+
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
5
|
+
harden({
|
|
6
|
+
sourceSpec:
|
|
7
|
+
'@agoric/vats/src/proposals/upgrade-provisionPool-to-BLD-proposal.js',
|
|
8
|
+
getManifestCall: [
|
|
9
|
+
'getManifestForUpgradingProvisionPool',
|
|
10
|
+
{
|
|
11
|
+
provisionPoolRef: publishRef(
|
|
12
|
+
install('@agoric/inter-protocol/src/provisionPool.js'),
|
|
13
|
+
),
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
19
|
+
export default async (homeP, endowments) => {
|
|
20
|
+
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
21
|
+
await writeCoreProposal(
|
|
22
|
+
'upgrade-provision-pool-to-BLD',
|
|
23
|
+
defaultProposalBuilder,
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
3
|
-
import { getManifestForAddOperators } from '@agoric/fast-usdc/src/add-operators.core.js';
|
|
4
|
-
import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
|
|
5
|
-
import { configurations } from '@agoric/fast-usdc/src/utils/deploy-config.js';
|
|
6
|
-
import { Far } from '@endo/far';
|
|
7
|
-
import { parseArgs } from 'node:util';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js';
|
|
11
|
-
* @import {ParseArgsConfig} from 'node:util';
|
|
12
|
-
* @import {FastUSDCConfig, FeedPolicy} from '@agoric/fast-usdc/src/types.js';
|
|
13
|
-
* @import {FastUSDCOpts} from './start-fast-usdc.build.js';
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const { keys } = Object;
|
|
17
|
-
|
|
18
|
-
/** @type {ParseArgsConfig['options']} */
|
|
19
|
-
const options = {
|
|
20
|
-
net: { type: 'string' },
|
|
21
|
-
oracle: { type: 'string', multiple: true },
|
|
22
|
-
};
|
|
23
|
-
const oraclesUsage = 'use --oracle name:address ...';
|
|
24
|
-
|
|
25
|
-
const crossVatContext = /** @type {const} */ ({
|
|
26
|
-
/** @type {Brand<'nat'>} */
|
|
27
|
-
USDC: Far('USDC Brand'),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
/** @type {CoreEvalBuilder} */
|
|
31
|
-
export const defaultProposalBuilder = async (
|
|
32
|
-
powers,
|
|
33
|
-
/** @type {FastUSDCConfig} */ config,
|
|
34
|
-
) => {
|
|
35
|
-
return harden({
|
|
36
|
-
sourceSpec: '@agoric/fast-usdc/src/add-operators.core.js',
|
|
37
|
-
/** @type {[string, Parameters<typeof getManifestForAddOperators>[1]]} */
|
|
38
|
-
getManifestCall: [
|
|
39
|
-
getManifestForAddOperators.name,
|
|
40
|
-
{
|
|
41
|
-
options: toExternalConfig(config, crossVatContext),
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/** @type {DeployScriptFunction} */
|
|
48
|
-
export default async (homeP, endowments) => {
|
|
49
|
-
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
50
|
-
const { scriptArgs } = endowments;
|
|
51
|
-
|
|
52
|
-
/** @type {{ values: FastUSDCOpts }} */
|
|
53
|
-
// @ts-expect-error ensured by options
|
|
54
|
-
const {
|
|
55
|
-
values: { oracle: oracleArgs, net },
|
|
56
|
-
} = parseArgs({ args: scriptArgs, options });
|
|
57
|
-
|
|
58
|
-
const parseOracleArgs = () => {
|
|
59
|
-
if (net) {
|
|
60
|
-
if (!(net in configurations)) {
|
|
61
|
-
throw Error(`${net} not in ${keys(configurations)}`);
|
|
62
|
-
}
|
|
63
|
-
return configurations[net].oracles;
|
|
64
|
-
}
|
|
65
|
-
if (!oracleArgs) throw Error(oraclesUsage);
|
|
66
|
-
return Object.fromEntries(
|
|
67
|
-
oracleArgs.map(arg => {
|
|
68
|
-
const result = arg.match(/(?<name>[^:]+):(?<address>.+)/);
|
|
69
|
-
if (!(result && result.groups)) throw Error(oraclesUsage);
|
|
70
|
-
const { name, address } = result.groups;
|
|
71
|
-
return [name, address];
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const config = harden({
|
|
77
|
-
oracles: parseOracleArgs(),
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
await writeCoreEval('add-operators', utils =>
|
|
81
|
-
defaultProposalBuilder(utils, config),
|
|
82
|
-
);
|
|
83
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
-
import { AmountMath } from '@agoric/ertp';
|
|
3
|
-
import { getManifestForDistributeFees } from '@agoric/fast-usdc/src/distribute-fees.core.js';
|
|
4
|
-
import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
|
|
5
|
-
import {
|
|
6
|
-
multiplyBy,
|
|
7
|
-
parseRatio,
|
|
8
|
-
} from '@agoric/zoe/src/contractSupport/ratio.js';
|
|
9
|
-
import { Far } from '@endo/far';
|
|
10
|
-
import { parseArgs } from 'node:util';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js'
|
|
14
|
-
* @import {FeeDistributionTerms} from '@agoric/fast-usdc/src/distribute-fees.core.js'
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const usage =
|
|
18
|
-
'Use: [--fixedFees <number> | --feePortion <percent>] --destinationAddress <address> ...';
|
|
19
|
-
|
|
20
|
-
const xVatCtx = /** @type {const} */ ({
|
|
21
|
-
/** @type {Brand<'nat'>} */
|
|
22
|
-
USDC: Far('USDC Brand'),
|
|
23
|
-
});
|
|
24
|
-
const { USDC } = xVatCtx;
|
|
25
|
-
const USDC_DECIMALS = 6n;
|
|
26
|
-
const unit = AmountMath.make(USDC, 10n ** USDC_DECIMALS);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {unknown} _utils
|
|
30
|
-
* @param {FeeDistributionTerms} feeTerms
|
|
31
|
-
* @satisfies {CoreEvalBuilder}
|
|
32
|
-
*/
|
|
33
|
-
export const feeProposalBuilder = async (_utils, feeTerms) => {
|
|
34
|
-
return harden({
|
|
35
|
-
sourceSpec: '@agoric/fast-usdc/src/distribute-fees.core.js',
|
|
36
|
-
/** @type {[string, Parameters<typeof getManifestForDistributeFees>[1]]} */
|
|
37
|
-
getManifestCall: [
|
|
38
|
-
getManifestForDistributeFees.name,
|
|
39
|
-
{ options: toExternalConfig(harden({ feeTerms }), xVatCtx) },
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** @type {DeployScriptFunction} */
|
|
45
|
-
export default async (homeP, endowments) => {
|
|
46
|
-
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
47
|
-
/** @type {{ values: Record<string, string | undefined> }} */
|
|
48
|
-
const {
|
|
49
|
-
values: { destinationAddress, ...opt },
|
|
50
|
-
} = parseArgs({
|
|
51
|
-
args: endowments.scriptArgs,
|
|
52
|
-
options: {
|
|
53
|
-
destinationAddress: { type: 'string' },
|
|
54
|
-
fixedFees: { type: 'string' },
|
|
55
|
-
feePortion: { type: 'string' },
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
if (!destinationAddress) assert.fail(usage);
|
|
59
|
-
if (opt.fixedFees && opt.feePortion) assert.fail(usage);
|
|
60
|
-
|
|
61
|
-
/** @type {FeeDistributionTerms} */
|
|
62
|
-
const feeTerms = {
|
|
63
|
-
destinationAddress,
|
|
64
|
-
...((opt.fixedFees && {
|
|
65
|
-
fixedFees: multiplyBy(unit, parseRatio(opt.fixedFees, USDC)),
|
|
66
|
-
}) ||
|
|
67
|
-
(opt.feePortion && {
|
|
68
|
-
feePortion: parseRatio(opt.feePortion, USDC),
|
|
69
|
-
}) ||
|
|
70
|
-
assert.fail(usage)),
|
|
71
|
-
};
|
|
72
|
-
await writeCoreEval('eval-fast-usdc-fees', utils =>
|
|
73
|
-
feeProposalBuilder(utils, feeTerms),
|
|
74
|
-
);
|
|
75
|
-
};
|