Skip to content

Commit eab85b7

Browse files
authored
Merge pull request #235 from Agoric/mk/prop-92
feat: add proposal 92
2 parents 92a3862 + 492f186 commit eab85b7

File tree

12 files changed

+1631
-1
lines changed

12 files changed

+1631
-1
lines changed

packages/synthetic-chain/public/upgrade-test-scripts/run_prepare_zero.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ denoms=(
5454
"ibc/386D09AE31DA7C0C93091BB45D08CB7A0730B1F697CD813F06A5446DCF02EEB2" #main_usdt_grv
5555
"ibc/3914BDEF46F429A26917E4D8D434620EC4817DC6B6E68FB327E190902F1E9242" #main_dai_axl
5656
"ibc/3D5291C23D776C3AA7A7ABB34C7B023193ECD2BC42EA19D3165B2CF9652117E7" #main_dai_grv
57+
"ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9" #noble_usdc
5758
"provisionpass" #for swingset provisioning
5859
)
5960

proposals/59:usdc-psm/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
#!/bin/bash
22

3+
source /usr/src/upgrade-test-scripts/env_setup.sh
4+
35
echo check for USDC in psm pairs
46
agd query vstorage children published.psm.IST | grep USDC
7+
8+
echo DEBUG print mint limit
9+
pair="IST.USDC"
10+
agops psm info --pair ${pair}
11+
12+
# test mint limit was adjusted
13+
echo DEBUG test mint limit was adjusted
14+
agd query vstorage data published.psm.${pair}.governance
15+
16+
test_val $(agd query vstorage data published.psm.${pair}.governance | sed "s/^value: '//" | sed "s/'$//" | tr -d '\n' | jq -r '.values[] | fromjson | .body | sub("^#";"") | fromjson | .current.MintLimit.value.value | ltrimstr("+")') "133345000000" "PSM MintLimit set correctly"

