agoric 0.21.2-other-dev-3eb1a1d.0 → 0.21.2-other-dev-d15096d.0.d15096d
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/README.md +0 -73
- package/package.json +51 -49
- package/src/bin-agops.js +1 -5
- package/src/chain-config.js +9 -2
- package/src/commands/gov.js +29 -18
- package/src/commands/inter.js +17 -530
- package/src/commands/oracle.js +71 -43
- package/src/commands/perf.js +21 -13
- package/src/commands/psm.js +24 -15
- package/src/commands/reserve.js +17 -7
- package/src/commands/test-upgrade.js +15 -9
- package/src/commands/vaults.js +17 -7
- package/src/commands/wallet.js +38 -31
- package/src/deploy.js +7 -1
- package/src/entrypoint.js +1 -2
- package/src/follow.js +13 -8
- package/src/helpers.js +2 -1
- package/src/install.js +3 -11
- package/src/lib/casting.js +5 -1
- package/src/lib/chain.js +17 -31
- package/src/lib/format.js +7 -4
- package/src/lib/index.js +7 -0
- package/src/lib/packageManager.js +24 -0
- package/src/lib/wallet.js +25 -19
- package/src/main-publish.js +5 -1
- package/src/main.js +4 -36
- package/src/publish.js +15 -5
- package/src/scripts.js +10 -31
- package/src/sdk-package-names.js +12 -4
- package/src/start.js +2 -3
- package/tools/getting-started.js +30 -7
- package/src/commands/auction.js +0 -169
- package/src/lib/network-config.js +0 -41
package/src/main.js
CHANGED
|
@@ -87,19 +87,6 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
87
87
|
return subMain(cosmosMain, ['cosmos', ...command], opts);
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
const ibcSetup = path.join(
|
|
91
|
-
dirname,
|
|
92
|
-
'..',
|
|
93
|
-
'node_modules',
|
|
94
|
-
'.bin',
|
|
95
|
-
'ibc-setup',
|
|
96
|
-
);
|
|
97
|
-
program.command(
|
|
98
|
-
'ibc-setup <command...>',
|
|
99
|
-
'set up Inter Blockchain Communication',
|
|
100
|
-
{ executableFile: ibcSetup },
|
|
101
|
-
);
|
|
102
|
-
|
|
103
90
|
baseCmd('open')
|
|
104
91
|
.description('launch the Agoric UI')
|
|
105
92
|
.option(
|
|
@@ -184,21 +171,6 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
184
171
|
return subMain(setDefaultsMain, ['set-defaults', prog, configDir], opts);
|
|
185
172
|
});
|
|
186
173
|
|
|
187
|
-
const ibcRelayer = path.join(
|
|
188
|
-
dirname,
|
|
189
|
-
'..',
|
|
190
|
-
'node_modules',
|
|
191
|
-
'.bin',
|
|
192
|
-
'ibc-relayer',
|
|
193
|
-
);
|
|
194
|
-
program.command(
|
|
195
|
-
'ibc-relayer',
|
|
196
|
-
'run an Inter Blockchain Communications relayer',
|
|
197
|
-
{
|
|
198
|
-
executableFile: ibcRelayer,
|
|
199
|
-
},
|
|
200
|
-
);
|
|
201
|
-
|
|
202
174
|
baseCmd('install [force-sdk-version]')
|
|
203
175
|
.description('install Dapp dependencies')
|
|
204
176
|
.action(async (forceSdkVersion, _options, cmd) => {
|
|
@@ -210,17 +182,13 @@ const main = async (progname, rawArgs, powers) => {
|
|
|
210
182
|
baseCmd('follow <path-spec...>')
|
|
211
183
|
.description('follow an Agoric Casting leader')
|
|
212
184
|
.option(
|
|
213
|
-
'--proof <
|
|
214
|
-
|
|
185
|
+
'--proof <none>',
|
|
186
|
+
`set proof mode (currently only 'none' is supported)`,
|
|
215
187
|
value => {
|
|
216
|
-
assert(
|
|
217
|
-
['strict', 'optimistic', 'none'].includes(value),
|
|
218
|
-
X`--proof must be one of 'strict', 'optimistic', or 'none'`,
|
|
219
|
-
TypeError,
|
|
220
|
-
);
|
|
188
|
+
assert.equal(value, 'none', X`--proof can only be 'none'`, TypeError);
|
|
221
189
|
return value;
|
|
222
190
|
},
|
|
223
|
-
'
|
|
191
|
+
'none',
|
|
224
192
|
)
|
|
225
193
|
.option(
|
|
226
194
|
'--sleep <seconds>',
|
package/src/publish.js
CHANGED
|
@@ -15,7 +15,17 @@ import { defaultRegistryTypes } from '@cosmjs/stargate';
|
|
|
15
15
|
import { stringToPath } from '@cosmjs/crypto';
|
|
16
16
|
import { Decimal } from '@cosmjs/math';
|
|
17
17
|
import { fromBech32 } from '@cosmjs/encoding';
|
|
18
|
-
import {
|
|
18
|
+
import { CodecHelper } from '@agoric/cosmic-proto';
|
|
19
|
+
import { MsgInstallBundle as MsgInstallBundleType } from '@agoric/cosmic-proto/swingset/msgs.js';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @import {resolve} from 'path';
|
|
23
|
+
* @import {promises} from 'fs';
|
|
24
|
+
* @import {SigningStargateClient} from '@cosmjs/stargate';
|
|
25
|
+
* @import {EncodeObject} from '@cosmjs/proto-signing';
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const MsgInstallBundle = CodecHelper(MsgInstallBundleType);
|
|
19
29
|
|
|
20
30
|
// https://github.com/Agoric/agoric-sdk/blob/master/golang/cosmos/daemon/main.go
|
|
21
31
|
const Agoric = {
|
|
@@ -226,9 +236,9 @@ const urlForRpcAddress = address => {
|
|
|
226
236
|
|
|
227
237
|
/**
|
|
228
238
|
* @param {object} args
|
|
229
|
-
* @param {typeof
|
|
230
|
-
* @param {typeof
|
|
231
|
-
* @param {typeof
|
|
239
|
+
* @param {typeof resolve} args.pathResolve
|
|
240
|
+
* @param {typeof promises.readFile} args.readFile
|
|
241
|
+
* @param {typeof SigningStargateClient.connectWithSigner} args.connectWithSigner
|
|
232
242
|
* @param {() => number} args.random - a random number in the interval [0, 1)
|
|
233
243
|
*/
|
|
234
244
|
export const makeCosmosBundlePublisher = ({
|
|
@@ -269,7 +279,7 @@ export const makeCosmosBundlePublisher = ({
|
|
|
269
279
|
submitter: fromBech32(from.address).data,
|
|
270
280
|
};
|
|
271
281
|
|
|
272
|
-
/** @type {Array<
|
|
282
|
+
/** @type {Array<EncodeObject>} */
|
|
273
283
|
const encodeObjects = [
|
|
274
284
|
{
|
|
275
285
|
typeUrl: Agoric.proto.swingset.InstallBundle.typeUrl,
|
package/src/scripts.js
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
/* eslint-env node */
|
|
3
3
|
import bundleSource from '@endo/bundle-source';
|
|
4
4
|
import { E } from '@endo/captp';
|
|
5
|
-
import { search as readContainingPackageDescriptor } from '@endo/compartment-mapper';
|
|
6
5
|
|
|
7
|
-
import createEsmRequire from 'esm';
|
|
8
6
|
import { createRequire } from 'module';
|
|
9
7
|
import path from 'path';
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @import {ModuleFormat} from '@endo/bundle-source';
|
|
11
|
+
* @import {BundleOptions} from '@endo/bundle-source';
|
|
12
|
+
* @import {BundleSourceResult} from '@endo/bundle-source';
|
|
13
|
+
*/
|
|
11
14
|
|
|
12
15
|
const require = createRequire(import.meta.url);
|
|
13
|
-
const esmRequire = createEsmRequire(/** @type {NodeModule} */ ({}));
|
|
14
16
|
|
|
15
17
|
const PATH_SEP_RE = new RegExp(`${path.sep.replace(/\\/g, '\\\\')}`, 'g');
|
|
16
18
|
|
|
@@ -133,39 +135,16 @@ export { bootPlugin } from ${JSON.stringify(absPath)};
|
|
|
133
135
|
// Use a dynamic import to load the deploy script.
|
|
134
136
|
// It is unconfined.
|
|
135
137
|
|
|
136
|
-
// Use Node.js ESM support if package.json of template says "type":
|
|
137
|
-
// "module".
|
|
138
|
-
const read = async location => fs.readFile(url.fileURLToPath(location));
|
|
139
|
-
const { packageDescriptorText } = await readContainingPackageDescriptor(
|
|
140
|
-
read,
|
|
141
|
-
url.pathToFileURL(moduleFile).href,
|
|
142
|
-
).catch(cause => {
|
|
143
|
-
throw Error(
|
|
144
|
-
`Expected a package.json beside deploy script ${moduleFile}, ${cause}`,
|
|
145
|
-
{ cause },
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
const packageDescriptor = JSON.parse(packageDescriptorText);
|
|
149
|
-
const nativeEsm = packageDescriptor.type === 'module';
|
|
150
|
-
console.log(
|
|
151
|
-
`Deploy script will run with ${
|
|
152
|
-
nativeEsm ? 'Node.js ESM' : 'standardthings/esm emulation'
|
|
153
|
-
}`,
|
|
154
|
-
);
|
|
155
|
-
|
|
156
138
|
const modulePath = pathResolve(moduleFile);
|
|
157
|
-
|
|
158
|
-
if (!mainNS) {
|
|
159
|
-
mainNS = esmRequire(modulePath);
|
|
160
|
-
}
|
|
139
|
+
const mainNS = await import(modulePath);
|
|
161
140
|
|
|
162
141
|
const allEndowments = harden({
|
|
163
142
|
home: bootP,
|
|
164
143
|
/**
|
|
165
|
-
* @template {
|
|
144
|
+
* @template {ModuleFormat} ModuleFormat
|
|
166
145
|
* @param {string} file
|
|
167
|
-
* @param {
|
|
168
|
-
* @returns {Promise<
|
|
146
|
+
* @param {BundleOptions<ModuleFormat>} options
|
|
147
|
+
* @returns {Promise<BundleSourceResult<ModuleFormat>>}
|
|
169
148
|
*/
|
|
170
149
|
bundleSource: (file, options = {}) =>
|
|
171
150
|
bundleSource(pathResolve(file), {
|
package/src/sdk-package-names.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
// DO NOT EDIT - automatically generated by get-sdk-package-names.js
|
|
2
2
|
// prettier-ignore
|
|
3
3
|
export default [
|
|
4
|
+
"@aglocal/benchmark",
|
|
5
|
+
"@aglocal/boot",
|
|
6
|
+
"@aglocal/deployment",
|
|
7
|
+
"@aglocal/fast-usdc-contract",
|
|
8
|
+
"@aglocal/fast-usdc-deploy",
|
|
9
|
+
"@aglocal/portfolio-contract",
|
|
10
|
+
"@aglocal/portfolio-deploy",
|
|
11
|
+
"@aglocal/swingset-runner",
|
|
12
|
+
"@aglocal/ymax-planner",
|
|
4
13
|
"@agoric/access-token",
|
|
5
14
|
"@agoric/async-flow",
|
|
6
15
|
"@agoric/base-zone",
|
|
7
|
-
"@agoric/benchmark",
|
|
8
|
-
"@agoric/boot",
|
|
9
16
|
"@agoric/builders",
|
|
10
17
|
"@agoric/cache",
|
|
11
18
|
"@agoric/casting",
|
|
@@ -15,9 +22,9 @@ export default [
|
|
|
15
22
|
"@agoric/cosmos",
|
|
16
23
|
"@agoric/create-dapp",
|
|
17
24
|
"@agoric/deploy-script-support",
|
|
18
|
-
"@agoric/deployment",
|
|
19
25
|
"@agoric/ertp",
|
|
20
26
|
"@agoric/eslint-config",
|
|
27
|
+
"@agoric/eslint-plugin",
|
|
21
28
|
"@agoric/fast-usdc",
|
|
22
29
|
"@agoric/governance",
|
|
23
30
|
"@agoric/import-manager",
|
|
@@ -28,6 +35,8 @@ export default [
|
|
|
28
35
|
"@agoric/notifier",
|
|
29
36
|
"@agoric/orchestration",
|
|
30
37
|
"@agoric/pegasus",
|
|
38
|
+
"@agoric/pola-io",
|
|
39
|
+
"@agoric/portfolio-api",
|
|
31
40
|
"@agoric/smart-wallet",
|
|
32
41
|
"@agoric/solo",
|
|
33
42
|
"@agoric/sparse-ints",
|
|
@@ -36,7 +45,6 @@ export default [
|
|
|
36
45
|
"@agoric/store",
|
|
37
46
|
"@agoric/swing-store",
|
|
38
47
|
"@agoric/swingset-liveslots",
|
|
39
|
-
"@agoric/swingset-runner",
|
|
40
48
|
"@agoric/swingset-vat",
|
|
41
49
|
"@agoric/swingset-xsnap-supervisor",
|
|
42
50
|
"@agoric/telemetry",
|
package/src/start.js
CHANGED
|
@@ -276,7 +276,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
276
276
|
await rmVerbose(serverDir);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
/** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<pspawn>} */
|
|
279
|
+
/** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<typeof pspawn>} */
|
|
280
280
|
let chainSpawn;
|
|
281
281
|
if (!popts.dockerTag) {
|
|
282
282
|
chainSpawn = (args, spawnOpts) =>
|
|
@@ -482,7 +482,7 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
482
482
|
await rmVerbose(serverDir);
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
-
/** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<pspawn>} */
|
|
485
|
+
/** @type {(args: string[], spawnOpts?: Parameters<typeof pspawn>[2], dockerArgs?: string[]) => ReturnType<typeof pspawn>} */
|
|
486
486
|
let soloSpawn;
|
|
487
487
|
if (!popts.dockerTag) {
|
|
488
488
|
soloSpawn = (args, spawnOpts) => pspawn(agSolo, args, spawnOpts);
|
|
@@ -597,7 +597,6 @@ export default async function startMain(progname, rawArgs, powers, opts) {
|
|
|
597
597
|
'swingset',
|
|
598
598
|
'egress',
|
|
599
599
|
soloAddr,
|
|
600
|
-
`--chain-id=${CHAIN_ID}`,
|
|
601
600
|
`--node=tcp://${rpcAddr}`,
|
|
602
601
|
]);
|
|
603
602
|
if (exitStatus) {
|
package/tools/getting-started.js
CHANGED
|
@@ -11,6 +11,11 @@ import { spawn } from 'child_process';
|
|
|
11
11
|
|
|
12
12
|
import { makePspawn } from '../src/helpers.js';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @import {ExecutionContext} from 'ava';
|
|
16
|
+
* @import {ChildProcess} from 'child_process';
|
|
17
|
+
*/
|
|
18
|
+
|
|
14
19
|
const RETRY_BLOCKHEIGHT_SECONDS = 3;
|
|
15
20
|
const SOCKET_TIMEOUT_SECONDS = 2;
|
|
16
21
|
|
|
@@ -66,7 +71,7 @@ const getLatestBlockHeight = url =>
|
|
|
66
71
|
* Test the "getting started" workflow. Note that this function may be imported
|
|
67
72
|
* by external repositories.
|
|
68
73
|
*
|
|
69
|
-
* @param {
|
|
74
|
+
* @param {ExecutionContext} t
|
|
70
75
|
* @param {{ init?: string[], install?: string[] }} [options]
|
|
71
76
|
*/
|
|
72
77
|
export const gettingStartedWorkflowTest = async (t, options = {}) => {
|
|
@@ -108,12 +113,30 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => {
|
|
|
108
113
|
});
|
|
109
114
|
}
|
|
110
115
|
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
/**
|
|
117
|
+
* @param {string[]} args
|
|
118
|
+
* @returns {{childProcess?: ChildProcess} & Promise<void>}
|
|
119
|
+
*/
|
|
120
|
+
function yarn(...args) {
|
|
121
|
+
const ps = pspawnStdout('yarn', args, {
|
|
113
122
|
stdio: ['ignore', 'pipe', 'inherit'],
|
|
114
123
|
env: { ...process.env },
|
|
115
124
|
detached: true,
|
|
116
125
|
});
|
|
126
|
+
/** @type {{childProcess?: ChildProcess} & Promise<void>} */
|
|
127
|
+
const p = new Promise((resolve, reject) => {
|
|
128
|
+
ps.then(code => {
|
|
129
|
+
if (code !== 0) {
|
|
130
|
+
reject(
|
|
131
|
+
new Error(`yarn ${args.join(' ')} failed with exit code ${code}`),
|
|
132
|
+
);
|
|
133
|
+
} else {
|
|
134
|
+
resolve();
|
|
135
|
+
}
|
|
136
|
+
}).catch(reject);
|
|
137
|
+
});
|
|
138
|
+
p.childProcess = ps.childProcess;
|
|
139
|
+
return p;
|
|
117
140
|
}
|
|
118
141
|
|
|
119
142
|
const olddir = process.cwd();
|
|
@@ -170,12 +193,12 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => {
|
|
|
170
193
|
} else {
|
|
171
194
|
// ==============
|
|
172
195
|
// yarn install
|
|
173
|
-
|
|
196
|
+
await yarn('install', ...installOptions);
|
|
174
197
|
}
|
|
175
198
|
|
|
176
199
|
// ==============
|
|
177
200
|
// yarn start:docker
|
|
178
|
-
|
|
201
|
+
await yarn('start:docker');
|
|
179
202
|
|
|
180
203
|
// ==============
|
|
181
204
|
// wait for the chain to start
|
|
@@ -205,11 +228,11 @@ export const gettingStartedWorkflowTest = async (t, options = {}) => {
|
|
|
205
228
|
|
|
206
229
|
// ==============
|
|
207
230
|
// yarn start:contract
|
|
208
|
-
|
|
231
|
+
await yarn('start:contract');
|
|
209
232
|
|
|
210
233
|
// ==============
|
|
211
234
|
// yarn start:ui
|
|
212
|
-
const startUiP = yarn(
|
|
235
|
+
const startUiP = yarn('start:ui');
|
|
213
236
|
finalizers.push(() => pkill(startUiP.childProcess, 'SIGINT'));
|
|
214
237
|
const uiListening = makePromiseKit();
|
|
215
238
|
let retries = 0;
|
package/src/commands/auction.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
/* eslint-env node */
|
|
3
|
-
import { InvalidArgumentError } from 'commander';
|
|
4
|
-
import { Fail } from '@endo/errors';
|
|
5
|
-
import { makeVstorageKit } from '@agoric/client-utils';
|
|
6
|
-
import { outputActionAndHint } from '../lib/wallet.js';
|
|
7
|
-
import { getNetworkConfig } from '../lib/network-config.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @import {ParamTypesMap, ParamTypesMapFromRecord} from '@agoric/governance/src/contractGovernance/typedParamManager.js'
|
|
11
|
-
* @import {ParamValueForType} from '@agoric/governance/src/types.js'
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const networkConfig = await getNetworkConfig({ env: process.env, fetch });
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @template {ParamTypesMap} M
|
|
18
|
-
* @typedef {{
|
|
19
|
-
* [K in keyof M]: ParamValueForType<M[K]>
|
|
20
|
-
* }} ParamValues
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/** @typedef {ReturnType<import('@agoric/inter-protocol/src/auction/params.js').makeAuctioneerParams>} AuctionParamRecord */
|
|
24
|
-
/** @typedef {ParamValues<ParamTypesMapFromRecord<AuctionParamRecord>>} AuctionParams */
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @param {import('anylogger').Logger} _logger
|
|
28
|
-
* @param {{
|
|
29
|
-
* createCommand: typeof import('commander').createCommand,
|
|
30
|
-
* fetch: typeof window.fetch,
|
|
31
|
-
* stdout: Pick<import('stream').Writable, 'write'>,
|
|
32
|
-
* stderr: Pick<import('stream').Writable, 'write'>,
|
|
33
|
-
* now: () => number,
|
|
34
|
-
* }} io
|
|
35
|
-
*/
|
|
36
|
-
export const makeAuctionCommand = (
|
|
37
|
-
_logger,
|
|
38
|
-
{ createCommand, stdout, stderr, fetch, now },
|
|
39
|
-
) => {
|
|
40
|
-
const auctioneer = createCommand('auctioneer').description(
|
|
41
|
-
'Auctioneer commands',
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
auctioneer
|
|
45
|
-
.command('proposeParamChange')
|
|
46
|
-
.description('propose a change to start frequency')
|
|
47
|
-
.option(
|
|
48
|
-
'--start-frequency <seconds>',
|
|
49
|
-
'how often to start auctions',
|
|
50
|
-
BigInt,
|
|
51
|
-
)
|
|
52
|
-
.option('--price-lock-period <seconds>', 'price lock period', BigInt)
|
|
53
|
-
.option('--clock-step <seconds>', 'descending clock frequency', BigInt)
|
|
54
|
-
.option(
|
|
55
|
-
'--starting-rate <basis-points>',
|
|
56
|
-
'relative to oracle: 999 = 1bp discount',
|
|
57
|
-
BigInt,
|
|
58
|
-
)
|
|
59
|
-
.option('--lowest-rate <basis-points>', 'lower limit for discount', BigInt)
|
|
60
|
-
.option(
|
|
61
|
-
'--discount-step <basis-points>',
|
|
62
|
-
'descending clock step size',
|
|
63
|
-
BigInt,
|
|
64
|
-
)
|
|
65
|
-
.requiredOption(
|
|
66
|
-
'--charterAcceptOfferId <string>',
|
|
67
|
-
'offer that had continuing invitation result',
|
|
68
|
-
)
|
|
69
|
-
.option('--offer-id <string>', 'Offer id', String, `propose-${Date.now()}`)
|
|
70
|
-
.option(
|
|
71
|
-
'--deadline <minutes>',
|
|
72
|
-
'minutes from now to close the vote',
|
|
73
|
-
Number,
|
|
74
|
-
1,
|
|
75
|
-
)
|
|
76
|
-
.action(
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* @param {{
|
|
80
|
-
* charterAcceptOfferId: string,
|
|
81
|
-
* startFrequency?: bigint,
|
|
82
|
-
* clockStep?: bigint,
|
|
83
|
-
* startingRate?: bigint,
|
|
84
|
-
* lowestRate?: bigint,
|
|
85
|
-
* discountStep?: bigint,
|
|
86
|
-
* priceLockPeriod?: bigint,
|
|
87
|
-
* offerId: string,
|
|
88
|
-
* deadline: number,
|
|
89
|
-
* }} opts
|
|
90
|
-
*/
|
|
91
|
-
async opts => {
|
|
92
|
-
const { agoricNames, readPublished } = await makeVstorageKit(
|
|
93
|
-
{ fetch },
|
|
94
|
-
networkConfig,
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const { current } = await readPublished(`auction.governance`);
|
|
98
|
-
|
|
99
|
-
const {
|
|
100
|
-
AuctionStartDelay: {
|
|
101
|
-
value: { timerBrand },
|
|
102
|
-
},
|
|
103
|
-
} = current;
|
|
104
|
-
timerBrand || Fail`no timer brand?`;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* typed param manager requires RelativeTimeRecord
|
|
108
|
-
* but TimeMath.toRel prodocues a RelativeTime (which may be a bare bigint).
|
|
109
|
-
*
|
|
110
|
-
* @param {bigint} relValue
|
|
111
|
-
* @returns {import('@agoric/time').RelativeTimeRecord}
|
|
112
|
-
*/
|
|
113
|
-
const toRel = relValue => ({ timerBrand, relValue });
|
|
114
|
-
|
|
115
|
-
/** @type {Partial<AuctionParams>} */
|
|
116
|
-
const params = {
|
|
117
|
-
...(opts.startFrequency && {
|
|
118
|
-
StartFrequency: toRel(opts.startFrequency),
|
|
119
|
-
}),
|
|
120
|
-
...(opts.clockStep && { ClockStep: toRel(opts.clockStep) }),
|
|
121
|
-
...(opts.startingRate && { StartingRate: opts.startingRate }),
|
|
122
|
-
...(opts.lowestRate && { LowestRate: opts.lowestRate }),
|
|
123
|
-
...(opts.discountStep && { DiscountStep: opts.discountStep }),
|
|
124
|
-
...(opts.priceLockPeriod && {
|
|
125
|
-
PriceLockPeriod: toRel(opts.priceLockPeriod),
|
|
126
|
-
}),
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
if (Object.keys(params).length === 0) {
|
|
130
|
-
// InvalidArgumentError is a class constructor, and so
|
|
131
|
-
// must be invoked with `new`.
|
|
132
|
-
throw new InvalidArgumentError(`no parameters given`);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const instance = agoricNames.instance.auctioneer;
|
|
136
|
-
instance || Fail`missing auctioneer in names`;
|
|
137
|
-
|
|
138
|
-
const t0 = now();
|
|
139
|
-
const deadline = BigInt(Math.round(t0 / 1000) + 60 * opts.deadline);
|
|
140
|
-
|
|
141
|
-
/** @type {import('@agoric/inter-protocol/src/econCommitteeCharter.js').ParamChangesOfferArgs} */
|
|
142
|
-
const offerArgs = {
|
|
143
|
-
deadline,
|
|
144
|
-
params,
|
|
145
|
-
instance,
|
|
146
|
-
path: { paramPath: { key: 'governedParams' } },
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
/** @type {import('@agoric/smart-wallet/src/offers.js').OfferSpec} */
|
|
150
|
-
const offer = {
|
|
151
|
-
id: opts.offerId,
|
|
152
|
-
invitationSpec: {
|
|
153
|
-
source: 'continuing',
|
|
154
|
-
previousOffer: opts.charterAcceptOfferId,
|
|
155
|
-
invitationMakerName: 'VoteOnParamChange',
|
|
156
|
-
},
|
|
157
|
-
offerArgs,
|
|
158
|
-
proposal: {},
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
outputActionAndHint(
|
|
162
|
-
{ method: 'executeOffer', offer },
|
|
163
|
-
{ stdout, stderr },
|
|
164
|
-
);
|
|
165
|
-
},
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
return auctioneer;
|
|
169
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { NonNullish } from '@agoric/internal';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @import {MinimalNetworkConfig} from '@agoric/client-utils';
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const networkConfigUrl = agoricNetSubdomain =>
|
|
8
|
-
`https://${agoricNetSubdomain}.agoric.net/network-config`;
|
|
9
|
-
export const rpcUrl = agoricNetSubdomain =>
|
|
10
|
-
`https://${agoricNetSubdomain}.rpc.agoric.net:443`;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} str
|
|
14
|
-
* @param {{ fetch: typeof fetch }} io
|
|
15
|
-
* @returns {Promise<MinimalNetworkConfig>}
|
|
16
|
-
*/
|
|
17
|
-
const fromAgoricNet = (str, { fetch }) => {
|
|
18
|
-
const [netName, chainName] = str.split(',');
|
|
19
|
-
if (chainName) {
|
|
20
|
-
return Promise.resolve({ chainName, rpcAddrs: [rpcUrl(netName)] });
|
|
21
|
-
}
|
|
22
|
-
return fetch(networkConfigUrl(netName)).then(res => res.json());
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param {{ env: typeof process.env, fetch: typeof fetch }} io
|
|
27
|
-
* @returns {Promise<MinimalNetworkConfig>}
|
|
28
|
-
*/
|
|
29
|
-
export const getNetworkConfig = async ({ env, fetch }) => {
|
|
30
|
-
if (!('AGORIC_NET' in env) || env.AGORIC_NET === 'local') {
|
|
31
|
-
return { rpcAddrs: ['http://0.0.0.0:26657'], chainName: 'agoriclocal' };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return fromAgoricNet(NonNullish(env.AGORIC_NET), { fetch }).catch(err => {
|
|
35
|
-
throw Error(
|
|
36
|
-
`cannot get network config (${env.AGORIC_NET || 'local'}): ${
|
|
37
|
-
err.message
|
|
38
|
-
}`,
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
};
|