@agoric/builders 0.1.1-upgrade-18-dev-6ddbef0.0 → 0.1.1-upgrade-19-dev-c605745.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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/builders",
3
- "version": "0.1.1-upgrade-18-dev-6ddbef0.0+6ddbef0",
3
+ "version": "0.1.1-upgrade-19-dev-c605745.0+c605745",
4
4
  "description": "Build scripts for proposals to an Agoric chain",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -23,35 +23,37 @@
23
23
  "author": "Agoric",
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@agoric/ertp": "0.16.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
27
- "@agoric/internal": "0.3.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
28
- "@agoric/notifier": "0.6.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
29
- "@agoric/smart-wallet": "0.5.4-upgrade-18-dev-6ddbef0.0+6ddbef0",
30
- "@agoric/vat-data": "0.5.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
31
- "@agoric/vats": "0.15.2-upgrade-18-dev-6ddbef0.0+6ddbef0",
32
- "@agoric/zoe": "0.26.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
33
- "@endo/bundle-source": "^3.4.2",
34
- "@endo/captp": "^4.4.2",
35
- "@endo/eventual-send": "^1.2.7",
36
- "@endo/far": "^1.1.8",
37
- "@endo/init": "^1.1.6",
38
- "@endo/marshal": "^1.6.1",
39
- "@endo/promise-kit": "^1.1.7",
40
- "@endo/stream": "^1.2.7",
41
- "import-meta-resolve": "^2.2.1"
26
+ "@agoric/ertp": "0.16.3-upgrade-19-dev-c605745.0+c605745",
27
+ "@agoric/fast-usdc": "0.1.1-upgrade-19-dev-c605745.0+c605745",
28
+ "@agoric/internal": "0.3.3-upgrade-19-dev-c605745.0+c605745",
29
+ "@agoric/notifier": "0.6.3-upgrade-19-dev-c605745.0+c605745",
30
+ "@agoric/smart-wallet": "0.5.4-upgrade-19-dev-c605745.0+c605745",
31
+ "@agoric/vat-data": "0.5.3-upgrade-19-dev-c605745.0+c605745",
32
+ "@agoric/vats": "0.15.2-upgrade-19-dev-c605745.0+c605745",
33
+ "@agoric/zoe": "0.26.3-upgrade-19-dev-c605745.0+c605745",
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",
43
+ "import-meta-resolve": "^4.1.0"
42
44
  },
43
45
  "devDependencies": {
44
- "@agoric/deploy-script-support": "0.10.4-upgrade-18-dev-6ddbef0.0+6ddbef0",
45
- "@agoric/governance": "0.10.4-upgrade-18-dev-6ddbef0.0+6ddbef0",
46
- "@agoric/inter-protocol": "0.16.2-upgrade-18-dev-6ddbef0.0+6ddbef0",
47
- "@agoric/orchestration": "0.1.1-upgrade-18-dev-6ddbef0.0+6ddbef0",
48
- "@agoric/store": "0.9.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
49
- "@agoric/swing-store": "0.9.2-upgrade-18-dev-6ddbef0.0+6ddbef0",
50
- "@agoric/swingset-liveslots": "0.10.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
51
- "@agoric/time": "0.3.3-upgrade-18-dev-6ddbef0.0+6ddbef0",
52
- "@endo/errors": "^1.2.7",
46
+ "@agoric/deploy-script-support": "0.10.4-upgrade-19-dev-c605745.0+c605745",
47
+ "@agoric/governance": "0.10.4-upgrade-19-dev-c605745.0+c605745",
48
+ "@agoric/inter-protocol": "0.16.2-upgrade-19-dev-c605745.0+c605745",
49
+ "@agoric/orchestration": "0.1.1-upgrade-19-dev-c605745.0+c605745",
50
+ "@agoric/store": "0.9.3-upgrade-19-dev-c605745.0+c605745",
51
+ "@agoric/swing-store": "0.9.2-upgrade-19-dev-c605745.0+c605745",
52
+ "@agoric/swingset-liveslots": "0.10.3-upgrade-19-dev-c605745.0+c605745",
53
+ "@agoric/time": "0.3.3-upgrade-19-dev-c605745.0+c605745",
54
+ "@endo/errors": "^1.2.9",
53
55
  "ava": "^5.3.0",
54
- "c8": "^9.1.0"
56
+ "c8": "^10.1.2"
55
57
  },
56
58
  "files": [
57
59
  "CHANGELOG.md",
@@ -79,7 +81,7 @@
79
81
  "workerThreads": false
80
82
  },
81
83
  "typeCoverage": {
82
- "atLeast": 82.43
84
+ "atLeast": 91.57
83
85
  },
