chore(governance): add e2e tests for market update proposals (#4945)
This commit is contained in:
parent
a19ea1c939
commit
14928d318d
@ -22,6 +22,7 @@ NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
|
|||||||
NX_VEGA_REST_URL=http://localhost:3008/api/v2/
|
NX_VEGA_REST_URL=http://localhost:3008/api/v2/
|
||||||
NX_SUCCESSOR_MARKETS=true
|
NX_SUCCESSOR_MARKETS=true
|
||||||
NX_PRODUCT_PERPETUALS=true
|
NX_PRODUCT_PERPETUALS=true
|
||||||
|
NX_UPDATE_MARKET_STATE=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
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"rationale": {
|
|
||||||
"title": "Add USDT Coin (USDT)",
|
|
||||||
"description": "Proposal to add USDT Coin (USDT) as an asset"
|
|
||||||
},
|
|
||||||
"terms": {
|
|
||||||
"newAsset": {
|
|
||||||
"changes": {
|
|
||||||
"name": "USDT Coin",
|
|
||||||
"symbol": "USDT",
|
|
||||||
"decimals": "18",
|
|
||||||
"quantum": "1",
|
|
||||||
"erc20": {
|
|
||||||
"contractAddress": "0xb404c51bbc10dcbe948077f18a4b8e553d160084"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"closingTimestamp": 1662374250,
|
|
||||||
"enactmentTimestamp": 1662460650
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"rationale": {
|
||||||
|
"title": "Market resume test",
|
||||||
|
"description": "E2E test for market resume proposal"
|
||||||
|
},
|
||||||
|
"terms": {
|
||||||
|
"updateMarketState": {
|
||||||
|
"changes": {
|
||||||
|
"marketId": "b33bb4157e12355db22e41f277ddd0c10104dec29a4d6960bbcb96d186c40cbd",
|
||||||
|
"updateType": "MARKET_STATE_UPDATE_TYPE_RESUME"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"closingTimestamp": 0,
|
||||||
|
"enactmentTimestamp": 0
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"rationale": {
|
||||||
|
"title": "Market suspended test",
|
||||||
|
"description": "E2E test for market suspended proposal"
|
||||||
|
},
|
||||||
|
"terms": {
|
||||||
|
"updateMarketState": {
|
||||||
|
"changes": {
|
||||||
|
"marketId": "",
|
||||||
|
"updateType": "MARKET_STATE_UPDATE_TYPE_SUSPEND"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"closingTimestamp": 0,
|
||||||
|
"enactmentTimestamp": 0
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"rationale": {
|
||||||
|
"title": "Market terminate test",
|
||||||
|
"description": "E2E test for market terminate proposal"
|
||||||
|
},
|
||||||
|
"terms": {
|
||||||
|
"updateMarketState": {
|
||||||
|
"changes": {
|
||||||
|
"marketId": "",
|
||||||
|
"updateType": "MARKET_STATE_UPDATE_TYPE_TERMINATE",
|
||||||
|
"price": "100"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"closingTimestamp": 0,
|
||||||
|
"enactmentTimestamp": 0
|
||||||
|
}
|
||||||
|
}
|
@ -1,85 +0,0 @@
|
|||||||
{
|
|
||||||
"instrument": {
|
|
||||||
"code": "Token.24h",
|
|
||||||
"future": {
|
|
||||||
"quoteName": "fBTC",
|
|
||||||
"dataSourceSpecForSettlementData": {
|
|
||||||
"external": {
|
|
||||||
"oracle": {
|
|
||||||
"signers": [
|
|
||||||
{
|
|
||||||
"pubKey": {
|
|
||||||
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filters": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"name": "prices.BTC.value",
|
|
||||||
"type": "TYPE_INTEGER"
|
|
||||||
},
|
|
||||||
"conditions": [
|
|
||||||
{
|
|
||||||
"operator": "OPERATOR_GREATER_THAN",
|
|
||||||
"value": "0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dataSourceSpecForTradingTermination": {
|
|
||||||
"external": {
|
|
||||||
"oracle": {
|
|
||||||
"signers": [
|
|
||||||
{
|
|
||||||
"pubKey": {
|
|
||||||
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filters": [
|
|
||||||
{
|
|
||||||
"key": {
|
|
||||||
"name": "trading.terminated.ETH5",
|
|
||||||
"type": "TYPE_BOOLEAN"
|
|
||||||
},
|
|
||||||
"conditions": [
|
|
||||||
{
|
|
||||||
"operator": "OPERATOR_GREATER_THAN_OR_EQUAL",
|
|
||||||
"value": "1648684800000000000"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dataSourceSpecBinding": {
|
|
||||||
"settlementDataProperty": "prices.BTC.value",
|
|
||||||
"tradingTerminationProperty": "trading.terminated.ETH5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"metadata": ["sector:energy", "sector:food", "source:docs.vega.xyz"],
|
|
||||||
"priceMonitoringParameters": {
|
|
||||||
"triggers": [
|
|
||||||
{
|
|
||||||
"horizon": "43200",
|
|
||||||
"probability": "0.9999999",
|
|
||||||
"auctionExtension": "600"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"logNormal": {
|
|
||||||
"tau": 0.0001140771161,
|
|
||||||
"riskAversionParameter": 0.001,
|
|
||||||
"params": {
|
|
||||||
"mu": 0,
|
|
||||||
"r": 0.016,
|
|
||||||
"sigma": 0.3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -60,6 +60,17 @@ describe(
|
|||||||
before('connect wallets and set approval limit', function () {
|
before('connect wallets and set approval limit', function () {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
ethereumWalletConnect();
|
ethereumWalletConnect();
|
||||||
|
cy.createMarket();
|
||||||
|
navigateTo(navigation.proposals);
|
||||||
|
cy.getByTestId('closed-proposals').within(() => {
|
||||||
|
cy.contains('Add Lorem Ipsum market')
|
||||||
|
.parentsUntil(proposalListItem)
|
||||||
|
.last()
|
||||||
|
.within(() => {
|
||||||
|
cy.getByTestId(viewProposalButton).click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
getProposalInformationFromTable('ID').invoke('text').as('parentMarketId');
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit proposals tab', function () {
|
beforeEach('visit proposals tab', function () {
|
||||||
@ -298,9 +309,6 @@ describe(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Able to see successor market details with new and updated values', function () {
|
it('Able to see successor market details with new and updated values', function () {
|
||||||
cy.createMarket();
|
|
||||||
cy.reload();
|
|
||||||
waitForSpinner();
|
|
||||||
cy.getByTestId('closed-proposals').within(() => {
|
cy.getByTestId('closed-proposals').within(() => {
|
||||||
cy.contains('Add Lorem Ipsum market')
|
cy.contains('Add Lorem Ipsum market')
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
@ -309,14 +317,9 @@ describe(
|
|||||||
cy.getByTestId(viewProposalButton).click();
|
cy.getByTestId(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('ID')
|
|
||||||
.invoke('text')
|
|
||||||
.as('parentMarketId')
|
|
||||||
.then(() => {
|
|
||||||
cy.VegaWalletSubmitProposal(
|
cy.VegaWalletSubmitProposal(
|
||||||
createSuccessorMarketProposalTxBody(this.parentMarketId)
|
createSuccessorMarketProposalTxBody(this.parentMarketId)
|
||||||
);
|
);
|
||||||
});
|
|
||||||
navigateTo(navigation.proposals);
|
navigateTo(navigation.proposals);
|
||||||
cy.reload();
|
cy.reload();
|
||||||
getProposalFromTitle('Test successor market proposal details').within(
|
getProposalFromTitle('Test successor market proposal details').within(
|
||||||
@ -434,5 +437,87 @@ describe(
|
|||||||
'Minimum Probability Of Trading LP Orders'
|
'Minimum Probability Of Trading LP Orders'
|
||||||
).should('contain.text', '1e-8');
|
).should('contain.text', '1e-8');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Able to see suspended market proposal', function () {
|
||||||
|
const proposalPath = 'src/fixtures/proposals/suspend-market-raw.json';
|
||||||
|
const enactmentTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
||||||
|
const closingTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(2);
|
||||||
|
submitUniqueRawProposal({
|
||||||
|
proposalBody: proposalPath,
|
||||||
|
updateMarketId: this.parentMarketId,
|
||||||
|
enactmentTimestamp: enactmentTimestamp,
|
||||||
|
closingTimestamp: closingTimestamp,
|
||||||
|
});
|
||||||
|
getProposalFromTitle('Market suspended test').within(() => {
|
||||||
|
cy.getByTestId(marketProposalType).should(
|
||||||
|
'have.text',
|
||||||
|
'Suspend market'
|
||||||
|
);
|
||||||
|
cy.getByTestId(viewProposalButton).click();
|
||||||
|
});
|
||||||
|
cy.getByTestId(marketProposalType).should('have.text', 'Suspend market');
|
||||||
|
cy.getByTestId(marketDataToggle).click();
|
||||||
|
cy.getByTestId('proposal-update-market-state').within(() => {
|
||||||
|
getProposalInformationFromTable('Market ID')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', this.parentMarketId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to see resume market proposal', function () {
|
||||||
|
const proposalPath = 'src/fixtures/proposals/resume-market-raw.json';
|
||||||
|
const enactmentTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
||||||
|
const closingTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(2);
|
||||||
|
submitUniqueRawProposal({
|
||||||
|
proposalBody: proposalPath,
|
||||||
|
updateMarketId: this.parentMarketId,
|
||||||
|
enactmentTimestamp: enactmentTimestamp,
|
||||||
|
closingTimestamp: closingTimestamp,
|
||||||
|
});
|
||||||
|
getProposalFromTitle('Market resume test').within(() => {
|
||||||
|
cy.getByTestId(marketProposalType).should('have.text', 'Resume market');
|
||||||
|
cy.getByTestId(viewProposalButton).click();
|
||||||
|
});
|
||||||
|
cy.getByTestId(marketProposalType).should('have.text', 'Resume market');
|
||||||
|
cy.getByTestId(marketDataToggle).click();
|
||||||
|
cy.getByTestId('proposal-update-market-state').within(() => {
|
||||||
|
getProposalInformationFromTable('Market ID')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', this.parentMarketId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to see terminate market proposal', function () {
|
||||||
|
const proposalPath = 'src/fixtures/proposals/terminate-market-raw.json';
|
||||||
|
const enactmentTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
||||||
|
const closingTimestamp = createTenDigitUnixTimeStampForSpecifiedDays(2);
|
||||||
|
submitUniqueRawProposal({
|
||||||
|
proposalBody: proposalPath,
|
||||||
|
updateMarketId: this.parentMarketId,
|
||||||
|
enactmentTimestamp: enactmentTimestamp,
|
||||||
|
closingTimestamp: closingTimestamp,
|
||||||
|
});
|
||||||
|
getProposalFromTitle('Market terminate test').within(() => {
|
||||||
|
cy.getByTestId(marketProposalType).should(
|
||||||
|
'have.text',
|
||||||
|
'Terminate market'
|
||||||
|
);
|
||||||
|
cy.getByTestId(viewProposalButton).click();
|
||||||
|
});
|
||||||
|
cy.getByTestId(marketProposalType).should(
|
||||||
|
'have.text',
|
||||||
|
'Terminate market'
|
||||||
|
);
|
||||||
|
cy.getByTestId(marketDataToggle).click();
|
||||||
|
cy.getByTestId('proposal-update-market-state').within(() => {
|
||||||
|
getProposalInformationFromTable('Market ID')
|
||||||
|
.invoke('text')
|
||||||
|
.and('eq', this.parentMarketId);
|
||||||
|
getProposalDetailsValue('Termination Price').should(
|
||||||
|
'contain.text',
|
||||||
|
'0.001 fUSDC'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -54,6 +54,7 @@ export function submitUniqueRawProposal(proposalFields: {
|
|||||||
proposalBody?: string;
|
proposalBody?: string;
|
||||||
proposalTitle?: string;
|
proposalTitle?: string;
|
||||||
proposalDescription?: string;
|
proposalDescription?: string;
|
||||||
|
updateMarketId?: string;
|
||||||
closingTimestamp?: number;
|
closingTimestamp?: number;
|
||||||
enactmentTimestamp?: number;
|
enactmentTimestamp?: number;
|
||||||
submit?: boolean;
|
submit?: boolean;
|
||||||
@ -71,6 +72,10 @@ export function submitUniqueRawProposal(proposalFields: {
|
|||||||
if (proposalFields.proposalDescription) {
|
if (proposalFields.proposalDescription) {
|
||||||
rawProposal.rationale.description = proposalFields.proposalDescription;
|
rawProposal.rationale.description = proposalFields.proposalDescription;
|
||||||
}
|
}
|
||||||
|
if (proposalFields.updateMarketId) {
|
||||||
|
rawProposal.terms.updateMarketState.changes.marketId =
|
||||||
|
proposalFields.updateMarketId;
|
||||||
|
}
|
||||||
if (proposalFields.closingTimestamp) {
|
if (proposalFields.closingTimestamp) {
|
||||||
rawProposal.terms.closingTimestamp = proposalFields.closingTimestamp;
|
rawProposal.terms.closingTimestamp = proposalFields.closingTimestamp;
|
||||||
} else if (
|
} else if (
|
||||||
|
Loading…
Reference in New Issue
Block a user