@agoric/builders 0.2.0-u19.3 → 0.2.0-u20.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 CHANGED
@@ -3,35 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [0.2.0-u19.3](https://github.com/Agoric/agoric-sdk/compare/@agoric/builders@0.2.0-u19.2...@agoric/builders@0.2.0-u19.3) (2025-03-13)
7
-
8
- **Note:** Version bump only for package @agoric/builders
9
-
10
-
11
-
12
-
13
-
14
- ## [0.2.0-u19.2](https://github.com/Agoric/agoric-sdk/compare/@agoric/builders@0.2.0-u19.1...@agoric/builders@0.2.0-u19.2) (2025-03-06)
15
-
16
- **Note:** Version bump only for package @agoric/builders
17
-
18
-
19
-
20
-
21
-
22
- ## [0.2.0-u19.1](https://github.com/Agoric/agoric-sdk/compare/@agoric/builders@0.2.0-u19.0...@agoric/builders@0.2.0-u19.1) (2025-03-03)
23
-
24
- **Note:** Version bump only for package @agoric/builders
25
-
26
-
27
-
28
-
29
-
30
- ## 0.2.0-u19.0 (2025-02-24)
6
+ ## 0.2.0-u20.0 (2025-04-16)
31
7
 
32
8
 
33
9
  ### ⚠ BREAKING CHANGES
34
10
 
11
+ * **chainHub:** register and retrieve non-cosmos chains
35
12
  * remove orch.makeLocalAccount
36
13
  * make Network and IBC vats durable (#8721)
37
14
 
@@ -40,9 +17,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
40
17
  * smartWallet verstion 2 with watchedPromises ([5ed5107](https://github.com/Agoric/agoric-sdk/commit/5ed51078d39e643d91b572d9c50fad4a276d7ded))
41
18
  * `ForwardOpts` accepts `intermediateRecipient` ([eb975f1](https://github.com/Agoric/agoric-sdk/commit/eb975f1df1587bc9307b27c20b7b236cc7fe386e))
42
19
  * `ForwardOptsShape` ([50b1717](https://github.com/Agoric/agoric-sdk/commit/50b1717c1e40ed67a5e69810961ad8d0144c5f9e))
20
+ * `update-fee-config` proposal ([5d8775c](https://github.com/Agoric/agoric-sdk/commit/5d8775c409896369a931e6d78ae1d7958ad9d901))
43
21
  * a proposal to upgrade scaledPriceAuthorities ([e5ed0ff](https://github.com/Agoric/agoric-sdk/commit/e5ed0ff6abcb83f52b32d49125e21e6e41923ed0))
44
22
  * add `bech32Prefix?: string` to `CosmosChainInfo` ([cb9e1ee](https://github.com/Agoric/agoric-sdk/commit/cb9e1eeab9295b44ec009b82d73c457299e8d6f4))
45
23
  * add priceFeed for StkAtom ([6a861df](https://github.com/Agoric/agoric-sdk/commit/6a861dfa14f42b4547a24ba31175a3b1a74c97c1))
24
+ * Add terminate-governed-instance.js proposal ([c2cb517](https://github.com/Agoric/agoric-sdk/commit/c2cb51779039ef2a5921efcc35b3b365a7b6159f)), closes [#10725](https://github.com/Agoric/agoric-sdk/issues/10725) [#10861](https://github.com/Agoric/agoric-sdk/issues/10861)
46
25
  * add transfer method to CosmosOrchestrationAccount ([b1fdde1](https://github.com/Agoric/agoric-sdk/commit/b1fdde18b33237d1a2ea6f02938d998f55ce4d01))
47
26
  * add upgrade zcf only proposal ([73e0bb8](https://github.com/Agoric/agoric-sdk/commit/73e0bb830e7612e74c8fb510b909db154d2b2219))
48
27
  * added replace electorate proposal in chain upgrade ([4e88d9f](https://github.com/Agoric/agoric-sdk/commit/4e88d9f0412fe2b90efda30df0afbb61887bf35f))
@@ -55,8 +34,12 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
55
34
  * **builders:** fast-usdc oracleSet option for MAINNET, ... ([3bf01a2](https://github.com/Agoric/agoric-sdk/commit/3bf01a279e5b2c72d6667704a07056501012260e))
56
35
  * **builders:** fast-usdc policy update builder ([8ded3d8](https://github.com/Agoric/agoric-sdk/commit/8ded3d8be612a6944b80f3f63ab6fb727c76d179))
57
36
  * **builders:** non-ambient `strictPriceFeedProposalBuilder` in `priceFeedSupport.js` ([95174a2](https://github.com/Agoric/agoric-sdk/commit/95174a23671ed16f7497ef6b0edaa63a54f1343d))
37
+ * **builders:** to reconfigure Fast USDC ([833e674](https://github.com/Agoric/agoric-sdk/commit/833e67499acfe20e2d73c9322b8c3b28df52b1d6))
38
+ * Caip10RecordShape ([8a104f2](https://github.com/Agoric/agoric-sdk/commit/8a104f27cae9c6c1bd44c86d7bd2736fea333234))
58
39
  * chain-capabilities.js constants ([52ff70a](https://github.com/Agoric/agoric-sdk/commit/52ff70a187df1fadc89ccc506228bc6d0ca48da6))
40
+ * **chainHub:** register and retrieve non-cosmos chains ([bd11be2](https://github.com/Agoric/agoric-sdk/commit/bd11be25656ad0dd9ea4ad18c85f74a11ef2e520))
59
41
  * coreEval to update priceFeeds, auction, and vaultManager ([fd91f78](https://github.com/Agoric/agoric-sdk/commit/fd91f781ad721033d67485d1732272af0c689ae7))
42
+ * **cosmos:** upgrade IBC vat for next release ([c994490](https://github.com/Agoric/agoric-sdk/commit/c99449081560480e7e2dd6fc069b12dbcc630370))
60
43
  * examples/auto-stake-it.contract.js ([b87ecba](https://github.com/Agoric/agoric-sdk/commit/b87ecba0ea41f1397dbd513d8e4c541f1299fd3f)), closes [#9042](https://github.com/Agoric/agoric-sdk/issues/9042)
61
44
  * export `DenomDetailShape` ([2dfddb3](https://github.com/Agoric/agoric-sdk/commit/2dfddb3fb2018d769b1acc1b32f4ff3b4c7f67b7))
62
45
  * export `OrchestrationPowersShape` ([34b61ea](https://github.com/Agoric/agoric-sdk/commit/34b61eae918a5f02ba6e06ac7e15b24750494821))
@@ -83,6 +66,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
83
66
  * stakeBld contract ([a7e30a4](https://github.com/Agoric/agoric-sdk/commit/a7e30a4e43c00b2916d2d57c70063650e726321f))
84
67
  * start a new auction in a3p-integration ([969235b](https://github.com/Agoric/agoric-sdk/commit/969235b18abbd15187e343d5f616f12177d224c4))
85
68
  * update price feed proposal support for custom config ([8804ed2](https://github.com/Agoric/agoric-sdk/commit/8804ed28e259bf4ee9dd8872ccdd9ec42897e279))
69
+ * update settler reference proposal ([23e52dc](https://github.com/Agoric/agoric-sdk/commit/23e52dc7a074c3366a24bbd34a4df7a419fd992f))
86
70
  * upgrade auction and vaults to use the new governor ([5aeac6d](https://github.com/Agoric/agoric-sdk/commit/5aeac6d2bd3a95357c9a725e01391b3d967530ff))
87
71
  * upgrade v7-board and test it ([#10516](https://github.com/Agoric/agoric-sdk/issues/10516)) ([d8a109e](https://github.com/Agoric/agoric-sdk/commit/d8a109edcc78c977ef856131b52dd449e6a9d724)), closes [#10394](https://github.com/Agoric/agoric-sdk/issues/10394)
88
72
  * **vat-transfer:** first cut at working proposal ([2864bd5](https://github.com/Agoric/agoric-sdk/commit/2864bd5c12300c3595df9676bcfde894dbe59b29))
@@ -100,5 +84,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
100
84
  * **orchestration:** makeAccount never resolves when icqEnabled: false ([a74b6a2](https://github.com/Agoric/agoric-sdk/commit/a74b6a27d5108c5e014d546b86c695e3fc8bf2e5))
101
85
  * repair storage of zcfBundleCap and add a3p test ([72c7574](https://github.com/Agoric/agoric-sdk/commit/72c75740aff920ffb53231441d0f00a8747400f1))
102
86
  * support issuerName separate from keyword in add-collateral-core ([f0b1559](https://github.com/Agoric/agoric-sdk/commit/f0b1559374fe67d10e92f20c85d90a6f07e03cf0))
87
+ * **types:** discriminate `ChainInfo` union on `namespace` ([0f9f3fc](https://github.com/Agoric/agoric-sdk/commit/0f9f3fcbdd9da33b2eca1c02a2f7189c5405e8ff))
103
88
  * validate scriptArgs endowment ([6864614](https://github.com/Agoric/agoric-sdk/commit/68646147d3e95c68b4a90c9e37d888ef00e9d35d))
104
89
  * write-chain-info after u17 ([fc1f3ce](https://github.com/Agoric/agoric-sdk/commit/fc1f3ce1fe03bb2018edd4eb55d6561312d5fbe8))
90
+
91
+
92
+ ### Reverts
93
+
94
+ * Revert "chore: remove 'encoding' from ChainAddress" ([be9dee2](https://github.com/Agoric/agoric-sdk/commit/be9dee245a04714568a45ae8b328f54b20b43d8a))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/builders",
3
- "version": "0.2.0-u19.3",
3
+ "version": "0.2.0-u20.0",
4
4
  "description": "Build scripts for proposals to an Agoric chain",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -23,35 +23,34 @@
23
23
  "author": "Agoric",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@agoric/ertp": "^0.16.3-u19.2",
27
- "@agoric/fast-usdc": "^0.2.0-u19.2",
28
- "@agoric/internal": "^0.4.0-u19.2",
29
- "@agoric/notifier": "^0.7.0-u19.2",
30
- "@agoric/smart-wallet": "^0.5.4-u19.2",
31
- "@agoric/vat-data": "^0.5.3-u19.2",
32
- "@agoric/vats": "^0.16.0-u19.2",
33
- "@agoric/zoe": "^0.27.0-u19.2",
34
- "@endo/bundle-source": "^3.5.1",
35
- "@endo/captp": "^4.4.4",
36
- "@endo/eventual-send": "^1.3.0",
37
- "@endo/far": "^1.1.10",
38
- "@endo/init": "^1.1.8",
39
- "@endo/marshal": "^1.6.3",
40
- "@endo/patterns": "^1.4.8",
41
- "@endo/promise-kit": "^1.1.9",
42
- "@endo/stream": "^1.2.9",
26
+ "@agoric/ertp": "^0.16.3-u20.0",
27
+ "@agoric/internal": "^0.4.0-u20.0",
28
+ "@agoric/notifier": "^0.7.0-u20.0",
29
+ "@agoric/smart-wallet": "^0.5.4-u20.0",
30
+ "@agoric/vat-data": "^0.5.3-u20.0",
31
+ "@agoric/vats": "^0.16.0-u20.0",
32
+ "@agoric/zoe": "^0.27.0-u20.0",
33
+ "@endo/bundle-source": "^4.0.0",
34
+ "@endo/captp": "^4.4.5",
35
+ "@endo/eventual-send": "^1.3.1",
36
+ "@endo/far": "^1.1.11",
37
+ "@endo/init": "^1.1.9",
38
+ "@endo/marshal": "^1.6.4",
39
+ "@endo/patterns": "^1.5.0",
40
+ "@endo/promise-kit": "^1.1.10",
41
+ "@endo/stream": "^1.2.10",
43
42
  "import-meta-resolve": "^4.1.0"
44
43
  },
45
44
  "devDependencies": {
46
- "@agoric/deploy-script-support": "^0.10.4-u19.2",
47
- "@agoric/governance": "^0.10.4-u19.2",
48
- "@agoric/inter-protocol": "^0.17.0-u19.2",
49
- "@agoric/orchestration": "^0.2.0-u19.2",
50
- "@agoric/store": "^0.9.3-u19.0",
51
- "@agoric/swing-store": "^0.10.0-u19.2",
52
- "@agoric/swingset-liveslots": "^0.10.3-u19.2",
53
- "@agoric/time": "^0.3.3-u19.0",
54
- "@endo/errors": "^1.2.9",
45
+ "@agoric/deploy-script-support": "^0.10.4-u20.0",
46
+ "@agoric/governance": "^0.10.4-u20.0",
47
+ "@agoric/inter-protocol": "^0.17.0-u20.0",
48
+ "@agoric/orchestration": "^0.2.0-u20.0",
49
+ "@agoric/store": "^0.9.3-u20.0",
50
+ "@agoric/swing-store": "^0.10.0-u20.0",
51
+ "@agoric/swingset-liveslots": "^0.10.3-u20.0",
52
+ "@agoric/time": "^0.3.3-u20.0",
53
+ "@endo/errors": "^1.2.10",
55
54
  "ava": "^5.3.0",
56
55
  "c8": "^10.1.2"
57
56
  },
@@ -81,7 +80,7 @@
81
80
  "workerThreads": false
82
81
  },
83
82
  "typeCoverage": {
84
- "atLeast": 91.57
83
+ "atLeast": 91.55
85
84
  },
86
- "gitHead": "f0ae74b84cb6de3724bfdcd18b4bea7e8199dee1"
85
+ "gitHead": "8e4207fa19dabf76c1f91f8779b5b5b93570ecea"
87
86
  }
@@ -1,10 +1,10 @@
1
1
  /// <reference types="ses" />
2
2
  import { makeHelpers } from '@agoric/deploy-script-support';
3
3
 
4
- /** @type {Record<string, import('@agoric/orchestration/src/chain-info.js').ChainInfo>} */
4
+ /** @type {Record<string, import('@agoric/orchestration').ChainInfo>} */
5
5
  const chainInfo = {
6
6
  hot: {
7
- allegedName: 'Hot New Chain',
7
+ bech32Prefix: 'cosmos',
8
8
  chainId: 'hot-1',
9
9
  connections: {
10
10
  'cosmoshub-4': {
@@ -26,6 +26,8 @@ const chainInfo = {
26
26
  },
27
27
  },
28
28
  },
29
+ namespace: 'cosmos',
30
+ reference: 'hot-1',
29
31
  },
30
32
  };
31
33
 
@@ -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/src/chain-info.js').ChainInfo>} */
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
- allegedName: 'Hot New Chain',
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
- 'USDC_axl',
58
- 'USDT_grv',
57
+ 'ATOM',
58
+ 'USDT',
59
59
  'DAI_axl',
60
60
  'DAI_grv',
61
+ 'USDC_axl',
62
+ 'stOSMO',
61
63
  'stATOM',
62
- 'USDC_grv',
63
- 'ATOM',
64
- 'USDT_axl',
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 ({ publishRef, install }) =>
5
- harden({
6
- sourceSpec: '@agoric/vats/src/proposals/upgrade-vats-generic-proposal.js',
7
- getManifestCall: [
8
- 'getManifestForUpgradingVats',
9
- {
10
- bundleRefs: {
11
- ibc: publishRef(install('@agoric/vats/src/vat-ibc.js')),
12
- network: publishRef(install('@agoric/vats/src/vat-network.js')),
13
- localchain: publishRef(install('@agoric/vats/src/vat-localchain.js')),
14
- transfer: publishRef(install('@agoric/vats/src/vat-transfer.js')),
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-network', defaultProposalBuilder);
20
+ await writeCoreProposal('upgrade-orchestration', defaultProposalBuilder);
27
21
  };
@@ -0,0 +1,23 @@
1
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
2
+ export const upgradeVatsProposalBuilder = async (
3
+ { publishRef, install },
4
+ bundleRecord,
5
+ ) => {
6
+ if (!bundleRecord) {
7
+ throw Error('Missing bundleRecord');
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(bundleRecord).map(
16
+ ([name, entrypoint]) =>
17
+ /** @type {const} */ ([name, publishRef(install(entrypoint))]),
18
+ ),
19
+ ),
20
+ },
21
+ ],
22
+ });
23
+ };
@@ -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
- };
@@ -1,65 +0,0 @@
1
- import { parseArgs } from 'node:util';
2
- import { getManifestForUpdateFastUsdcPolicy } from '@agoric/fast-usdc/src/fast-usdc-policy.core.js';
3
- import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
4
- import { FeedPolicyShape } from '@agoric/fast-usdc/src/type-guards.js';
5
- import { makeHelpers } from '@agoric/deploy-script-support';
6
-
7
- /**
8
- * @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js'
9
- * @import {ParseArgsConfig} from 'node:util'
10
- * @import {FastUSDCConfig} from '@agoric/fast-usdc';
11
- */
12
-
13
- /** @type {ParseArgsConfig['options']} */
14
- const options = {
15
- feedPolicy: { type: 'string' },
16
- };
17
- const feedPolicyUsage = 'use --feedPolicy <policy> ...';
18
-
19
- /**
20
- * @typedef {{
21
- * feedPolicy?: string;
22
- * }} FastUSDCUpdateOpts
23
- */
24
-
25
- /**
26
- * @param {Parameters<CoreEvalBuilder>[0]} powers
27
- * @param {FastUSDCConfig} config
28
- * @satisfies {CoreEvalBuilder}
29
- */
30
- export const updateProposalBuilder = async (
31
- powers,
32
- /** @type {Pick<FastUSDCConfig, 'feedPolicy'>} */ config,
33
- ) => {
34
- return harden({
35
- sourceSpec: '@agoric/fast-usdc/src/fast-usdc-policy.core.js',
36
- /** @type {[string, Parameters<typeof getManifestForUpdateFastUsdcPolicy>[1]]} */
37
- getManifestCall: [
38
- getManifestForUpdateFastUsdcPolicy.name,
39
- {
40
- options: toExternalConfig(
41
- config,
42
- {},
43
- harden({ feedPolicy: FeedPolicyShape }),
44
- ),
45
- },
46
- ],
47
- });
48
- };
49
-
50
- /** @type {DeployScriptFunction} */
51
- export default async (homeP, endowments) => {
52
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
53
- const {
54
- values: { feedPolicy },
55
- } = parseArgs({ args: endowments.scriptArgs, options });
56
-
57
- const parseFeedPolicy = () => {
58
- if (typeof feedPolicy !== 'string') throw Error(feedPolicyUsage);
59
- return JSON.parse(feedPolicy);
60
- };
61
- const config = harden({ feedPolicy: parseFeedPolicy() });
62
- await writeCoreEval('eval-fast-usdc-policy-update', utils =>
63
- updateProposalBuilder(utils, config),
64
- );
65
- };
@@ -1,207 +0,0 @@
1
- // @ts-check
2
- import { makeHelpers } from '@agoric/deploy-script-support';
3
- import { AmountMath } from '@agoric/ertp';
4
- import { getManifestForFastUSDC } from '@agoric/fast-usdc/src/start-fast-usdc.core.js';
5
- import { FastUSDCConfigShape } from '@agoric/fast-usdc/src/type-guards.js';
6
- import { toExternalConfig } from '@agoric/fast-usdc/src/utils/config-marshal.js';
7
- import { configurations } from '@agoric/fast-usdc/src/utils/deploy-config.js';
8
- import {
9
- multiplyBy,
10
- parseRatio,
11
- } from '@agoric/zoe/src/contractSupport/ratio.js';
12
- import { Far } from '@endo/far';
13
- import { parseArgs } from 'node:util';
14
-
15
- /**
16
- * @import {CoreEvalBuilder, DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js'
17
- * @import {ParseArgsConfig} from 'node:util'
18
- * @import {FastUSDCConfig, FeedPolicy} from '@agoric/fast-usdc';
19
- */
20
-
21
- const { keys } = Object;
22
-
23
- /** @type {ParseArgsConfig['options']} */
24
- const options = {
25
- flatFee: { type: 'string', default: '0.01' },
26
- variableRate: { type: 'string', default: '0.01' },
27
- contractRate: { type: 'string', default: '0.2' },
28
- net: { type: 'string' },
29
- oracle: { type: 'string', multiple: true },
30
- feedPolicy: { type: 'string' },
31
- usdcDenom: {
32
- type: 'string',
33
- default:
34
- 'ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9',
35
- },
36
- chainInfo: { type: 'string' },
37
- assetInfo: { type: 'string' },
38
- noNoble: { type: 'boolean', default: false },
39
- };
40
- const oraclesUsage = 'use --oracle name:address ...';
41
-
42
- const feedPolicyUsage = 'use --feedPolicy <policy> ...';
43
-
44
- const chainInfoUsage = 'use --chainInfo {chainName:CosmosChainInfo, ...}';
45
- const assetInfoUsage =
46
- 'use --assetInfo { denom:DenomInfo & {brandKey?: string} ... }';
47
-
48
- /**
49
- * @typedef {{
50
- * flatFee: string;
51
- * variableRate: string;
52
- * contractRate: string;
53
- * net?: string;
54
- * oracle?: string[];
55
- * usdcDenom: string;
56
- * feedPolicy?: string;
57
- * chainInfo?: string;
58
- * assetInfo?: string;
59
- * noNoble: boolean;
60
- * }} FastUSDCOpts
61
- */
62
-
63
- const crossVatContext = /** @type {const} */ ({
64
- /** @type {Brand<'nat'>} */
65
- USDC: Far('USDC Brand'),
66
- });
67
- const { USDC } = crossVatContext;
68
- const USDC_DECIMALS = 6;
69
- const unit = AmountMath.make(USDC, 10n ** BigInt(USDC_DECIMALS));
70
-
71
- /**
72
- * @param {Parameters<CoreEvalBuilder>[0]} powers
73
- * @param {FastUSDCConfig} config
74
- * @satisfies {CoreEvalBuilder}
75
- */
76
- export const defaultProposalBuilder = async (
77
- { publishRef, install },
78
- config,
79
- ) => {
80
- return harden({
81
- sourceSpec: '@agoric/fast-usdc/src/start-fast-usdc.core.js',
82
- /** @type {[string, Parameters<typeof getManifestForFastUSDC>[1]]} */
83
- getManifestCall: [
84
- getManifestForFastUSDC.name,
85
- {
86
- options: toExternalConfig(config, crossVatContext, FastUSDCConfigShape),
87
- installKeys: {
88
- fastUsdc: publishRef(
89
- install('@agoric/fast-usdc/src/fast-usdc.contract.js'),
90
- ),
91
- },
92
- },
93
- ],
94
- });
95
- };
96
-
97
- /** @type {DeployScriptFunction} */
98
- export default async (homeP, endowments) => {
99
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
100
- const { scriptArgs } = endowments;
101
-
102
- /** @type {{ values: FastUSDCOpts }} */
103
- // @ts-expect-error ensured by options
104
- const {
105
- values: {
106
- oracle: oracleArgs,
107
- net,
108
- usdcDenom,
109
- feedPolicy,
110
- chainInfo,
111
- assetInfo,
112
- noNoble,
113
- ...fees
114
- },
115
- } = parseArgs({ args: scriptArgs, options });
116
-
117
- /** @returns {FeedPolicy} */
118
- const parseFeedPolicy = () => {
119
- if (net) {
120
- if (!(net in configurations)) {
121
- throw Error(`${net} not in ${keys(configurations)}`);
122
- }
123
- return configurations[net].feedPolicy;
124
- }
125
- if (!feedPolicy) throw Error(feedPolicyUsage);
126
- const parsed = JSON.parse(feedPolicy);
127
- if (!parsed.chainPolicies) {
128
- return {
129
- ...configurations.MAINNET.feedPolicy,
130
- ...parsed,
131
- };
132
- } else {
133
- // consider having callers use `toExternalConfig` to pass in bigints and
134
- // use `fromExternalConfig` here to parse
135
- throw Error('TODO: support unmarshalling feedPolicy');
136
- }
137
- };
138
-
139
- const parseOracleArgs = () => {
140
- if (net) {
141
- if (!(net in configurations)) {
142
- throw Error(`${net} not in ${keys(configurations)}`);
143
- }
144
- return configurations[net].oracles;
145
- }
146
- if (!oracleArgs) throw Error(oraclesUsage);
147
- return Object.fromEntries(
148
- oracleArgs.map(arg => {
149
- const result = arg.match(/(?<name>[^:]+):(?<address>.+)/);
150
- if (!(result && result.groups)) throw Error(oraclesUsage);
151
- const { name, address } = result.groups;
152
- return [name, address];
153
- }),
154
- );
155
- };
156
-
157
- /** @param {string} numeral */
158
- const toAmount = numeral => multiplyBy(unit, parseRatio(numeral, USDC));
159
- /** @param {string} numeral */
160
- const toRatio = numeral => parseRatio(numeral, USDC);
161
- const parseFeeConfigArgs = () => {
162
- const { flatFee, variableRate, contractRate } = fees;
163
- return {
164
- flat: toAmount(flatFee),
165
- variableRate: toRatio(variableRate),
166
- contractRate: toRatio(contractRate),
167
- };
168
- };
169
-
170
- const parseChainInfo = () => {
171
- if (net) {
172
- if (!(net in configurations)) {
173
- throw Error(`${net} not in ${keys(configurations)}`);
174
- }
175
- return configurations[net].chainInfo;
176
- }
177
- if (!chainInfo) throw Error(chainInfoUsage);
178
- return JSON.parse(chainInfo);
179
- };
180
- const parseAssetInfo = () => {
181
- if (net) {
182
- if (!(net in configurations)) {
183
- throw Error(`${net} not in ${keys(configurations)}`);
184
- }
185
- return configurations[net].assetInfo;
186
- }
187
- if (!assetInfo) throw Error(assetInfoUsage);
188
- return JSON.parse(assetInfo);
189
- };
190
-
191
- /** @type {FastUSDCConfig} */
192
- const config = harden({
193
- oracles: parseOracleArgs(),
194
- terms: {
195
- usdcDenom,
196
- },
197
- feeConfig: parseFeeConfigArgs(),
198
- feedPolicy: parseFeedPolicy(),
199
- chainInfo: parseChainInfo(),
200
- assetInfo: parseAssetInfo(),
201
- noNoble,
202
- });
203
-
204
- await writeCoreEval('start-fast-usdc', utils =>
205
- defaultProposalBuilder(utils, config),
206
- );
207
- };
@@ -1,134 +0,0 @@
1
- /**
2
- * @file Terminate price-feed governor instances such as mainnet v110.
3
- * Functions as both an off-chain builder and an on-chain core-eval.
4
- */
5
-
6
- /// <reference types="@agoric/vats/src/core/types-ambient"/>
7
-
8
- import { E } from '@endo/far';
9
-
10
- const SELF = '@agoric/builders/scripts/vats/terminate-governor-instance.js';
11
- const USAGE = `Usage: agoric run /path/to/terminate-governor-instance.js \\
12
- <$governorInstanceHandleBoardID:$instanceKitLabel>...`;
13
-
14
- const repr = val =>
15
- typeof val === 'string' || (typeof val === 'object' && val !== null)
16
- ? JSON.stringify(val)
17
- : String(val);
18
- const defaultMakeError = (strings, ...subs) =>
19
- Error(
20
- strings.map((s, i) => `${i === 0 ? '' : repr(subs[i - 1])}${s}`).join(''),
21
- );
22
- const makeUsageError = (strings, ...subs) => {
23
- const err = defaultMakeError(strings, ...subs);
24
- console.error(err.message);
25
- console.error(USAGE);
26
- return err;
27
- };
28
-
29
- const rtarget = /^(?<boardID>board[0-9]+):(?<instanceKitLabel>.+)$/;
30
- /**
31
- * @param {string[]} args
32
- * @param {(strings: TemplateStringsArray | string[], ...subs: unknown[]) => Error} [makeError]
33
- * @returns {Array<{boardID: string, instanceKitLabel: string}>}
34
- */
35
- const parseTargets = (args = [], makeError = defaultMakeError) => {
36
- if (!Array.isArray(args)) throw makeError`invalid targets: ${args}`;
37
- /** @type {Array<{boardID: string, instanceKitLabel: string}>} */
38
- const targets = [];
39
- const badTargets = [];
40
- for (const arg of args) {
41
- const m = typeof arg === 'string' && arg.match(rtarget);
42
- if (!m) {
43
- badTargets.push(arg);
44
- } else {
45
- // @ts-expect-error cast
46
- targets.push(m.groups);
47
- }
48
- }
49
- if (badTargets.length !== 0) {
50
- throw makeError`malformed target(s): ${badTargets}`;
51
- } else if (targets.length === 0) {
52
- throw makeError`no target(s)`;
53
- }
54
- return targets;
55
- };
56
-
57
- /**
58
- * @param {BootstrapPowers} powers
59
- * @param {{ options: { targetSpecifiers: string[] } }} config
60
- */
61
- export const terminateGovernors = async (
62
- { consume: { board, governedContractKits } },
63
- { options: { targetSpecifiers } },
64
- ) => {
65
- const { Fail, quote: q } = assert;
66
- const targets = parseTargets(targetSpecifiers, Fail);
67
- const doneP = Promise.allSettled(
68
- targets.map(async ({ boardID, instanceKitLabel }) => {
69
- const logLabel = [boardID, instanceKitLabel];
70
- const contractInstanceHandle = await E(board).getValue(boardID);
71
- const instanceKit = await E(governedContractKits).get(
72
- // @ts-expect-error TS2345 Property '[tag]' is missing
73
- contractInstanceHandle,
74
- );
75
- console.log(
76
- `${q(logLabel)} alleged governor contract instance kit`,
77
- instanceKit,
78
- );
79
- const { label, governorAdminFacet, adminFacet } = instanceKit;
80
- label === instanceKitLabel ||
81
- Fail`${q(logLabel)} unexpected instanceKit label, got ${label} but wanted ${q(instanceKitLabel)}`;
82
- (adminFacet && adminFacet !== governorAdminFacet) ||
83
- Fail`${q(logLabel)} instanceKit adminFacet should have been present and different from governorAdminFacet but was ${adminFacet}`;
84
- const reason = harden(Error(`core-eval terminating ${label} governor`));
85
- await E(governorAdminFacet).terminateContract(reason);
86
- console.log(`${q(logLabel)} terminated governor`);
87
- }),
88
- );
89
- const results = await doneP;
90
- const problems = targets.flatMap(({ boardID, instanceKitLabel }, i) => {
91
- if (results[i].status === 'fulfilled') return [];
92
- return [[boardID, instanceKitLabel, results[i].reason]];
93
- });
94
- if (problems.length !== 0) {
95
- console.error('governor termination(s) failed', problems);
96
- Fail`governor termination(s) failed: ${problems}`;
97
- }
98
- };
99
- harden(terminateGovernors);
100
-
101
- export const getManifest = (_powers, targetSpecifiers) => {
102
- parseTargets(targetSpecifiers);
103
- return {
104
- manifest: {
105
- [terminateGovernors.name]: {
106
- consume: { board: true, governedContractKits: true },
107
- },
108
- },
109
- // Provide `terminateGovernors` a second argument like
110
- // `{ options: { targetSpecifiers } }`.
111
- options: { targetSpecifiers },
112
- };
113
- };
114
-
115
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
116
- export const defaultProposalBuilder = async (_utils, targetSpecifiers) => {
117
- parseTargets(targetSpecifiers);
118
- return harden({
119
- sourceSpec: SELF,
120
- getManifestCall: ['getManifest', targetSpecifiers],
121
- });
122
- };
123
-
124
- /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
125
- export default async (homeP, endowments) => {
126
- const { scriptArgs } = endowments;
127
- parseTargets(scriptArgs, makeUsageError);
128
- const dspModule = await import('@agoric/deploy-script-support');
129
- const { makeHelpers } = dspModule;
130
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
131
- await writeCoreEval(terminateGovernors.name, utils =>
132
- defaultProposalBuilder(utils, scriptArgs),
133
- );
134
- };