84
- "gitHead": "6ddbef09f18c18f205e8d166c363ff4884115ce9"
86
+ "gitHead": "c605745ee6619292b51cec5fc0db0a25ff1b203c"
85
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
+ };
@@ -0,0 +1,75 @@
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
+ };
@@ -0,0 +1,65 @@
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
+ };
@@ -0,0 +1,207 @@
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
+ };
@@ -0,0 +1,82 @@
1
+ import { parseScriptArgs, makeHelpers } from '@agoric/deploy-script-support';
2
+ import { getManifestForReplaceFeeDistributor } from '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js';
3
+ import { SECONDS_PER_HOUR } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js';
4
+
5
+ const configurations = {
6
+ A3P_INTEGRATION: {
7
+ params: {
8
+ collectionInterval: 30n,
9
+ keywordShares: {
10
+ RewardDistributor: 0n,
11
+ Reserve: 1n,
12
+ },
13
+ },
14
+ },
15
+ MAINNET: {
16
+ params: {
17
+ collectionInterval: 1n * SECONDS_PER_HOUR,
18
+ keywordShares: {
19
+ RewardDistributor: 0n,
20
+ Reserve: 1n,
21
+ },
22
+ },
23
+ },
24
+ DEVNET: {
25
+ params: {
26
+ collectionInterval: 1n * SECONDS_PER_HOUR,
27
+ keywordShares: {
28
+ RewardDistributor: 0n,
29
+ Reserve: 1n,
30
+ },
31
+ },
32
+ },
33
+ EMERYNET: {
34
+ params: {
35
+ collectionInterval: 1n * SECONDS_PER_HOUR,
36
+ keywordShares: {
37
+ RewardDistributor: 0n,
38
+ Reserve: 1n,
39
+ },
40
+ },
41
+ },
42
+ };
43
+
44
+ const { keys } = Object;
45
+ const knownVariants = keys(configurations);
46
+
47
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
48
+ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
49
+ const config = opts.config || configurations[opts.variant];
50
+ console.log('feeDist OPTS', opts, config);
51
+ if (!config) {
52
+ const error = `Unknown variant "${opts.variant}". Expected one of ${knownVariants.join(', ')}`;
53
+ console.error(error);
54
+ throw Error(error);
55
+ }
56
+ const { params } = config;
57
+
58
+ return harden({
59
+ sourceSpec:
60
+ '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js',
61
+ getManifestCall: [
62
+ getManifestForReplaceFeeDistributor.name,
63
+ {
64
+ feeDistributorRef: publishRef(
65
+ install('@agoric/inter-protocol/src/feeDistributor.js'),
66
+ ),
67
+ ...params,
68
+ },
69
+ ],
70
+ });
71
+ };
72
+
73
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
74
+ export default async (homeP, endowments) => {
75
+ const name = 'replace-feeDistributor-combo';
76
+ const opts = parseScriptArgs(endowments, name, knownVariants);
77
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
78
+
79
+ await writeCoreEval('replace-feeDistributor', utils =>
80
+ defaultProposalBuilder(utils, opts),
81
+ );
82
+ };
@@ -0,0 +1,36 @@
1
+ import { makeHelpers } from '@agoric/deploy-script-support';
2
+ import { getManifestForReplaceFeeDistributor } from '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js';
3
+ import { SECONDS_PER_HOUR } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js';
4
+
5
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
6
+ export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
7
+ console.log('feeDist OPTS', opts);
8
+ return harden({
9
+ sourceSpec:
10
+ '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js',
11
+ getManifestCall: [
12
+ getManifestForReplaceFeeDistributor.name,
13
+ {
14
+ feeDistributorRef: publishRef(
15
+ install('@agoric/inter-protocol/src/feeDistributor.js'),
16
+ ),
17
+ ...opts,
18
+ },
19
+ ],
20
+ });
21
+ };
22
+
23
+ /** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
24
+ export default async (homeP, endowments) => {
25
+ const { writeCoreEval } = await makeHelpers(homeP, endowments);
26
+
27
+ await writeCoreEval('replace-feeDistributor', utils =>
28
+ defaultProposalBuilder(utils, {
29
+ collectionInterval: 1n * SECONDS_PER_HOUR,
30
+ keywordShares: {
31
+ RewardDistributor: 0n,
32
+ Reserve: 1n,
33
+ },
34
+ }),
35
+ );
36
+ };
@@ -32,7 +32,7 @@ const configurations = {
32
32
  'agoric1qj07c7vfk3knqdral0sej7fa6eavkdn8vd8etf', // Simply Staking
33
33
  'agoric10vjkvkmpp9e356xeh6qqlhrny2htyzp8hf88fk', // P2P
34
34
  ],
35
- inBrandNames: ['ATOM', 'stTIA', 'stkATOM'],
35
+ inBrandNames: ['ATOM', 'stTIA', 'stkATOM', 'dATOM'],
36
36
  },
37
37
  EMERYNET: {
38
38
  oracleAddresses: [
@@ -41,6 +41,16 @@ const configurations = {
41
41
  ],
42
42
  inBrandNames: ['ATOM', 'stATOM', 'stOSMO', 'stTIA', 'stkATOM'],
43
43
  },
44
+ BOOT_TEST: {
45
+ oracleAddresses: [
46
+ 'agoric144rrhh4m09mh7aaffhm6xy223ym76gve2x7y78', // DSRV
47
+ 'agoric19d6gnr9fyp6hev4tlrg87zjrzsd5gzr5qlfq2p', // Stakin
48
+ 'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8', // 01node
49
+ 'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr', // Simply Staking
50
+ 'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj', // P2P
51
+ ],
52
+ inBrandNames: ['ATOM'],
53
+ },
44
54
  };
45
55
 
46
56
  const { keys } = Object;