Get the total voting power of SNS

When a proposal is live, the NNS displays the % of votes cast from the available SNS votes, in this case 59.915%:

I’m just wondering if there is a way to get the total voting power available? (Aside from looping every neuron and calculating using list_neurons).

Thanks

Hi James, I don’t know of a way to get it at any moment in time, but you can get it the same way that the NNS dapp and ICP Dashboard do for the Voting Results display, from the Proposal object. Call get_proposal on the Governance canister of the SNS, and look for Proposal::latest_tally::total (which is in e8s), described as:

// The total voting power unit of eligible neurons that can vote
// on the proposal that this tally is associated with (i.e., the sum
// of the voting power of yes, no, and undecided votes).

For example, for OpenFPL proposal 517:

latest_tally = opt record {
  no = 19_331_021_763_272 : nat64;
  yes = 4_717_077_603_679_840 : nat64;
  total = 7_046_572_138_244_708 : nat64;
  timestamp_seconds = 1_732_555_626 : nat64;
};

Converting from e8s, the total voting power at the time that the proposal was created was 70,465,721.

2 Likes

Yeah that’s the way i went, good to know, thanks mate.

1 Like