Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(agoric-cli): proposeChangeMintLimit #6278

Merged
merged 4 commits into from
Sep 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions packages/agoric-cli/src/commands/psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @ts-check
/* eslint-disable func-names */
/* global fetch, process */
import { AmountMath } from '@agoric/ertp';
import { Command } from 'commander';
import { asPercent } from '../lib/format.js';
import { makePSMSpendAction } from '../lib/psm.js';
Expand Down Expand Up @@ -284,6 +285,69 @@ export const makePsmCommand = async logger => {
console.warn('Now execute the prepared offer');
});

psm
.command('proposeChangeMintLimit')
.description('propose to change the MintLimit parameter')
.option(
'--offerId [number]',
'id of this offer (optional)',
Number,
Date.now(),
)
.requiredOption(
'--pair [Minted.Anchor]',
'token pair (Minted.Anchor)',
s => s.split('.'),
['IST', 'AUSD'],
)
.requiredOption(
'--previousOfferId [number]',
'offer using psm charter invitation',
Number,
)
.requiredOption('--limit [number]', 'new mint limit (in IST)', Number)
.option(
'--deadline [minutes]',
'minutes from now to close the vote',
Number,
1,
)
.action(async function () {
const opts = this.opts();

const psmInstance = lookupPsmInstance(opts.pair);

/** @type {Brand} */
// @ts-expect-error yes, it is a brand
const istBrand = agoricNames.brand.IST;
const scaledAmount = harden({
brand: istBrand,
value: BigInt(opts.limit * 1_000_000),
});
/** @type {import('../lib/psm.js').OfferSpec} */
const offer = {
id: Number(opts.offerId),
invitationSpec: {
source: 'continuing',
previousOffer: opts.previousOfferId,
invitationMakerName: 'VoteOnParamChange',
},
proposal: {},
offerArgs: {
instance: psmInstance,
params: { MintLimit: scaledAmount },
deadline: BigInt(opts.deadline * 60 + Math.round(Date.now() / 1000)),
},
};

outputAction({
method: 'executeOffer',
offer,
});

console.warn('Now execute the prepared offer');
});

psm
.command('vote')
.description('vote on a question (hard-coded for now))')
Expand Down