Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4de2e6605a | ||
|
|
f35b28992c | ||
|
|
30ae461ac7 | ||
|
|
26127a485a | ||
|
|
13a3ba22ee |
@@ -24,8 +24,10 @@ NX_SUCCESSOR_MARKETS=true
|
|||||||
NX_PRODUCT_PERPETUALS=true
|
NX_PRODUCT_PERPETUALS=true
|
||||||
NX_REFERRALS=true
|
NX_REFERRALS=true
|
||||||
NX_UPDATE_MARKET_STATE=true
|
NX_UPDATE_MARKET_STATE=true
|
||||||
|
NX_GOVERNANCE_TRANSFERS=true
|
||||||
NX_VOLUME_DISCOUNTS=true
|
NX_VOLUME_DISCOUNTS=true
|
||||||
|
|
||||||
|
|
||||||
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
|
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
|
||||||
NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn
|
NX_CHROME_EXTENSION_URL=https://chrome.google.com/webstore/detail/vega-wallet-fairground/nmmjkiafpmphlikhefgjbblebfgclikn
|
||||||
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/pl/firefox/addon/vega-wallet
|
NX_MOZILLA_EXTENSION_URL=https://addons.mozilla.org/pl/firefox/addon/vega-wallet
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"rationale": {
|
||||||
|
"title": "Governance cancel transfer proposal",
|
||||||
|
"description": "Rejected cancel transfer proposal"
|
||||||
|
},
|
||||||
|
"terms": {
|
||||||
|
"cancelTransfer": {
|
||||||
|
"changes": {
|
||||||
|
"transferId": "invalid transfer id"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"closingTimestamp": 0,
|
||||||
|
"enactmentTimestamp": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,12 +27,16 @@ import {
|
|||||||
} from '../../../../governance-e2e/src/support/staking.functions';
|
} from '../../../../governance-e2e/src/support/staking.functions';
|
||||||
import { ethereumWalletConnect } from '../../../../governance-e2e/src/support/wallet-eth.functions';
|
import { ethereumWalletConnect } from '../../../../governance-e2e/src/support/wallet-eth.functions';
|
||||||
import {
|
import {
|
||||||
|
depositAsset,
|
||||||
switchVegaWalletPubKey,
|
switchVegaWalletPubKey,
|
||||||
vegaWalletSetSpecifiedApprovalAmount,
|
vegaWalletSetSpecifiedApprovalAmount,
|
||||||
} from '../../support/wallet-functions';
|
} from '../../support/wallet-functions';
|
||||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
import type { testFreeformProposal } from '../../support/common-interfaces';
|
||||||
import { formatDateWithLocalTimezone } from '@vegaprotocol/utils';
|
import { formatDateWithLocalTimezone } from '@vegaprotocol/utils';
|
||||||
import { createSuccessorMarketProposalTxBody } from '../../support/proposal.functions';
|
import {
|
||||||
|
createGovernanceTransferProposalTxBody,
|
||||||
|
createSuccessorMarketProposalTxBody,
|
||||||
|
} from '../../support/proposal.functions';
|
||||||
|
|
||||||
const proposalListItem = '[data-testid="proposals-list-item"]';
|
const proposalListItem = '[data-testid="proposals-list-item"]';
|
||||||
const participationNotMet = 'token-participation-not-met';
|
const participationNotMet = 'token-participation-not-met';
|
||||||
@@ -51,6 +55,7 @@ const openProposals = 'open-proposals';
|
|||||||
const viewProposalButton = 'view-proposal-btn';
|
const viewProposalButton = 'view-proposal-btn';
|
||||||
const proposalTermsToggle = 'proposal-json-toggle';
|
const proposalTermsToggle = 'proposal-json-toggle';
|
||||||
const marketDataToggle = 'proposal-market-data-toggle';
|
const marketDataToggle = 'proposal-market-data-toggle';
|
||||||
|
const governanceTransferToggle = 'proposal-transfer-details';
|
||||||
const marketProposalType = 'proposal-type';
|
const marketProposalType = 'proposal-type';
|
||||||
|
|
||||||
describe(
|
describe(
|
||||||
@@ -520,5 +525,78 @@ describe(
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Able to see governance transfer proposal', function () {
|
||||||
|
const vegaAssetAddress = '0x67175Da1D5e966e40D11c4B2519392B2058373de';
|
||||||
|
depositAsset(vegaAssetAddress, '1000', 18);
|
||||||
|
cy.getByTestId('currency-title', Cypress.env('txTimeout')).should(
|
||||||
|
'contain.text',
|
||||||
|
'Collateral'
|
||||||
|
);
|
||||||
|
cy.VegaWalletTopUpNetworkAccount('100');
|
||||||
|
cy.VegaWalletSubmitProposal(createGovernanceTransferProposalTxBody());
|
||||||
|
cy.reload();
|
||||||
|
getProposalFromTitle('Governance transfer proposal').within(() => {
|
||||||
|
cy.getByTestId(marketProposalType).should('have.text', 'NewTransfer');
|
||||||
|
cy.getByTestId(viewProposalButton).click();
|
||||||
|
});
|
||||||
|
cy.getByTestId(marketProposalType).should('have.text', 'NewTransfer');
|
||||||
|
cy.getByTestId(governanceTransferToggle).click();
|
||||||
|
cy.getByTestId('proposal-transfer-details-table').within(() => {
|
||||||
|
getProposalInformationFromTable('Source Type')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', 'Network Treasury');
|
||||||
|
getProposalInformationFromTable('Destination')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', Cypress.env('vegaWalletPublicKey'));
|
||||||
|
getProposalInformationFromTable('Asset')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', 'VEGA');
|
||||||
|
getProposalInformationFromTable('Fraction Of Balance')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', '50%');
|
||||||
|
getProposalInformationFromTable('Amount')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', '100.00');
|
||||||
|
getProposalInformationFromTable('Transfer Type')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', 'All or nothing');
|
||||||
|
getProposalInformationFromTable('Kind')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', 'One off');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it(' Able to see cancel transfer proposal - rejected', function () {
|
||||||
|
const proposalPath = 'src/fixtures/proposals/cancel-transfer-raw.json';
|
||||||
|
const enactmentTimestamp =
|
||||||
|
createTenDigitUnixTimeStampForSpecifiedDays(11);
|
||||||
|
const closingTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(10);
|
||||||
|
submitUniqueRawProposal({
|
||||||
|
proposalBody: proposalPath,
|
||||||
|
enactmentTimestamp: enactmentTimestamp,
|
||||||
|
closingTimestamp: closingTimestamp,
|
||||||
|
submit: false,
|
||||||
|
});
|
||||||
|
cy.getByTestId('proposal-submit').should('be.visible').click();
|
||||||
|
cy.getByTestId('dialog-title').should('have.text', 'Proposal rejected');
|
||||||
|
cy.getByTestId('icon-cross').last().click();
|
||||||
|
navigateTo(navigation.proposals);
|
||||||
|
cy.get('[href="/proposals/rejected"]').click();
|
||||||
|
getProposalFromTitle('Governance cancel transfer proposal').within(() => {
|
||||||
|
cy.getByTestId(marketProposalType).should(
|
||||||
|
'have.text',
|
||||||
|
'CancelTransfer'
|
||||||
|
);
|
||||||
|
cy.getByTestId(viewProposalButton).click();
|
||||||
|
});
|
||||||
|
cy.getByTestId(marketProposalType).should('have.text', 'CancelTransfer');
|
||||||
|
getProposalInformationFromTable('Error details')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', 'Governance transfer invalid transfer id not found');
|
||||||
|
getProposalInformationFromTable('transferId')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', 'invalid transfer id');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { addSeconds, millisecondsToSeconds } from 'date-fns';
|
import { addDays, addSeconds, millisecondsToSeconds } from 'date-fns';
|
||||||
import type { ProposalSubmissionBody } from '@vegaprotocol/wallet';
|
import type { ProposalSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import { aliasGQLQuery } from '@vegaprotocol/cypress';
|
import { aliasGQLQuery } from '@vegaprotocol/cypress';
|
||||||
import { upgradeProposalsData } from '../fixtures/mocks/network-upgrade';
|
import { upgradeProposalsData } from '../fixtures/mocks/network-upgrade';
|
||||||
import { proposalsData } from '../fixtures/mocks/proposals';
|
import { proposalsData } from '../fixtures/mocks/proposals';
|
||||||
import { nodeData } from '../fixtures/mocks/nodes';
|
import { nodeData } from '../fixtures/mocks/nodes';
|
||||||
|
import { AccountType, GovernanceTransferType } from '@vegaprotocol/types';
|
||||||
|
|
||||||
export function createUpdateNetworkProposalTxBody(): ProposalSubmissionBody {
|
export function createUpdateNetworkProposalTxBody(): ProposalSubmissionBody {
|
||||||
const MIN_CLOSE_SEC = 5;
|
const MIN_CLOSE_SEC = 5;
|
||||||
@@ -358,6 +359,46 @@ export function createSuccessorMarketProposalTxBody(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createGovernanceTransferProposalTxBody(): ProposalSubmissionBody {
|
||||||
|
const MIN_CLOSE_SEC = 5;
|
||||||
|
const MIN_ENACT_SEC = 7;
|
||||||
|
|
||||||
|
const closingDate = addDays(new Date(), MIN_CLOSE_SEC);
|
||||||
|
const enactmentDate = addDays(closingDate, MIN_ENACT_SEC);
|
||||||
|
const closingTimestamp = millisecondsToSeconds(closingDate.getTime());
|
||||||
|
const enactmentTimestamp = millisecondsToSeconds(enactmentDate.getTime());
|
||||||
|
const destination = Cypress.env('vegaWalletPublicKey');
|
||||||
|
return {
|
||||||
|
proposalSubmission: {
|
||||||
|
rationale: {
|
||||||
|
title: 'Governance transfer proposal',
|
||||||
|
description: 'E2E test for transfer proposal test',
|
||||||
|
},
|
||||||
|
terms: {
|
||||||
|
newTransfer: {
|
||||||
|
changes: {
|
||||||
|
fractionOfBalance: '0.5',
|
||||||
|
amount: '100' + '0'.repeat(18),
|
||||||
|
sourceType: AccountType.ACCOUNT_TYPE_NETWORK_TREASURY,
|
||||||
|
source: '',
|
||||||
|
transferType:
|
||||||
|
GovernanceTransferType.GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING,
|
||||||
|
destinationType: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||||
|
destination,
|
||||||
|
asset:
|
||||||
|
'b4f2726571fbe8e33b442dc92ed2d7f0d810e21835b7371a7915a365f07ccd9b',
|
||||||
|
oneOff: {
|
||||||
|
deliverOn: '0',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
closingTimestamp,
|
||||||
|
enactmentTimestamp,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function mockNetworkUpgradeProposal() {
|
export function mockNetworkUpgradeProposal() {
|
||||||
cy.mockGQL((req) => {
|
cy.mockGQL((req) => {
|
||||||
aliasGQLQuery(req, 'Nodes', nodeData);
|
aliasGQLQuery(req, 'Nodes', nodeData);
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ export async function depositAsset(
|
|||||||
) {
|
) {
|
||||||
// Approve asset
|
// Approve asset
|
||||||
const faucet = new Token(assetEthAddress, signer);
|
const faucet = new Token(assetEthAddress, signer);
|
||||||
|
// Wait needed to allow Eth chain to catch up
|
||||||
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||||
|
cy.wait(4000);
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(decimalPlaces + 1)),
|
faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(decimalPlaces + 1)),
|
||||||
transactionTimeout
|
transactionTimeout
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { addImportNodeWallets } from './lib/commands/import-node-wallets';
|
|||||||
import { addVegaWalletTopUpRewardsPool } from './lib/commands/vega-wallet-top-up-rewards-pool';
|
import { addVegaWalletTopUpRewardsPool } from './lib/commands/vega-wallet-top-up-rewards-pool';
|
||||||
import { addAssociateTokensToVegaWallet } from './lib/commands/associate-tokens-to-vega-wallet';
|
import { addAssociateTokensToVegaWallet } from './lib/commands/associate-tokens-to-vega-wallet';
|
||||||
import { addMockChainId } from './lib/commands/mock-chain-id';
|
import { addMockChainId } from './lib/commands/mock-chain-id';
|
||||||
|
import { addVegaWalletTopUpNetworkAccount } from './lib/commands/vega-wallet-fund-network-account';
|
||||||
|
|
||||||
addGetTestIdcommand();
|
addGetTestIdcommand();
|
||||||
addMockGQLCommand();
|
addMockGQLCommand();
|
||||||
@@ -52,6 +53,7 @@ addImportNodeWallets();
|
|||||||
addVegaWalletTopUpRewardsPool();
|
addVegaWalletTopUpRewardsPool();
|
||||||
addAssociateTokensToVegaWallet();
|
addAssociateTokensToVegaWallet();
|
||||||
addMockChainId();
|
addMockChainId();
|
||||||
|
addVegaWalletTopUpNetworkAccount();
|
||||||
|
|
||||||
export {
|
export {
|
||||||
mockConnectWallet,
|
mockConnectWallet,
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { AccountType } from '@vegaprotocol/types';
|
||||||
|
import type { TransferBody } from '@vegaprotocol/wallet';
|
||||||
|
import { createWalletClient, sendVegaTx } from '../capsule/wallet-client';
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
|
namespace Cypress {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
interface Chainable<Subject> {
|
||||||
|
VegaWalletTopUpNetworkAccount(amount: string): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addVegaWalletTopUpNetworkAccount() {
|
||||||
|
Cypress.Commands.add('VegaWalletTopUpNetworkAccount', (amount: string) => {
|
||||||
|
const vegaWalletUrl = Cypress.env('VEGA_WALLET_URL');
|
||||||
|
const token = Cypress.env('VEGA_WALLET_API_TOKEN');
|
||||||
|
const vegaPubKey = Cypress.env('VEGA_PUBLIC_KEY');
|
||||||
|
const assetAddress =
|
||||||
|
'b4f2726571fbe8e33b442dc92ed2d7f0d810e21835b7371a7915a365f07ccd9b';
|
||||||
|
createWalletClient(vegaWalletUrl, token);
|
||||||
|
|
||||||
|
const transactionBody: TransferBody = {
|
||||||
|
transfer: {
|
||||||
|
fromAccountType: AccountType.ACCOUNT_TYPE_GENERAL,
|
||||||
|
toAccountType: AccountType.ACCOUNT_TYPE_NETWORK_TREASURY,
|
||||||
|
to: '0000000000000000000000000000000000000000000000000000000000000000',
|
||||||
|
asset: assetAddress,
|
||||||
|
amount: amount + '0'.repeat(18),
|
||||||
|
oneOff: {
|
||||||
|
deliverOn: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.highlight('Topping network account');
|
||||||
|
|
||||||
|
sendVegaTx(vegaPubKey, transactionBody);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -29,11 +29,6 @@ export function addVegaWalletTopUpRewardsPool() {
|
|||||||
.then((epochText) => {
|
.then((epochText) => {
|
||||||
transferStartEpoch = Number(epochText.replace('Epoch', '')) + 5;
|
transferStartEpoch = Number(epochText.replace('Epoch', '')) + 5;
|
||||||
transferEndEpoch = transferStartEpoch + 100;
|
transferEndEpoch = transferStartEpoch + 100;
|
||||||
|
|
||||||
/* eslint-disable no-console */
|
|
||||||
console.log(transferStartEpoch);
|
|
||||||
console.log(transferEndEpoch);
|
|
||||||
/* eslint-enable */
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
@@ -235,6 +235,39 @@ interface ProposalUpdateAssetTerms {
|
|||||||
enactmentTimestamp: number;
|
enactmentTimestamp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ProposalTransferTerms {
|
||||||
|
newTransfer: {
|
||||||
|
changes: {
|
||||||
|
fractionOfBalance: string;
|
||||||
|
amount: string;
|
||||||
|
sourceType: string;
|
||||||
|
source: string;
|
||||||
|
transferType: string;
|
||||||
|
destinationType: string;
|
||||||
|
destination: string;
|
||||||
|
asset: string;
|
||||||
|
recurring?: {
|
||||||
|
startEpoch: number;
|
||||||
|
endEpoch: number;
|
||||||
|
};
|
||||||
|
oneOff?: {
|
||||||
|
deliverOn: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
closingTimestamp: number;
|
||||||
|
enactmentTimestamp: number;
|
||||||
|
validationTimestamp?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ProposalCancelTransferTerms {
|
||||||
|
cancelTransfer: {
|
||||||
|
changes: {
|
||||||
|
transferId: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
interface DataSourceSpecBinding {
|
interface DataSourceSpecBinding {
|
||||||
settlementDataProperty: string;
|
settlementDataProperty: string;
|
||||||
tradingTerminationProperty: string;
|
tradingTerminationProperty: string;
|
||||||
@@ -342,7 +375,9 @@ export interface ProposalSubmission {
|
|||||||
| ProposalUpdateMarketTerms
|
| ProposalUpdateMarketTerms
|
||||||
| ProposalNetworkParameterTerms
|
| ProposalNetworkParameterTerms
|
||||||
| ProposalNewAssetTerms
|
| ProposalNewAssetTerms
|
||||||
| ProposalUpdateAssetTerms;
|
| ProposalUpdateAssetTerms
|
||||||
|
| ProposalTransferTerms
|
||||||
|
| ProposalCancelTransferTerms;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProposalSubmissionBody {
|
export interface ProposalSubmissionBody {
|
||||||
|
|||||||
Reference in New Issue
Block a user