Skip to content

Commit

Permalink
pausing confirmed to work using steps in README
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Sep 26, 2023
1 parent a7b7a07 commit 7264d15
Show file tree
Hide file tree
Showing 3 changed files with 511 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,17 @@ agops gov charter --name kreadCommitteeCharter --send-from krgov1
# now should have two used invitations
agoric wallet show --keyring-backend=test --from krgov1

# propose to pause offers
agops gov proposePauseOffers --instance kread --send-from krgov1 --substring foo

# verify it's there
agd query vstorage data published.committees.kread-gov.latestQuestion

agops gov vote --instance kreadCommittee --pathname kread-gov --forPosition 0 --send-from krgov1

# after a minute the chain output should report the question resolving in the affirmative
agd query vstorage data published.committees.kread-gov.latestOutcome
# TODO a way to read capdata out of vstorage
# this should say "win" for the strings you specified
agd query vstorage data --output json published.committees.kread-gov.latestOutcome | jq -r .value | jq -r .values[0] | jq
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env node
// @ts-check
// @jessie-check
/* eslint @typescript-eslint/no-floating-promises: "warn" */

/* global fetch, setTimeout */

import '@endo/init/pre.js';

import '@agoric/casting/node-fetch-shim.js';
import '@endo/init';

import { E } from '@endo/far';

import { execFileSync } from 'child_process';
import path from 'path';
import process from 'process';
import anylogger from 'anylogger';
import { Command, CommanderError, createCommand } from 'commander';
import { makeOracleCommand } from './commands/oracle.js';
import { makeEconomicCommiteeCommand } from './commands/ec.js';
import { makeGovCommand } from './commands/gov.js';
import { makePsmCommand } from './commands/psm.js';
import { makeReserveCommand } from './commands/reserve.js';
import { makeVaultsCommand } from './commands/vaults.js';
import { makePerfCommand } from './commands/perf.js';
import { makeInterCommand } from './commands/inter.js';
import { makeAuctionCommand } from './commands/auction.js';
import { makeTestCommand } from './commands/test-upgrade.js';

const logger = anylogger('agops');
const progname = path.basename(process.argv[1]);

const program = new Command();
program.name(progname).version('docker-u11');

program.addCommand(makeOracleCommand(logger));
program.addCommand(makeEconomicCommiteeCommand(logger));
program.addCommand(makeGovCommand(logger));
program.addCommand(makePerfCommand(logger));
program.addCommand(makePsmCommand(logger));
program.addCommand(makeVaultsCommand(logger));

/**
* XXX Threading I/O powers has gotten a bit jumbled.
*
* Perhaps a more straightforward approach would be:
*
* - makeTUI({ stdout, stderr, logger })
* where tui.show(data) prints data as JSON to stdout
* and tui.warn() and tui.error() log ad-hoc to stderr
* - makeQueryClient({ fetch })
* with q.withConfig(networkConfig)
* and q.vstorage.get('published...') (no un-marshaling)
* and q.pollBlocks(), q.pollTx()
* also, printing the progress message should be done
* in the lookup callback
* - makeBoardClient(queryClient)
* with b.readLatestHead('published...')
* - makeKeyringNames({ execFileSync })
* with names.lookup('gov1') -> 'agoric1...'
* and names.withBackend('test')
* and names.withHome('~/.agoric')
* - makeSigner({ execFileSync })
* signer.sendSwingsetTx()
*/
const procIO = {
env: { ...process.env },
stdout: process.stdout,
stderr: process.stderr,
createCommand,
execFileSync,
now: () => Date.now(),
setTimeout,
};

program.addCommand(makeReserveCommand(logger, procIO));
program.addCommand(makeAuctionCommand(logger, { ...procIO, fetch }));
program.addCommand(makeInterCommand(procIO, { fetch }));
program.addCommand(makeTestCommand(procIO, { fetch }));

E.when(program.parseAsync(process.argv), undefined, err => {
if (err instanceof CommanderError) {
console.error(err.message);
} else {
console.error(err); // CRASH! show stack trace
}
process.exit(1);
});
Loading

0 comments on commit 7264d15

Please sign in to comment.