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

Develop Hotfix 2 #853

Merged
merged 10 commits into from
May 17, 2024
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This includes following key features:
- BP Voting and Governance
- Premium Name bids

Following, excelent products can be taken as reference points for further features:
Following, excellent products can be taken as reference points for further features:

- [EOS Authority](https://eosauthority.com/)
- [Blocks](https://bloks.io/)
Expand Down Expand Up @@ -112,7 +112,7 @@ app running at localhost:4000

[Vue 2 documentation](https://vuejs.org/v2/api/)

[Vue 3 documenation](https://v3.vuejs.org/)
[Vue 3 documentation](https://v3.vuejs.org/)

[Testing Quasar with Jest](https://github.com/quasarframework/quasar-testing/tree/next/packages/unit-jest)

Expand Down
14 changes: 12 additions & 2 deletions src/config/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,23 @@ export default class ConfigManager {
}

private findChain(chainName: string) {
const fromMainnet = this.mainnets.find(
let fromMainnet = this.mainnets.find(
c => c.getName() === chainName,
);
if (fromMainnet) {
return fromMainnet;
} else {
fromMainnet = this.testnets.find(c => c.getName() === chainName);
}

return this.testnets.find(c => c.getName() === chainName);
if (fromMainnet) {
return fromMainnet;
} else {
if (typeof chainName === 'string') {
throw new Error(`Chain '${chainName}' not found`);
} else {
throw new Error('CHAIN_NAME env variable not found');
}
}
}
}
29 changes: 19 additions & 10 deletions src/pages/ProposalItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default defineComponent({

const multsigTransactionData = ref<Action[]>([]);
const requestedApprovalsRows = ref<RequestedApprovals[]>([]);
const activeProducers = ref<RequestedApprovals[]>([]);
const activeProducersApproved = ref<RequestedApprovals[]>([]);

const requestedApprovalsColumns = [
{
Expand Down Expand Up @@ -99,15 +101,7 @@ export default defineComponent({
!isCanceled.value
));

const producersApprovalStatus = computed(() => {
const allProducers = requestedApprovalsRows.value.filter(
item => item.isBp,
);
const producersHaveAlreadyApproved = allProducers.filter(
item => item.status,
);
return `${producersHaveAlreadyApproved.length}/${allProducers.length}`;
});
const producersApprovalStatus = computed(() => `${activeProducersApproved.value.length}/${activeProducers.value.length}`);

function handleError(e: unknown, defaultMessage: string) {
const error = JSON.parse(JSON.stringify(e)) as Error;
Expand Down Expand Up @@ -282,7 +276,6 @@ export default defineComponent({
proposer.value = proposal.proposer;

const totalRequestedApprovals = proposal.provided_approvals.length + proposal.requested_approvals.length;
isApproved.value = proposal.provided_approvals.length === totalRequestedApprovals;
approvalStatus.value = `${proposal.provided_approvals.length}/${totalRequestedApprovals}`;
isExecuted.value = proposal.executed;

Expand All @@ -302,6 +295,22 @@ export default defineComponent({
requestedApprovalsRows.value = requestedApprovalsRowsValue;
multsigTransactionData.value = multsigTransactionDataValue;

activeProducers.value = requestedApprovalsRows.value.filter(
item => item.isBp,
);
activeProducersApproved.value = activeProducers.value.filter(
item => item.status,
);

if (activeProducers.value.length === 0) {
// No BPs are involved in the proposal, so we need to 100% of the requested approvals
isApproved.value = proposal.provided_approvals.length === totalRequestedApprovals;
} else {
// 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);
}

const transactions = await handleTransactionHistory(proposal.block_num);

isCanceled.value = transactions.some(
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5616,9 +5616,9 @@ flatted@^3.1.0:
integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==

follow-redirects@^1.0.0, follow-redirects@^1.14.0:
version "1.15.4"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
integrity sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==

for-in@^1.0.2:
version "1.0.2"
Expand Down Expand Up @@ -6423,9 +6423,9 @@ ip-regex@^4.1.0:
integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==

ip@^1.1.5:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48"
integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==
version "1.1.9"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396"
integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==

[email protected]:
version "1.9.1"
Expand Down Expand Up @@ -11618,9 +11618,9 @@ [email protected]:
javascript-stringify "^2.0.1"

webpack-dev-middleware@^5.3.1:
version "5.3.3"
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz#efae67c2793908e7311f1d9b06f2a08dcc97e51f"
integrity sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==
version "5.3.4"
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz#eb7b39281cbce10e104eb2b8bf2b63fce49a3517"
integrity sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==
dependencies:
colorette "^2.0.10"
memfs "^3.4.3"
Expand Down
Loading