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

fix: make it possible to set decimalPlaces when calling startPSM #6348

Merged
merged 8 commits into from
Sep 29, 2022
10 changes: 9 additions & 1 deletion packages/inter-protocol/src/proposals/startPSM.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,19 @@ export const startPSM = async (
E(E(zoe).getInvitationIssuer()).getAmountOf(poserInvitationP),
]);

const [anchorInfo, stableInfo] = await Promise.all(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/stable/minted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. It starts from STABLE.symbol, but I'll rename it locally.

[anchorBrand, stable].map(b => E(b).getDisplayInfo()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider a note about why "display" info is reliable for this use case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have an answer for that. Can you write something that would justify it?

);
const mintLimit = AmountMath.make(stable, MINT_LIMIT);
const terms = await deeplyFulfilledObject(
harden({
anchorBrand,
anchorPerMinted: makeRatio(100n, anchorBrand, 100n, stable),
anchorPerMinted: makeRatio(
10n ** anchorInfo.decimalPlaces,
anchorBrand,
10n ** stableInfo.decimalPlaces,
stable,
),
governedParams: {
[CONTRACT_ELECTORATE]: {
type: ParamTypes.INVITATION,
Expand Down
4 changes: 2 additions & 2 deletions packages/inter-protocol/test/psm/gov-add-psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const DAI = {

const config = {
options: { anchorOptions: DAI },
WantStableFeeBP: 1n,
GiveStableFeeBP: 3n,
WantMintedFeeBP: 1n,
GiveMintedFeeBP: 3n,
MINT_LIMIT: 0n,
};

Expand Down