@agoric/builders 0.1.1-dev-ad2ef34.0 → 0.1.1-dev-7e9048c.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/builders",
3
- "version": "0.1.1-dev-ad2ef34.0+ad2ef34",
3
+ "version": "0.1.1-dev-7e9048c.0+7e9048c",
4
4
  "description": "Build scripts for proposals to an Agoric chain",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -23,14 +23,14 @@
23
23
  "author": "Agoric",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@agoric/ertp": "0.16.3-dev-ad2ef34.0+ad2ef34",
27
- "@agoric/fast-usdc": "0.1.1-dev-ad2ef34.0+ad2ef34",
28
- "@agoric/internal": "0.3.3-dev-ad2ef34.0+ad2ef34",
29
- "@agoric/notifier": "0.6.3-dev-ad2ef34.0+ad2ef34",
30
- "@agoric/smart-wallet": "0.5.4-dev-ad2ef34.0+ad2ef34",
31
- "@agoric/vat-data": "0.5.3-dev-ad2ef34.0+ad2ef34",
32
- "@agoric/vats": "0.15.2-dev-ad2ef34.0+ad2ef34",
33
- "@agoric/zoe": "0.26.3-dev-ad2ef34.0+ad2ef34",
26
+ "@agoric/ertp": "0.16.3-dev-7e9048c.0+7e9048c",
27
+ "@agoric/fast-usdc": "0.1.1-dev-7e9048c.0+7e9048c",
28
+ "@agoric/internal": "0.3.3-dev-7e9048c.0+7e9048c",
29
+ "@agoric/notifier": "0.6.3-dev-7e9048c.0+7e9048c",
30
+ "@agoric/smart-wallet": "0.5.4-dev-7e9048c.0+7e9048c",
31
+ "@agoric/vat-data": "0.5.3-dev-7e9048c.0+7e9048c",
32
+ "@agoric/vats": "0.15.2-dev-7e9048c.0+7e9048c",
33
+ "@agoric/zoe": "0.26.3-dev-7e9048c.0+7e9048c",
34
34
  "@endo/bundle-source": "^3.5.0",
35
35
  "@endo/captp": "^4.4.3",
36
36
  "@endo/eventual-send": "^1.2.8",
@@ -43,14 +43,14 @@
43
43
  "import-meta-resolve": "^2.2.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@agoric/deploy-script-support": "0.10.4-dev-ad2ef34.0+ad2ef34",
47
- "@agoric/governance": "0.10.4-dev-ad2ef34.0+ad2ef34",
48
- "@agoric/inter-protocol": "0.16.2-dev-ad2ef34.0+ad2ef34",
49
- "@agoric/orchestration": "0.1.1-dev-ad2ef34.0+ad2ef34",
50
- "@agoric/store": "0.9.3-dev-ad2ef34.0+ad2ef34",
51
- "@agoric/swing-store": "0.9.2-dev-ad2ef34.0+ad2ef34",
52
- "@agoric/swingset-liveslots": "0.10.3-dev-ad2ef34.0+ad2ef34",
53
- "@agoric/time": "0.3.3-dev-ad2ef34.0+ad2ef34",
46
+ "@agoric/deploy-script-support": "0.10.4-dev-7e9048c.0+7e9048c",
47
+ "@agoric/governance": "0.10.4-dev-7e9048c.0+7e9048c",
48
+ "@agoric/inter-protocol": "0.16.2-dev-7e9048c.0+7e9048c",
49
+ "@agoric/orchestration": "0.1.1-dev-7e9048c.0+7e9048c",
50
+ "@agoric/store": "0.9.3-dev-7e9048c.0+7e9048c",
51
+ "@agoric/swing-store": "0.9.2-dev-7e9048c.0+7e9048c",
52
+ "@agoric/swingset-liveslots": "0.10.3-dev-7e9048c.0+7e9048c",
53
+ "@agoric/time": "0.3.3-dev-7e9048c.0+7e9048c",
54
54
  "@endo/errors": "^1.2.8",
55
55
  "ava": "^5.3.0",
56
56
  "c8": "^10.1.2"
@@ -83,5 +83,5 @@
83
83
  "typeCoverage": {
84
84
  "atLeast": 90.93
85
85
  },
86
- "gitHead": "ad2ef34143d6048a279c644c46bc7ad97097b165"
86
+ "gitHead": "7e9048c1ef18f3a0530417839cfddba40da8ebda"
87
87
  }
@@ -0,0 +1,83 @@
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
+ };
@@ -22,10 +22,14 @@ const feedPolicyUsage = 'use --feedPolicy <policy> ...';
22
22
  * }} FastUSDCUpdateOpts
23
23
  */
24
24
 
25
- /** @type {CoreEvalBuilder} */
25
+ /**
26
+ * @param {Parameters<CoreEvalBuilder>[0]} powers
27
+ * @param {FastUSDCConfig} config
28
+ * @satisfies {CoreEvalBuilder}
29
+ */
26
30
  export const updateProposalBuilder = async (
27
- _utils,
28
- /** @type {FastUSDCConfig} */ config,
31
+ powers,
32
+ /** @type {Pick<FastUSDCConfig, 'feedPolicy'>} */ config,
29
33
  ) => {
30
34
  return harden({
31
35
  sourceSpec: '@agoric/fast-usdc/src/fast-usdc-policy.core.js',
@@ -1,10 +1,8 @@
1
1
  // @ts-check
2
2
  import { makeHelpers } from '@agoric/deploy-script-support';
3
3
  import { AmountMath } from '@agoric/ertp';
4
- import {
5
- FastUSDCConfigShape,
6
- getManifestForFastUSDC,
7
- } from '@agoric/fast-usdc/src/fast-usdc.start.js';
4
+ import { getManifestForFastUSDC } from '@agoric/fast-usdc/src/start-fast-usdc.core.js';
5
+ import { FastUSDCConfigShape } from '@agoric/fast-usdc/src/type-guards.js';
8
6
  import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
9
7
  import { configurations } from '@agoric/fast-usdc/src/utils/deploy-config.js';
10
8
  import {
@@ -72,13 +70,17 @@ const { USDC } = crossVatContext;
72
70
  const USDC_DECIMALS = 6;
73
71
  const unit = AmountMath.make(USDC, 10n ** BigInt(USDC_DECIMALS));
74
72
 
75
- /** @type {CoreEvalBuilder} */
73
+ /**
74
+ * @param {Parameters<CoreEvalBuilder>[0]} powers
75
+ * @param {FastUSDCConfig} config
76
+ * @satisfies {CoreEvalBuilder}
77
+ */
76
78
  export const defaultProposalBuilder = async (
77
79
  { publishRef, install },
78
- /** @type {FastUSDCConfig} */ config,
80
+ config,
79
81
  ) => {
80
82
  return harden({
81
- sourceSpec: '@agoric/fast-usdc/src/fast-usdc.start.js',
83
+ sourceSpec: '@agoric/fast-usdc/src/start-fast-usdc.core.js',
82
84
  /** @type {[string, Parameters<typeof getManifestForFastUSDC>[1]]} */
83
85
  getManifestCall: [
84
86
  getManifestForFastUSDC.name,