Compare commits
4 Commits
chore/brin
...
develop
Author | SHA1 | Date | |
---|---|---|---|
88264d890d | |||
|
26b78f878b | ||
|
054c0377b4 | ||
|
29bcbd06fb |
@ -4,6 +4,5 @@ tmp/*
|
|||||||
.dockerignore
|
.dockerignore
|
||||||
dockerfiles
|
dockerfiles
|
||||||
node_modules
|
node_modules
|
||||||
.git
|
|
||||||
.github
|
.github
|
||||||
.vscode
|
.vscode
|
||||||
|
@ -21,7 +21,6 @@ import {
|
|||||||
navigation,
|
navigation,
|
||||||
closeDialog,
|
closeDialog,
|
||||||
turnTelemetryOff,
|
turnTelemetryOff,
|
||||||
setRiskAccepted,
|
|
||||||
} from '../../support/common.functions';
|
} from '../../support/common.functions';
|
||||||
import {
|
import {
|
||||||
clickOnValidatorFromList,
|
clickOnValidatorFromList,
|
||||||
@ -83,7 +82,6 @@ context(
|
|||||||
beforeEach('visit governance tab', function () {
|
beforeEach('visit governance tab', function () {
|
||||||
cy.clearLocalStorage();
|
cy.clearLocalStorage();
|
||||||
turnTelemetryOff();
|
turnTelemetryOff();
|
||||||
setRiskAccepted();
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
cy.mockChainId();
|
cy.mockChainId();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
@ -94,7 +92,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Test can only pass if run before other proposal tests.
|
// Test can only pass if run before other proposal tests.
|
||||||
it('Should be able to see that no proposals exist', function () {
|
it.skip('Should be able to see that no proposals exist', function () {
|
||||||
// 3001-VOTE-003
|
// 3001-VOTE-003
|
||||||
cy.getByTestId(noOpenProposals)
|
cy.getByTestId(noOpenProposals)
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
|
@ -3,7 +3,6 @@ import {
|
|||||||
dissociateFromSecondWalletKey,
|
dissociateFromSecondWalletKey,
|
||||||
navigateTo,
|
navigateTo,
|
||||||
navigation,
|
navigation,
|
||||||
setRiskAccepted,
|
|
||||||
turnTelemetryOff,
|
turnTelemetryOff,
|
||||||
waitForSpinner,
|
waitForSpinner,
|
||||||
} from '../../support/common.functions';
|
} from '../../support/common.functions';
|
||||||
@ -75,7 +74,6 @@ context(
|
|||||||
beforeEach('visit governance tab', function () {
|
beforeEach('visit governance tab', function () {
|
||||||
cy.clearLocalStorage();
|
cy.clearLocalStorage();
|
||||||
turnTelemetryOff();
|
turnTelemetryOff();
|
||||||
setRiskAccepted();
|
|
||||||
cy.mockChainId();
|
cy.mockChainId();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
waitForSpinner();
|
||||||
@ -217,7 +215,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 3003-PMAN-001
|
// 3003-PMAN-001
|
||||||
it(
|
it.skip(
|
||||||
'Able to submit valid new market proposal',
|
'Able to submit valid new market proposal',
|
||||||
// @ts-ignore clash between jest and cypress
|
// @ts-ignore clash between jest and cypress
|
||||||
{ tags: '@smoke' },
|
{ tags: '@smoke' },
|
||||||
@ -301,7 +299,7 @@ context(
|
|||||||
|
|
||||||
// Will fail if run after 'Able to submit update market proposal and vote for proposal'
|
// Will fail if run after 'Able to submit update market proposal and vote for proposal'
|
||||||
// 3002-PROP-022
|
// 3002-PROP-022
|
||||||
it('Unable to submit update market proposal without equity-like share in the market', function () {
|
it.skip('Unable to submit update market proposal without equity-like share in the market', function () {
|
||||||
switchVegaWalletPubKey();
|
switchVegaWalletPubKey();
|
||||||
stakingPageAssociateTokens('1');
|
stakingPageAssociateTokens('1');
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_MARKET);
|
goToMakeNewProposal(governanceProposalType.UPDATE_MARKET);
|
||||||
|
@ -238,7 +238,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 1002-STKE-041 1002-STKE-053
|
// 1002-STKE-041 1002-STKE-053
|
||||||
it(
|
it.skip(
|
||||||
'Able to remove part of a stake against a validator',
|
'Able to remove part of a stake against a validator',
|
||||||
// @ts-ignore clash between jest and cypress
|
// @ts-ignore clash between jest and cypress
|
||||||
{ tags: '@smoke' },
|
{ tags: '@smoke' },
|
||||||
@ -428,7 +428,7 @@ context(
|
|||||||
validateValidatorListTotalStakeAndShare('0', '3,002.00', '50.02%');
|
validateValidatorListTotalStakeAndShare('0', '3,002.00', '50.02%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
it.skip('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
||||||
// 1002-STKE-004
|
// 1002-STKE-004
|
||||||
stakingPageAssociateTokens('3');
|
stakingPageAssociateTokens('3');
|
||||||
verifyUnstakedBalance(3.0);
|
verifyUnstakedBalance(3.0);
|
||||||
@ -442,7 +442,7 @@ context(
|
|||||||
verifyStakedBalance(7.0);
|
verifyStakedBalance(7.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Associating vesting contract tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
it.skip('Associating vesting contract tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
||||||
// 1002-STKE-004
|
// 1002-STKE-004
|
||||||
stakingPageAssociateTokens('3', { type: 'contract' });
|
stakingPageAssociateTokens('3', { type: 'contract' });
|
||||||
verifyUnstakedBalance(3.0);
|
verifyUnstakedBalance(3.0);
|
||||||
@ -456,7 +456,7 @@ context(
|
|||||||
verifyStakedBalance(7.0);
|
verifyStakedBalance(7.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Associating vesting contract tokens - when wallet tokens already staked - auto stakes tokens to staked validator', function () {
|
it.skip('Associating vesting contract tokens - when wallet tokens already staked - auto stakes tokens to staked validator', function () {
|
||||||
// 1002-STKE-004
|
// 1002-STKE-004
|
||||||
stakingPageAssociateTokens('3', { type: 'wallet' });
|
stakingPageAssociateTokens('3', { type: 'wallet' });
|
||||||
verifyUnstakedBalance(3.0);
|
verifyUnstakedBalance(3.0);
|
||||||
@ -470,7 +470,7 @@ context(
|
|||||||
verifyStakedBalance(7.0);
|
verifyStakedBalance(7.0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Associating tokens - with multiple validators already staked - auto stakes to staked validators - abiding by existing stake ratio', function () {
|
it.skip('Associating tokens - with multiple validators already staked - auto stakes to staked validators - abiding by existing stake ratio', function () {
|
||||||
// 1002-STKE-004
|
// 1002-STKE-004
|
||||||
stakingPageAssociateTokens('6');
|
stakingPageAssociateTokens('6');
|
||||||
verifyUnstakedBalance(6.0);
|
verifyUnstakedBalance(6.0);
|
||||||
|
@ -100,7 +100,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
it(
|
it.skip(
|
||||||
'Able to withdraw asset: -eth wallet connected -withdraw funds button',
|
'Able to withdraw asset: -eth wallet connected -withdraw funds button',
|
||||||
// @ts-ignore clash between jest and cypress
|
// @ts-ignore clash between jest and cypress
|
||||||
{ tags: '@smoke' },
|
{ tags: '@smoke' },
|
||||||
@ -284,7 +284,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Skipping test due to bug #3882
|
// Skipping test due to bug #3882
|
||||||
it('Unable to withdraw asset on pub key view', function () {
|
it.skip('Unable to withdraw asset on pub key view', function () {
|
||||||
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
||||||
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
|
|||||||
cy.getByTestId('app-announcement').should('not.exist');
|
cy.getByTestId('app-announcement').should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show open or enacted proposals without proposal summary', function () {
|
it.skip('should show open or enacted proposals without proposal summary', function () {
|
||||||
cy.get('body').then(($body) => {
|
cy.get('body').then(($body) => {
|
||||||
if (!$body.find('[data-testid="proposals-list-item"]').length) {
|
if (!$body.find('[data-testid="proposals-list-item"]').length) {
|
||||||
cy.createMarket();
|
cy.createMarket();
|
||||||
@ -189,7 +189,7 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
|
|||||||
cy.viewport('iphone-xr');
|
cy.viewport('iphone-xr');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have burger button', () => {
|
it.skip('should have burger button', () => {
|
||||||
cy.getByTestId('button-menu-drawer').should('be.visible').click();
|
cy.getByTestId('button-menu-drawer').should('be.visible').click();
|
||||||
cy.getByTestId('menu-drawer').should('be.visible');
|
cy.getByTestId('menu-drawer').should('be.visible');
|
||||||
});
|
});
|
||||||
|
@ -255,7 +255,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 3009-NTWU-001 3009-NTWU-002 3009-NTWU-006 3009-NTWU-009
|
// 3009-NTWU-001 3009-NTWU-002 3009-NTWU-006 3009-NTWU-009
|
||||||
it('should display network upgrade banner with estimate', function () {
|
it.skip('should display network upgrade banner with estimate', function () {
|
||||||
mockNetworkUpgradeProposal();
|
mockNetworkUpgradeProposal();
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.getByTestId('banners').within(() => {
|
cy.getByTestId('banners').within(() => {
|
||||||
|
@ -34,14 +34,14 @@ context('View functionality with public key', { tags: '@smoke' }, function () {
|
|||||||
cy.connectPublicKey(vegaWalletPubKey);
|
cy.connectPublicKey(vegaWalletPubKey);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to connect public key via wallet and view assets in wallet', function () {
|
it.skip('Able to connect public key via wallet and view assets in wallet', function () {
|
||||||
verifyConnectedToPubKey();
|
verifyConnectedToPubKey();
|
||||||
cy.getByTestId('currency-title', { timeout: 80000 })
|
cy.getByTestId('currency-title', { timeout: 10000 })
|
||||||
.should('have.length.at.least', 2)
|
.should('have.length.at.least', 2)
|
||||||
.and('contain.text', 'USDC (fake)');
|
.and('contain.text', 'USDC (fake)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unable to submit proposal with public key', function () {
|
it.skip('Unable to submit proposal with public key', function () {
|
||||||
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
goToMakeNewProposal(governanceProposalType.RAW);
|
||||||
|
@ -40,7 +40,7 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Skipping due to bug #3471 causing flaky failuress
|
// Skipping due to bug #3471 causing flaky failuress
|
||||||
it('should have option to view go to next and previous page', function () {
|
it.skip('should have option to view go to next and previous page', function () {
|
||||||
waitForBeginningOfEpoch();
|
waitForBeginningOfEpoch();
|
||||||
cy.getByTestId('page-info')
|
cy.getByTestId('page-info')
|
||||||
.should('contain.text', 'Page ')
|
.should('contain.text', 'Page ')
|
||||||
@ -63,7 +63,7 @@ context(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only('should have option to go to last and newest page', function () {
|
it('should have option to go to last and newest page', function () {
|
||||||
cy.getByTestId('goto-last-page').click();
|
cy.getByTestId('goto-last-page').click();
|
||||||
cy.getByTestId('epoch-total-rewards-table')
|
cy.getByTestId('epoch-total-rewards-table')
|
||||||
.last()
|
.last()
|
||||||
@ -71,9 +71,7 @@ context(
|
|||||||
.first()
|
.first()
|
||||||
.should('have.text', 'EPOCH 1');
|
.should('have.text', 'EPOCH 1');
|
||||||
cy.getByTestId('goto-first-page').click();
|
cy.getByTestId('goto-first-page').click();
|
||||||
cy.getByTestId('epoch-total-rewards-table')
|
cy.get('h2').should('not.contain.text', 'EPOCH 1');
|
||||||
.get('h2')
|
|
||||||
.should('not.contain.text', 'EPOCH 1');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import { differenceInHours, format, formatDistanceToNowStrict } from 'date-fns';
|
|||||||
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
|
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
|
||||||
import { MarketName } from '../proposal/market-name';
|
import { MarketName } from '../proposal/market-name';
|
||||||
import { Indicator } from '../proposal/indicator';
|
import { Indicator } from '../proposal/indicator';
|
||||||
|
import { type ProposalNode } from '../proposal/proposal-utils';
|
||||||
|
|
||||||
const ProposalTypeTags = ({
|
const ProposalTypeTags = ({
|
||||||
proposal,
|
proposal,
|
||||||
@ -540,10 +541,12 @@ const BatchProposalStateText = ({
|
|||||||
|
|
||||||
export const ProposalHeader = ({
|
export const ProposalHeader = ({
|
||||||
proposal,
|
proposal,
|
||||||
|
restData,
|
||||||
isListItem = true,
|
isListItem = true,
|
||||||
voteState,
|
voteState,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal | BatchProposal;
|
proposal: Proposal | BatchProposal;
|
||||||
|
restData?: ProposalNode | null;
|
||||||
isListItem?: boolean;
|
isListItem?: boolean;
|
||||||
voteState?: VoteState | null;
|
voteState?: VoteState | null;
|
||||||
}) => {
|
}) => {
|
||||||
@ -595,7 +598,7 @@ export const ProposalHeader = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ProposalDetails proposal={proposal} />
|
<ProposalDetails proposal={proposal} />
|
||||||
<VoteBreakdown proposal={proposal} />
|
<VoteBreakdown proposal={proposal} restData={restData} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -91,6 +91,28 @@ export type ProposalNode = {
|
|||||||
proposal: ProposalData;
|
proposal: ProposalData;
|
||||||
proposalType: ProposalNodeType;
|
proposalType: ProposalNodeType;
|
||||||
proposals: SubProposalData[];
|
proposals: SubProposalData[];
|
||||||
|
yes?: [
|
||||||
|
{
|
||||||
|
partyId: string;
|
||||||
|
elsPerMarket?: [
|
||||||
|
{
|
||||||
|
marketId: string;
|
||||||
|
els: string;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
no?: [
|
||||||
|
{
|
||||||
|
partyId: string;
|
||||||
|
elsPerMarket?: [
|
||||||
|
{
|
||||||
|
marketId: string;
|
||||||
|
els: string;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
type SingleProposalNode = ProposalNode & {
|
type SingleProposalNode = ProposalNode & {
|
||||||
|
@ -48,6 +48,7 @@ export const Proposal = ({ proposal, restData }: ProposalProps) => {
|
|||||||
|
|
||||||
<ProposalHeader
|
<ProposalHeader
|
||||||
proposal={proposal}
|
proposal={proposal}
|
||||||
|
restData={restData}
|
||||||
isListItem={false}
|
isListItem={false}
|
||||||
voteState={voteState}
|
voteState={voteState}
|
||||||
/>
|
/>
|
||||||
|
@ -17,6 +17,7 @@ import {
|
|||||||
import { useBatchVoteInformation } from '../../hooks/use-vote-information';
|
import { useBatchVoteInformation } from '../../hooks/use-vote-information';
|
||||||
import { MarketName } from '../proposal/market-name';
|
import { MarketName } from '../proposal/market-name';
|
||||||
import { Indicator } from '../proposal/indicator';
|
import { Indicator } from '../proposal/indicator';
|
||||||
|
import { type ProposalNode } from '../proposal/proposal-utils';
|
||||||
|
|
||||||
export const CompactVotes = ({ number }: { number: BigNumber }) => (
|
export const CompactVotes = ({ number }: { number: BigNumber }) => (
|
||||||
<CompactNumber
|
<CompactNumber
|
||||||
@ -110,24 +111,64 @@ const Status = ({ reached, threshold, text, testId }: StatusProps) => {
|
|||||||
|
|
||||||
export const VoteBreakdown = ({
|
export const VoteBreakdown = ({
|
||||||
proposal,
|
proposal,
|
||||||
|
restData,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal | BatchProposal;
|
proposal: Proposal | BatchProposal;
|
||||||
|
restData?: ProposalNode | null;
|
||||||
}) => {
|
}) => {
|
||||||
if (proposal.__typename === 'Proposal') {
|
if (proposal.__typename === 'Proposal') {
|
||||||
return <VoteBreakdownNormal proposal={proposal} />;
|
return <VoteBreakdownNormal proposal={proposal} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proposal.__typename === 'BatchProposal') {
|
if (proposal.__typename === 'BatchProposal') {
|
||||||
return <VoteBreakdownBatch proposal={proposal} />;
|
return <VoteBreakdownBatch proposal={proposal} restData={restData} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const VoteBreakdownBatch = ({ proposal }: { proposal: BatchProposal }) => {
|
const VoteBreakdownBatch = ({
|
||||||
|
proposal,
|
||||||
|
restData,
|
||||||
|
}: {
|
||||||
|
proposal: BatchProposal;
|
||||||
|
restData?: ProposalNode | null;
|
||||||
|
}) => {
|
||||||
const [fullBreakdown, setFullBreakdown] = useState(false);
|
const [fullBreakdown, setFullBreakdown] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const yesELS =
|
||||||
|
restData?.yes?.reduce((all, y) => {
|
||||||
|
if (y.elsPerMarket) {
|
||||||
|
y.elsPerMarket.forEach((item) => {
|
||||||
|
const share = Number(item.els);
|
||||||
|
if (all[item.marketId]) {
|
||||||
|
all[item.marketId].push(share);
|
||||||
|
} else {
|
||||||
|
all[item.marketId] = [share];
|
||||||
|
}
|
||||||
|
return all;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return all;
|
||||||
|
}, {} as Record<string, number[]>) || {};
|
||||||
|
|
||||||
|
const noELS =
|
||||||
|
restData?.no?.reduce((all, y) => {
|
||||||
|
if (y.elsPerMarket) {
|
||||||
|
y.elsPerMarket.forEach((item) => {
|
||||||
|
const share = Number(item.els);
|
||||||
|
if (all[item.marketId]) {
|
||||||
|
all[item.marketId].push(share);
|
||||||
|
} else {
|
||||||
|
all[item.marketId] = [share];
|
||||||
|
}
|
||||||
|
return all;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return all;
|
||||||
|
}, {} as Record<string, number[]>) || {};
|
||||||
|
|
||||||
const voteInfo = useBatchVoteInformation({
|
const voteInfo = useBatchVoteInformation({
|
||||||
terms: compact(
|
terms: compact(
|
||||||
proposal.subProposals ? proposal.subProposals.map((p) => p?.terms) : []
|
proposal.subProposals ? proposal.subProposals.map((p) => p?.terms) : []
|
||||||
@ -194,6 +235,8 @@ const VoteBreakdownBatch = ({ proposal }: { proposal: BatchProposal }) => {
|
|||||||
proposal={proposal}
|
proposal={proposal}
|
||||||
votes={proposal.votes}
|
votes={proposal.votes}
|
||||||
terms={p.terms}
|
terms={p.terms}
|
||||||
|
yesELS={yesELS}
|
||||||
|
noELS={noELS}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@ -254,6 +297,8 @@ const VoteBreakdownBatch = ({ proposal }: { proposal: BatchProposal }) => {
|
|||||||
proposal={proposal}
|
proposal={proposal}
|
||||||
votes={proposal.votes}
|
votes={proposal.votes}
|
||||||
terms={p.terms}
|
terms={p.terms}
|
||||||
|
yesELS={yesELS}
|
||||||
|
noELS={noELS}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@ -271,17 +316,17 @@ const VoteBreakdownBatchSubProposal = ({
|
|||||||
votes,
|
votes,
|
||||||
terms,
|
terms,
|
||||||
indicator,
|
indicator,
|
||||||
|
yesELS,
|
||||||
|
noELS,
|
||||||
}: {
|
}: {
|
||||||
proposal: BatchProposal;
|
proposal: BatchProposal;
|
||||||
votes: VoteFieldsFragment;
|
votes: VoteFieldsFragment;
|
||||||
terms: ProposalTermsFieldsFragment;
|
terms: ProposalTermsFieldsFragment;
|
||||||
indicator?: number;
|
indicator?: number;
|
||||||
|
yesELS: Record<string, number[]>;
|
||||||
|
noELS: Record<string, number[]>;
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const voteInfo = useVoteInformation({
|
|
||||||
votes,
|
|
||||||
terms,
|
|
||||||
});
|
|
||||||
|
|
||||||
const isProposalOpen = proposal?.state === ProposalState.STATE_OPEN;
|
const isProposalOpen = proposal?.state === ProposalState.STATE_OPEN;
|
||||||
const isUpdateMarket = terms?.change?.__typename === 'UpdateMarket';
|
const isUpdateMarket = terms?.change?.__typename === 'UpdateMarket';
|
||||||
@ -294,6 +339,15 @@ const VoteBreakdownBatchSubProposal = ({
|
|||||||
marketId = terms.change.market.id;
|
marketId = terms.change.market.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const voteInfo = useVoteInformation({
|
||||||
|
votes,
|
||||||
|
terms,
|
||||||
|
// yes votes ELS for this specific proposal (market)
|
||||||
|
yesELS: marketId ? yesELS[marketId] : undefined,
|
||||||
|
// no votes ELS for this specific proposal (market)
|
||||||
|
noELS: marketId ? noELS[marketId] : undefined,
|
||||||
|
});
|
||||||
|
|
||||||
const marketName = marketId ? (
|
const marketName = marketId ? (
|
||||||
<>
|
<>
|
||||||
: <MarketName marketId={marketId} />
|
: <MarketName marketId={marketId} />
|
||||||
|
@ -8,13 +8,18 @@ import {
|
|||||||
type VoteFieldsFragment,
|
type VoteFieldsFragment,
|
||||||
} from '../__generated__/Proposals';
|
} from '../__generated__/Proposals';
|
||||||
import { type ProposalChangeType } from '../types';
|
import { type ProposalChangeType } from '../types';
|
||||||
|
import sum from 'lodash/sum';
|
||||||
|
|
||||||
export const useVoteInformation = ({
|
export const useVoteInformation = ({
|
||||||
votes,
|
votes,
|
||||||
terms,
|
terms,
|
||||||
|
yesELS,
|
||||||
|
noELS,
|
||||||
}: {
|
}: {
|
||||||
votes: VoteFieldsFragment;
|
votes: VoteFieldsFragment;
|
||||||
terms: ProposalTermsFieldsFragment;
|
terms: ProposalTermsFieldsFragment;
|
||||||
|
yesELS?: number[];
|
||||||
|
noELS?: number[];
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
appState: { totalSupply, decimals },
|
appState: { totalSupply, decimals },
|
||||||
@ -31,7 +36,9 @@ export const useVoteInformation = ({
|
|||||||
paramsForChange,
|
paramsForChange,
|
||||||
votes,
|
votes,
|
||||||
totalSupply,
|
totalSupply,
|
||||||
decimals
|
decimals,
|
||||||
|
yesELS,
|
||||||
|
noELS
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -72,7 +79,11 @@ const getVoteData = (
|
|||||||
},
|
},
|
||||||
votes: ProposalFieldsFragment['votes'],
|
votes: ProposalFieldsFragment['votes'],
|
||||||
totalSupply: BigNumber,
|
totalSupply: BigNumber,
|
||||||
decimals: number
|
decimals: number,
|
||||||
|
/** A list of ELS yes votes */
|
||||||
|
yesELS?: number[],
|
||||||
|
/** A list if ELS no votes */
|
||||||
|
noELS?: number[]
|
||||||
) => {
|
) => {
|
||||||
const requiredMajorityPercentage = params.requiredMajority
|
const requiredMajorityPercentage = params.requiredMajority
|
||||||
? new BigNumber(params.requiredMajority).times(100)
|
? new BigNumber(params.requiredMajority).times(100)
|
||||||
@ -86,17 +97,31 @@ const getVoteData = (
|
|||||||
addDecimal(votes.no.totalTokens ?? 0, decimals)
|
addDecimal(votes.no.totalTokens ?? 0, decimals)
|
||||||
);
|
);
|
||||||
|
|
||||||
const noEquityLikeShareWeight = !votes.no.totalEquityLikeShareWeight
|
let noEquityLikeShareWeight = !votes.no.totalEquityLikeShareWeight
|
||||||
? new BigNumber(0)
|
? new BigNumber(0)
|
||||||
: new BigNumber(votes.no.totalEquityLikeShareWeight).times(100);
|
: new BigNumber(votes.no.totalEquityLikeShareWeight).times(100);
|
||||||
|
// there's no meaningful `totalEquityLikeShareWeight` in batch proposals,
|
||||||
|
// it has to be deduced from `elsPerMarket` of `no` votes of given proposal
|
||||||
|
// data. (by REST DATA)
|
||||||
|
if (noELS != null) {
|
||||||
|
const noTotalELS = sum(noELS);
|
||||||
|
noEquityLikeShareWeight = new BigNumber(noTotalELS).times(100);
|
||||||
|
}
|
||||||
|
|
||||||
const yesTokens = new BigNumber(
|
const yesTokens = new BigNumber(
|
||||||
addDecimal(votes.yes.totalTokens ?? 0, decimals)
|
addDecimal(votes.yes.totalTokens ?? 0, decimals)
|
||||||
);
|
);
|
||||||
|
|
||||||
const yesEquityLikeShareWeight = !votes.yes.totalEquityLikeShareWeight
|
let yesEquityLikeShareWeight = !votes.yes.totalEquityLikeShareWeight
|
||||||
? new BigNumber(0)
|
? new BigNumber(0)
|
||||||
: new BigNumber(votes.yes.totalEquityLikeShareWeight).times(100);
|
: new BigNumber(votes.yes.totalEquityLikeShareWeight).times(100);
|
||||||
|
// there's no meaningful `totalEquityLikeShareWeight` in batch proposals,
|
||||||
|
// it has to be deduced from `elsPerMarket` of `yes` votes of given proposal
|
||||||
|
// data. (by REST DATA)
|
||||||
|
if (noELS != null) {
|
||||||
|
const yesTotalELS = sum(yesELS);
|
||||||
|
yesEquityLikeShareWeight = new BigNumber(yesTotalELS).times(100);
|
||||||
|
}
|
||||||
|
|
||||||
const totalTokensVoted = yesTokens.plus(noTokens);
|
const totalTokensVoted = yesTokens.plus(noTokens);
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ const nextConfig = {
|
|||||||
GIT_COMMIT: commitHash,
|
GIT_COMMIT: commitHash,
|
||||||
GIT_TAG: tag,
|
GIT_TAG: tag,
|
||||||
},
|
},
|
||||||
|
basePath: '/apps/vegas', // Set the base path
|
||||||
|
assetPrefix: '/apps/vegas', // Set the asset prefix
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = SENTRY_AUTH_TOKEN
|
module.exports = SENTRY_AUTH_TOKEN
|
||||||
|
@ -34,6 +34,21 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/types/jest.config.ts"
|
"jestConfig": "libs/types/jest.config.ts"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"generate": {
|
||||||
|
"executor": "nx:run-commands",
|
||||||
|
"options": {
|
||||||
|
"commands": ["npx graphql-codegen --config=libs/types/codegen.yml"],
|
||||||
|
"parallel": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"local-registry": {
|
||||||
|
"executor": "@nx/js:verdaccio",
|
||||||
|
"options": {
|
||||||
|
"port": 4873,
|
||||||
|
"config": ".verdaccio/config.yml",
|
||||||
|
"storage": "tmp/local-registry/storage"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
|
@ -35,6 +35,14 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/utils/jest.config.ts"
|
"jestConfig": "libs/utils/jest.config.ts"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"local-registry": {
|
||||||
|
"executor": "@nx/js:verdaccio",
|
||||||
|
"options": {
|
||||||
|
"port": 4873,
|
||||||
|
"config": ".verdaccio/config.yml",
|
||||||
|
"storage": "tmp/local-registry/storage"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
|
@ -35,6 +35,14 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"jestConfig": "libs/wallet/jest.config.ts"
|
"jestConfig": "libs/wallet/jest.config.ts"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"local-registry": {
|
||||||
|
"executor": "@nx/js:verdaccio",
|
||||||
|
"options": {
|
||||||
|
"port": 4873,
|
||||||
|
"config": ".verdaccio/config.yml",
|
||||||
|
"storage": "tmp/local-registry/storage"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tags": []
|
"tags": []
|
||||||
|
@ -241,8 +241,5 @@
|
|||||||
"graphql": "15.8.0",
|
"graphql": "15.8.0",
|
||||||
"//": "workaround storybook issue: https://github.com/storybookjs/storybook/issues/21642",
|
"//": "workaround storybook issue: https://github.com/storybookjs/storybook/issues/21642",
|
||||||
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0"
|
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0"
|
||||||
},
|
|
||||||
"nx": {
|
|
||||||
"includedScripts": []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
project.json
14
project.json
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "nx-monorepo",
|
|
||||||
"$schema": "node_modules/nx/schemas/project-schema.json",
|
|
||||||
"targets": {
|
|
||||||
"local-registry": {
|
|
||||||
"executor": "@nx/js:verdaccio",
|
|
||||||
"options": {
|
|
||||||
"port": 4873,
|
|
||||||
"config": ".verdaccio/config.yml",
|
|
||||||
"storage": "tmp/local-registry/storage"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user