Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Spike: Referendum-Relayer: Display veto percentage #17

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

aidan-starke
Copy link
Collaborator

@aidan-starke aidan-starke commented Jun 29, 2022

Why

What is changing

  • add fetchVetoPercentage util
  • if message type is new, fetch and display veto threshold
  • if message type is update, fetch and display veto percentage

Screenshot

Screen Shot 2022-06-29 at 1 32 15 PM

@vercel
Copy link

vercel bot commented Jun 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
gov-services ✅ Ready (Inspect) Visit Preview Jun 29, 2022 at 2:04AM (UTC)

const totalStaked = (
(await cennzApi.query.staking.erasTotalStake(stakingEra)) as u128
).toNumber();

Copy link
Collaborator

Choose a reason for hiding this comment

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

Use Promise.all here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cennzApi.query.staking.erasTotalStake relies on the result from the first promise

@@ -19,4 +19,11 @@ export interface ReferendumMessageBody {
proposal: ProposalInterface;
referendum?: ReferendumInterface;
vetoSum: number;
vetoThreshold?: number;
vetoPercentage?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

should vetoPercentage be number too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is a string as I'm using toFixed(), I was tossing up between using 0 and 2 decimal places, what do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display veto sum / percentage of veto's in a nice way on Discord
2 participants