Skip to content

Commit

Permalink
Merge branch 'master' into dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Duddino authored Sep 19, 2023
2 parents e394e53 + ffb3b71 commit 6114c55
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 11 deletions.
1 change: 1 addition & 0 deletions locale/de/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export const de_translation = {
proposalFinalisationReady: 'Bereit zum Einreichen', //Ready to submit
proposalPassing: 'Bestehend', //PASSING
proposalFailing: 'Scheiternd', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'Finanziert', //FUNDED
proposalNotFunded: 'nicht Finanziert', //NOT FUNDED
proposalPaymentsRemaining: 'Ausstehende Transaktionen<br>', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/en/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export const en_translation = {
proposalFinalisationReady: 'Ready to submit',
proposalPassing: 'PASSING',
proposalFailing: 'FAILING',
proposalTooYoung: 'TOO YOUNG',
proposalFunded: 'FUNDED',
proposalNotFunded: 'NOT FUNDED',
proposalPaymentsRemaining: 'installment(s) remaining<br>of',
Expand Down
1 change: 1 addition & 0 deletions locale/es-mx/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export const es_mx_translation = {
proposalFinalisationReady: 'Listo para enviarla', //Ready to submit
proposalPassing: 'PASANDO', //PASSING
proposalFailing: 'FRACASANDO', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCIADA', //FUNDED
proposalNotFunded: 'NO FINANCIADA', //NOT FUNDED
proposalPaymentsRemaining: 'plazo(s) restante(s)<br>de', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/fr/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export const fr_translation = {
proposalFinalisationReady: 'Prêt à soumettre', //Ready to submit
proposalPassing: 'PASSANT', //PASSING
proposalFailing: 'ÉCHOUANT', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCÉE', //FUNDED
proposalNotFunded: 'NON FINANCÉE', //NOT FUNDED
proposalPaymentsRemaining: "l'installation(s) restants<br>de", //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/it/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export const it_translation = {
proposalFinalisationReady: "Pronto per l'invio", //Ready to submit
proposalPassing: 'Passata', //PASSING
proposalFailing: 'Fallita', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'Finanziata', //FUNDED
proposalNotFunded: 'Non finanziata', //NOT FUNDED
proposalPaymentsRemaining: 'rata/i rimanente<br>di', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/ph/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export const ph_translation = {
proposalFinalisationReady: 'Handa ng ipasa', //Ready to submit
proposalPassing: 'PASSING', //PASSING
proposalFailing: 'FAILING', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FUNDED', //FUNDED
proposalNotFunded: 'NOT FUNDED', //NOT FUNDED
proposalPaymentsRemaining: 'installment(s) remaining<br>of', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/pt-br/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export const pt_br_translation = {
proposalFinalisationReady: 'Pronto para enviar', //Ready to submit
proposalPassing: 'PASSAGEM', //PASSING
proposalFailing: 'FALHA', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCIADO/A', //FUNDED
proposalNotFunded: 'NÃO FINANCIADO/A', //NOT FUNDED
proposalPaymentsRemaining: 'parcela(s) restante(s)<br>de', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/pt-pt/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export const pt_pt_translation = {
proposalFinalisationReady: 'Pronto para enviar', //Ready to submit
proposalPassing: 'PASSAGEM', //PASSING
proposalFailing: 'FALHA', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: 'FINANCIADO/A', //FUNDED
proposalNotFunded: 'NÃO FINANCIADO/A', //NOT FUNDED
proposalPaymentsRemaining: 'parcela(s) restante(s)<br>de', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/template/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export const translation_template = {
proposalFinalisationReady: '', //Ready to submit
proposalPassing: '', //PASSING
proposalFailing: '', //FAILING
proposalTooYoung: '', //TOO YOUNG
proposalFunded: '', //FUNDED
proposalNotFunded: '', //NOT FUNDED
proposalPaymentsRemaining: '', //installment(s) remaining<br>of
Expand Down
1 change: 1 addition & 0 deletions locale/uwu/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export const uwu_translation = {
proposalFinalisationReady: 'Ready tew submit', //Ready to submit
proposalPassing: 'PASSING, YAY!', //PASSING
proposalFailing: 'FAILING, NAY!', //FAILING
proposalTooYoung: 'TOO YOUNG, BAKA!', //TOO YOUNG
proposalFunded: 'FUNDED!', //FUNDED
proposalNotFunded: 'NO MONIES', //NOT FUNDED
proposalPaymentsRemaining: 'payment(s) remainingz<br>of', //installment(s) remaining<br>of
Expand Down
2 changes: 2 additions & 0 deletions scripts/chain_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const cChainParams = {
},
budgetCycleBlocks: 43200,
proposalFee: 50 * COIN,
proposalFeeConfirmRequirement: 6,
maxPaymentCycles: 6,
maxPayment: 10 * 43200 * COIN, // 43200 blocks of 10 PIV
},
Expand Down Expand Up @@ -74,6 +75,7 @@ export const cChainParams = {
},
budgetCycleBlocks: 144,
proposalFee: 50 * COIN,
proposalFeeConfirmRequirement: 3,
maxPaymentCycles: 20,
maxPayment: 10 * 144 * COIN, // 144 blocks of 10 tPIV
},
Expand Down
40 changes: 29 additions & 11 deletions scripts/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,11 @@ async function waitForSubmissionBlockHeight(cProposalCache) {
*/
function getProposalFinalisationStatus(cPropCache) {
const cNet = getNetwork();
const nConfsLeft = cPropCache.nSubmissionHeight + 6 - cNet.cachedBlockCount;
// Confirmations left until finalisation, by network consensus
const nConfsLeft =
cPropCache.nSubmissionHeight +
cChainParams.current.proposalFeeConfirmRequirement -
cNet.cachedBlockCount;

if (cPropCache.nSubmissionHeight === 0 || cNet.cachedBlockCount === 0) {
return translation.proposalFinalisationConfirming;
Expand Down Expand Up @@ -1868,6 +1872,7 @@ async function renderProposals(arrProposals, fContested) {
Nays: 0,
local: true,
Ratio: 0,
IsEstablished: false,
mpw: p,
};
}) || [];
Expand Down Expand Up @@ -1921,12 +1926,24 @@ async function renderProposals(arrProposals, fContested) {
const nNetYesPercent = (nNetYes / cMasternodes.enabled) * 100;

// Proposal Status calculation
const nRequiredVotes = Math.round(cMasternodes.enabled * 0.1);
const strStatus =
nNetYes >= nRequiredVotes
? translation.proposalPassing
: translation.proposalFailing;
let strFundingStatus = translation.proposalNotFunded;
const nRequiredVotes = cMasternodes.enabled / 10;
let strStatus = '';
let strFundingStatus = '';

// Proposal Status calculations
if (nNetYes < nRequiredVotes) {
// Scenario 1: Not enough votes
strStatus = translation.proposalFailing;
strFundingStatus = translation.proposalNotFunded;
} else if (!cProposal.IsEstablished) {
// Scenario 2: Enough votes, but not established
strStatus = translation.proposalFailing;
strFundingStatus = translation.proposalTooYoung;
} else {
// Scenario 3: Enough votes, and established
strStatus = translation.proposalPassing;
strFundingStatus = translation.proposalFunded;
}

// Funding Status and allocation calculations
if (cProposal.local) {
Expand All @@ -1937,14 +1954,14 @@ async function renderProposals(arrProposals, fContested) {
updateGovernanceTab
);
}
const strStatus = getProposalFinalisationStatus(cPropCache);
const strLocalStatus = getProposalFinalisationStatus(cPropCache);
const finalizeButton = document.createElement('button');
finalizeButton.className = 'pivx-button-small';
finalizeButton.innerHTML = '<i class="fas fa-check"></i>';

if (
strStatus === translation.proposalFinalisationReady ||
strStatus === translation.proposalFinalisationExpired
strLocalStatus === translation.proposalFinalisationReady ||
strLocalStatus === translation.proposalFinalisationExpired
) {
finalizeButton.addEventListener('click', async () => {
const result = await Masternode.finalizeProposal(
Expand Down Expand Up @@ -2017,7 +2034,7 @@ async function renderProposals(arrProposals, fContested) {

domStatus.innerHTML = `
<span style="font-size:12px; line-height: 15px; display: block; margin-bottom:15px;">
<span style="color:#fff; font-weight:700;">${strStatus}</span><br>
<span style="color:#fff; font-weight:700;">${strLocalStatus}</span><br>
</span>
<span class="governArrow for-mobile ptr">
<i class="fa-solid fa-angle-down"></i>
Expand All @@ -2026,6 +2043,7 @@ async function renderProposals(arrProposals, fContested) {
} else {
if (domTable.id == 'proposalsTableBody') {
if (
cProposal.IsEstablished &&
nNetYes >= nRequiredVotes &&
totalAllocatedAmount + cProposal.MonthlyPayment <=
cChainParams.current.maxPayment / COIN
Expand Down

0 comments on commit 6114c55

Please sign in to comment.