proposals/59:usdc-psm/use.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Exit when any command fails
4+
set -e
5+
6+
source /usr/src/upgrade-test-scripts/env_setup.sh
7+
8+
govaccounts=("$GOV1ADDR" "$GOV2ADDR" "$GOV3ADDR")
9+
pair="IST.USDC"
10+
11+
source "$HOME/.agoric/envs"
12+
waitForBlock 2
13+
14+
# Proposing this parameter change in USE layer to make it a part of history
15+
echo DEBUG Propose a vote to raise the mint limit
16+
# Propose a vote to raise the mint limit
17+
PROPOSAL_OFFER=$(mktemp -t agops.XXX)
18+
oid=$(echo "$(agd q vstorage data published.wallet.$GOV1ADDR.current -o json | jq -r .value)" | sed "s/^value: '//" | sed "s/'$//" | tr -d '\n' | jq -r '.values[] | fromjson | .body | sub("^#";"") | fromjson | .offerToUsedInvitation[][] | select(type == "string" and startswith("ecCharter-"))' | head -n 1)
19+
agops psm proposeChangeMintLimit --pair ${pair} --limit 133345 --previousOfferId "${oid}" >|"$PROPOSAL_OFFER"
20+
jq '.body | ltrimstr("#") | fromjson' <"$PROPOSAL_OFFER"
21+
agops perf satisfaction --from $GOV1ADDR --executeOffer $PROPOSAL_OFFER --keyring-backend=test
22+
23+
waitForBlock 3
24+
num_accounts=${#govaccounts[@]}
25+
26+
# only need majority votes
27+
for ((idx = 0; idx < num_accounts - 1; idx++)); do
28+
currentAccount="${govaccounts[idx]}"
29+
currentOfferId=$(agops ec find-continuing-ids --from "$currentAccount" | jq -r 'select(.offerId | startswith("gov-committee")) | .offerId')
30+
echo "DEBUG vote on the question that was made"
31+
echo "$currentAccount using offer ID ${currentOfferId}"
32+
agops ec vote --send-from "$currentAccount" --forPosition 0 --offerId "${currentOfferId}"
33+
done
34+
35+
# wait for election to be resolved
36+
sleep 60

proposals/91:upgrade-19/test.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,32 @@
22

33
set -euo pipefail
44

5+
source /usr/src/upgrade-test-scripts/env_setup.sh
6+
57
# segregate so changing these does not invalidate the proposal image
68
# à la https://github.com/Agoric/agoric-3-proposals/pull/213
79
cd test
810

911
GLOBIGNORE=initial.test.js
1012
yarn ava initial.test.js
11-
1213
yarn ava *.test.js
14+
15+
pair="IST.USDC"
16+
NOBLE_USDC_DENOM="ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
17+
18+
19+
echo DEBUG test mint limit was adjusted
20+
agd query vstorage data published.psm.${pair}.governance
21+
22+
# u19 reset the mint limit to default
23+
test_val $(agd query vstorage data published.psm.${pair}.governance | sed "s/^value: '//" | sed "s/'$//" | tr -d '\n' | jq -r '.values[] | fromjson | .body | sub("^#";"") | fromjson | .current.MintLimit.value.value | ltrimstr("+")') "1000000000" "PSM MintLimit was reset to default"
24+
25+
agd tx --keyring-backend=test bank send validator $GOV1ADDR "3000000000${NOBLE_USDC_DENOM}" --from=provision --chain-id=agoriclocal --yes
26+
waitForBlock 3
27+
28+
agd q bank balances $GOV1ADDR --output=json
29+
echo DEBUG execute PSM swap
30+
SWAP_OFFER=$(mktemp -t agops.XXX)
31+
agops psm swap --pair ${pair} --wantMinted 1001.00 --feePct 0.10 >|"$SWAP_OFFER"
32+
OUTPUT=$(agops perf satisfaction --from $GOV1ADDR --executeOffer "$SWAP_OFFER" --keyring-backend=test 2>&1 || true)
33+
echo "$OUTPUT" | grep "Request would exceed mint limit"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CoreEval proposal to reset MintLimit for USDC, USDT PSMs
2+
3+
Files under `submission` are taken from the relevant [release](https://github.com/Agoric/agoric-sdk/releases/tag/psm-param-fix).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"agoricProposal": {
3+
"type": "/agoric.swingset.CoreEvalProposal",
4+
"releaseNotes": "https://github.com/Agoric/agoric-sdk/releases/tag/psm-param-fix"
5+
},
6+
"type": "module",
7+
"license": "Apache-2.0",
8+
"dependencies": {
9+
"@agoric/synthetic-chain": "~0.5.5"
10+
},
11+
"scripts": {
12+
"agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops"
13+
},
14+
"packageManager": "[email protected]"
15+
}

