@agoric/builders 0.1.1-dev-cbcea8c.0.cbcea8c → 0.1.1-dev-04baeed.0.04baeed

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 (27) hide show
  1. package/package.json +18 -19
  2. package/scripts/testing/register-interchain-bank-assets.builder.js +41 -0
  3. package/scripts/vats/init-core.js +2 -2
  4. package/scripts/vats/invite-committee.js +45 -0
  5. package/scripts/vats/start-econ-committee.js +46 -0
  6. package/scripts/inter-protocol/add-collateral-core.js +0 -132
  7. package/scripts/inter-protocol/init-core.js +0 -233
  8. package/scripts/inter-protocol/invite-committee-core.js +0 -52
  9. package/scripts/inter-protocol/manual-price-feed.js +0 -131
  10. package/scripts/inter-protocol/price-feed-core.js +0 -113
  11. package/scripts/inter-protocol/replace-electorate-core.js +0 -173
  12. package/scripts/inter-protocol/replace-feeDistributor-combo.js +0 -87
  13. package/scripts/inter-protocol/replace-feeDistributor.js +0 -41
  14. package/scripts/inter-protocol/updatePriceFeeds.js +0 -141
  15. package/scripts/inter-protocol/withdraw-reserve.build.js +0 -73
  16. package/scripts/inter-protocol/withdraw-vbank-reserve-permit.json +0 -6
  17. package/scripts/inter-protocol/withdraw-vbank-reserve.js +0 -72
  18. package/scripts/testing/replace-feeDistributor-short.js +0 -38
  19. package/scripts/vats/priceFeedSupport.js +0 -99
  20. package/scripts/vats/updateAtomPriceFeed.js +0 -27
  21. package/scripts/vats/updateStAtomPriceFeed.js +0 -27
  22. package/scripts/vats/updateStOsmoPriceFeed.js +0 -27
  23. package/scripts/vats/updateStTiaPriceFeed.js +0 -27
  24. package/scripts/vats/updateStkAtomPriceFeed.js +0 -27
  25. package/scripts/vats/upgrade-asset-reserve.js +0 -26
  26. package/scripts/vats/upgrade-psm.js +0 -24
  27. package/scripts/vats/upgradeScaledPriceAuthorities.js +0 -28
