Skip to content

Instantly share code, notes, and snippets.

@dckc
Last active November 28, 2022 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dckc/d252f24dc8185aa913554a20daa79fbb to your computer and use it in GitHub Desktop.
Save dckc/d252f24dc8185aa913554a20daa79fbb to your computer and use it in GitHub Desktop.

example usage, on a local chain:

agd --chain-id=agoriclocal \
  tx gov submit-proposal swingset-core-eval \
  test/psm/gov-add-psm-permit.json test/psm/gov-add-psm.js \
  --title="$(head -1 test/psm/gov-replace-committee.md) on agoriclocal" --description="$(cat test/psm/gov-replace-committee.md)" \
  --deposit=1000000ubld \
  --gas=auto --gas-adjustment=1.2 \
  --yes --from=k1 -b sync
{
"consume": {
"agoricNamesAdmin": true,
"bankManager": true,
"board": true,
"chainStorage": true,
"zoe": "zoe",
"feeMintAccess": "zoe",
"economicCommitteeCreatorFacet": "economicCommittee",
"provisionPoolStartResult": true,
"psmCharterCreatorFacet": "psmCharter",
"psmFacets": true,
"chainTimerService": "timer"
},
"produce": {
"testFirstAnchorKit": true
},
"installation": {
"consume": {
"contractGovernor": true,
"psm": true,
"mintHolder": true
}
},
"instance": {
"consume": {
"economicCommittee": true
}
},
"brand": { "consume": { "DAI": true, "IST": true } }
}
/* global startPSM */
// @ts-check
/**
* @typedef {{
* denom: string,
* keyword?: string,
* proposedName?: string,
* decimalPlaces?: number
* }} AnchorOptions
*/
/** @type {AnchorOptions[]} */
const assetDetails = [
{
keyword: 'DAI_axl',
proposedName: 'DAI',
decimalPlaces: 18,
denom:
'ibc/3914BDEF46F429A26917E4D8D434620EC4817DC6B6E68FB327E190902F1E9242',
},
{
keyword: 'DAI_grv',
proposedName: 'DAI',
decimalPlaces: 18,
denom:
'ibc/3D5291C23D776C3AA7A7ABB34C7B023193ECD2BC42EA19D3165B2CF9652117E7',
},
];
const initParams = {
WantMintedFeeBP: 0n,
GiveMintedFeeBP: 0n,
MINT_LIMIT: 1_000_000000n, // 1000 IST
};
/** @param {*} permittedPowers see gov-add-psm-permit.json */
const main = async permittedPowers => {
const {
consume: { feeMintAccess: _, ...restC },
...restP
} = permittedPowers;
const noMinting = { consume: restC, ...restP };
await Promise.all(
assetDetails.map(async anchorOptions => {
console.log('starting PSM:', anchorOptions);
const config = { ...initParams, options: { anchorOptions } };
await Promise.all([
startPSM.makeAnchorAsset(noMinting, { options: { anchorOptions } }),
startPSM.startPSM(permittedPowers, config),
]);
console.log('started PSM:', config);
}),
);
};
// "export" from script
main;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment