open-block-explorer
open-block-explorer copied to clipboard
Show execute button on aproved proposal and not always like now
Overview
We need to add precision to the way we calculate the necessary votes to determine if a proposal is approved or not. Currently what we do is just to assume all is approved and always show the execute button. We rely on the fact that the actual blockchain implementation checks everything perfectly and we are safe from any hack attempt. However, it is nicer to show the buttons only when they are available.
Related Issue: #856
Links
https://github.com/telosnetwork/open-block-explorer/blob/a413715aa7b572a460ea88ad1173d93ca51043c7/src/pages/ProposalItem.vue#L304-L318
Acceptance Criteria
- if it's the case of approval for BPs, then the calculation is already correct:
// If BPs are involved, we need 2/3 (+1) of the BPs to approve the proposal
const approval = (activeProducers.value.length * 2 / 3) + 1;
isApproved.value = activeProducersApproved.value.length >= Math.floor(approval);
- if it's the case of approval for private parties, the calculated number should consider the weights of each vote and the minimum for that particular signer.