@@ -1,131 +0,0 @@
1
- import { E } from '@endo/far';
2
- import { deeplyFulfilled } from '@endo/marshal';
3
- import { makeNotifierFromAsyncIterable } from '@agoric/notifier';
4
-
5
- import process from 'node:process';
6
-
7
- /**
8
- * @import {Board} from '@agoric/vats';
9
- */
10
-
11
- /**
12
- * After extracting the oracleAdmins to entries in home.scratch, you can use one
13
- * from the REPL like:
14
- *
15
- * lookup('agoricNames', 'oracleBrand', 'ATOM').then(brand => atom = brand)
16
- * -> [Object Alleged: ATOM brand]{}
17
- * lookup('agoricNames', 'oracleBrand', 'USD').then(brand => usd = brand)
18
- * -> [Object Alleged: USD brand]{}
19
- * pa = home.priceAuthority
20
- * -> [Object Alleged: PriceAuthority]{}
21
- * qn = E(pa).makeQuoteNotifier({ value: 1n * 10n ** 6n, brand: atom }, usd)
22
- * -> [Object Alleged: QuoteNotifier]{}
23
- * oa = E(home.scratch).get("offerResult unknown#1652669688625")
24
- * -> [Object Alleged: OracleAdmin]{}
25
- * E(oa).pushResult('19.37')
26
- * E(qn).getUpdateSince()
27
- *
28
- * @typedef {{
29
- * board: Board;
30
- * chainTimerService;
31
- * scratch;
32
- * zoe;
33
- * }} Home
34
- * @param {Promise<Home>} homePromise
35
- * @param {object} root0
36
- * @param {(...path: string[]) => Promise<any>} root0.lookup A promise for the
37
- * references available from REPL home
38
- */
39
- export default async function priceAuthorityFromNotifier(
40
- homePromise,
41
- { lookup },
42
- ) {
43
- const { AGGREGATOR_INSTANCE_LOOKUP } = process.env;
44
-
45
- // Let's wait for the promise to resolve.
46
- const home = await deeplyFulfilled(homePromise);
47
-
48
- let aggregatorInstance;
49
- if (AGGREGATOR_INSTANCE_LOOKUP) {
50
- aggregatorInstance = await lookup(JSON.parse(AGGREGATOR_INSTANCE_LOOKUP));
51
- }
52
-
53
- if (!aggregatorInstance) {
54
- console.log('Autodetecting aggregator instance...');
55
- // @ts-expect-error inspecific Home type
56
- const purse = E(home.wallet).getPurse('Default Zoe invite purse');
57
- const { value } = await E(purse).getCurrentAmount();
58
- const invitations = value.filter(
59
- ({ description }) => description === 'oracle invitation',
60
- );
61
- if (invitations.length > 1) {
62
- console.error('Multiple oracle invitations found', invitations);
63
- throw Error('You need an AGGREGATOR_INSTANCE_LOOKUP to disambiguate');
64
- }
65
- if (invitations.length === 0) {
66
- console.error(
67
- 'No oracle invitations found; you may need an AGGREGATOR_INSTANCE_LOOKUP',
68
- );
69
- } else {
70
- console.log('Found oracle invitation', invitations);
71
- aggregatorInstance = invitations[0].instance;
72
- }
73
- }
74
-
75
- if (!aggregatorInstance) {
76
- return;
77
- }
78
-
79
- const offer = {
80
- id: Date.now(),
81
- proposalTemplate: {},
82
- invitationQuery: {
83
- description: 'oracle invitation',
84
- instance: aggregatorInstance,
85
- },
86
- };
87
-
88
- console.log('Getting wallet bridge...');
89
- // @ts-expect-error inspecific Home type
90
- const bridge = await E(home.wallet).getBridge();
91
-
92
- // Consume an aggregator invitation for this instance.
93
- await E(bridge)
94
- .addOffer(offer)
95
- .then(
96
- () =>
97
- console.log(
98
- `Please approve your wallet's proposal to connect the aggregator ${aggregatorInstance}...`,
99
- ),
100
- () => {},
101
- );
102
-
103
- // @ts-expect-error inspecific Home type
104
- const walletAdmin = E(home.wallet).getAdminFacet();
105
-
106
- console.log('=====================================================');
107
- console.log('=== Extracting oracleAdmins from price feed offers...');
108
- console.log('=== Control-C to cancel');
109
- const offerIt = E(walletAdmin).getOffersNotifier();
110
- for await (const offers of makeNotifierFromAsyncIterable(offerIt)) {
111
- // console.log(offers);
112
- const completed = offers
113
- .filter(
114
- ({ status, invitationQuery: { instance } }) =>
115
- status === 'complete' && instance === aggregatorInstance,
116
- )
117
- .map(async ({ id }) => {
118
- const orKey = `offerResult ${id}`;
119
- await E(home.scratch).set(
120
- orKey,
121
- // @ts-expect-error inspecific Home type
122
- E(home.wallet).lookup('offerResult', id),
123
- );
124
- console.log(
125
- 'Use this oracleAdmin:',
126
- `E(home.scratch).get(${JSON.stringify(orKey)})`,
127
- );
128
- });
129
- await Promise.all(completed);
130
- }
131
- }
@@ -1,113 +0,0 @@
1
- /* eslint-env node */
2
- import { makeHelpers } from '@agoric/deploy-script-support';
3
- import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
4
- import { buildBundlePath } from '../lib/build-bundle.js';
5
-
6
- /**
7
- * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
8
- */
9
-
10
- export const DEFAULT_CONTRACT_TERMS = {
11
- POLL_INTERVAL: 30n,
12
- maxSubmissionCount: 1000,
13
- minSubmissionCount: 2,
14
- restartDelay: 1, // the number of rounds an Oracle has to wait before they can initiate another round
15
- timeout: 10, // in seconds according to chainTimerService
16
- minSubmissionValue: 1n,
17
- maxSubmissionValue: 2n ** 256n,
18
- };
19
-
20
- /** @type {CoreEvalBuilder} */
21
- export const defaultProposalBuilder = async (
22
- { publishRef, install },
23
- options = {},
24
- ) => {
25
- const {
26
- brandIn,
27
- brandOut,
28
- contractTerms = DEFAULT_CONTRACT_TERMS,
29
- AGORIC_INSTANCE_NAME,
30
- IN_BRAND_LOOKUP,
31
- OUT_BRAND_LOOKUP,
32
- IN_BRAND_NAME = IN_BRAND_LOOKUP[IN_BRAND_LOOKUP.length - 1],
33
- OUT_BRAND_NAME = OUT_BRAND_LOOKUP[OUT_BRAND_LOOKUP.length - 1],
34
- oracleAddresses,
35
- ...optionsRest
36
- } = options;
37
-
38
- assert(AGORIC_INSTANCE_NAME, 'AGORIC_INSTANCE_NAME is required');
39
- assert(Array.isArray(oracleAddresses), 'oracleAddresses array is required');
40
-
41
- if (!brandIn) {
42
- assert.equal(IN_BRAND_LOOKUP[0], 'agoricNames');
43
- assert(IN_BRAND_NAME);
44
- }
45
- if (!brandOut) {
46
- assert.equal(OUT_BRAND_LOOKUP[0], 'agoricNames');
47
- assert(OUT_BRAND_NAME);
48
- }
49
-
50
- const priceAggregator = interProtocolBundleSpecs.priceAggregator;
51
- const priceAggregatorPath = await buildBundlePath(
52
- import.meta.url,
53
- priceAggregator,
54
- );
55
-
56
- return harden({
57
- sourceSpec: '@agoric/inter-protocol/src/proposals/price-feed-proposal.js',
58
- getManifestCall: [
59
- 'getManifestForPriceFeed',
60
- {
61
- ...optionsRest,
62
- AGORIC_INSTANCE_NAME,
63
- contractTerms,
64
- oracleAddresses,
65
- IN_BRAND_LOOKUP,
66
- OUT_BRAND_LOOKUP,
67
- IN_BRAND_NAME,
68
- OUT_BRAND_NAME,
69
- brandInRef: brandIn && publishRef(brandIn),
70
- brandOutRef: brandOut && publishRef(brandOut),
71
- priceAggregatorRef: publishRef(
72
- install(priceAggregator.packagePath, priceAggregatorPath),
73
- ),
74
- },
75
- ],
76
- });
77
- };
78
-
79
- export const createGov = async (homeP, endowments) => {
80
- const { lookup } = endowments;
81
-
82
- const {
83
- AGORIC_INSTANCE_NAME,
84
- IN_BRAND_DECIMALS = '6',
85
- IN_BRAND_LOOKUP = JSON.stringify(['wallet', 'brand', 'BLD']),
86
- OUT_BRAND_DECIMALS = '6',
87
- OUT_BRAND_LOOKUP = JSON.stringify(['agoricNames', 'oracleBrand', 'USD']),
88
- ORACLE_ADDRESSES,
89
- } = process.env;
90
-
91
- assert(AGORIC_INSTANCE_NAME, 'AGORIC_INSTANCE_NAME is required');
92
- assert(ORACLE_ADDRESSES, 'ORACLE_ADDRESSES is required');
93
-
94
- const oracleAddresses = ORACLE_ADDRESSES.split(',');
95
-
96
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
97
-
98
- const inLookup = JSON.parse(IN_BRAND_LOOKUP);
99
- const outLookup = JSON.parse(OUT_BRAND_LOOKUP);
100
-
101
- const proposalBuilder = powers =>
102
- defaultProposalBuilder(powers, {
103
- AGORIC_INSTANCE_NAME,
104
- IN_BRAND_DECIMALS: parseInt(IN_BRAND_DECIMALS, 10),
105
- OUT_BRAND_DECIMALS: parseInt(OUT_BRAND_DECIMALS, 10),
106
- oracleAddresses,
107
- brandIn: lookup(inLookup).catch(() => undefined),
108
- brandOut: lookup(outLookup).catch(() => undefined),
109
- });
110
- await writeCoreEval('gov-price-feed', proposalBuilder); // gov-price-feed.js gov-price-feed-permit.json
111
- };
112
-
113
- export default createGov;
@@ -1,173 +0,0 @@
1
- /**
2
- * @file build core eval script to replace EC committee and charter
3
- * Usage:
4
- * To run this script, use the following command format in the CLI:
5
- * agoric run replace-electorate-core.js [ENVIRONMENT]
6
- * where [ENVIRONMENT] is one of the following:
7
- * - MAINNET
8
- * - DEVNET
9
- * - EMERYNET
10
- * - A3P_INTEGRATION
11
- * - BOOTSTRAP_TEST
12
- *
13
- * Example:
14
- * agoric run replace-electorate-core.js MAINNET
15
- */
16
- import { makeHelpers } from '@agoric/deploy-script-support';
17
- import { governanceSourceSpecRegistry } from '@agoric/governance/source-spec-registry.js';
18
- import { getManifestForReplaceAllElectorates } from '@agoric/inter-protocol/src/proposals/replaceElectorate.js';
19
- import { buildBundlePath } from '../lib/build-bundle.js';
20
-
21
- /**
22
- * @import {replaceAllElectorates} from '@agoric/inter-protocol/src/proposals/replaceElectorate.js';
23
- * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
24
- * @import {DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js';
25
- */
26
-
27
- /** @typedef {Parameters<typeof replaceAllElectorates>[1]['options']} ReplaceElectorateOptions */
28
-
29
- /** @type {Record<string, ReplaceElectorateOptions>} */
30
- const configurations = {
31
- MAINNET: {
32
- committeeName: 'Economic Committee',
33
- voterAddresses: {
34
- 'Chloe White': 'agoric1d4228cvelf8tj65f4h7n2td90sscavln2283h5',
35
- 'Chris Berg': 'agoric13p9adwk0na5npfq64g22l6xucvqdmu3xqe70wq',
36
- 'Joe Clark': 'agoric1zayxg4e9vd0es9c9jlpt36qtth255txjp6a8yc',
37
- },
38
- highPrioritySendersConfig: {
39
- addressesToAdd: [],
40
- addressesToRemove: [
41
- 'agoric1gx9uu7y6c90rqruhesae2t7c2vlw4uyyxlqxrx',
42
- 'agoric14543m33dr28x7qhwc558hzlj9szwhzwzpcmw6a',
43
- 'agoric1el6zqs8ggctj5vwyukyk4fh50wcpdpwgugd5l5',
44
- ],
45
- },
46
- },
47
- DEVNET: {
48
- committeeName: 'Economic Committee',
49
- voterAddresses: {
50
- gov1: 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce',
51
- gov2: 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang',
52
- gov4: 'agoric1f0h5zgxyg3euxsqzs0506uj4cmu56y30pqx46s',
53
- },
54
- highPrioritySendersConfig: {
55
- addressesToAdd: ['agoric1f0h5zgxyg3euxsqzs0506uj4cmu56y30pqx46s'],
56
- addressesToRemove: ['agoric1w8wktaur4zf8qmmtn3n7x3r0jhsjkjntcm3u6h'],
57
- },
58
- },
59
- EMERYNET: {
60
- committeeName: 'Economic Committee',
61
- voterAddresses: {
62
- gov1: 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce',
63
- gov2: 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang',
64
- gov4: 'agoric1f0h5zgxyg3euxsqzs0506uj4cmu56y30pqx46s',
65
- },
66
- highPrioritySendersConfig: {
67
- addressesToAdd: ['agoric1f0h5zgxyg3euxsqzs0506uj4cmu56y30pqx46s'],
68
- addressesToRemove: ['agoric1w8wktaur4zf8qmmtn3n7x3r0jhsjkjntcm3u6h'],
69
- },
70
- },
71
- A3P_INTEGRATION: {
72
- committeeName: 'Economic Committee',
73
- voterAddresses: {
74
- gov1: 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q',
75
- gov2: 'agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277',
76
- gov4: 'agoric1c9gyu460lu70rtcdp95vummd6032psmpdx7wdy',
77
- },
78
- highPrioritySendersConfig: {
79
- addressesToAdd: ['agoric1c9gyu460lu70rtcdp95vummd6032psmpdx7wdy'],
80
- addressesToRemove: ['agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq'],
81
- },
82
- },
83
- BOOTSTRAP_TEST: {
84
- committeeName: 'Economic Committee',
85
- voterAddresses: {
86
- gov1: 'agoric1gx9uu7y6c90rqruhesae2t7c2vlw4uyyxlqxrx',
87
- gov2: 'agoric1d4228cvelf8tj65f4h7n2td90sscavln2283h5',
88
- gov3: 'agoric14543m33dr28x7qhwc558hzlj9szwhzwzpcmw6a',
89
- },
90
- highPrioritySendersConfig: {
91
- addressesToAdd: [],
92
- addressesToRemove: [
93
- 'agoric13p9adwk0na5npfq64g22l6xucvqdmu3xqe70wq',
94
- 'agoric1el6zqs8ggctj5vwyukyk4fh50wcpdpwgugd5l5',
95
- 'agoric1zayxg4e9vd0es9c9jlpt36qtth255txjp6a8yc',
96
- ],
97
- },
98
- },
99
- };
100
-
101
- const { keys } = Object;
102
- const knownVariants = keys(configurations);
103
-
104
- /** @type {CoreEvalBuilder} */
105
- export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
106
- const config = opts.config || configurations[opts.variant];
107
- if (!config) {
108
- const error = `Unknown variant "${opts.variant}". Expected one of ${knownVariants.join(', ')}`;
109
- console.error(error);
110
- throw Error(error);
111
- }
112
- const { committeeName, voterAddresses, highPrioritySendersConfig } = config;
113
- const committee = governanceSourceSpecRegistry.committee;
114
- const economicCommitteePath = await buildBundlePath(
115
- import.meta.url,
116
- committee,
117
- );
118
- console.log(
119
- 'Generating replace committee proposal with config',
120
- JSON.stringify({
121
- committeeName,
122
- voterAddresses,
123
- highPrioritySendersConfig,
124
- }),
125
- );
126
- return harden({
127
- sourceSpec: '@agoric/inter-protocol/src/proposals/replaceElectorate.js',
128
- getManifestCall: [
129
- getManifestForReplaceAllElectorates.name,
130
- {
131
- committeeName,
132
- voterAddresses,
133
- highPrioritySendersConfig,
134
- economicCommitteeRef: publishRef(
135
- install(committee.packagePath, economicCommitteePath),
136
- ),
137
- },
138
- ],
139
- });
140
- };
141
-
142
- const Usage = `agoric run replace-electorate-core.js ${[...knownVariants, '<json-config>'].join(' | ')}`;
143
-
144
- /** @type {DeployScriptFunction} */
145
- export default async (homeP, endowments) => {
146
- const { scriptArgs } = endowments;
147
- const variantOrConfig = scriptArgs?.[0];
148
- console.log('replace-electorate-core.js', variantOrConfig);
149
-
150
- const opts = {};
151
-
152
- if (typeof variantOrConfig === 'string') {
153
- if (variantOrConfig[0] === '{') {
154
- try {
155
- opts.config = JSON.parse(variantOrConfig);
156
- } catch (err) {
157
- throw Error(`Failed to parse config argument ${variantOrConfig}`);
158
- }
159
- } else {
160
- opts.variant = variantOrConfig;
161
- }
162
- } else {
163
- console.error(Usage);
164
- throw Error(Usage);
165
- }
166
-
167
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
168
-
169
- await writeCoreEval(
170
- `replace-committee-${opts.variant || 'from-config'}`,
171
- utils => defaultProposalBuilder(utils, opts),
172
- );
173
- };
@@ -1,87 +0,0 @@
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
- /**
6
- * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
7
- * @import {DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js';
8
- */
9
-
10
- const configurations = {
11
- A3P_INTEGRATION: {
12
- params: {
13
- collectionInterval: 30n,
14
- keywordShares: {
15
- RewardDistributor: 0n,
16
- Reserve: 1n,
17
- },
18
- },
19
- },
20
- MAINNET: {
21
- params: {
22
- collectionInterval: 1n * SECONDS_PER_HOUR,
23
- keywordShares: {
24
- RewardDistributor: 0n,
25
- Reserve: 1n,
26
- },
27
- },
28
- },
29
- DEVNET: {
30
- params: {
31
- collectionInterval: 1n * SECONDS_PER_HOUR,
32
- keywordShares: {
33
- RewardDistributor: 0n,
34
- Reserve: 1n,
35
- },
36
- },
37
- },
38
- EMERYNET: {
39
- params: {
40
- collectionInterval: 1n * SECONDS_PER_HOUR,
41
- keywordShares: {
42
- RewardDistributor: 0n,
43
- Reserve: 1n,
44
- },
45
- },
46
- },
47
- };
48
-
49
- const { keys } = Object;
50
- const knownVariants = keys(configurations);
51
-
52
- /** @type {CoreEvalBuilder} */
53
- export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
54
- const config = opts.config || configurations[opts.variant];
55
- console.log('feeDist OPTS', opts, config);
56
- if (!config) {
57
- const error = `Unknown variant "${opts.variant}". Expected one of ${knownVariants.join(', ')}`;
58
- console.error(error);
59
- throw Error(error);
60
- }
61
- const { params } = config;
62
-
63
- return harden({
64
- sourceSpec:
65
- '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js',
66
- getManifestCall: [
67
- getManifestForReplaceFeeDistributor.name,
68
- {
69
- feeDistributorRef: publishRef(
70
- install('@agoric/inter-protocol/src/feeDistributor.js'),
71
- ),
72
- ...params,
73
- },
74
- ],
75
- });
76
- };
77
-
78
- /** @type {DeployScriptFunction} */
79
- export default async (homeP, endowments) => {
80
- const name = 'replace-feeDistributor-combo';
81
- const opts = parseScriptArgs(endowments, name, knownVariants);
82
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
83
-
84
- await writeCoreEval('replace-feeDistributor', utils =>
85
- defaultProposalBuilder(utils, opts),
86
- );
87
- };
@@ -1,41 +0,0 @@
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
- /**
6
- * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
7
- * @import {DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js';
8
- */
9
-
10
- /** @type {CoreEvalBuilder} */
11
- export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
12
- console.log('feeDist OPTS', opts);
13
- return harden({
14
- sourceSpec:
15
- '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js',
16
- getManifestCall: [
17
- getManifestForReplaceFeeDistributor.name,
18
- {
19
- feeDistributorRef: publishRef(
20
- install('@agoric/inter-protocol/src/feeDistributor.js'),
21
- ),
22
- ...opts,
23
- },
24
- ],
25
- });
26
- };
27
-
28
- /** @type {DeployScriptFunction} */
29
- export default async (homeP, endowments) => {
30
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
31
-
32
- await writeCoreEval('replace-feeDistributor', utils =>
33
- defaultProposalBuilder(utils, {
34
- collectionInterval: 1n * SECONDS_PER_HOUR,
35
- keywordShares: {
36
- RewardDistributor: 0n,
37
- Reserve: 1n,
38
- },
39
- }),
40
- );
41
- };
@@ -1,141 +0,0 @@
1
- import { makeHelpers } from '@agoric/deploy-script-support';
2
- import { interProtocolBundleSpecs } from '@agoric/inter-protocol/source-spec-registry.js';
3
- import { getManifestForPriceFeeds } from '@agoric/inter-protocol/src/proposals/deploy-price-feeds.js';
4
- import { buildBundlePath } from '../lib/build-bundle.js';
5
-
6
- /**
7
- * @import {PriceFeedConfig} from '@agoric/inter-protocol/src/proposals/deploy-price-feeds.js';
8
- * @import {CoreEvalBuilder} from '@agoric/deploy-script-support/src/externalTypes.js';
9
- * @import {DeployScriptFunction} from '@agoric/deploy-script-support/src/externalTypes.js';
10
- */
11
-
12
- /** @type {Record<string, PriceFeedConfig>} */
13
- const configurations = {
14
- A3P_INTEGRATION: {
15
- oracleAddresses: [
16
- 'agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q', // GOV1
17
- 'agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277', // GOV2
18
- 'agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq', // GOV3
19
- ],
20
- inBrandNames: ['ATOM', 'stATOM'],
21
- },
22
- MAINNET: {
23
- oracleAddresses: [
24
- 'agoric144rrhh4m09mh7aaffhm6xy223ym76gve2x7y78', // DSRV
25
- 'agoric19d6gnr9fyp6hev4tlrg87zjrzsd5gzr5qlfq2p', // Stakin
26
- 'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8', // 01node
27
- 'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr', // Simply Staking
28
- 'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj', // P2P
29
- ],
30
- inBrandNames: ['ATOM', 'stATOM', 'stOSMO', 'stTIA', 'stkATOM'],
31
- contractTerms: { minSubmissionCount: 3 },
32
- },
33
- DEVNET: {
34
- oracleAddresses: [
35
- 'agoric1lw4e4aas9q84tq0q92j85rwjjjapf8dmnllnft', // DSRV
36
- 'agoric1zj6vrrrjq4gsyr9lw7dplv4vyejg3p8j2urm82', // Stakin
37
- 'agoric1ra0g6crtsy6r3qnpu7ruvm7qd4wjnznyzg5nu4', // 01node
38
- 'agoric1qj07c7vfk3knqdral0sej7fa6eavkdn8vd8etf', // Simply Staking
39
- 'agoric10vjkvkmpp9e356xeh6qqlhrny2htyzp8hf88fk', // P2P
40
- ],
41
- inBrandNames: ['ATOM', 'stTIA', 'stkATOM', 'dATOM'],
42
- },
43
- EMERYNET: {
44
- oracleAddresses: [
45
- 'agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce', // GOV1
46
- 'agoric140dmkrz2e42ergjj7gyvejhzmjzurvqeq82ang', // GOV2
47
- ],
48
- inBrandNames: ['ATOM', 'stATOM', 'stOSMO', 'stTIA', 'stkATOM'],
49
- },
50
- BOOT_TEST: {
51
- oracleAddresses: [
52
- 'agoric144rrhh4m09mh7aaffhm6xy223ym76gve2x7y78', // DSRV
53
- 'agoric19d6gnr9fyp6hev4tlrg87zjrzsd5gzr5qlfq2p', // Stakin
54
- 'agoric19uscwxdac6cf6z7d5e26e0jm0lgwstc47cpll8', // 01node
55
- 'agoric1krunjcqfrf7la48zrvdfeeqtls5r00ep68mzkr', // Simply Staking
56
- 'agoric1n4fcxsnkxe4gj6e24naec99hzmc4pjfdccy5nj', // P2P
57
- ],
58
- inBrandNames: ['ATOM'],
59
- },
60
- };
61
-
62
- const { keys } = Object;
63
- const knownVariants = keys(configurations);
64
-
65
- /** @type {CoreEvalBuilder} */
66
- export const defaultProposalBuilder = async ({ publishRef, install }, opts) => {
67
- const config = opts.config || configurations[opts.variant];
68
- if (!config) {
69
- const error = `Unknown variant "${opts.variant}". Expected one of ${knownVariants.join(', ')}`;
70
- console.error(error);
71
- throw Error(error);
72
- }
73
- const { oracleAddresses, inBrandNames, contractTerms } = config;
74
- const priceAggregator = interProtocolBundleSpecs.priceAggregator;
75
- const priceAggregatorPath = await buildBundlePath(
76
- import.meta.url,
77
- priceAggregator,
78
- );
79
- const scaledPriceAuthorityPath = await buildBundlePath(
80
- import.meta.url,
81
- '@agoric/zoe/src/contracts/scaledPriceAuthority.js',
82
- 'scaledPriceAuthority',
83
- );
84
- console.log(
85
- 'Generating price feeds update proposal with config',
86
- JSON.stringify({ oracleAddresses, inBrandNames, contractTerms }),
87
- );
88
- return harden({
89
- sourceSpec: '@agoric/inter-protocol/src/proposals/deploy-price-feeds.js',
90
- getManifestCall: [
91
- getManifestForPriceFeeds.name,
92
- {
93
- oracleAddresses,
94
- inBrandNames,
95
- contractTerms,
96
- priceAggregatorRef: publishRef(
97
- install(priceAggregator.packagePath, priceAggregatorPath),
98
- ),
99
- scaledPARef: publishRef(
100
- install(
101
- '@agoric/zoe/src/contracts/scaledPriceAuthority.js',
102
- scaledPriceAuthorityPath,
103
- ),
104
- ),
105
- },
106
- ],
107
- });
108
- };
109
-
110
- const Usage = `agoric run updatePriceFeeds.js ${[...knownVariants, '<json-config>'].join(' | ')}`;
111
-
112
- /** @type {DeployScriptFunction} */
113
- export default async (homeP, endowments) => {
114
- const { scriptArgs } = endowments;
115
- const variantOrConfig = scriptArgs?.[0];
116
- console.log('updatePriceFeeds.js', variantOrConfig);
117
-
118
- const opts = {};
119
-
120
- if (typeof variantOrConfig === 'string') {
121
- if (variantOrConfig[0] === '{') {
122
- try {
123
- opts.config = JSON.parse(variantOrConfig);
124
- } catch (err) {
125
- throw Error(`Failed to parse config argument ${variantOrConfig}`);
126
- }
127
- } else {
128
- opts.variant = variantOrConfig;
129
- }
130
- } else {
131
- console.error(Usage);
132
- throw Error(Usage);
133
- }
134
-
135
- const { writeCoreEval } = await makeHelpers(homeP, endowments);
136
-
137
- await writeCoreEval(
138
- `gov-price-feeds-${opts.variant || 'from-config'}`,
139
- utils => defaultProposalBuilder(utils, opts),
140
- );
141
- };