proposals/92:reset-psm-mintlimit/submission/b1-29e7a47537e6fedccb75dd2c01e28a4bfdf787c6c3c7d7e06156627ed5b31ba80aa05727d10350fa776af0d13eacf15af586da7a8468e9fa0a3f9d41727fc67a.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"consume": {
3+
"economicCommitteeCreatorFacet": true,
4+
"instancePrivateArgs": true,
5+
"psmKit": true,
6+
"zoe": true
7+
},
8+
"brand": {
9+
"consume": {
10+
"IST": true
11+
}
12+
}
13+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/* global E */
2+
/**
3+
* @import {EconomyBootstrapPowers} from './econ-behaviors'
4+
*/
5+
6+
const ISTUnit = 1_000_000n;
7+
const MintLimitValue = 500_000n * ISTUnit;
8+
9+
let tick = 0;
10+
const trace = (...args) => console.log('--- PGRe', (tick += 1), ...args);
11+
12+
trace('script started');
13+
14+
const { entries, fromEntries } = Object;
15+
16+
/**
17+
* Given an object whose properties may be promise-valued, return a promise for
18+
* an analogous object in which each such value has been replaced with its
19+
* fulfillment. This is a non-recursive form of endo `deeplyFulfilled`.
20+
*
21+
* @template T
22+
* @param {{ [K in keyof T]: T[K] | Promise<T[K]> }} obj
23+
* @returns {Promise<T>}
24+
*/
25+
const shallowlyFulfilled = async obj => {
26+
if (!obj) {
27+
return obj;
28+
}
29+
const awaitedEntries = await Promise.all(
30+
entries(obj).map(async ([key, valueP]) => {
31+
const value = await valueP;
32+
return [key, value];
33+
}),
34+
);
35+
return fromEntries(awaitedEntries);
36+
};
37+
38+
/**
39+
* null case is vestigial
40+
*
41+
* @typedef {{
42+
* consume: { chainStorage: Promise<StorageNode> };
43+
* }} ChainStorageNonNull
44+
*/
45+
46+
/**
47+
* Reset MintLimit on all PSMs to 50K IST.
48+
*
49+
* parts adapted from packages/vats/src/proposals/upgrade-psm-proposal.js
50+
*
51+
* @param {EconomyBootstrapPowers & ChainStorageNonNull} powers
52+
* @param {object} [opts]
53+
* @param {string} opts.bundleID
54+
*/
55+
const resetPSMMintLimits = async (
56+
powers,
57+
opts = {
58+
// see psm-bundle-check.test.js
59+
bundleID:
60+
'b1-29e7a47537e6fedccb75dd2c01e28a4bfdf787c6c3c7d7e06156627ed5b31ba80aa05727d10350fa776af0d13eacf15af586da7a8468e9fa0a3f9d41727fc67a',
61+
},
62+
) => {
63+
trace('resetPSMMintLimits', opts);
64+
const { economicCommitteeCreatorFacet, instancePrivateArgs, psmKit, zoe } =
65+
powers.consume;
66+
const { bundleID } = opts;
67+
68+
const ISTbrand = await powers.brand.consume.IST;
69+
const MintLimit = harden({ brand: ISTbrand, value: MintLimitValue });
70+
trace({ MintLimit });
71+
72+
const psmKitMap = await psmKit;
73+
for (const kit of psmKitMap.values()) {
74+
// const instanceKey = `psm-${Stable.symbol}-${keyword}`;
75+
const [_psm, _ist, keyword] = kit.label.split('-');
76+
trace('PSM name(s)', kit.label, keyword);
77+
assert(keyword, kit.label);
78+
if (!['USDC', 'USDT'].includes(keyword)) {
79+
trace('out of scope:', keyword);
80+
continue;
81+
}
82+
83+
const privateArgsPre = await shallowlyFulfilled(
84+
// @ts-expect-error instancePrivateArgs is a mixed bag
85+
await E(instancePrivateArgs).get(kit.psm),
86+
);
87+
const toPose = await E(economicCommitteeCreatorFacet).getPoserInvitation();
88+
const privateArgs = {
89+
...privateArgsPre,
90+
paramUpdates: { MintLimit },
91+
initialPoserInvitation: toPose,
92+
};
93+
trace(keyword, 'privateArgs', privateArgs);
94+
const it = await E(kit.psmAdminFacet).upgradeContract(
95+
bundleID,
96+
privateArgs,
97+
);
98+
trace('upgraded', keyword, it);
99+
}
100+
};
101+
harden(resetPSMMintLimits);
102+
103+
trace('"export" using completion value', resetPSMMintLimits);
104+
resetPSMMintLimits;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
source /usr/src/upgrade-test-scripts/env_setup.sh
6+
7+
pair="IST.USDC"
8+
NOBLE_USDC_DENOM="ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
9+
10+
echo DEBUG test mint limit was adjusted
11+
agd query vstorage data published.psm.${pair}.governance
12+
13+
# there are two instances in governance vstorage path, use latest
14+
test_val $(agd query vstorage data published.psm.${pair}.governance | sed "s/^value: '//" | sed "s/'$//" | tr -d '\n' | jq -r '.values[-1] | fromjson | .body | sub("^#";"") | fromjson | .current.MintLimit.value.value | ltrimstr("+")') "500000000000" "PSM MintLimit was reset to 500K"
15+
16+
agd tx --keyring-backend=test bank send validator $GOV1ADDR "2000000000${NOBLE_USDC_DENOM}" --from=provision --chain-id=agoriclocal --yes
17+
18+
waitForBlock 3
19+
agd q bank balances $GOV1ADDR --output=json
20+
echo DEBUG execute PSM swap
21+
SWAP_OFFER=$(mktemp -t agops.XXX)
22+
agops psm swap --pair ${pair} --wantMinted 1001.00 --feePct 0.10 >|"$SWAP_OFFER"
23+
agops perf satisfaction --from $GOV1ADDR --executeOffer "$SWAP_OFFER" --keyring-backend=test

0 commit comments

Comments
 (0)