From b336291b49428b58b308680ab5b6bf0e7d65a227 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Thu, 27 Apr 2023 17:26:00 +0100 Subject: [PATCH 01/42] =?UTF-8?q?fix(governance):=20use=20default=20jsonrp?= =?UTF-8?q?c=20connector=20when=20the=20provider=20from=20useWe=E2=80=A6?= =?UTF-8?q?=20(#3563)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contexts/contracts/contracts-provider.tsx | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/governance/src/contexts/contracts/contracts-provider.tsx b/apps/governance/src/contexts/contracts/contracts-provider.tsx index 7737a4248..f4a4c470f 100644 --- a/apps/governance/src/contexts/contracts/contracts-provider.tsx +++ b/apps/governance/src/contexts/contracts/contracts-provider.tsx @@ -14,13 +14,17 @@ import { ContractsContext } from './contracts-context'; import { createDefaultProvider } from '../../lib/web3-connectors'; import { useEthereumConfig } from '@vegaprotocol/web3'; import { useEnvironment } from '@vegaprotocol/environment'; -import { ENV } from '../../config/env'; +import { ENV } from '../../config'; /** * Provides Vega Ethereum contract instances to its children. */ export const ContractsProvider = ({ children }: { children: JSX.Element }) => { - const { provider: activeProvider, account } = useWeb3React(); + const { + provider: activeProvider, + account, + chainId: activeChainId, + } = useWeb3React(); const { config } = useEthereumConfig(); const { VEGA_ENV, ETHEREUM_PROVIDER_URL } = useEnvironment(); const [contracts, setContracts] = @@ -39,7 +43,11 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => { ETHEREUM_PROVIDER_URL, Number(config.chain_id) ); - const provider = activeProvider ? activeProvider : defaultProvider; + + const provider = + activeProvider && activeChainId === Number(config.chain_id) + ? activeProvider + : defaultProvider; if ( account && @@ -84,7 +92,14 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => { // TODO: hacky quick fix for release to prevent race condition, find a better fix for this. cancelled = true; }; - }, [activeProvider, account, config, VEGA_ENV, ETHEREUM_PROVIDER_URL]); + }, [ + activeProvider, + activeChainId, + account, + config, + VEGA_ENV, + ETHEREUM_PROVIDER_URL, + ]); if (!contracts) { return ( From 85060a04213dff92f748aa6d4ac9151f22b46f73 Mon Sep 17 00:00:00 2001 From: dexturr Date: Thu, 27 Apr 2023 18:10:05 +0000 Subject: [PATCH 02/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 84 ++++++++++++++------ 1 file changed, 59 insertions(+), 25 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 206381376..1ef5e0f95 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "494.628795994665", - "locked_amount": "14427.42907711226823345", + "locked_amount": "14266.7513944347992639375", "deposits": [ { "amount": "188", @@ -822,7 +822,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "8976", "total_removed": "596.64743517951", - "locked_amount": "2541.2572777777773456", + "locked_amount": "2466.30490740740732208", "deposits": [ { "amount": "111", @@ -4605,7 +4605,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52591.8412504624188046894", + "locked_amount": "52532.3598535741728398289", "deposits": [ { "amount": "86666.297", @@ -4671,7 +4671,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "473.811908577533575", + "locked_amount": "470.370847323972325", "deposits": [ { "amount": "2500", @@ -4792,7 +4792,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "12030.63245395531275", + "locked_amount": "12006.80684505837325", "deposits": [ { "amount": "12500", @@ -5058,8 +5058,8 @@ "tranche_start": "2023-02-01T00:00:00.000Z", "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", - "total_removed": "12704.026146825", - "locked_amount": "19784.56635589318875", + "total_removed": "17678.335539225", + "locked_amount": "19732.6652662676475", "deposits": [ { "amount": "7500", @@ -5078,6 +5078,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x4dc6eefb43f5b1704894582aa926f0c6ecd94550ac354b7d5b5f49b0f17261fd" }, + { + "amount": "4974.3093924", + "user": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600", + "tx": "0xfce75d8b6bf0d20cbdb1ef29cfabcae4f4504c30b30ca166b4e66d37f7f04339" + }, { "amount": "126.30064455", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -5420,6 +5425,12 @@ } ], "withdrawals": [ + { + "amount": "4974.3093924", + "user": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600", + "tranche_id": 34, + "tx": "0xfce75d8b6bf0d20cbdb1ef29cfabcae4f4504c30b30ca166b4e66d37f7f04339" + }, { "amount": "6960.3360957", "user": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600", @@ -5434,8 +5445,8 @@ } ], "total_tokens": "30000", - "withdrawn_tokens": "9235.4492784", - "remaining_tokens": "20764.5507216" + "withdrawn_tokens": "14209.7586708", + "remaining_tokens": "15790.2413292" } ] }, @@ -5445,7 +5456,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52543.857812680580054667", + "locked_amount": "52484.430685082756083458", "deposits": [ { "amount": "129999.45", @@ -5478,7 +5489,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "50223.4879614053898767713", + "locked_amount": "50186.42849337648431156926", "deposits": [ { "amount": "54144.7663", @@ -5511,7 +5522,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "22037.516533485537", + "locked_amount": "21994.5524797057361", "deposits": [ { "amount": "10000", @@ -5704,7 +5715,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1951.96584855403365", + "locked_amount": "1948.5342148655505", "deposits": [ { "amount": "5000", @@ -6245,7 +6256,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "434.275725138121845", + "locked_amount": "403.1350713627993", "deposits": [ { "amount": "7500", @@ -6751,7 +6762,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "188643.4559650818349440268", + "locked_amount": "187312.0312486713071773836", "deposits": [ { "amount": "1852091.69", @@ -12251,7 +12262,7 @@ "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "57278.000000000000000003", - "total_removed": "48182.21518131551", + "total_removed": "50196.35141572991", "locked_amount": "0", "deposits": [ { @@ -22836,6 +22847,16 @@ } ], "withdrawals": [ + { + "amount": "725", + "user": "0x52Dd36AB8e8eec8f6bE968E93679838dc73b19D3", + "tx": "0xbc67aa993d42656a84c7da90e6abcc0a3c00e7e9e21da4013251b0f8582567ca" + }, + { + "amount": "1289.1362344144", + "user": "0xab6dE081Af6C78433AFDaC5B756804bcE17e9eC1", + "tx": "0x9e6077e2dc83701a70b2a04028ab533e89cd7f1bb757ea4fe45e1388cfee600d" + }, { "amount": "25", "user": "0x363D3d06d70761c34D6EfEB25E409A9549E6970D", @@ -32345,10 +32366,17 @@ "tx": "0x1a0e42b837a8f3908bc4e36e9b024f48c371b98f066a0db36fd98793cd178f57" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "725", + "user": "0x52Dd36AB8e8eec8f6bE968E93679838dc73b19D3", + "tranche_id": 11, + "tx": "0xbc67aa993d42656a84c7da90e6abcc0a3c00e7e9e21da4013251b0f8582567ca" + } + ], "total_tokens": "725", - "withdrawn_tokens": "0", - "remaining_tokens": "725" + "withdrawn_tokens": "725", + "remaining_tokens": "0" }, { "address": "0xab6dE081Af6C78433AFDaC5B756804bcE17e9eC1", @@ -33051,6 +33079,12 @@ } ], "withdrawals": [ + { + "amount": "1289.1362344144", + "user": "0xab6dE081Af6C78433AFDaC5B756804bcE17e9eC1", + "tranche_id": 11, + "tx": "0x9e6077e2dc83701a70b2a04028ab533e89cd7f1bb757ea4fe45e1388cfee600d" + }, { "amount": "842.29689345648", "user": "0xab6dE081Af6C78433AFDaC5B756804bcE17e9eC1", @@ -33095,8 +33129,8 @@ } ], "total_tokens": "3439", - "withdrawn_tokens": "2149.8637655856", - "remaining_tokens": "1289.1362344144" + "withdrawn_tokens": "3439", + "remaining_tokens": "0" }, { "address": "0x23E18CBa049393DFebC5a17e3b5ec9aF584CAE04", @@ -40578,7 +40612,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "314380.63787207732811164918", + "locked_amount": "312334.701635806482800925758", "deposits": [ { "amount": "1998.95815", @@ -41971,7 +42005,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6414461.14236901907061884390331141365044606", + "locked_amount": "6407206.38383686475925178450726816596566644", "deposits": [ { "amount": "16249.93", @@ -48527,7 +48561,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "200344.3436236687041787785927410316", + "locked_amount": "193646.7968688536809448427165051816", "deposits": [ { "amount": "129284.449", @@ -58560,7 +58594,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43935.8732690563416", - "locked_amount": "49815.409147170801381683055403356", + "locked_amount": "49491.218855463579856215150481968", "deposits": [ { "amount": "3000", From 5e558c4cd3c3fecac462b50873119b295f8296c9 Mon Sep 17 00:00:00 2001 From: daro-maj <119658839+daro-maj@users.noreply.github.com> Date: Thu, 27 Apr 2023 21:28:25 +0200 Subject: [PATCH 03/42] test(trading): 7001-COLL-collateral - e2e tests (#3561) Co-authored-by: m.ray <16125548+MadalinaRaicu@users.noreply.github.com> --- .../src/integration/trading-accounts.cy.ts | 82 +++++++++++++++++-- .../trading-deal-ticket-order.cy.ts | 13 +++ .../src/integration/trading-orders.cy.ts | 2 +- libs/accounts/src/lib/accounts-table.tsx | 6 +- 4 files changed, 96 insertions(+), 7 deletions(-) diff --git a/apps/trading-e2e/src/integration/trading-accounts.cy.ts b/apps/trading-e2e/src/integration/trading-accounts.cy.ts index fd0234641..8b337fa8c 100644 --- a/apps/trading-e2e/src/integration/trading-accounts.cy.ts +++ b/apps/trading-e2e/src/integration/trading-accounts.cy.ts @@ -1,17 +1,23 @@ import { checkSorting } from '@vegaprotocol/cypress'; describe('accounts', { tags: '@smoke' }, () => { - before(() => { - cy.clearAllLocalStorage(); + beforeEach(() => { cy.mockTradingPage(); cy.mockWeb3Provider(); cy.mockSubscription(); cy.setVegaWallet(); cy.visit('/#/markets/market-0'); - cy.wait('@Assets'); }); it('renders accounts', () => { + // 7001-COLL-001 + // 7001-COLL-002 + // 7001-COLL-003 + // 7001-COLL-004 + // 7001-COLL-005 + // 7001-COLL-006 + // 7001-COLL-007 + const tradingAccountRowId = '[row-id="t-0"]'; cy.getByTestId('Collateral').click(); @@ -22,6 +28,21 @@ describe('accounts', { tags: '@smoke' }, () => { .find('[col-id="asset.symbol"]') .should('have.text', 'AST0'); + cy.getByTestId('tab-accounts') + .get(tradingAccountRowId) + .find('[col-id="used"]') + .should('have.text', '1.010.00%'); + + cy.getByTestId('tab-accounts') + .get(tradingAccountRowId) + .find('[col-id="available"]') + .should('have.text', '100,000.00'); + + cy.getByTestId('tab-accounts') + .get(tradingAccountRowId) + .find('[col-id="total"]') + .should('have.text', '100,001.01'); + cy.getByTestId('tab-accounts') .get(tradingAccountRowId) .find('[col-id="accounts-actions"]') @@ -31,12 +52,63 @@ describe('accounts', { tags: '@smoke' }, () => { .get(tradingAccountRowId) .find('[col-id="total"]') .should('have.text', '100,001.01'); + + cy.getByTestId('tab-accounts') + .get('[col-id="accounts-actions"]') + .find('[data-testid="dropdown-menu"]') + .eq(1) + .click(); + cy.getByTestId('deposit').should('be.visible'); + cy.getByTestId('withdraw').should('be.visible'); + cy.getByTestId('breakdown').should('be.visible'); + cy.getByTestId('Collateral').click({ force: true }); }); it('should open asset details dialog when clicked on symbol', () => { + // 7001-COLL-008 cy.getByTestId('asset').contains('tEURO').click(); - cy.get('[data-testid="dialog-content"]:visible').should('exist'); - cy.get('[data-testid="dialog-close"]:visible').click(); + cy.get('[data-testid$="_label"]').should('have.length', 16); + cy.get('[data-testid="dialog-close"]').click(); + }); + + it('should open asset details dialog when clicked on symbol', () => { + // 7001-COLL-008 + cy.getByTestId('asset').contains('tEURO').click(); + cy.get('[data-testid$="_label"]').should('have.length', 16); + cy.get('[data-testid="dialog-close"]').click(); + }); + + it('should open usage breakdown dialog when clicked on used', () => { + // 7001-COLL-009 + cy.getByTestId('breakdown').contains('1.01').click(); + const headers = ['Market', 'Account type', 'Balance']; + cy.getByTestId('usage-breakdown').within(($headers) => { + cy.wrap($headers) + .get('.ag-header-cell-text') + .each(($header, i) => { + cy.wrap($header).should('have.text', headers[i]); + }); + }); + cy.get('[data-testid="dialog-close"]').click(); + }); + + it('sorting usage breakdown columns should work well', () => { + // 7001-COLL-010 + cy.getByTestId('breakdown').contains('1.01').click(); + cy.getByTestId('usage-breakdown') + .find('[col-id="type"]') + .eq(1) + .should('have.text', 'Margin'); + cy.getByTestId('usage-breakdown') + .find('[col-id="type"]') + .eq(2) + .should('have.text', 'Margin'); + cy.getByTestId('usage-breakdown') + .find('[col-id="type"]') + .eq(3) + .should('have.text', 'General'); + + cy.get('[data-testid="dialog-close"]').click(); }); describe('sorting by ag-grid columns should work well', () => { diff --git a/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts b/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts index 1c74e5415..418d1c290 100644 --- a/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts +++ b/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts @@ -88,5 +88,18 @@ describe('deal ticker order validation', { tags: '@smoke' }, () => { 'Size cannot be lower than 1' ); }); + it('must have total margin available', () => { + // 7001-COLL-011 + cy.getByTestId('tab-ticket') + .find('.text-xs') + .eq(5) + .within(() => { + cy.get('[data-state="closed"]').should( + 'have.text', + 'Total margin available' + ); + cy.get('.text-neutral-500').should('have.text', '~100,000.01 tDAI'); + }); + }); }); }); diff --git a/apps/trading-e2e/src/integration/trading-orders.cy.ts b/apps/trading-e2e/src/integration/trading-orders.cy.ts index f3a459f7a..8d8524f8b 100644 --- a/apps/trading-e2e/src/integration/trading-orders.cy.ts +++ b/apps/trading-e2e/src/integration/trading-orders.cy.ts @@ -455,7 +455,7 @@ describe('amend and cancel order', { tags: '@smoke' }, () => { }); }); it('must be warned (pre-submit) if the input price has too many digits after the decimal place for the market', () => { - // 7003-MORD-016 + // 7003-MORD-013 updateOrder({ id: orderId, status: Schema.OrderStatus.STATUS_ACTIVE, diff --git a/libs/accounts/src/lib/accounts-table.tsx b/libs/accounts/src/lib/accounts-table.tsx index ff820a428..170abbc17 100644 --- a/libs/accounts/src/lib/accounts-table.tsx +++ b/libs/accounts/src/lib/accounts-table.tsx @@ -299,6 +299,7 @@ export const AccountTable = forwardRef( } > @@ -359,7 +360,10 @@ export const AccountTable = forwardRef( } -
+

{row?.asset?.symbol} {t('usage breakdown')}

From 30c1dbd019e0c7a9301fc190130d35b35d8f11e0 Mon Sep 17 00:00:00 2001 From: dexturr Date: Fri, 28 Apr 2023 00:14:44 +0000 Subject: [PATCH 04/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 1ef5e0f95..d420ea970 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "494.628795994665", - "locked_amount": "14266.7513944347992639375", + "locked_amount": "14104.3291518132719137625", "deposits": [ { "amount": "188", @@ -822,7 +822,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "8976", "total_removed": "596.64743517951", - "locked_amount": "2466.30490740740732208", + "locked_amount": "2390.53874074074112416", "deposits": [ { "amount": "111", @@ -4605,7 +4605,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52532.3598535741728398289", + "locked_amount": "52472.2326366771880209976", "deposits": [ { "amount": "86666.297", @@ -4671,7 +4671,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "470.370847323972325", + "locked_amount": "466.8924247049247", "deposits": [ { "amount": "2500", @@ -4792,7 +4792,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "12006.80684505837325", + "locked_amount": "11982.7225493156195", "deposits": [ { "amount": "12500", @@ -5059,7 +5059,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17678.335539225", - "locked_amount": "19732.6652662676475", + "locked_amount": "19680.20065991405625", "deposits": [ { "amount": "7500", @@ -5456,7 +5456,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52484.430685082756083458", + "locked_amount": "52424.358326705700589065", "deposits": [ { "amount": "129999.45", @@ -5489,7 +5489,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "50186.42849337648431156926", + "locked_amount": "50148.96665171115575795528", "deposits": [ { "amount": "54144.7663", @@ -5522,7 +5522,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21994.5524797057361", + "locked_amount": "21951.12194317605482", "deposits": [ { "amount": "10000", @@ -5715,7 +5715,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1948.5342148655505", + "locked_amount": "1945.0653221714865", "deposits": [ { "amount": "5000", @@ -6256,7 +6256,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "403.1350713627993", + "locked_amount": "371.6563075506434925", "deposits": [ { "amount": "7500", @@ -6762,7 +6762,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "187312.0312486713071773836", + "locked_amount": "185966.1505717934249501196", "deposits": [ { "amount": "1852091.69", @@ -40612,7 +40612,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "312334.701635806482800925758", + "locked_amount": "310266.551621327718386904753", "deposits": [ { "amount": "1998.95815", @@ -42005,7 +42005,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6407206.38383686475925178450726816596566644", + "locked_amount": "6399872.8566734463335734766201054909462017", "deposits": [ { "amount": "16249.93", @@ -48561,7 +48561,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "193646.7968688536809448427165051816", + "locked_amount": "186876.53141659908353306365130595", "deposits": [ { "amount": "129284.449", @@ -58594,7 +58594,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43935.8732690563416", - "locked_amount": "49491.218855463579856215150481968", + "locked_amount": "49163.508663619965925790566007088", "deposits": [ { "amount": "3000", From e4fd040933b236417c9d79768e69e81ac4922b22 Mon Sep 17 00:00:00 2001 From: dexturr Date: Fri, 28 Apr 2023 06:08:57 +0000 Subject: [PATCH 05/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 49 ++++++++++++-------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index d420ea970..66747ed7e 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "494.628795994665", - "locked_amount": "14104.3291518132719137625", + "locked_amount": "13946.5615435956807465125", "deposits": [ { "amount": "188", @@ -822,7 +822,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "8976", "total_removed": "596.64743517951", - "locked_amount": "2390.53874074074112416", + "locked_amount": "2316.943851851851464", "deposits": [ { "amount": "111", @@ -4605,7 +4605,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52472.2326366771880209976", + "locked_amount": "52413.828522526897906274", "deposits": [ { "amount": "86666.297", @@ -4671,7 +4671,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "466.8924247049247", + "locked_amount": "463.513685388685375", "deposits": [ { "amount": "2500", @@ -4792,7 +4792,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11982.7225493156195", + "locked_amount": "11959.3284520933965", "deposits": [ { "amount": "12500", @@ -5059,7 +5059,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17678.335539225", - "locked_amount": "19680.20065991405625", + "locked_amount": "19629.239564149785", "deposits": [ { "amount": "7500", @@ -5456,7 +5456,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52424.358326705700589065", + "locked_amount": "52366.0074989608675515285", "deposits": [ { "amount": "129999.45", @@ -5489,7 +5489,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "50148.96665171115575795528", + "locked_amount": "50112.57837715237381561549", "deposits": [ { "amount": "54144.7663", @@ -5522,7 +5522,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21951.12194317605482", + "locked_amount": "21908.93602232369342", "deposits": [ { "amount": "10000", @@ -5715,7 +5715,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1945.0653221714865", + "locked_amount": "1941.6958396752915", "deposits": [ { "amount": "5000", @@ -6256,7 +6256,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "371.6563075506434925", + "locked_amount": "341.079650092080135", "deposits": [ { "amount": "7500", @@ -6762,7 +6762,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "185966.1505717934249501196", + "locked_amount": "184658.8396277372732387052", "deposits": [ { "amount": "1852091.69", @@ -40612,7 +40612,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "310266.551621327718386904753", + "locked_amount": "308257.66985764130666401388", "deposits": [ { "amount": "1998.95815", @@ -42005,7 +42005,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6399872.8566734463335734766201054909462017", + "locked_amount": "6392749.49092195080541091690422070752608813", "deposits": [ { "amount": "16249.93", @@ -48561,7 +48561,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "186876.53141659908353306365130595", + "locked_amount": "180300.2856379379679487702400136114", "deposits": [ { "amount": "129284.449", @@ -58593,8 +58593,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "43935.8732690563416", - "locked_amount": "49163.508663619965925790566007088", + "total_removed": "43997.0543192803416", + "locked_amount": "48845.189864906103545725365702684", "deposits": [ { "amount": "3000", @@ -65238,6 +65238,11 @@ "user": "0x0a6A5e1da768709A2bF17b2E58B2B73120051D03", "tx": "0x097e43cb4f64f1cb502f321eceb8b91e6378cac0b3b6fe558fc1d543aec597e2" }, + { + "amount": "61.181050224", + "user": "0xe7770271d882C54C46B9f00137e96a3BbfFD4d94", + "tx": "0x3c7d0394e431000fa5c733213116dc39b0f87a9a32a40e75cec3c2fce7795b0b" + }, { "amount": "168.502276762", "user": "0x38A292CB98Dc602ECAFF94E8E5fADD9800e4bA13", @@ -78243,6 +78248,12 @@ } ], "withdrawals": [ + { + "amount": "61.181050224", + "user": "0xe7770271d882C54C46B9f00137e96a3BbfFD4d94", + "tranche_id": 5, + "tx": "0x3c7d0394e431000fa5c733213116dc39b0f87a9a32a40e75cec3c2fce7795b0b" + }, { "amount": "101.521461192", "user": "0xe7770271d882C54C46B9f00137e96a3BbfFD4d94", @@ -78281,8 +78292,8 @@ } ], "total_tokens": "600", - "withdrawn_tokens": "476.48491248", - "remaining_tokens": "123.51508752" + "withdrawn_tokens": "537.665962704", + "remaining_tokens": "62.334037296" }, { "address": "0x79D8ff1699911f065fD97a95a6B47216925C4B0e", From 66d2b835137a4faedd78f1899650b0206436afba Mon Sep 17 00:00:00 2001 From: dexturr Date: Fri, 28 Apr 2023 12:09:23 +0000 Subject: [PATCH 06/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 69 +++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 66747ed7e..dc114cbf7 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -37,8 +37,8 @@ "tranche_start": "2023-04-20T00:00:00.000Z", "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", - "total_removed": "494.628795994665", - "locked_amount": "13946.5615435956807465125", + "total_removed": "537.22112238579", + "locked_amount": "13786.0174867862645531375", "deposits": [ { "amount": "188", @@ -226,6 +226,11 @@ "amount": "96.6447222258", "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", "tx": "0x13b160a21d48eab98cc304bbb46cd675da08afbf6e0ad261c67c10ba34dc4d74" + }, + { + "amount": "42.592326391125", + "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", + "tx": "0x5f544a659ae728cc7b1a29dcda14740425cadf1f47aa74bae92bf2ade3c8093d" } ], "users": [ @@ -281,11 +286,17 @@ "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", "tranche_id": 56, "tx": "0x13b160a21d48eab98cc304bbb46cd675da08afbf6e0ad261c67c10ba34dc4d74" + }, + { + "amount": "42.592326391125", + "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", + "tranche_id": 56, + "tx": "0x5f544a659ae728cc7b1a29dcda14740425cadf1f47aa74bae92bf2ade3c8093d" } ], "total_tokens": "1207.5", - "withdrawn_tokens": "298.738388303775", - "remaining_tokens": "908.761611696225" + "withdrawn_tokens": "341.3307146949", + "remaining_tokens": "866.1692853051" }, { "address": "0x33Ce1D9E53AFb7367E34749517C086405a651a95", @@ -822,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "8976", "total_removed": "596.64743517951", - "locked_amount": "2316.943851851851464", + "locked_amount": "2242.0538148148150032", "deposits": [ { "amount": "111", @@ -1594,7 +1605,7 @@ "tranche_start": "2023-03-06T00:00:00.000Z", "tranche_end": "2023-04-06T00:00:00.000Z", "total_added": "14099", - "total_removed": "3112.49002352036", + "total_removed": "3142.49002352036", "locked_amount": "0", "deposits": [ { @@ -2359,6 +2370,11 @@ } ], "withdrawals": [ + { + "amount": "30", + "user": "0xBe9F912Ad481C61B653463E8F1D2b2b310D49861", + "tx": "0x191a1901917ada560c9c30efd3d24c0ec116b9dc131a6966cc67ad7e3701df3b" + }, { "amount": "30", "user": "0x8499411Bff99ddE9A02903008F917EEa0E27B42A", @@ -2593,10 +2609,17 @@ "tx": "0x20d505a766d3d8e376509ed8003a5b9f35fd0524f0979a5a57c7d3714d01d3e5" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "30", + "user": "0xBe9F912Ad481C61B653463E8F1D2b2b310D49861", + "tranche_id": 53, + "tx": "0x191a1901917ada560c9c30efd3d24c0ec116b9dc131a6966cc67ad7e3701df3b" + } + ], "total_tokens": "30", - "withdrawn_tokens": "0", - "remaining_tokens": "30" + "withdrawn_tokens": "30", + "remaining_tokens": "0" }, { "address": "0xA9821681fEF27Ed817DF77E476DDDAf0aDac4443", @@ -4605,7 +4628,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52413.828522526897906274", + "locked_amount": "52354.396592703131652297", "deposits": [ { "amount": "86666.297", @@ -4671,7 +4694,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "463.513685388685375", + "locked_amount": "460.07548585673575", "deposits": [ { "amount": "2500", @@ -4792,7 +4815,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11959.3284520933965", + "locked_amount": "11935.52265750805275", "deposits": [ { "amount": "12500", @@ -5059,7 +5082,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17678.335539225", - "locked_amount": "19629.239564149785", + "locked_amount": "19577.381637507675", "deposits": [ { "amount": "7500", @@ -5456,7 +5479,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52366.0074989608675515285", + "locked_amount": "52306.629793295059806393", "deposits": [ { "amount": "129999.45", @@ -5489,7 +5512,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "50112.57837715237381561549", + "locked_amount": "50075.54972923179337511559", "deposits": [ { "amount": "54144.7663", @@ -5522,7 +5545,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21908.93602232369342", + "locked_amount": "21866.007699137490576", "deposits": [ { "amount": "10000", @@ -5715,7 +5738,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1941.6958396752915", + "locked_amount": "1938.26705986808735", "deposits": [ { "amount": "5000", @@ -6256,7 +6279,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "341.079650092080135", + "locked_amount": "309.9648941068150575", "deposits": [ { "amount": "7500", @@ -6762,7 +6785,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "184658.8396277372732387052", + "locked_amount": "183328.522176383808038828", "deposits": [ { "amount": "1852091.69", @@ -40612,7 +40635,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "308257.66985764130666401388", + "locked_amount": "306213.435102254068923605253", "deposits": [ { "amount": "1998.95815", @@ -42005,7 +42028,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6392749.49092195080541091690422070752608813", + "locked_amount": "6385500.76573176443723552685141297101162474", "deposits": [ { "amount": "16249.93", @@ -48561,7 +48584,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "180300.2856379379679487702400136114", + "locked_amount": "173608.308825906440421784938704799", "deposits": [ { "amount": "129284.449", @@ -58594,7 +58617,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "48845.189864906103545725365702684", + "locked_amount": "48521.26918257097251294495027906", "deposits": [ { "amount": "3000", From a10f67d7ab5ba56398e93e1124ba8b2015d949d3 Mon Sep 17 00:00:00 2001 From: Edd Date: Fri, 28 Apr 2023 14:08:42 +0100 Subject: [PATCH 07/42] feat(explorer): add epoch to block explorer homepage (#3536) --- apps/explorer-e2e/src/integration/home.cy.js | 64 ++++++------------- .../components/stats-manager/Stats.graphql | 3 + .../stats-manager/__generated__/Stats.ts | 5 +- .../stats-manager/stats-manager.tsx | 14 ++-- libs/network-stats/src/config/stats-fields.ts | 8 ++- 5 files changed, 41 insertions(+), 53 deletions(-) diff --git a/apps/explorer-e2e/src/integration/home.cy.js b/apps/explorer-e2e/src/integration/home.cy.js index 5f9342727..bc8f058dd 100644 --- a/apps/explorer-e2e/src/integration/home.cy.js +++ b/apps/explorer-e2e/src/integration/home.cy.js @@ -9,21 +9,22 @@ context('Home Page', function () { it('should show connected environment stats', function () { const statTitles = { 0: 'Status', - 1: 'Block height', - 2: 'Uptime', - 3: 'Total nodes', - 4: 'Total staked', - 5: 'Backlog', - 6: 'Trades / second', - 7: 'Orders / block', - 8: 'Orders / second', - 9: 'Transactions / block', - 10: 'Block time', - 11: 'Time', - 12: 'App', - 13: 'Tendermint', - 14: 'Up since', - 15: 'Chain ID', + 1: 'Epoch', + 2: 'Block height', + 3: 'Uptime', + 4: 'Total nodes', + 5: 'Total staked', + 6: 'Backlog', + 7: 'Trades / second', + 8: 'Orders / block', + 9: 'Orders / second', + 10: 'Transactions / block', + 11: 'Block time', + 12: 'Time', + 13: 'App', + 14: 'Tendermint', + 15: 'Up since', + 16: 'Chain ID', }; cy.get('[data-testid="stats-title"]') @@ -31,42 +32,13 @@ context('Home Page', function () { cy.wrap($list).should('contain.text', statTitles[index]); }) .then(($list) => { - cy.wrap($list).should('have.length', 16); + cy.wrap($list).should('have.length', 17); }); - - cy.get(statsValue).eq(0).should('contain.text', 'CONNECTED'); - cy.get(statsValue).eq(1).should('not.be.empty'); - cy.get(statsValue) - .eq(2) - .invoke('text') - .should('match', /\d+d \d+h \d+m \d+s/i); - cy.get(statsValue).eq(3).should('contain.text', '2'); - cy.get(statsValue) - .eq(4) - .invoke('text') - .should('match', /\d+\.\d\d(?!\d)/i); - cy.get(statsValue).eq(5).should('contain.text', '0'); - cy.get(statsValue).eq(6).should('contain.text', '0'); - cy.get(statsValue).eq(7).should('contain.text', '0'); - cy.get(statsValue).eq(8).should('contain.text', '0'); - cy.get(statsValue).eq(9).should('not.be.empty'); - cy.get(statsValue).eq(10).should('not.be.empty'); - cy.get(statsValue).eq(11).should('not.be.empty'); - cy.get(statsValue) - .eq(12) - .invoke('text') - .should('match', /v\d+\.\d+\.\d+/i); - cy.get(statsValue) - .eq(13) - .invoke('text') - .should('match', /\d+\.\d+\.\d+/i); - cy.get(statsValue).eq(14).should('not.be.empty'); - cy.get(statsValue).eq(15).should('not.be.empty'); }); it('Block height should be updating', function () { cy.get(statsValue) - .eq(1) + .eq(2) .invoke('text') .then((blockHeightTxt) => { cy.get(statsValue) diff --git a/libs/network-stats/src/components/stats-manager/Stats.graphql b/libs/network-stats/src/components/stats-manager/Stats.graphql index 348d64156..3be3c5840 100644 --- a/libs/network-stats/src/components/stats-manager/Stats.graphql +++ b/libs/network-stats/src/components/stats-manager/Stats.graphql @@ -1,4 +1,7 @@ query Stats { + epoch { + id + } nodeData { stakedTotal totalNodes diff --git a/libs/network-stats/src/components/stats-manager/__generated__/Stats.ts b/libs/network-stats/src/components/stats-manager/__generated__/Stats.ts index 6c2275fa7..d253da9c7 100644 --- a/libs/network-stats/src/components/stats-manager/__generated__/Stats.ts +++ b/libs/network-stats/src/components/stats-manager/__generated__/Stats.ts @@ -6,11 +6,14 @@ const defaultOptions = {} as const; export type StatsQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type StatsQuery = { __typename?: 'Query', nodeData?: { __typename?: 'NodeData', stakedTotal: string, totalNodes: number, inactiveNodes: number } | null, statistics: { __typename?: 'Statistics', status: string, blockHeight: string, blockDuration: string, backlogLength: string, txPerBlock: string, tradesPerSecond: string, ordersPerSecond: string, averageOrdersPerBlock: string, vegaTime: any, appVersion: string, chainVersion: string, chainId: string, genesisTime: any } }; +export type StatsQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, nodeData?: { __typename?: 'NodeData', stakedTotal: string, totalNodes: number, inactiveNodes: number } | null, statistics: { __typename?: 'Statistics', status: string, blockHeight: string, blockDuration: string, backlogLength: string, txPerBlock: string, tradesPerSecond: string, ordersPerSecond: string, averageOrdersPerBlock: string, vegaTime: any, appVersion: string, chainVersion: string, chainId: string, genesisTime: any } }; export const StatsDocument = gql` query Stats { + epoch { + id + } nodeData { stakedTotal totalNodes diff --git a/libs/network-stats/src/components/stats-manager/stats-manager.tsx b/libs/network-stats/src/components/stats-manager/stats-manager.tsx index 2a88d56be..b1de0ff6e 100644 --- a/libs/network-stats/src/components/stats-manager/stats-manager.tsx +++ b/libs/network-stats/src/components/stats-manager/stats-manager.tsx @@ -19,10 +19,14 @@ export const StatsManager = ({ className }: StatsManagerProps) => { return () => stopPolling(); }, [startPolling, stopPolling]); - const getValue = (field: keyof NodeData | keyof Statistics) => - ['stakedTotal', 'totalNodes', 'inactiveNodes'].includes(field) - ? data?.nodeData?.[field as keyof NodeData] - : data?.statistics?.[field as keyof Statistics]; + const getValue = (field: keyof NodeData | keyof Statistics | 'epoch') => { + if (['stakedTotal', 'totalNodes', 'inactiveNodes'].includes(field)) { + return data?.nodeData?.[field as keyof NodeData]; + } else if (field === 'epoch') { + return data?.epoch.id; + } + return data?.statistics?.[field as keyof Statistics]; + }; const panels = fieldsDefinition.map( ({ field, title, description, formatter, goodThreshold }) => ({ @@ -50,7 +54,7 @@ export const StatsManager = ({ className }: StatsManagerProps) => { className={classNames( 'border rounded p-2 relative border-vega-light-200 dark:border-vega-dark-200', { - 'col-span-2': field === 'chainId' || field === 'status', + 'col-span-2': field === 'chainId', }, { 'bg-transparent border-vega-light-200 dark:border-vega-dark-200': diff --git a/libs/network-stats/src/config/stats-fields.ts b/libs/network-stats/src/config/stats-fields.ts index 96f8be4e5..f6b315d84 100644 --- a/libs/network-stats/src/config/stats-fields.ts +++ b/libs/network-stats/src/config/stats-fields.ts @@ -20,7 +20,7 @@ export type FieldValue = any; export type GoodThreshold = (...args: FieldValue[]) => boolean; export interface Stats { - field: keyof NodeData | keyof Statistics; + field: keyof NodeData | keyof Statistics | 'epoch'; title: string; goodThreshold?: GoodThreshold; // eslint-disable-next-line @@ -161,6 +161,11 @@ const VEGA_TIME: Stats = { description: t('The time on the blockchain'), }; +const EPOCH: Stats = { + field: 'epoch', + title: 'Epoch', +}; + const APP_VERSION: Stats = { field: 'appVersion', title: t('App'), @@ -217,6 +222,7 @@ const CHAIN_ID: Stats = { export const fieldsDefinition: Stats[] = [ STATUS, + EPOCH, BLOCK_HEIGHT, UPTIME, TOTAL_NODES, From 77ab719b372ab7d920b1bb80bd40b11adfd94f1e Mon Sep 17 00:00:00 2001 From: Edd Date: Fri, 28 Apr 2023 17:00:49 +0100 Subject: [PATCH 08/42] fix(explorer): fix asset links and deterministic order details (#3567) --- .../src/app/components/links/asset-link/asset-link.tsx | 2 +- .../components/order-details/deterministic-order-details.tsx | 4 ++-- .../src/app/routes/parties/id/components/party-accounts.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/explorer/src/app/components/links/asset-link/asset-link.tsx b/apps/explorer/src/app/components/links/asset-link/asset-link.tsx index 232296b2d..bfaf87def 100644 --- a/apps/explorer/src/app/components/links/asset-link/asset-link.tsx +++ b/apps/explorer/src/app/components/links/asset-link/asset-link.tsx @@ -43,7 +43,7 @@ export const AssetLink = ({ if (asDialog) { open(assetId, e.target as HTMLElement); } else { - navigate(`${Routes.ASSETS}/${asset?.id}`); + navigate(`/${Routes.ASSETS}/${asset?.id}`); } }} {...props} diff --git a/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx b/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx index 7c0dce1f3..2e3b51458 100644 --- a/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx +++ b/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx @@ -9,7 +9,7 @@ import SizeInMarket from '../size-in-market/size-in-market'; export interface DeterministicOrderDetailsProps { id: string; // Version to fetch, with 0 being 'latest' and 1 being 'first'. Defaults to 0 - version?: number; + version?: number | null; } export const wrapperClasses = @@ -28,7 +28,7 @@ export const wrapperClasses = */ const DeterministicOrderDetails = ({ id, - version = 0, + version = null, }: DeterministicOrderDetailsProps) => { const { data, error } = useExplorerDeterministicOrderQuery({ variables: { orderId: id, version }, diff --git a/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx b/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx index 5259a7410..1b2c6dc32 100644 --- a/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx +++ b/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx @@ -71,7 +71,7 @@ export const PartyAccounts = ({ accounts }: PartyAccountsProps) => { /> - + ); From 473ef3ae83d7cee13a40bde755196383c8c2e2b3 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Fri, 28 Apr 2023 18:08:36 +0100 Subject: [PATCH 09/42] feat(governance): default font Alpha (#3543) --- apps/governance/src/components/page-templates/app-layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/governance/src/components/page-templates/app-layout.tsx b/apps/governance/src/components/page-templates/app-layout.tsx index a30baa017..ccb9de75f 100644 --- a/apps/governance/src/components/page-templates/app-layout.tsx +++ b/apps/governance/src/components/page-templates/app-layout.tsx @@ -14,7 +14,7 @@ export const AppLayout = ({ children }: AppLayoutProps) => { const { isReadOnly } = useVegaWallet(); const AppLayoutClasses = classNames( 'app w-full max-w-[1500px] mx-auto grid', - 'lg:text-body-large', + 'font-alpha lg:text-body-large', { 'grid-rows-[repeat(2,min-content)_1fr_min-content]': !isReadOnly, 'grid-rows-[repeat(3,min-content)_1fr_min-content]': isReadOnly, From e86fb6d0b46545cd37a595758a1c9bd8594f05f2 Mon Sep 17 00:00:00 2001 From: dexturr Date: Fri, 28 Apr 2023 18:08:10 +0000 Subject: [PATCH 10/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index dc114cbf7..47808c022 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "13786.0174867862645531375", + "locked_amount": "13626.20837225115883275", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "8976", "total_removed": "596.64743517951", - "locked_amount": "2242.0538148148150032", + "locked_amount": "2167.50661111111075872", "deposits": [ { "amount": "111", @@ -4628,7 +4628,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52354.396592703131652297", + "locked_amount": "52295.2367317341121410505", "deposits": [ { "amount": "86666.297", @@ -4694,7 +4694,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "460.07548585673575", + "locked_amount": "456.65302579365075", "deposits": [ { "amount": "2500", @@ -4815,7 +4815,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11935.52265750805275", + "locked_amount": "11911.8258416364725", "deposits": [ { "amount": "12500", @@ -5082,7 +5082,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17678.335539225", - "locked_amount": "19577.381637507675", + "locked_amount": "19525.76110727440125", "deposits": [ { "amount": "7500", @@ -5479,7 +5479,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52306.629793295059806393", + "locked_amount": "52247.523908255404354395", "deposits": [ { "amount": "129999.45", @@ -5512,7 +5512,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "50075.54972923179337511559", + "locked_amount": "50038.69059190697946257094", "deposits": [ { "amount": "54144.7663", @@ -5545,7 +5545,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21866.007699137490576", + "locked_amount": "21823.275894216137136", "deposits": [ { "amount": "10000", @@ -5738,7 +5738,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1938.26705986808735", + "locked_amount": "1934.8539764079148", "deposits": [ { "amount": "5000", @@ -6279,7 +6279,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "309.9648941068150575", + "locked_amount": "278.99257596685101", "deposits": [ { "amount": "7500", @@ -6785,7 +6785,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "183328.522176383808038828", + "locked_amount": "182004.2946828443421504342", "deposits": [ { "amount": "1852091.69", @@ -40635,7 +40635,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "306213.435102254068923605253", + "locked_amount": "304178.558491729117521273949", "deposits": [ { "amount": "1998.95815", @@ -42028,7 +42028,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6385500.76573176443723552685141297101162474", + "locked_amount": "6378285.2239224094536141351898354004339011", "deposits": [ { "amount": "16249.93", @@ -48584,7 +48584,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "173608.308825906440421784938704799", + "locked_amount": "166946.9666991784607753764316950323", "deposits": [ { "amount": "129284.449", @@ -58617,7 +58617,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "48521.26918257097251294495027906", + "locked_amount": "48198.831351782662753545427092864", "deposits": [ { "amount": "3000", From 50232ab0890f8d138759dea414e1d1e9d8be2184 Mon Sep 17 00:00:00 2001 From: dexturr Date: Sat, 29 Apr 2023 00:16:25 +0000 Subject: [PATCH 11/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 54 ++++++++++++++------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 47808c022..9d7554c70 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "13626.20837225115883275", + "locked_amount": "13462.17519555362587805", "deposits": [ { "amount": "188", @@ -831,15 +831,20 @@ "tranche_id": 54, "tranche_start": "2023-04-06T00:00:00.000Z", "tranche_end": "2023-05-06T00:00:00.000Z", - "total_added": "8976", + "total_added": "13986", "total_removed": "596.64743517951", - "locked_amount": "2167.50661111111075872", + "locked_amount": "3258.08510416666599672", "deposits": [ { "amount": "111", "user": "0x90Cf7B9958C3BbBCddAb52Ecc408535D4f3C4241", "tx": "0x1229e077f48b796678436bfa8143cea3ae71df58b589ac922be205c4482be235" }, + { + "amount": "5010", + "user": "0x83D7eD53E7CB97b542F1F71f40561d51F8019C8B", + "tx": "0xf0d2927bb8d9363ddefaad3783f9a0abf8e468316c4baea24766991f6cb8cdac" + }, { "amount": "33", "user": "0xBf1AaB792D729fA125e6D7122D4b916a1E1C44B1", @@ -1029,6 +1034,21 @@ "withdrawn_tokens": "0", "remaining_tokens": "111" }, + { + "address": "0x83D7eD53E7CB97b542F1F71f40561d51F8019C8B", + "deposits": [ + { + "amount": "5010", + "user": "0x83D7eD53E7CB97b542F1F71f40561d51F8019C8B", + "tranche_id": 54, + "tx": "0xf0d2927bb8d9363ddefaad3783f9a0abf8e468316c4baea24766991f6cb8cdac" + } + ], + "withdrawals": [], + "total_tokens": "5010", + "withdrawn_tokens": "0", + "remaining_tokens": "5010" + }, { "address": "0xBf1AaB792D729fA125e6D7122D4b916a1E1C44B1", "deposits": [ @@ -4628,7 +4648,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52295.2367317341121410505", + "locked_amount": "52234.5131618929201789101", "deposits": [ { "amount": "86666.297", @@ -4694,7 +4714,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "456.65302579365075", + "locked_amount": "453.14010353072865", "deposits": [ { "amount": "2500", @@ -4815,7 +4835,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11911.8258416364725", + "locked_amount": "11887.50267335950025", "deposits": [ { "amount": "12500", @@ -5082,7 +5102,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17678.335539225", - "locked_amount": "19525.76110727440125", + "locked_amount": "19472.77614717618", "deposits": [ { "amount": "7500", @@ -5479,7 +5499,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52247.523908255404354395", + "locked_amount": "52186.855741031142662853", "deposits": [ { "amount": "129999.45", @@ -5512,7 +5532,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "50038.69059190697946257094", + "locked_amount": "50000.8571967135422162939", "deposits": [ { "amount": "54144.7663", @@ -5545,7 +5565,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21823.275894216137136", + "locked_amount": "21779.41460553019106", "deposits": [ { "amount": "10000", @@ -5738,7 +5758,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1934.8539764079148", + "locked_amount": "1931.3506785895485", "deposits": [ { "amount": "5000", @@ -6279,7 +6299,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "278.99257596685101", + "locked_amount": "247.2015999079194075", "deposits": [ { "amount": "7500", @@ -6785,7 +6805,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "182004.2946828443421504342", + "locked_amount": "180645.0653105561486300316", "deposits": [ { "amount": "1852091.69", @@ -40635,7 +40655,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "304178.558491729117521273949", + "locked_amount": "302089.896179927235932179628", "deposits": [ { "amount": "1998.95815", @@ -42028,7 +42048,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6378285.2239224094536141351898354004339011", + "locked_amount": "6370878.96146969596772343823775878825006754", "deposits": [ { "amount": "16249.93", @@ -48584,7 +48604,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "166946.9666991784607753764316950323", + "locked_amount": "160109.5524922661645473337966091678", "deposits": [ { "amount": "129284.449", @@ -58617,7 +58637,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "48198.831351782662753545427092864", + "locked_amount": "47867.870869174846105531852562172", "deposits": [ { "amount": "3000", From c9cce876069a2d78b999de26a1739c009207b17e Mon Sep 17 00:00:00 2001 From: dexturr Date: Sat, 29 Apr 2023 06:08:49 +0000 Subject: [PATCH 12/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 9d7554c70..ff0bc278b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "13462.17519555362587805", + "locked_amount": "13305.224189863038223", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "13986", "total_removed": "596.64743517951", - "locked_amount": "3258.08510416666599672", + "locked_amount": "3144.00639583333386342", "deposits": [ { "amount": "111", @@ -4648,7 +4648,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52234.5131618929201789101", + "locked_amount": "52176.4113464700975562325", "deposits": [ { "amount": "86666.297", @@ -4714,7 +4714,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "453.14010353072865", + "locked_amount": "449.778852513227625", "deposits": [ { "amount": "2500", @@ -4835,7 +4835,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11887.50267335950025", + "locked_amount": "11864.2296635970205", "deposits": [ { "amount": "12500", @@ -5102,7 +5102,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17678.335539225", - "locked_amount": "19472.77614717618", + "locked_amount": "19422.0788251995075", "deposits": [ { "amount": "7500", @@ -5499,7 +5499,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52186.855741031142662853", + "locked_amount": "52128.806936204259651012", "deposits": [ { "amount": "129999.45", @@ -5532,7 +5532,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "50000.8571967135422162939", + "locked_amount": "49964.65726726117955940801", "deposits": [ { "amount": "54144.7663", @@ -5565,7 +5565,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21779.41460553019106", + "locked_amount": "21737.447038305425224", "deposits": [ { "amount": "10000", @@ -5758,7 +5758,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1931.3506785895485", + "locked_amount": "1927.99863647894475", "deposits": [ { "amount": "5000", @@ -6299,7 +6299,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "247.2015999079194075", + "locked_amount": "216.7832067219158175", "deposits": [ { "amount": "7500", @@ -6805,7 +6805,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "180645.0653105561486300316", + "locked_amount": "179344.5209862931247167142", "deposits": [ { "amount": "1852091.69", @@ -40655,7 +40655,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "302089.896179927235932179628", + "locked_amount": "300091.317828260280483501067", "deposits": [ { "amount": "1998.95815", @@ -42048,7 +42048,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6370878.96146969596772343823775878825006754", + "locked_amount": "6363792.130955681333881138184264997972425", "deposits": [ { "amount": "16249.93", @@ -48604,7 +48604,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "160109.5524922661645473337966091678", + "locked_amount": "153567.0358115666345737133731921032", "deposits": [ { "amount": "129284.449", @@ -58637,7 +58637,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "47867.870869174846105531852562172", + "locked_amount": "47551.184704992369520671105327228", "deposits": [ { "amount": "3000", From 66d3e89b9e072a7a681cb2157d11209d65f31285 Mon Sep 17 00:00:00 2001 From: dexturr Date: Sat, 29 Apr 2023 12:09:56 +0000 Subject: [PATCH 13/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 49 ++++++++++++-------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index ff0bc278b..85efff2f5 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "13305.224189863038223", + "locked_amount": "13144.3609157021625130625", "deposits": [ { "amount": "188", @@ -832,8 +832,8 @@ "tranche_start": "2023-04-06T00:00:00.000Z", "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "13986", - "total_removed": "596.64743517951", - "locked_amount": "3144.00639583333386342", + "total_removed": "731.78640740205", + "locked_amount": "3027.08408333333405508", "deposits": [ { "amount": "111", @@ -987,6 +987,11 @@ "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", "tx": "0x4027743264e01043ddb16676c6f7914c110df9e7212bd3f21cb6842614ce238f" }, + { + "amount": "135.13897222254", + "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", + "tx": "0x29905e6ae54245e824fe9ea488f491b1a3c33f6d8b9345cf2b6b00aec305c5bf" + }, { "amount": "5.46866782407", "user": "0x92A1e98C6f09970e45645Cbe57c6DcaF4547c8FE", @@ -1261,6 +1266,12 @@ "tranche_id": 54, "tx": "0x4027743264e01043ddb16676c6f7914c110df9e7212bd3f21cb6842614ce238f" }, + { + "amount": "135.13897222254", + "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", + "tranche_id": 54, + "tx": "0x29905e6ae54245e824fe9ea488f491b1a3c33f6d8b9345cf2b6b00aec305c5bf" + }, { "amount": "155.03186111556", "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", @@ -1287,8 +1298,8 @@ } ], "total_tokens": "858", - "withdrawn_tokens": "531.01030786518", - "remaining_tokens": "326.98969213482" + "withdrawn_tokens": "666.14928008772", + "remaining_tokens": "191.85071991228" }, { "address": "0x0bBf7580e036eA5D69ABe679CC90117EeC2e3dc1", @@ -4648,7 +4659,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52176.4113464700975562325", + "locked_amount": "52116.8612453255955856611", "deposits": [ { "amount": "86666.297", @@ -4714,7 +4725,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "449.778852513227625", + "locked_amount": "446.33381664631655", "deposits": [ { "amount": "2500", @@ -4835,7 +4846,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11864.2296635970205", + "locked_amount": "11840.37653482286575", "deposits": [ { "amount": "12500", @@ -5102,7 +5113,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17678.335539225", - "locked_amount": "19422.0788251995075", + "locked_amount": "19370.11778698588125", "deposits": [ { "amount": "7500", @@ -5499,7 +5510,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52128.806936204259651012", + "locked_amount": "52069.311167034172360335", "deposits": [ { "amount": "129999.45", @@ -5532,7 +5543,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49964.65726726117955940801", + "locked_amount": "49927.55499352627650230034", "deposits": [ { "amount": "54144.7663", @@ -5565,7 +5576,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21737.447038305425224", + "locked_amount": "21694.433358701168738", "deposits": [ { "amount": "10000", @@ -5758,7 +5769,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1927.99863647894475", + "locked_amount": "1924.56303906646365", "deposits": [ { "amount": "5000", @@ -6299,7 +6310,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7280.725809525", - "locked_amount": "216.7832067219158175", + "locked_amount": "185.60658379373955", "deposits": [ { "amount": "7500", @@ -6805,7 +6816,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "179344.5209862931247167142", + "locked_amount": "178011.5584017477748967068", "deposits": [ { "amount": "1852091.69", @@ -40655,7 +40666,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "300091.317828260280483501067", + "locked_amount": "298043.112950810458183400266", "deposits": [ { "amount": "1998.95815", @@ -42048,7 +42059,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "864782.86597041115934852", - "locked_amount": "6363792.130955681333881138184264997972425", + "locked_amount": "6356529.3279675680721142300136677673938903", "deposits": [ { "amount": "16249.93", @@ -48604,7 +48615,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6130217.967403708954663132", - "locked_amount": "153567.0358115666345737133731921032", + "locked_amount": "146862.0624663752374092143529038253", "deposits": [ { "amount": "129284.449", @@ -58637,7 +58648,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "47551.184704992369520671105327228", + "locked_amount": "47226.634934122253604346014408912", "deposits": [ { "amount": "3000", From ab180875b10f6342c376c407cc0e0ea40a508436 Mon Sep 17 00:00:00 2001 From: dexturr Date: Sat, 29 Apr 2023 18:07:34 +0000 Subject: [PATCH 14/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 122 ++++++++++++++----- 1 file changed, 93 insertions(+), 29 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 85efff2f5..b924203f9 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "13144.3609157021625130625", + "locked_amount": "12985.0714573206022081875", "deposits": [ { "amount": "188", @@ -831,9 +831,9 @@ "tranche_id": 54, "tranche_start": "2023-04-06T00:00:00.000Z", "tranche_end": "2023-05-06T00:00:00.000Z", - "total_added": "13986", + "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "3027.08408333333405508", + "locked_amount": "3022.4623611111103152", "deposits": [ { "amount": "111", @@ -845,6 +845,11 @@ "user": "0x83D7eD53E7CB97b542F1F71f40561d51F8019C8B", "tx": "0xf0d2927bb8d9363ddefaad3783f9a0abf8e468316c4baea24766991f6cb8cdac" }, + { + "amount": "534", + "user": "0x2586bA83696a92b5467Aaa0CF9EEC052F28F2c02", + "tx": "0xf970ea0ce3e36fa0014d24bb830dd2ea0dbea06f6e53af486de5ee7e1c63e540" + }, { "amount": "33", "user": "0xBf1AaB792D729fA125e6D7122D4b916a1E1C44B1", @@ -1054,6 +1059,21 @@ "withdrawn_tokens": "0", "remaining_tokens": "5010" }, + { + "address": "0x2586bA83696a92b5467Aaa0CF9EEC052F28F2c02", + "deposits": [ + { + "amount": "534", + "user": "0x2586bA83696a92b5467Aaa0CF9EEC052F28F2c02", + "tranche_id": 54, + "tx": "0xf970ea0ce3e36fa0014d24bb830dd2ea0dbea06f6e53af486de5ee7e1c63e540" + } + ], + "withdrawals": [], + "total_tokens": "534", + "withdrawn_tokens": "0", + "remaining_tokens": "534" + }, { "address": "0xBf1AaB792D729fA125e6D7122D4b916a1E1C44B1", "deposits": [ @@ -4659,7 +4679,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52116.8612453255955856611", + "locked_amount": "52057.8937562740703571679", "deposits": [ { "amount": "86666.297", @@ -4725,7 +4745,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "446.33381664631655", + "locked_amount": "442.922485500610575", "deposits": [ { "amount": "2500", @@ -4846,7 +4866,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11840.37653482286575", + "locked_amount": "11816.7567746074875", "deposits": [ { "amount": "12500", @@ -5112,8 +5132,8 @@ "tranche_start": "2023-02-01T00:00:00.000Z", "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", - "total_removed": "17678.335539225", - "locked_amount": "19370.11778698588125", + "total_removed": "17836.1796921", + "locked_amount": "19318.66511279926125", "deposits": [ { "amount": "7500", @@ -5137,6 +5157,11 @@ "user": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600", "tx": "0xfce75d8b6bf0d20cbdb1ef29cfabcae4f4504c30b30ca166b4e66d37f7f04339" }, + { + "amount": "157.844152875", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x6bb6303a6a322698e6e295ad38b2a22bd20d8b44306d423a3e513bb0b858ad56" + }, { "amount": "126.30064455", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -5301,6 +5326,12 @@ "tranche_id": 34, "tx": "0x4dc6eefb43f5b1704894582aa926f0c6ecd94550ac354b7d5b5f49b0f17261fd" }, + { + "amount": "157.844152875", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 34, + "tx": "0x6bb6303a6a322698e6e295ad38b2a22bd20d8b44306d423a3e513bb0b858ad56" + }, { "amount": "126.30064455", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -5465,8 +5496,8 @@ } ], "total_tokens": "7500", - "withdrawn_tokens": "3468.576868425", - "remaining_tokens": "4031.423131575" + "withdrawn_tokens": "3626.4210213", + "remaining_tokens": "3873.5789787" }, { "address": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600", @@ -5510,7 +5541,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52069.311167034172360335", + "locked_amount": "52010.397478396824042975", "deposits": [ { "amount": "129999.45", @@ -5543,7 +5574,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49927.55499352627650230034", + "locked_amount": "49890.81571217827289341667", "deposits": [ { "amount": "54144.7663", @@ -5576,7 +5607,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21694.433358701168738", + "locked_amount": "21651.8405060882823", "deposits": [ { "amount": "10000", @@ -5769,7 +5800,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1924.56303906646365", + "locked_amount": "1921.1610540334855", "deposits": [ { "amount": "5000", @@ -6309,8 +6340,8 @@ "tranche_start": "2022-11-01T00:00:00.000Z", "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", - "total_removed": "7280.725809525", - "locked_amount": "185.60658379373955", + "total_removed": "7438.558452225", + "locked_amount": "154.7349792817678875", "deposits": [ { "amount": "7500", @@ -6329,6 +6360,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xa9dd827abcfaa4b289c6bcf5923d455380c1d4f9ce4ce615415a513df60b1ea8" }, + { + "amount": "157.8326427", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xb76564ca91603758216069d7b139c683037029425e10b1694af25b478c19e26f" + }, { "amount": "126.2948895", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -6548,6 +6584,12 @@ "tranche_id": 33, "tx": "0xa9dd827abcfaa4b289c6bcf5923d455380c1d4f9ce4ce615415a513df60b1ea8" }, + { + "amount": "157.8326427", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 33, + "tx": "0xb76564ca91603758216069d7b139c683037029425e10b1694af25b478c19e26f" + }, { "amount": "126.2948895", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -6790,8 +6832,8 @@ } ], "total_tokens": "7500", - "withdrawn_tokens": "7280.725809525", - "remaining_tokens": "219.274190475" + "withdrawn_tokens": "7438.558452225", + "remaining_tokens": "61.441547775" }, { "address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1", @@ -6816,7 +6858,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "178011.5584017477748967068", + "locked_amount": "176691.636938985903874295", "deposits": [ { "amount": "1852091.69", @@ -40666,7 +40708,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "298043.112950810458183400266", + "locked_amount": "296014.853210390063205120392", "deposits": [ { "amount": "1998.95815", @@ -42058,8 +42100,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "864782.86597041115934852", - "locked_amount": "6356529.3279675680721142300136677673938903", + "total_removed": "865763.00168014330259852", + "locked_amount": "6349337.2491547577524443413936960232562855", "deposits": [ { "amount": "16249.93", @@ -42598,6 +42640,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x6d5ce55a076149d5f66e5e84720d3bd46f31e5c79c54632927c1a00d1fdbce37" }, + { + "amount": "980.13570973214325", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x45de80ad7201a69e9ac4f1f964218840867adaf64a7fc6020b51baa5de37816e" + }, { "amount": "981.387731774910625", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -44730,6 +44777,12 @@ "tranche_id": 2, "tx": "0x6d5ce55a076149d5f66e5e84720d3bd46f31e5c79c54632927c1a00d1fdbce37" }, + { + "amount": "980.13570973214325", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x45de80ad7201a69e9ac4f1f964218840867adaf64a7fc6020b51baa5de37816e" + }, { "amount": "981.387731774910625", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -46238,8 +46291,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "154884.69775377100425", - "remaining_tokens": "105114.18974622899575" + "withdrawn_tokens": "155864.8334635031475", + "remaining_tokens": "104134.0540364968525" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -48614,8 +48667,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "6130217.967403708954663132", - "locked_amount": "146862.0624663752374092143529038253", + "total_removed": "6131576.921601344944289882", + "locked_amount": "140222.3812282470258942893328792012", "deposits": [ { "amount": "129284.449", @@ -48849,6 +48902,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x0c555d0f3b2b4b3fb50f208d9155b5886c83511a552518af11cadd5d5a06acec" }, + { + "amount": "1358.95419763598962675", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x59bc5ab04aa250d84bd2ffe62dba38ed926c26f8ac2497e9414f3a7df2b3a661" + }, { "amount": "1360.32447632896938825", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -52173,6 +52231,12 @@ "tranche_id": 3, "tx": "0x0c555d0f3b2b4b3fb50f208d9155b5886c83511a552518af11cadd5d5a06acec" }, + { + "amount": "1358.95419763598962675", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x59bc5ab04aa250d84bd2ffe62dba38ed926c26f8ac2497e9414f3a7df2b3a661" + }, { "amount": "1360.32447632896938825", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -54995,8 +55059,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "354157.83455853103848675", - "remaining_tokens": "4965.63501646896151325" + "withdrawn_tokens": "355516.7887561670281135", + "remaining_tokens": "3606.6808188329718865" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -58648,7 +58712,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "47226.634934122253604346014408912", + "locked_amount": "46905.2455842255884665584170472", "deposits": [ { "amount": "3000", From ac2e262bf3a2183b678dd732d3e0edd899229de3 Mon Sep 17 00:00:00 2001 From: dexturr Date: Sun, 30 Apr 2023 00:16:34 +0000 Subject: [PATCH 15/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index b924203f9..dfaeb3856 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "12985.0714573206022081875", + "locked_amount": "12820.7116396122701576625", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "3022.4623611111103152", + "locked_amount": "2898.437361111111864", "deposits": [ { "amount": "111", @@ -4679,7 +4679,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "52057.8937562740703571679", + "locked_amount": "51997.0492669418740649497", "deposits": [ { "amount": "86666.297", @@ -4745,7 +4745,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "442.922485500610575", + "locked_amount": "439.402567918192875", "deposits": [ { "amount": "2500", @@ -4866,7 +4866,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11816.7567746074875", + "locked_amount": "11792.385171346619", "deposits": [ { "amount": "12500", @@ -5133,7 +5133,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "19318.66511279926125", + "locked_amount": "19265.574643186005", "deposits": [ { "amount": "7500", @@ -5541,7 +5541,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "52010.397478396824042975", + "locked_amount": "51949.60850200540002108", "deposits": [ { "amount": "129999.45", @@ -5574,7 +5574,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49890.81571217827289341667", + "locked_amount": "49852.9069789422733474347", "deposits": [ { "amount": "54144.7663", @@ -5607,7 +5607,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21651.8405060882823", + "locked_amount": "21607.89187595129587", "deposits": [ { "amount": "10000", @@ -5800,7 +5800,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1921.1610540334855", + "locked_amount": "1917.65078006088275", "deposits": [ { "amount": "5000", @@ -6341,7 +6341,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7438.558452225", - "locked_amount": "154.7349792817678875", + "locked_amount": "122.88069751381137", "deposits": [ { "amount": "7500", @@ -6858,7 +6858,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "176691.636938985903874295", + "locked_amount": "175329.7009187803816375184", "deposits": [ { "amount": "1852091.69", @@ -40708,7 +40708,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "296014.853210390063205120392", + "locked_amount": "293922.031723093670396469242", "deposits": [ { "amount": "1998.95815", @@ -42101,7 +42101,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "865763.00168014330259852", - "locked_amount": "6349337.2491547577524443413936960232562855", + "locked_amount": "6341916.2385327878836315446718437437672344", "deposits": [ { "amount": "16249.93", @@ -48668,7 +48668,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6131576.921601344944289882", - "locked_amount": "140222.3812282470258942893328792012", + "locked_amount": "133371.351605643915218568167086041", "deposits": [ { "amount": "129284.449", @@ -58712,7 +58712,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "46905.2455842255884665584170472", + "locked_amount": "46573.626056485904261395134855384", "deposits": [ { "amount": "3000", From a76ff44ffde55710b22f7eab0581113c417284bb Mon Sep 17 00:00:00 2001 From: dexturr Date: Sun, 30 Apr 2023 06:09:37 +0000 Subject: [PATCH 16/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index dfaeb3856..36d9efe06 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "12820.7116396122701576625", + "locked_amount": "12663.4562638888886750875", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2898.437361111111864", + "locked_amount": "2779.7733333333329784", "deposits": [ { "amount": "111", @@ -4679,7 +4679,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51997.0492669418740649497", + "locked_amount": "51938.834776538809619496", "deposits": [ { "amount": "86666.297", @@ -4745,7 +4745,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "439.402567918192875", + "locked_amount": "436.034798534798425", "deposits": [ { "amount": "2500", @@ -4866,7 +4866,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11792.385171346619", + "locked_amount": "11769.0670289855075", "deposits": [ { "amount": "12500", @@ -5133,7 +5133,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "19265.574643186005", + "locked_amount": "19214.77900552486125", "deposits": [ { "amount": "7500", @@ -5541,7 +5541,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51949.60850200540002108", + "locked_amount": "51891.4471250000004333315", "deposits": [ { "amount": "129999.45", @@ -5574,7 +5574,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49852.9069789422733474347", + "locked_amount": "49816.6368481320566111821", "deposits": [ { "amount": "54144.7663", @@ -5607,7 +5607,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21607.89187595129587", + "locked_amount": "21565.842922374429784", "deposits": [ { "amount": "10000", @@ -5800,7 +5800,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1917.65078006088275", + "locked_amount": "1914.2922374429222", "deposits": [ { "amount": "5000", @@ -6341,7 +6341,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7438.558452225", - "locked_amount": "122.88069751381137", + "locked_amount": "92.403314917126605", "deposits": [ { "amount": "7500", @@ -6858,7 +6858,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "175329.7009187803816375184", + "locked_amount": "174026.6344907761479044366", "deposits": [ { "amount": "1852091.69", @@ -40708,7 +40708,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "293922.031723093670396469242", + "locked_amount": "291919.672302795683811116452", "deposits": [ { "amount": "1998.95815", @@ -42101,7 +42101,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "865763.00168014330259852", - "locked_amount": "6341916.2385327878836315446718437437672344", + "locked_amount": "6334816.00059217409981700945073666566666667", "deposits": [ { "amount": "16249.93", @@ -48668,7 +48668,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6131576.921601344944289882", - "locked_amount": "133371.351605643915218568167086041", + "locked_amount": "126816.4572743170953606758369149299", "deposits": [ { "amount": "129284.449", @@ -58712,7 +58712,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "46573.626056485904261395134855384", + "locked_amount": "46256.340760365268783920344292228", "deposits": [ { "amount": "3000", From c2d14d1abe1e3726cbd71bf40db6d3fd8845f894 Mon Sep 17 00:00:00 2001 From: dexturr Date: Sun, 30 Apr 2023 12:10:07 +0000 Subject: [PATCH 17/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 90 +++++++++++++++----- 1 file changed, 67 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 36d9efe06..368b022cb 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "12663.4562638888886750875", + "locked_amount": "12502.8825124421295583625", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2779.7733333333329784", + "locked_amount": "2658.6052777777782564", "deposits": [ { "amount": "111", @@ -4679,7 +4679,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51938.834776538809619496", + "locked_amount": "51879.3918540340555778824", "deposits": [ { "amount": "86666.297", @@ -4745,7 +4745,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "436.034798534798425", + "locked_amount": "432.59596306471305", "deposits": [ { "amount": "2500", @@ -4866,7 +4866,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11769.0670289855075", + "locked_amount": "11745.25683121980525", "deposits": [ { "amount": "12500", @@ -5133,7 +5133,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "19214.77900552486125", + "locked_amount": "19162.9114871086575", "deposits": [ { "amount": "7500", @@ -5541,7 +5541,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51891.4471250000004333315", + "locked_amount": "51832.05843668263554906", "deposits": [ { "amount": "129999.45", @@ -5574,7 +5574,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49816.6368481320566111821", + "locked_amount": "49779.60135129851202381693", "deposits": [ { "amount": "54144.7663", @@ -5607,7 +5607,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21565.842922374429784", + "locked_amount": "21522.906659056313896", "deposits": [ { "amount": "10000", @@ -5800,7 +5800,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1914.2922374429222", + "locked_amount": "1910.86282343987835", "deposits": [ { "amount": "5000", @@ -6341,7 +6341,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7438.558452225", - "locked_amount": "92.403314917126605", + "locked_amount": "61.28280386740403325", "deposits": [ { "amount": "7500", @@ -6858,7 +6858,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "174026.6344907761479044366", + "locked_amount": "172696.070980521313704544", "deposits": [ { "amount": "1852091.69", @@ -9878,10 +9878,15 @@ "tranche_id": 10, "tranche_start": "2021-07-15T23:37:11.000Z", "tranche_end": "2021-07-15T23:37:11.000Z", - "total_added": "6459302.299000000000000001", - "total_removed": "6413483.280000000000000001", + "total_added": "6559302.299000000000000001", + "total_removed": "6513483.280000000000000001", "locked_amount": "0", "deposits": [ + { + "amount": "100000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tx": "0xfe7ab31de818986a1984617dea435e8bb02fba8fca50c1e173b5808fc8c2a81e" + }, { "amount": "100000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -10419,6 +10424,11 @@ } ], "withdrawals": [ + { + "amount": "100000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tx": "0xfe7ab31de818986a1984617dea435e8bb02fba8fca50c1e173b5808fc8c2a81e" + }, { "amount": "100000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -10899,6 +10909,12 @@ { "address": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", "deposits": [ + { + "amount": "100000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tranche_id": 10, + "tx": "0xfe7ab31de818986a1984617dea435e8bb02fba8fca50c1e173b5808fc8c2a81e" + }, { "amount": "100000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -11099,6 +11115,12 @@ } ], "withdrawals": [ + { + "amount": "100000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tranche_id": 10, + "tx": "0xfe7ab31de818986a1984617dea435e8bb02fba8fca50c1e173b5808fc8c2a81e" + }, { "amount": "100000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -11292,8 +11314,8 @@ "tx": "0xac16a4ce688d40a482a59914d68c3a676592f8804ee8f0781b66a4ba5ccfbdfc" } ], - "total_tokens": "3256651", - "withdrawn_tokens": "3256651", + "total_tokens": "3356651", + "withdrawn_tokens": "3356651", "remaining_tokens": "0" }, { @@ -40708,7 +40730,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "291919.672302795683811116452", + "locked_amount": "289875.059440545824432572658", "deposits": [ { "amount": "1998.95815", @@ -42101,7 +42123,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "865763.00168014330259852", - "locked_amount": "6334816.00059217409981700945073666566666667", + "locked_amount": "6327565.9346593284355784017845365886699108", "deposits": [ { "amount": "16249.93", @@ -48667,8 +48689,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "6131576.921601344944289882", - "locked_amount": "126816.4572743170953606758369149299", + "total_removed": "6166621.501523709799506182", + "locked_amount": "120123.2426972220286725778670055684", "deposits": [ { "amount": "129284.449", @@ -48907,6 +48929,16 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x59bc5ab04aa250d84bd2ffe62dba38ed926c26f8ac2497e9414f3a7df2b3a661" }, + { + "amount": "35040.39233886007943262", + "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", + "tx": "0x956f4f6e867e23aa7a3f0fb29612074de4edaf259eb1597f61b5289add0bedb2" + }, + { + "amount": "4.18758350477578368", + "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", + "tx": "0xa83729135615d88392e9ec5164e60ae9fe049b0127c7829c44dc94ee1b28d73e" + }, { "amount": "1360.32447632896938825", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -55290,6 +55322,18 @@ } ], "withdrawals": [ + { + "amount": "35040.39233886007943262", + "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", + "tranche_id": 3, + "tx": "0x956f4f6e867e23aa7a3f0fb29612074de4edaf259eb1597f61b5289add0bedb2" + }, + { + "amount": "4.18758350477578368", + "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", + "tranche_id": 3, + "tx": "0xa83729135615d88392e9ec5164e60ae9fe049b0127c7829c44dc94ee1b28d73e" + }, { "amount": "5074.06012653876566886", "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", @@ -55682,8 +55726,8 @@ } ], "total_tokens": "1266324.603486", - "withdrawn_tokens": "1220819.41847917671599364", - "remaining_tokens": "45505.18500682328400636" + "withdrawn_tokens": "1255863.99840154157120994", + "remaining_tokens": "10460.60508445842879006" }, { "address": "0xC5d9221EB9c28A69859264c0A2Fe0d3272228296", @@ -58712,7 +58756,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "46256.340760365268783920344292228", + "locked_amount": "45932.36016483632516836786453578", "deposits": [ { "amount": "3000", From a01df081ebf963344ed9432b6b3c913bfe0d46aa Mon Sep 17 00:00:00 2001 From: dexturr Date: Sun, 30 Apr 2023 18:07:29 +0000 Subject: [PATCH 18/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 52 ++++++++++++-------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 368b022cb..3bd00865b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "12502.8825124421295583625", + "locked_amount": "12343.7044089506148371125", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2658.6052777777782564", + "locked_amount": "2538.4903703703706536", "deposits": [ { "amount": "111", @@ -4679,7 +4679,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51879.3918540340555778824", + "locked_amount": "51820.4655875362822194898", "deposits": [ { "amount": "86666.297", @@ -4745,7 +4745,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "432.59596306471305", + "locked_amount": "429.1870166870168", "deposits": [ { "amount": "2500", @@ -4866,7 +4866,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11745.25683121980525", + "locked_amount": "11721.6535829307565", "deposits": [ { "amount": "12500", @@ -5133,7 +5133,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "19162.9114871086575", + "locked_amount": "19111.49478207489375", "deposits": [ { "amount": "7500", @@ -5541,7 +5541,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51832.05843668263554906", + "locked_amount": "51773.185932988644703383", "deposits": [ { "amount": "129999.45", @@ -5574,7 +5574,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49779.60135129851202381693", + "locked_amount": "49742.88775337411449034392", "deposits": [ { "amount": "54144.7663", @@ -5607,7 +5607,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21522.906659056313896", + "locked_amount": "21480.34358193810106", "deposits": [ { "amount": "10000", @@ -5800,7 +5800,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1910.86282343987835", + "locked_amount": "1907.4632166412985", "deposits": [ { "amount": "5000", @@ -6341,7 +6341,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7438.558452225", - "locked_amount": "61.28280386740403325", + "locked_amount": "30.432780847146069", "deposits": [ { "amount": "7500", @@ -6858,7 +6858,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "172696.070980521313704544", + "locked_amount": "171377.0722386403669530048", "deposits": [ { "amount": "1852091.69", @@ -40730,7 +40730,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "289875.059440545824432572658", + "locked_amount": "287848.217600861725551922997", "deposits": [ { "amount": "1998.95815", @@ -42123,7 +42123,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "865763.00168014330259852", - "locked_amount": "6327565.9346593284355784017845365886699108", + "locked_amount": "6320378.88363149269795995938072607934090294", "deposits": [ { "amount": "16249.93", @@ -48690,7 +48690,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6166621.501523709799506182", - "locked_amount": "120123.2426972220286725778670055684", + "locked_amount": "113488.2030780776403609082479683589", "deposits": [ { "amount": "129284.449", @@ -58756,7 +58756,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "45932.36016483632516836786453578", + "locked_amount": "45611.195489416506813315608422116", "deposits": [ { "amount": "3000", @@ -88511,7 +88511,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "69890.5995794947989", + "total_removed": "70140.5995794947989", "locked_amount": "0", "deposits": [ { @@ -92736,6 +92736,11 @@ } ], "withdrawals": [ + { + "amount": "250", + "user": "0x0E3407C9A94effa675471afe7A9D37e687C32141", + "tx": "0x6086c36011fd863c6a34f1a7cd45a798bb1bf6bde6f0e4106c51071c46dbef79" + }, { "amount": "250", "user": "0x99492aF57325BA3971542B9ea4036186BE50fa07", @@ -96010,10 +96015,17 @@ "tx": "0xee02e72ef8e0755982704385da512cc12c8ff0ea7b58056fa3d5a5932394e9ca" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x0E3407C9A94effa675471afe7A9D37e687C32141", + "tranche_id": 6, + "tx": "0x6086c36011fd863c6a34f1a7cd45a798bb1bf6bde6f0e4106c51071c46dbef79" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x953680303b33898962AB7FadCD485374CeDFf87e", From 752af9a983aa106a3c1dfc746e0f0bb0a6c995a5 Mon Sep 17 00:00:00 2001 From: dexturr Date: Mon, 1 May 2023 00:17:06 +0000 Subject: [PATCH 19/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 3bd00865b..8a99a221d 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "12343.7044089506148371125", + "locked_amount": "12179.0699158468357308375", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2538.4903703703706536", + "locked_amount": "2414.258101851851574", "deposits": [ { "amount": "111", @@ -4679,7 +4679,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51820.4655875362822194898", + "locked_amount": "51759.5194159048405587618", "deposits": [ { "amount": "86666.297", @@ -4745,7 +4745,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "429.1870166870168", + "locked_amount": "425.6612166768417", "deposits": [ { "amount": "2500", @@ -4778,7 +4778,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "15000.000000000000015", + "locked_amount": "14999.032872886473014999032872886473", "deposits": [ { "amount": "1.5e-14", @@ -4866,7 +4866,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11721.6535829307565", + "locked_amount": "11697.2412502516095", "deposits": [ { "amount": "12500", @@ -5133,7 +5133,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "19111.49478207489375", + "locked_amount": "19058.31558855126", "deposits": [ { "amount": "7500", @@ -5541,7 +5541,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51773.185932988644703383", + "locked_amount": "51712.295367070278144645", "deposits": [ { "amount": "129999.45", @@ -5574,7 +5574,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49742.88775337411449034392", + "locked_amount": "49704.91566769323042633714", "deposits": [ { "amount": "54144.7663", @@ -5607,7 +5607,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21480.34358193810106", + "locked_amount": "21436.321505580920538", "deposits": [ { "amount": "10000", @@ -5800,7 +5800,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1907.4632166412985", + "locked_amount": "1903.9470763571792", "deposits": [ { "amount": "5000", @@ -6341,7 +6341,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "7438.558452225", - "locked_amount": "30.432780847146069", + "locked_amount": "0", "deposits": [ { "amount": "7500", @@ -6858,7 +6858,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "171377.0722386403669530048", + "locked_amount": "170012.8601735952560871686", "deposits": [ { "amount": "1852091.69", @@ -40730,7 +40730,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "287848.217600861725551922997", + "locked_amount": "285751.898625081575755597529", "deposits": [ { "amount": "1998.95815", @@ -42123,7 +42123,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "865763.00168014330259852", - "locked_amount": "6320378.88363149269795995938072607934090294", + "locked_amount": "6312945.4711399195795315850936947403906461", "deposits": [ { "amount": "16249.93", @@ -48690,7 +48690,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6166621.501523709799506182", - "locked_amount": "113488.2030780776403609082479683589", + "locked_amount": "106625.72412864529925809241583413625", "deposits": [ { "amount": "129284.449", @@ -58756,7 +58756,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "43997.0543192803416", - "locked_amount": "45611.195489416506813315608422116", + "locked_amount": "45279.021764634016067283031151712", "deposits": [ { "amount": "3000", From 2ae56bb113ae819ec423a445647a1ad36c79f82a Mon Sep 17 00:00:00 2001 From: dexturr Date: Mon, 1 May 2023 06:07:17 +0000 Subject: [PATCH 20/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 49 ++++++++++++-------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 8a99a221d..5f6214c52 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "537.22112238579", - "locked_amount": "12179.0699158468357308375", + "locked_amount": "12023.0914095293211777", "deposits": [ { "amount": "188", @@ -833,7 +833,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2414.258101851851574", + "locked_amount": "2296.5575925925925424", "deposits": [ { "amount": "111", @@ -4679,7 +4679,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51759.5194159048405587618", + "locked_amount": "51701.7776107847449795748", "deposits": [ { "amount": "86666.297", @@ -4745,7 +4745,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "425.6612166768417", + "locked_amount": "422.3207926332925", "deposits": [ { "amount": "2500", @@ -4778,7 +4778,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14999.032872886473014999032872886473", + "locked_amount": "14979.208182367149014979208182367149", "deposits": [ { "amount": "1.5e-14", @@ -4866,7 +4866,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11697.2412502516095", + "locked_amount": "11674.11244464573325", "deposits": [ { "amount": "12500", @@ -5133,7 +5133,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "19058.31558855126", + "locked_amount": "19007.93239717618125", "deposits": [ { "amount": "7500", @@ -5541,7 +5541,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51712.295367070278144645", + "locked_amount": "51654.60624408201623898", "deposits": [ { "amount": "129999.45", @@ -5574,7 +5574,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49704.91566769323042633714", + "locked_amount": "49668.94004014031498546888", "deposits": [ { "amount": "54144.7663", @@ -5607,7 +5607,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21436.321505580920538", + "locked_amount": "21394.61397767630658", "deposits": [ { "amount": "10000", @@ -5800,7 +5800,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1903.9470763571792", + "locked_amount": "1900.615804160325", "deposits": [ { "amount": "5000", @@ -6858,7 +6858,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "170012.8601735952560871686", + "locked_amount": "168720.3742783587548274456", "deposits": [ { "amount": "1852091.69", @@ -40730,7 +40730,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "285751.898625081575755597529", + "locked_amount": "283765.797799897258197157351", "deposits": [ { "amount": "1998.95815", @@ -42123,7 +42123,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "865763.00168014330259852", - "locked_amount": "6312945.4711399195795315850936947403906461", + "locked_amount": "6305902.8851336775858781817531478860286564", "deposits": [ { "amount": "16249.93", @@ -48690,7 +48690,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6166621.501523709799506182", - "locked_amount": "106625.72412864529925809241583413625", + "locked_amount": "100124.0536950182345240666515099086", "deposits": [ { "amount": "129284.449", @@ -58755,8 +58755,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "43997.0543192803416", - "locked_amount": "45279.021764634016067283031151712", + "total_removed": "44078.8527972103416", + "locked_amount": "44964.312735847246072107806900052", "deposits": [ { "amount": "3000", @@ -65405,6 +65405,11 @@ "user": "0xe7770271d882C54C46B9f00137e96a3BbfFD4d94", "tx": "0x3c7d0394e431000fa5c733213116dc39b0f87a9a32a40e75cec3c2fce7795b0b" }, + { + "amount": "81.79847793", + "user": "0x4d4AA3f302cbA998AAFC03F9d73484434ed9Fd53", + "tx": "0x1e4902d0a3cb7b4f2ba7119dfcaa681a784e1d724c984961767e9feaa078fe54" + }, { "amount": "168.502276762", "user": "0x38A292CB98Dc602ECAFF94E8E5fADD9800e4bA13", @@ -87549,6 +87554,12 @@ } ], "withdrawals": [ + { + "amount": "81.79847793", + "user": "0x4d4AA3f302cbA998AAFC03F9d73484434ed9Fd53", + "tranche_id": 5, + "tx": "0x1e4902d0a3cb7b4f2ba7119dfcaa681a784e1d724c984961767e9feaa078fe54" + }, { "amount": "32.02214612", "user": "0x4d4AA3f302cbA998AAFC03F9d73484434ed9Fd53", @@ -87575,8 +87586,8 @@ } ], "total_tokens": "200", - "withdrawn_tokens": "99.05242897", - "remaining_tokens": "100.94757103" + "withdrawn_tokens": "180.8509069", + "remaining_tokens": "19.1490931" }, { "address": "0xd9390b46a1749DEe5325A490490491db9a826D1F", From b88da51c6877364dc869a6b49c39e96c36e38d8c Mon Sep 17 00:00:00 2001 From: dexturr Date: Mon, 1 May 2023 12:08:18 +0000 Subject: [PATCH 21/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 86 ++++++++++++++------ 1 file changed, 60 insertions(+), 26 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 5f6214c52..822a64bd5 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -37,8 +37,8 @@ "tranche_start": "2023-04-20T00:00:00.000Z", "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", - "total_removed": "537.22112238579", - "locked_amount": "12023.0914095293211777", + "total_removed": "959.3245960538025", + "locked_amount": "11862.280100983795583625", "deposits": [ { "amount": "188", @@ -231,6 +231,11 @@ "amount": "42.592326391125", "user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756", "tx": "0x5f544a659ae728cc7b1a29dcda14740425cadf1f47aa74bae92bf2ade3c8093d" + }, + { + "amount": "422.1034736680125", + "user": "0xf915Da10e5136352Ba049acB0545Deb119054256", + "tx": "0x5932f574afe019060f5812fc89c7298ab9f768cddebe0a803c27e9914b45dc3d" } ], "users": [ @@ -666,10 +671,17 @@ "tx": "0x6840e2b579765303fc31a04f43fcea1d5ccf157b46bbd1e3f3e7f6a2e6cea039" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "422.1034736680125", + "user": "0xf915Da10e5136352Ba049acB0545Deb119054256", + "tranche_id": 56, + "tx": "0x5932f574afe019060f5812fc89c7298ab9f768cddebe0a803c27e9914b45dc3d" + } + ], "total_tokens": "1121.25", - "withdrawn_tokens": "0", - "remaining_tokens": "1121.25" + "withdrawn_tokens": "422.1034736680125", + "remaining_tokens": "699.1465263319875" }, { "address": "0x237D23FcA6d7B2530C7614a9cB921CF27924911E", @@ -833,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2296.5575925925925424", + "locked_amount": "2175.2102777777776272", "deposits": [ { "amount": "111", @@ -4679,7 +4691,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51701.7776107847449795748", + "locked_amount": "51642.2467468320019705714", "deposits": [ { "amount": "86666.297", @@ -4745,7 +4757,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "422.3207926332925", + "locked_amount": "418.87686965811965", "deposits": [ { "amount": "2500", @@ -4778,7 +4790,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14979.208182367149014979208182367149", + "locked_amount": "14958.769248188406014958769248188406", "deposits": [ { "amount": "1.5e-14", @@ -4866,7 +4878,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11674.11244464573325", + "locked_amount": "11650.267021437198", "deposits": [ { "amount": "12500", @@ -5133,7 +5145,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "19007.93239717618125", + "locked_amount": "18955.98814456722", "deposits": [ { "amount": "7500", @@ -5541,7 +5553,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51654.60624408201623898", + "locked_amount": "51595.1296945521630417525", "deposits": [ { "amount": "129999.45", @@ -5574,7 +5586,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49668.94004014031498546888", + "locked_amount": "49631.84975200308971004133", "deposits": [ { "amount": "54144.7663", @@ -5607,7 +5619,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21394.61397767630658", + "locked_amount": "21351.614193302888218", "deposits": [ { "amount": "10000", @@ -5800,7 +5812,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1900.615804160325", + "locked_amount": "1897.1813165905632", "deposits": [ { "amount": "5000", @@ -6858,7 +6870,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "168720.3742783587548274456", + "locked_amount": "167387.8422968911644940364", "deposits": [ { "amount": "1852091.69", @@ -40730,7 +40742,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "283765.797799897258197157351", + "locked_amount": "281718.160082742394755587753", "deposits": [ { "amount": "1998.95815", @@ -42122,8 +42134,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "865763.00168014330259852", - "locked_amount": "6305902.8851336775858781817531478860286564", + "total_removed": "866687.25765937723884852", + "locked_amount": "6298642.09325955374430918146676915717356045", "deposits": [ { "amount": "16249.93", @@ -42667,6 +42679,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x45de80ad7201a69e9ac4f1f964218840867adaf64a7fc6020b51baa5de37816e" }, + { + "amount": "924.25597923393625", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x2e3b57da0245aea9164e96cd7421d82a3f34df2ab34bc9a64b91e629fb5cb31c" + }, { "amount": "981.387731774910625", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -44805,6 +44822,12 @@ "tranche_id": 2, "tx": "0x45de80ad7201a69e9ac4f1f964218840867adaf64a7fc6020b51baa5de37816e" }, + { + "amount": "924.25597923393625", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x2e3b57da0245aea9164e96cd7421d82a3f34df2ab34bc9a64b91e629fb5cb31c" + }, { "amount": "981.387731774910625", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -46313,8 +46336,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "155864.8334635031475", - "remaining_tokens": "104134.0540364968525" + "withdrawn_tokens": "156789.08944273708375", + "remaining_tokens": "103209.79805726291625" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -48689,8 +48712,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "6166621.501523709799506182", - "locked_amount": "100124.0536950182345240666515099086", + "total_removed": "6167911.210808830654624182", + "locked_amount": "93420.936997419715583180200347021", "deposits": [ { "amount": "129284.449", @@ -48939,6 +48962,11 @@ "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", "tx": "0xa83729135615d88392e9ec5164e60ae9fe049b0127c7829c44dc94ee1b28d73e" }, + { + "amount": "1289.709285120855118", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x2c531bd9c61e0a3705f161bba2c03703722f1e41533725684fcccb9176117e0e" + }, { "amount": "1360.32447632896938825", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -52269,6 +52297,12 @@ "tranche_id": 3, "tx": "0x59bc5ab04aa250d84bd2ffe62dba38ed926c26f8ac2497e9414f3a7df2b3a661" }, + { + "amount": "1289.709285120855118", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x2c531bd9c61e0a3705f161bba2c03703722f1e41533725684fcccb9176117e0e" + }, { "amount": "1360.32447632896938825", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -55091,8 +55125,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "355516.7887561670281135", - "remaining_tokens": "3606.6808188329718865" + "withdrawn_tokens": "356806.4980412878832315", + "remaining_tokens": "2316.9715337121167685" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -58756,7 +58790,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "44964.312735847246072107806900052", + "locked_amount": "44639.852834767825412159812480992", "deposits": [ { "amount": "3000", From 50378bc8d21729a869b27646b466573d77273cc2 Mon Sep 17 00:00:00 2001 From: dexturr Date: Mon, 1 May 2023 18:07:37 +0000 Subject: [PATCH 22/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 822a64bd5..5a97f625b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "11862.280100983795583625", + "locked_amount": "11702.240853009259116725", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2175.2102777777776272", + "locked_amount": "2054.44555555555569", "deposits": [ { "amount": "111", @@ -4691,7 +4691,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51642.2467468320019705714", + "locked_amount": "51583.0016925852274388997", "deposits": [ { "amount": "86666.297", @@ -4757,7 +4757,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "418.87686965811965", + "locked_amount": "415.44948107448105", "deposits": [ { "amount": "2500", @@ -4790,7 +4790,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14958.769248188406014958769248188406", + "locked_amount": "14938.428442028985014938428442028985", "deposits": [ { "amount": "1.5e-14", @@ -4878,7 +4878,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11650.267021437198", + "locked_amount": "11626.5360809178735", "deposits": [ { "amount": "12500", @@ -5145,7 +5145,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18955.98814456722", + "locked_amount": "18904.293278084715", "deposits": [ { "amount": "7500", @@ -5553,7 +5553,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51595.1296945521630417525", + "locked_amount": "51535.93869396290206161", "deposits": [ { "amount": "129999.45", @@ -5586,7 +5586,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49631.84975200308971004133", + "locked_amount": "49594.93753560284020700809", "deposits": [ { "amount": "54144.7663", @@ -5619,7 +5619,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21351.614193302888218", + "locked_amount": "21308.820852359209", "deposits": [ { "amount": "10000", @@ -5812,7 +5812,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1897.1813165905632", + "locked_amount": "1893.7633181126335", "deposits": [ { "amount": "5000", @@ -6870,7 +6870,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "167387.8422968911644940364", + "locked_amount": "166061.7078468645999604916", "deposits": [ { "amount": "1852091.69", @@ -40742,7 +40742,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "281718.160082742394755587753", + "locked_amount": "279680.353144028160016212611", "deposits": [ { "amount": "1998.95815", @@ -42135,7 +42135,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "866687.25765937723884852", - "locked_amount": "6298642.09325955374430918146676915717356045", + "locked_amount": "6291416.1606945846138680658148110348580698", "deposits": [ { "amount": "16249.93", @@ -48713,7 +48713,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6167911.210808830654624182", - "locked_amount": "93420.936997419715583180200347021", + "locked_amount": "86750.0021914553910321426184452321", "deposits": [ { "amount": "129284.449", @@ -58790,7 +58790,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "44639.852834767825412159812480992", + "locked_amount": "44316.950676727513010060690715372", "deposits": [ { "amount": "3000", From 77264e80f10e4357a6c4534b661058891efdc433 Mon Sep 17 00:00:00 2001 From: dexturr Date: Tue, 2 May 2023 00:15:50 +0000 Subject: [PATCH 23/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 5a97f625b..5015a4d3c 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "11702.240853009259116725", + "locked_amount": "11538.2447946084125130625", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "731.78640740205", - "locked_amount": "2054.44555555555569", + "locked_amount": "1930.695046296295884", "deposits": [ { "amount": "111", @@ -4691,7 +4691,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51583.0016925852274388997", + "locked_amount": "51522.2918635952832112496", "deposits": [ { "amount": "86666.297", @@ -4757,7 +4757,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "415.44948107448105", + "locked_amount": "411.93735373422885", "deposits": [ { "amount": "2500", @@ -4790,7 +4790,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14938.428442028985014938428442028985", + "locked_amount": "14917.584729770532014917584729770532", "deposits": [ { "amount": "1.5e-14", @@ -4878,7 +4878,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11626.5360809178735", + "locked_amount": "11602.218416616345", "deposits": [ { "amount": "12500", @@ -5145,7 +5145,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18904.293278084715", + "locked_amount": "18851.32030770411375", "deposits": [ { "amount": "7500", @@ -5553,7 +5553,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51535.93869396290206161", + "locked_amount": "51475.284255053094593955", "deposits": [ { "amount": "129999.45", @@ -5586,7 +5586,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49594.93753560284020700809", + "locked_amount": "49557.11270155060679069348", "deposits": [ { "amount": "54144.7663", @@ -5619,7 +5619,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21308.820852359209", + "locked_amount": "21264.969488838154542", "deposits": [ { "amount": "10000", @@ -5812,7 +5812,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1893.7633181126335", + "locked_amount": "1890.26081303906635", "deposits": [ { "amount": "5000", @@ -6870,7 +6870,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "166061.7078468645999604916", + "locked_amount": "164702.786048203238935632", "deposits": [ { "amount": "1852091.69", @@ -40742,7 +40742,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "279680.353144028160016212611", + "locked_amount": "277592.163465805068675451475", "deposits": [ { "amount": "1998.95815", @@ -42135,7 +42135,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "866687.25765937723884852", - "locked_amount": "6291416.1606945846138680658148110348580698", + "locked_amount": "6284011.5741701962002625538077348302771019", "deposits": [ { "amount": "16249.93", @@ -48713,7 +48713,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6167911.210808830654624182", - "locked_amount": "86750.0021914553910321426184452321", + "locked_amount": "79914.1351908721209680011024711317", "deposits": [ { "amount": "129284.449", @@ -58790,7 +58790,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "44316.950676727513010060690715372", + "locked_amount": "43986.065085611978622958896600696", "deposits": [ { "amount": "3000", From 9acc083c11154f6326caa60dfa44c1a1ae11e5c5 Mon Sep 17 00:00:00 2001 From: dexturr Date: Tue, 2 May 2023 06:09:38 +0000 Subject: [PATCH 24/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 52 ++++++++++++-------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 5015a4d3c..0b989009f 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "11538.2447946084125130625", + "locked_amount": "11380.640506896220893725", "deposits": [ { "amount": "188", @@ -844,8 +844,8 @@ "tranche_start": "2023-04-06T00:00:00.000Z", "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", - "total_removed": "731.78640740205", - "locked_amount": "1930.695046296295884", + "total_removed": "5079.76864115505", + "locked_amount": "1811.7677314814820336", "deposits": [ { "amount": "111", @@ -1009,6 +1009,11 @@ "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", "tx": "0x29905e6ae54245e824fe9ea488f491b1a3c33f6d8b9345cf2b6b00aec305c5bf" }, + { + "amount": "4347.982233753", + "user": "0x83D7eD53E7CB97b542F1F71f40561d51F8019C8B", + "tx": "0x23b713ac5ee16f744549b0c4d8b49943117d0964ca2b635d9629931ae2f4a961" + }, { "amount": "5.46866782407", "user": "0x92A1e98C6f09970e45645Cbe57c6DcaF4547c8FE", @@ -1066,10 +1071,17 @@ "tx": "0xf0d2927bb8d9363ddefaad3783f9a0abf8e468316c4baea24766991f6cb8cdac" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "4347.982233753", + "user": "0x83D7eD53E7CB97b542F1F71f40561d51F8019C8B", + "tranche_id": 54, + "tx": "0x23b713ac5ee16f744549b0c4d8b49943117d0964ca2b635d9629931ae2f4a961" + } + ], "total_tokens": "5010", - "withdrawn_tokens": "0", - "remaining_tokens": "5010" + "withdrawn_tokens": "4347.982233753", + "remaining_tokens": "662.017766247" }, { "address": "0x2586bA83696a92b5467Aaa0CF9EEC052F28F2c02", @@ -4691,7 +4703,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51522.2918635952832112496", + "locked_amount": "51463.9482091904865949352", "deposits": [ { "amount": "86666.297", @@ -4757,7 +4769,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "411.93735373422885", + "locked_amount": "408.562112077737175", "deposits": [ { "amount": "2500", @@ -4790,7 +4802,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14917.584729770532014917584729770532", + "locked_amount": "14897.55340428744001489755340428744", "deposits": [ { "amount": "1.5e-14", @@ -4878,7 +4890,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11602.218416616345", + "locked_amount": "11578.848536886071", "deposits": [ { "amount": "12500", @@ -5145,7 +5157,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18851.32030770411375", + "locked_amount": "18800.41196669736", "deposits": [ { "amount": "7500", @@ -5553,7 +5565,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51475.284255053094593955", + "locked_amount": "51416.99383189185572154", "deposits": [ { "amount": "129999.45", @@ -5586,7 +5598,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49557.11270155060679069348", + "locked_amount": "49520.76209601310870544447", "deposits": [ { "amount": "54144.7663", @@ -5619,7 +5631,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21264.969488838154542", + "locked_amount": "21222.827238711314258", "deposits": [ { "amount": "10000", @@ -5812,7 +5824,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1890.26081303906635", + "locked_amount": "1886.89481861998965", "deposits": [ { "amount": "5000", @@ -6870,7 +6882,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "164702.786048203238935632", + "locked_amount": "163396.8284281057515824046", "deposits": [ { "amount": "1852091.69", @@ -40742,7 +40754,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "277592.163465805068675451475", + "locked_amount": "275585.361289865707282073326", "deposits": [ { "amount": "1998.95815", @@ -42135,7 +42147,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "866687.25765937723884852", - "locked_amount": "6284011.5741701962002625538077348302771019", + "locked_amount": "6276895.5825033304505713155238378505095972", "deposits": [ { "amount": "16249.93", @@ -48713,7 +48725,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6167911.210808830654624182", - "locked_amount": "79914.1351908721209680011024711317", + "locked_amount": "73344.69712005803295291791238272985", "deposits": [ { "amount": "129284.449", @@ -58790,7 +58802,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "43986.065085611978622958896600696", + "locked_amount": "43668.075809464076001027650126832", "deposits": [ { "amount": "3000", From 00c5252aeafb5ddbfa99115e370f9bba2674ea8f Mon Sep 17 00:00:00 2001 From: daro-maj <119658839+daro-maj@users.noreply.github.com> Date: Tue, 2 May 2023 11:30:08 +0200 Subject: [PATCH 25/42] test(trading): ac for 6501-ASSE-assets - e2e tests (#3570) --- .../src/integration/trading-accounts.cy.ts | 50 +++++++++++++++---- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/apps/trading-e2e/src/integration/trading-accounts.cy.ts b/apps/trading-e2e/src/integration/trading-accounts.cy.ts index 8b337fa8c..eafbb1b95 100644 --- a/apps/trading-e2e/src/integration/trading-accounts.cy.ts +++ b/apps/trading-e2e/src/integration/trading-accounts.cy.ts @@ -1,5 +1,7 @@ import { checkSorting } from '@vegaprotocol/cypress'; +const dialogClose = 'dialog-close'; + describe('accounts', { tags: '@smoke' }, () => { beforeEach(() => { cy.mockTradingPage(); @@ -66,16 +68,44 @@ describe('accounts', { tags: '@smoke' }, () => { it('should open asset details dialog when clicked on symbol', () => { // 7001-COLL-008 + // 6501-ASSE-001 + // 6501-ASSE-002 + // 6501-ASSE-003 + // 6501-ASSE-004 + // 6501-ASSE-005 + // 6501-ASSE-006 + // 6501-ASSE-007 + // 6501-ASSE-008 + // 6501-ASSE-009 + // 6501-ASSE-010 + // 6501-ASSE-011 + // 6501-ASSE-012 + // 6501-ASSE-013 + const titles = [ + 'ID', + 'Type', + 'Name', + 'Symbol', + 'Decimals', + 'Quantum', + 'Status', + 'Contract address', + 'Withdrawal threshold', + 'Lifetime limit', + 'Infrastructure fee account balance', + 'Global reward pool account balance', + 'Maker paid fees account balance', + 'Maker received fees account balance', + 'Liquidity provision fee reward account balance', + 'Market proposer reward account balance', + ]; cy.getByTestId('asset').contains('tEURO').click(); cy.get('[data-testid$="_label"]').should('have.length', 16); - cy.get('[data-testid="dialog-close"]').click(); - }); - - it('should open asset details dialog when clicked on symbol', () => { - // 7001-COLL-008 - cy.getByTestId('asset').contains('tEURO').click(); - cy.get('[data-testid$="_label"]').should('have.length', 16); - cy.get('[data-testid="dialog-close"]').click(); + cy.get('[data-testid$="_label"]').each((element, index) => { + cy.wrap(element).should('have.text', titles[index]); + }); + cy.getByTestId(dialogClose).click(); + cy.getByTestId(dialogClose).should('not.exist'); }); it('should open usage breakdown dialog when clicked on used', () => { @@ -89,7 +119,7 @@ describe('accounts', { tags: '@smoke' }, () => { cy.wrap($header).should('have.text', headers[i]); }); }); - cy.get('[data-testid="dialog-close"]').click(); + cy.getByTestId(dialogClose).click(); }); it('sorting usage breakdown columns should work well', () => { @@ -108,7 +138,7 @@ describe('accounts', { tags: '@smoke' }, () => { .eq(3) .should('have.text', 'General'); - cy.get('[data-testid="dialog-close"]').click(); + cy.getByTestId(dialogClose).click(); }); describe('sorting by ag-grid columns should work well', () => { From de48ffa56337f598558c5603414898209424a669 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Tue, 2 May 2023 11:10:03 +0100 Subject: [PATCH 26/42] feat(governance): update market proposal only available for enacted markets (#3542) --- .../update-market/UpdateMarket.graphql | 3 + .../__generated__/UpdateMarket.ts | 5 +- .../__generated___/UpdateMarket.ts | 94 --------------- .../propose-update-market.spec.tsx | 112 ++++++++++++++++-- .../update-market/propose-update-market.tsx | 16 ++- 5 files changed, 122 insertions(+), 108 deletions(-) delete mode 100644 apps/governance/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts diff --git a/apps/governance/src/routes/proposals/propose/update-market/UpdateMarket.graphql b/apps/governance/src/routes/proposals/propose/update-market/UpdateMarket.graphql index a338ec489..4c24091ca 100644 --- a/apps/governance/src/routes/proposals/propose/update-market/UpdateMarket.graphql +++ b/apps/governance/src/routes/proposals/propose/update-market/UpdateMarket.graphql @@ -9,6 +9,9 @@ query ProposalMarketsQuery { code } } + proposal { + state + } } } } diff --git a/apps/governance/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts b/apps/governance/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts index e9e984537..ce50d970a 100644 --- a/apps/governance/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts +++ b/apps/governance/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts @@ -6,7 +6,7 @@ const defaultOptions = {} as const; export type ProposalMarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type ProposalMarketsQueryQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string } } } }> } | null }; +export type ProposalMarketsQueryQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string } }, proposal?: { __typename?: 'Proposal', state: Types.ProposalState } | null } }> } | null }; export const ProposalMarketsQueryDocument = gql` @@ -21,6 +21,9 @@ export const ProposalMarketsQueryDocument = gql` code } } + proposal { + state + } } } } diff --git a/apps/governance/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts b/apps/governance/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts deleted file mode 100644 index 1454716f4..000000000 --- a/apps/governance/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts +++ /dev/null @@ -1,94 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalMarketsQueryQueryVariables = Types.Exact<{ - [key: string]: never; -}>; - -export type ProposalMarketsQueryQuery = { - __typename?: 'Query'; - marketsConnection?: { - __typename?: 'MarketConnection'; - edges: Array<{ - __typename?: 'MarketEdge'; - node: { - __typename?: 'Market'; - id: string; - tradableInstrument: { - __typename?: 'TradableInstrument'; - instrument: { __typename?: 'Instrument'; name: string; code: string }; - }; - }; - }>; - } | null; -}; - -export const ProposalMarketsQueryDocument = gql` - query ProposalMarketsQuery { - marketsConnection { - edges { - node { - id - tradableInstrument { - instrument { - name - code - } - } - } - } - } - } -`; - -/** - * __useProposalMarketsQueryQuery__ - * - * To run a query within a React component, call `useProposalMarketsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalMarketsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useProposalMarketsQueryQuery({ - * variables: { - * }, - * }); - */ -export function useProposalMarketsQueryQuery( - baseOptions?: Apollo.QueryHookOptions< - ProposalMarketsQueryQuery, - ProposalMarketsQueryQueryVariables - > -) { - const options = { ...defaultOptions, ...baseOptions }; - return Apollo.useQuery< - ProposalMarketsQueryQuery, - ProposalMarketsQueryQueryVariables - >(ProposalMarketsQueryDocument, options); -} -export function useProposalMarketsQueryLazyQuery( - baseOptions?: Apollo.LazyQueryHookOptions< - ProposalMarketsQueryQuery, - ProposalMarketsQueryQueryVariables - > -) { - const options = { ...defaultOptions, ...baseOptions }; - return Apollo.useLazyQuery< - ProposalMarketsQueryQuery, - ProposalMarketsQueryQueryVariables - >(ProposalMarketsQueryDocument, options); -} -export type ProposalMarketsQueryQueryHookResult = ReturnType< - typeof useProposalMarketsQueryQuery ->; -export type ProposalMarketsQueryLazyQueryHookResult = ReturnType< - typeof useProposalMarketsQueryLazyQuery ->; -export type ProposalMarketsQueryQueryResult = Apollo.QueryResult< - ProposalMarketsQueryQuery, - ProposalMarketsQueryQueryVariables ->; diff --git a/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx index 2b8f6776f..23506cc0f 100644 --- a/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx +++ b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx @@ -1,15 +1,16 @@ import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; import { MemoryRouter as Router } from 'react-router-dom'; -import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import { VegaWalletContext } from '@vegaprotocol/wallet'; import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider'; import { mockWalletContext } from '../../test-helpers/mocks'; import { ProposeUpdateMarket } from './propose-update-market'; import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; -import type { ProposalMarketsQueryQuery } from './__generated___/UpdateMarket'; -import { ProposalMarketsQueryDocument } from './__generated___/UpdateMarket'; +import type { ProposalMarketsQueryQuery } from './__generated__/UpdateMarket'; +import { ProposalMarketsQueryDocument } from './__generated__/UpdateMarket'; +import { ProposalState } from '@vegaprotocol/types'; const updateMarketNetworkParamsQueryMock: MockedResponse = { request: { @@ -89,6 +90,10 @@ const marketQueryMock: MockedResponse = { code: 'ETHiUSDT', }, }, + proposal: { + __typename: 'Proposal', + state: ProposalState.STATE_ENACTED, + }, }, }, { @@ -101,11 +106,16 @@ const marketQueryMock: MockedResponse = { instrument: { __typename: 'Instrument', name: 'Las Vegas nuggets', - code: 'Nuggets2', + code: 'Nuggets', }, }, + proposal: { + __typename: 'Proposal', + state: ProposalState.STATE_OPEN, + }, }, }, + { __typename: 'MarketEdge', node: { @@ -115,10 +125,14 @@ const marketQueryMock: MockedResponse = { __typename: 'TradableInstrument', instrument: { __typename: 'Instrument', - name: 'Nuggets', - code: 'Nuggets', + name: 'California Nuggets', + code: 'Nuggets2', }, }, + proposal: { + __typename: 'Proposal', + state: ProposalState.STATE_WAITING_FOR_NODE_VOTE, + }, }, }, { @@ -130,10 +144,71 @@ const marketQueryMock: MockedResponse = { __typename: 'TradableInstrument', instrument: { __typename: 'Instrument', - name: 'CELUSD (June 2022)', - code: 'CELUSD', + name: 'Nevada Nuggets', + code: 'Nugetts3', }, }, + proposal: { + __typename: 'Proposal', + state: ProposalState.STATE_REJECTED, + }, + }, + }, + { + __typename: 'MarketEdge', + node: { + __typename: 'Market', + id: 'asdfe1755208914b6f258a28babd19ae8dfbaf4084d8867d8a120c50dca1e17f', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'NZ Nuggets', + code: 'Nugetts4', + }, + }, + proposal: { + __typename: 'Proposal', + state: ProposalState.STATE_DECLINED, + }, + }, + }, + { + __typename: 'MarketEdge', + node: { + __typename: 'Market', + id: 'asdfe1755208914b6f258a28babd19ae8dfbaf4084d8867d8a120c50dca1e17f', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'Aussie Nuggets', + code: 'Nugetts5', + }, + }, + proposal: { + __typename: 'Proposal', + state: ProposalState.STATE_PASSED, + }, + }, + }, + { + __typename: 'MarketEdge', + node: { + __typename: 'Market', + id: 'xcvbe1755208914b6f258a28babd19ae8dfbaf4084d8867d8a120c50dca1e17f', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'Tasmanian Nuggets', + code: 'Nugetts6', + }, + }, + proposal: { + __typename: 'Proposal', + state: ProposalState.STATE_FAILED, + }, }, }, ], @@ -199,6 +274,27 @@ describe('Propose Update Market', () => { expect(screen.getByTestId('proposal-market-select')).toHaveValue(''); }); + it('should only render enacted markets', async () => { + renderComponent(); + expect( + await screen.findByText('Update market proposal') + ).toBeInTheDocument(); + // (state enacted) + expect(screen.getByText('ETHUSD (September Market)')).toBeInTheDocument(); + // (state open) + expect(screen.queryByText('Las Vegas nuggets')).not.toBeInTheDocument(); + // (state waiting for node vote) + expect(screen.queryByText('California nuggets')).not.toBeInTheDocument(); + // (state rejected) + expect(screen.queryByText('Nevada nuggets')).not.toBeInTheDocument(); + // (state declined) + expect(screen.queryByText('NZ nuggets')).not.toBeInTheDocument(); + // (state passed) + expect(screen.queryByText('Aussie nuggets')).not.toBeInTheDocument(); + // (state failed) + expect(screen.queryByText('Tasmanian nuggets')).not.toBeInTheDocument(); + }); + it('should render the correct market details when the market select is used', async () => { renderComponent(); expect( diff --git a/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx index 8e5d99018..08732f8fb 100644 --- a/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx +++ b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx @@ -2,25 +2,28 @@ import { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useForm } from 'react-hook-form'; import { + doesValueEquateToParam, getClosingTimestamp, getEnactmentTimestamp, useProposalSubmit, - doesValueEquateToParam, } from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; import { createDocsLinks, validateJson } from '@vegaprotocol/utils'; import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import { ProposalFormDescription, + ProposalFormDownloadJson, ProposalFormSubheader, ProposalFormSubmit, ProposalFormTerms, ProposalFormTitle, ProposalFormTransactionDialog, - ProposalFormDownloadJson, ProposalFormVoteAndEnactmentDeadline, } from '../../components/propose'; -import { ProposalMinRequirements } from '../../components/shared'; +import { + ProposalMinRequirements, + ProposalUserAction, +} from '../../components/shared'; import { AsyncRenderer, ExternalLink, @@ -31,9 +34,9 @@ import { Select, } from '@vegaprotocol/ui-toolkit'; import { Heading } from '../../../../components/heading'; -import { ProposalUserAction } from '../../components/shared'; -import { useProposalMarketsQueryQuery } from './__generated___/UpdateMarket'; +import { useProposalMarketsQueryQuery } from './__generated__/UpdateMarket'; import { downloadJson } from '../../../../lib/download-json'; +import { ProposalState } from '@vegaprotocol/types'; export interface UpdateMarketProposalFormFields { proposalVoteDeadline: string; @@ -73,6 +76,9 @@ export const ProposeUpdateMarket = () => { return marketsData.marketsConnection.edges .map((edge) => edge.node) + .filter( + (market) => market.proposal?.state === ProposalState.STATE_ENACTED + ) .sort((a, b) => { const aName = a.tradableInstrument.instrument.name; const bName = b.tradableInstrument.instrument.name; From 8a59722f0965db7d1311e6f87a89cad5bd43efca Mon Sep 17 00:00:00 2001 From: dexturr Date: Tue, 2 May 2023 12:08:21 +0000 Subject: [PATCH 27/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 0b989009f..e19da81e3 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "11380.640506896220893725", + "locked_amount": "11220.861086998456172475", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "1811.7677314814820336", + "locked_amount": "1691.19907407407385", "deposits": [ { "amount": "111", @@ -4703,7 +4703,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51463.9482091904865949352", + "locked_amount": "51404.799340902463537955", "deposits": [ { "amount": "86666.297", @@ -4769,7 +4769,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "408.562112077737175", + "locked_amount": "405.14028795278795", "deposits": [ { "amount": "2500", @@ -4802,7 +4802,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14897.55340428744001489755340428744", + "locked_amount": "14877.245621980677014877245621980677", "deposits": [ { "amount": "1.5e-14", @@ -4890,7 +4890,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11578.848536886071", + "locked_amount": "11555.1561241948475", "deposits": [ { "amount": "12500", @@ -5157,7 +5157,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18800.41196669736", + "locked_amount": "18748.80102823818", "deposits": [ { "amount": "7500", @@ -5565,7 +5565,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51416.99383189185572154", + "locked_amount": "51357.898929503744408733", "deposits": [ { "amount": "129999.45", @@ -5598,7 +5598,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49520.76209601310870544447", + "locked_amount": "49483.90980760125352528846", "deposits": [ { "amount": "54144.7663", @@ -5631,7 +5631,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21222.827238711314258", + "locked_amount": "21180.103373921867602", "deposits": [ { "amount": "10000", @@ -5824,7 +5824,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1886.89481861998965", + "locked_amount": "1883.48236935565685", "deposits": [ { "amount": "5000", @@ -6882,7 +6882,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "163396.8284281057515824046", + "locked_amount": "162072.8469934678874854318", "deposits": [ { "amount": "1852091.69", @@ -40754,7 +40754,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "275585.361289865707282073326", + "locked_amount": "273550.862786203377517877189", "deposits": [ { "amount": "1998.95815", @@ -42147,7 +42147,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "866687.25765937723884852", - "locked_amount": "6276895.5825033304505713155238378505095972", + "locked_amount": "6269681.38143663317600286992855265041416594", "deposits": [ { "amount": "16249.93", @@ -48725,7 +48725,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6167911.210808830654624182", - "locked_amount": "73344.69712005803295291791238272985", + "locked_amount": "66684.5927583919648233980957995734", "deposits": [ { "amount": "129284.449", @@ -58802,7 +58802,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "43668.075809464076001027650126832", + "locked_amount": "43345.697891869583547956391273456", "deposits": [ { "amount": "3000", From 8d42481130994e70b5555a761e2d29c9de8bede0 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Tue, 2 May 2023 13:31:16 +0100 Subject: [PATCH 28/42] feat(governance): eth chain should not inhibit usage (#3568) --- .../disconnected-notice.spec.tsx | 39 ++++++++++++ .../disconnected-notice.tsx | 33 ++++++++++ .../components/disconnected-notice/index.tsx | 1 + .../src/components/eth-wallet/eth-wallet.tsx | 11 +++- .../web3-connector/web3-connector.tsx | 60 ++++++++++++------- .../contexts/app-state/app-state-context.ts | 10 ++++ .../contexts/app-state/app-state-provider.tsx | 9 ++- .../governance/src/i18n/translations/dev.json | 3 +- .../components/list-asset/list-asset.spec.tsx | 1 + .../hooks/use-vote-information.spec.ts | 1 + 10 files changed, 144 insertions(+), 24 deletions(-) create mode 100644 apps/governance/src/components/disconnected-notice/disconnected-notice.spec.tsx create mode 100644 apps/governance/src/components/disconnected-notice/disconnected-notice.tsx create mode 100644 apps/governance/src/components/disconnected-notice/index.tsx diff --git a/apps/governance/src/components/disconnected-notice/disconnected-notice.spec.tsx b/apps/governance/src/components/disconnected-notice/disconnected-notice.spec.tsx new file mode 100644 index 000000000..f22924342 --- /dev/null +++ b/apps/governance/src/components/disconnected-notice/disconnected-notice.spec.tsx @@ -0,0 +1,39 @@ +import { render, screen } from '@testing-library/react'; +import { DisconnectedNotice } from './disconnected-notice'; + +describe('DisconnectedNotice', () => { + it('renders Notification when isDisconnected is true and correctNetworkChainId is valid', () => { + render( + + ); + const disconnectedNotice = screen.getByTestId('disconnected-notice'); + expect(disconnectedNotice).toBeInTheDocument(); + }); + + it("doesn't render Notification when isDisconnected is false", () => { + render( + + ); + const disconnectedNotice = screen.queryByTestId('disconnected-notice'); + expect(disconnectedNotice).not.toBeInTheDocument(); + }); + + it("doesn't render Notification when correctNetworkChainId is undefined", () => { + render( + + ); + const disconnectedNotice = screen.queryByTestId('disconnected-notice'); + expect(disconnectedNotice).not.toBeInTheDocument(); + }); + + it("doesn't render Notification when correctNetworkChainId is null", () => { + render( + + ); + const disconnectedNotice = screen.queryByTestId('disconnected-notice'); + expect(disconnectedNotice).not.toBeInTheDocument(); + }); +}); diff --git a/apps/governance/src/components/disconnected-notice/disconnected-notice.tsx b/apps/governance/src/components/disconnected-notice/disconnected-notice.tsx new file mode 100644 index 000000000..efd63ceb1 --- /dev/null +++ b/apps/governance/src/components/disconnected-notice/disconnected-notice.tsx @@ -0,0 +1,33 @@ +import { useTranslation } from 'react-i18next'; +import { Intent, Notification } from '@vegaprotocol/ui-toolkit'; + +interface DisconnectedNoticeProps { + isDisconnected: boolean; + correctNetworkChainId?: string | null; +} + +export const DisconnectedNotice = ({ + isDisconnected, + correctNetworkChainId, +}: DisconnectedNoticeProps) => { + const { t } = useTranslation(); + + if ( + !isDisconnected || + correctNetworkChainId === undefined || + correctNetworkChainId === null + ) { + return null; + } + + return ( +
+ +
+ ); +}; diff --git a/apps/governance/src/components/disconnected-notice/index.tsx b/apps/governance/src/components/disconnected-notice/index.tsx new file mode 100644 index 000000000..943ebd09b --- /dev/null +++ b/apps/governance/src/components/disconnected-notice/index.tsx @@ -0,0 +1 @@ +export * from './disconnected-notice'; diff --git a/apps/governance/src/components/eth-wallet/eth-wallet.tsx b/apps/governance/src/components/eth-wallet/eth-wallet.tsx index f095ed20a..ca334a43d 100644 --- a/apps/governance/src/components/eth-wallet/eth-wallet.tsx +++ b/apps/governance/src/components/eth-wallet/eth-wallet.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import { Button } from '@vegaprotocol/ui-toolkit'; +import { DisconnectedNotice } from '../disconnected-notice'; import { AppStateActionType, @@ -26,7 +27,8 @@ import { import { Loader } from '@vegaprotocol/ui-toolkit'; import colors from 'tailwindcss/colors'; import { useBalances } from '../../lib/balances/balances-store'; -import { useWeb3Disconnect } from '@vegaprotocol/web3'; +import { useEthereumConfig, useWeb3Disconnect } from '@vegaprotocol/web3'; +import { getChainName } from '@vegaprotocol/web3'; const removeLeadingAddressSymbol = (key: string) => { if (key && key.length > 2 && key.slice(0, 2) === '0x') { @@ -182,16 +184,21 @@ const ConnectedKey = () => { export const EthWallet = () => { const { t } = useTranslation(); - const { appDispatch } = useAppState(); + const { appDispatch, appState } = useAppState(); const { account, connector } = useWeb3React(); const pendingTxs = usePendingTransactions(); const disconnect = useWeb3Disconnect(connector); + const { config } = useEthereumConfig(); return (

{t('ethereumKey')}

+ {account && (
- - {children} - + {children} void; } export const Web3Content = ({ children, appChainId }: Web3ContentProps) => { + const { appState, appDispatch } = useAppState(); const { connector, chainId } = useWeb3React(); + const [previousChainId, setPreviousChainId] = useState(chainId); const error = useWeb3ConnectStore((store) => store.error); const disconnect = useWeb3Disconnect(connector); + const showDisconnectNotice = useCallback( + (isVisible: boolean) => + appDispatch({ + type: AppStateActionType.SET_DISCONNECT_NOTICE, + isVisible, + }), + [appDispatch] + ); + useEffect(() => { if (connector?.connectEagerly) { connector.connectEagerly(); } - // wallet connect doesnt handle connectEagerly being called when connector is also in the + // wallet connect doesn't handle connectEagerly being called when connector is also in the // deps array. // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + useEffect(() => { + if (chainId !== undefined) { + // We use this to detect when the user switches networks. + setPreviousChainId(chainId); + + if (chainId !== appChainId) { + disconnect(); + + // If the user was previously connected, show the disconnect explanation notice. + if (previousChainId !== undefined && !appState.disconnectNotice) { + showDisconnectNotice(true); + } + } else if (appState.disconnectNotice) { + showDisconnectNotice(false); + } + } + }, [ + appChainId, + appDispatch, + appState.disconnectNotice, + chainId, + disconnect, + previousChainId, + showDisconnectNotice, + ]); + if (error) { return ( @@ -80,18 +113,5 @@ export const Web3Content = ({ children, appChainId }: Web3ContentProps) => { ); } - if (chainId !== undefined && chainId !== appChainId) { - return ( - -
-

- This app only works on {getChainName(appChainId)} -

- -
-
- ); - } - return children; }; diff --git a/apps/governance/src/contexts/app-state/app-state-context.ts b/apps/governance/src/contexts/app-state/app-state-context.ts index c2b8c3dce..054899d50 100644 --- a/apps/governance/src/contexts/app-state/app-state-context.ts +++ b/apps/governance/src/contexts/app-state/app-state-context.ts @@ -43,6 +43,11 @@ export interface AppState { * Message to display in a banner at the top of the screen, currently always shown as a warning/error */ bannerMessage: string; + /** + * Displays a notice to the user that they have been disconnected because they've changed their + * ethereum network to an incompatible one. + */ + disconnectNotice: boolean; } export enum AppStateActionType { @@ -58,6 +63,7 @@ export enum AppStateActionType { SET_ASSOCIATION_BREAKDOWN, SET_TRANSACTION_OVERLAY, SET_BANNER_MESSAGE, + SET_DISCONNECT_NOTICE, } export type AppStateAction = @@ -90,6 +96,10 @@ export type AppStateAction = | { type: AppStateActionType.SET_BANNER_MESSAGE; message: string; + } + | { + type: AppStateActionType.SET_DISCONNECT_NOTICE; + isVisible: boolean; }; type AppStateContextShape = { diff --git a/apps/governance/src/contexts/app-state/app-state-provider.tsx b/apps/governance/src/contexts/app-state/app-state-provider.tsx index 2b65344a9..182a9aee1 100644 --- a/apps/governance/src/contexts/app-state/app-state-provider.tsx +++ b/apps/governance/src/contexts/app-state/app-state-provider.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { BigNumber } from '../../lib/bignumber'; -import { AppStateActionType, AppStateContext } from './app-state-context'; import type { AppState, AppStateAction } from './app-state-context'; +import { AppStateActionType, AppStateContext } from './app-state-context'; interface AppStateProviderProps { children: React.ReactNode; @@ -19,6 +19,7 @@ const initialAppState: AppState = { ethConnectOverlay: false, transactionOverlay: false, bannerMessage: '', + disconnectNotice: false, }; function appStateReducer(state: AppState, action: AppStateAction): AppState { @@ -68,6 +69,12 @@ function appStateReducer(state: AppState, action: AppStateAction): AppState { bannerMessage: action.message, }; } + case AppStateActionType.SET_DISCONNECT_NOTICE: { + return { + ...state, + disconnectNotice: action.isVisible, + }; + } } } diff --git a/apps/governance/src/i18n/translations/dev.json b/apps/governance/src/i18n/translations/dev.json index 597361a04..e18e6107d 100644 --- a/apps/governance/src/i18n/translations/dev.json +++ b/apps/governance/src/i18n/translations/dev.json @@ -790,5 +790,6 @@ "approval (% validator voting power)": "approval (% validator voting power)", "67% voting power required": "67% voting power required", "Token": "Token", - "associateVegaNow": "Associate $VEGA now" + "associateVegaNow": "Associate $VEGA now", + "disconnectedNotice": "You have been disconnected. Connect your ETH wallet to the {{correctNetwork}} network to use this app." } diff --git a/apps/governance/src/routes/proposals/components/list-asset/list-asset.spec.tsx b/apps/governance/src/routes/proposals/components/list-asset/list-asset.spec.tsx index fa1026151..5cf4dfce3 100644 --- a/apps/governance/src/routes/proposals/components/list-asset/list-asset.spec.tsx +++ b/apps/governance/src/routes/proposals/components/list-asset/list-asset.spec.tsx @@ -56,6 +56,7 @@ const mockAppState: AppState = { ethConnectOverlay: false, transactionOverlay: false, bannerMessage: '', + disconnectNotice: false, }; jest.mock('../../../contexts/app-state/app-state-context', () => ({ diff --git a/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts b/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts index 7725d3626..c79bc73fc 100644 --- a/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts +++ b/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts @@ -19,6 +19,7 @@ const mockAppState: AppState = { ethConnectOverlay: false, transactionOverlay: false, bannerMessage: '', + disconnectNotice: false, }; jest.mock('../../../contexts/app-state/app-state-context', () => ({ From 351a20abad2795822011df5a5d02fece0897173f Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 2 May 2023 10:41:21 -0700 Subject: [PATCH 29/42] feat(trading,market-list): closed markets datagrid (#3429) --- .github/workflows/ci-cd-trigger.yml | 2 +- .../src/integration/closed-markets.cy.ts | 375 ++++++++++++++++++ .../trading-e2e/src/integration/deposit.cy.ts | 3 +- apps/trading-e2e/src/integration/home.cy.ts | 3 +- .../trading-e2e/src/integration/markets.cy.ts | 1 + .../src/support/order-update-subscription.ts | 1 + apps/trading-e2e/src/support/trading.ts | 3 + .../client-pages/markets/closed.spec.tsx | 335 ++++++++++++++++ apps/trading/client-pages/markets/closed.tsx | 285 +++++++++++++ .../client-pages/markets/markets-page.tsx | 4 + .../markets/settlement-date-cell.spec.tsx | 105 +++++ .../markets/settlement-date-cell.tsx | 55 +++ .../markets/settlement-price-cell.spec.tsx | 113 ++++++ .../markets/settlement-price-cell.tsx | 39 ++ .../select-market/select-market.spec.tsx | 24 +- .../welcome-landing-dialog.spec.tsx | 24 +- libs/cypress/mock.ts | 1 + libs/deal-ticket/src/test-helpers.ts | 12 +- libs/environment/src/hooks/use-links.ts | 1 + libs/fills/src/lib/test-helpers.ts | 12 +- .../src/lib/__generated__/markets.ts | 11 +- libs/market-list/src/lib/markets-data.mock.ts | 58 +-- libs/market-list/src/lib/markets-provider.ts | 14 +- libs/market-list/src/lib/markets.graphql | 7 + libs/market-list/src/lib/markets.mock.ts | 104 ++--- .../market-list/src/lib/utils/market-utils.ts | 9 + libs/oracles/.eslintrc.json | 2 +- libs/oracles/src/index.ts | 2 + .../src/lib/OracleSpecDataConnection.graphql | 18 + .../__generated__/OracleSpecDataConnection.ts | 61 +++ .../lib/oracle-spec-data-connection.mock.ts | 38 ++ .../lib/use-oracle-spec-binding-data.spec.tsx | 105 +++++ .../src/lib/use-oracle-spec-binding-data.ts | 26 ++ libs/oracles/tsconfig.spec.json | 3 +- .../lib/components/mocks/generate-orders.ts | 12 +- .../src/lib/withdraw-form-container.spec.tsx | 12 +- package.json | 2 +- yarn.lock | 8 +- 38 files changed, 1749 insertions(+), 141 deletions(-) create mode 100644 apps/trading-e2e/src/integration/closed-markets.cy.ts create mode 100644 apps/trading/client-pages/markets/closed.spec.tsx create mode 100644 apps/trading/client-pages/markets/closed.tsx create mode 100644 apps/trading/client-pages/markets/settlement-date-cell.spec.tsx create mode 100644 apps/trading/client-pages/markets/settlement-date-cell.tsx create mode 100644 apps/trading/client-pages/markets/settlement-price-cell.spec.tsx create mode 100644 apps/trading/client-pages/markets/settlement-price-cell.tsx create mode 100644 libs/oracles/src/lib/OracleSpecDataConnection.graphql create mode 100644 libs/oracles/src/lib/__generated__/OracleSpecDataConnection.ts create mode 100644 libs/oracles/src/lib/oracle-spec-data-connection.mock.ts create mode 100644 libs/oracles/src/lib/use-oracle-spec-binding-data.spec.tsx create mode 100644 libs/oracles/src/lib/use-oracle-spec-binding-data.ts diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index fd11dc4de..73c37dd16 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -50,7 +50,7 @@ jobs: secrets: inherit lint-test-build: - timeout-minutes: 35 + timeout-minutes: 60 needs: node-modules runs-on: ubuntu-22.04 name: '(CI) lint + unit test + build' diff --git a/apps/trading-e2e/src/integration/closed-markets.cy.ts b/apps/trading-e2e/src/integration/closed-markets.cy.ts new file mode 100644 index 000000000..a80f0ce47 --- /dev/null +++ b/apps/trading-e2e/src/integration/closed-markets.cy.ts @@ -0,0 +1,375 @@ +import { aliasGQLQuery } from '@vegaprotocol/cypress'; +import { MarketState, MarketStateMapping } from '@vegaprotocol/types'; +import { addDays, subDays } from 'date-fns'; +import { + chainIdQuery, + statisticsQuery, + createDataConnection, + oracleSpecDataConnectionQuery, + createMarketFragment, + marketsQuery, + marketsDataQuery, + createMarketsDataFragment, + assetQuery, + networkParamsQuery, +} from '@vegaprotocol/mock'; +import { + addDecimalsFormatNumber, + getDateTimeFormat, +} from '@vegaprotocol/utils'; + +describe('Closed markets', { tags: '@smoke' }, () => { + const rowSelector = + '[data-testid="tab-closed-markets"] .ag-center-cols-container .ag-row'; + + const assetsResult = assetQuery(); + // @ts-ignore asset definitely exists + const settlementAsset = assetsResult.assetsConnection.edges[0].node; + + const settledMarket = createMarketFragment({ + id: '0', + state: MarketState.STATE_SETTLED, + marketTimestamps: { + open: subDays(new Date(), 10).toISOString(), + close: subDays(new Date(), 4).toISOString(), + }, + tradableInstrument: { + instrument: { + product: { + dataSourceSpecForTradingTermination: { + id: 'market-1-trading-termination-oracle-id', + }, + dataSourceSpecForSettlementData: { + id: 'market-1-settlement-data-oracle-id', + }, + settlementAsset, + }, + }, + }, + }); + + const terminatedMarket = createMarketFragment({ + id: '1', + state: MarketState.STATE_TRADING_TERMINATED, + marketTimestamps: { + open: subDays(new Date(), 10).toISOString(), + close: null, // market + }, + tradableInstrument: { + instrument: { + metadata: { + tags: [ + `settlement-expiry-date:${addDays(new Date(), 4).toISOString()}`, + ], + }, + }, + }, + }); + + const delayedSettledMarket = createMarketFragment({ + id: '2', + state: MarketState.STATE_TRADING_TERMINATED, + marketTimestamps: { + open: subDays(new Date(), 10).toISOString(), + close: null, // market + }, + tradableInstrument: { + instrument: { + metadata: { + tags: [ + `settlement-expiry-date:${subDays(new Date(), 2).toISOString()}`, + ], + }, + }, + }, + }); + + const unknownMarket = createMarketFragment({ + id: '3', + state: MarketState.STATE_SETTLED, + }); + + const closedMarketsResult = [ + { + node: settledMarket, + }, + { + node: terminatedMarket, + }, + { + node: delayedSettledMarket, + }, + { node: unknownMarket }, + { + node: createMarketFragment({ id: '4', state: MarketState.STATE_PENDING }), + }, + { + node: createMarketFragment({ id: '5', state: MarketState.STATE_ACTIVE }), + }, + ]; + + const settledMarketData = createMarketsDataFragment({ + market: { + id: settledMarket.id, + }, + bestBidPrice: '1000', + bestOfferPrice: '2000', + markPrice: '1500', + }); + + const closedMarketsDataResult = [ + { + node: { + data: settledMarketData, + }, + }, + { + node: { + data: createMarketsDataFragment({ + market: { + id: terminatedMarket.id, + }, + }), + }, + }, + { + node: { + data: createMarketsDataFragment({ + market: { + id: delayedSettledMarket.id, + }, + }), + }, + }, + { + node: { + data: createMarketsDataFragment({ + market: { + id: unknownMarket.id, + }, + }), + }, + }, + ]; + + const specDataConnection = createDataConnection(); + + before(() => { + cy.mockGQL((req) => { + aliasGQLQuery(req, 'ChainId', chainIdQuery()); + aliasGQLQuery(req, 'Statistics', statisticsQuery()); + aliasGQLQuery(req, 'NetworkParams', networkParamsQuery()); + aliasGQLQuery( + req, + 'Markets', + marketsQuery({ + marketsConnection: { + edges: closedMarketsResult, + }, + }) + ); + aliasGQLQuery( + req, + 'MarketsData', + marketsDataQuery({ + marketsConnection: { + edges: closedMarketsDataResult, + }, + }) + ); + aliasGQLQuery( + req, + 'OracleSpecDataConnection', + oracleSpecDataConnectionQuery() + ); + }); + + cy.mockSubscription(); + + cy.visit('/#/markets/all'); + cy.get('[data-testid="Closed markets"]').click(); + }); + + it('renders a settled market', () => { + const expectedMarkets = closedMarketsResult.filter((edge) => { + return [ + MarketState.STATE_SETTLED, + MarketState.STATE_TRADING_TERMINATED, + ].includes(edge.node.state); + }); + const product = settledMarket.tradableInstrument.instrument.product; + + // rows should be filtered to only include settled/terminated markets + cy.get(rowSelector).should('have.length', expectedMarkets.length); + + // check each column in the first row renders correctly + // 6001-MARK-001 + cy.get(rowSelector) + .first() + .find('[col-id="code"]') + .should('have.text', settledMarket.tradableInstrument.instrument.code); + + // 6001-MARK-002 + cy.get(rowSelector) + .first() + .find('[col-id="name"]') + .should('have.text', settledMarket.tradableInstrument.instrument.name); + + // 6001-MARK-003 + cy.get(rowSelector) + .first() + .find('[col-id="state"]') + .should('have.text', MarketStateMapping[settledMarket.state]); + + // 6001-MARK-004 + // 6001-MARK-005 + // 6001-MARK-009 + // 6001-MARK-008 + // 6001-MARK-010 + cy.get(rowSelector) + .first() + .find('[col-id="settlementDate"]') + .find('[data-testid="link"]') + .should(($el) => { + const href = $el.attr('href'); + expect(href).to.match( + new RegExp( + `/oracles/${product.dataSourceSpecForTradingTermination.id}` + ) + ); + }) + .should('have.text', '4 days ago') + .should( + 'have.attr', + 'title', + getDateTimeFormat().format( + new Date(settledMarket.marketTimestamps.close) + ) + ); + + // 6001-MARK-011 + cy.get(rowSelector) + .first() + .find('[col-id="bestBidPrice"]') + .should( + 'have.text', + addDecimalsFormatNumber( + settledMarketData.bestBidPrice, + settledMarket.decimalPlaces + ) + ); + + // 6001-MARK-012 + cy.get(rowSelector) + .first() + .find('[col-id="bestOfferPrice"]') + .should( + 'have.text', + addDecimalsFormatNumber( + settledMarketData.bestOfferPrice, + settledMarket.decimalPlaces + ) + ); + + // 6001-MARK-013 + cy.get(rowSelector).first().find('[col-id="markPrice"]').should( + 'have.text', + + addDecimalsFormatNumber( + settledMarketData.markPrice, + settledMarket.decimalPlaces + ) + ); + + // 6001-MARK-014 + // 6001-MARK-015 + // 6001-MARK-016 + cy.get(rowSelector) + .first() + .find('[col-id="settlementDataOracleId"]') + .find('[data-testid="link"]') + .should(($el) => { + const href = $el.attr('href'); + expect(href).to.match( + new RegExp(`/oracles/${product.dataSourceSpecForSettlementData.id}`) + ); + }) + .should( + 'have.text', + addDecimalsFormatNumber( + // @ts-ignore cannot deep un-partial + specDataConnection.externalData.data.data[0].value, + settledMarket.decimalPlaces + ) + ); + + // 6001-MARK-017 + cy.get(rowSelector) + .first() + .find('[col-id="realisedPNL"]') + .should('have.text', '-'); + + // 6001-MARK-018 + cy.get(rowSelector) + .first() + .find('[col-id="settlementAsset"]') + .should('have.text', product.settlementAsset.symbol); + + // 6001-MARK-020 + cy.get(rowSelector) + .first() + .find('[col-id="id"]') + .should('have.text', settledMarket.id); + }); + + // test market list for market in terminated state + it('renders a terminated market', () => { + cy.get(rowSelector) + .eq(1) + .find('[col-id="state"]') + .should('have.text', MarketStateMapping[terminatedMarket.state]); + + // 6001-MARK-006 + // 6001-MARK-007 + cy.get(rowSelector) + .eq(1) + .find('[col-id="settlementDate"]') + .find('[data-testid="link"]') + .should('have.text', 'Expected in 4 days'); + }); + + it('renders a terminated market which was expected to have settled', () => { + cy.get(rowSelector) + .eq(2) + .find('[col-id="settlementDate"]') + .should('have.class', 'text-danger') + .find('[data-testid="link"]') + .should('have.text', 'Expected 2 days ago'); + }); + + it('renders terminated market which doesnt have settlement date metadata', () => { + cy.get(rowSelector) + .eq(3) + .find('[col-id="settlementDate"]') + .find('[data-testid="link"]') + .should('have.text', 'Unknown'); + }); + + it('can open asset detail dialog', () => { + cy.mockGQL((req) => { + aliasGQLQuery(req, 'Asset', assetsResult); + }); + + cy.get(rowSelector) + .first() + .find('[col-id="settlementAsset"]') + .find('button') + .click(); + + // 6001-MARK-019 + cy.get('[data-testid="dialog-title"]').should( + 'have.text', + `Asset details - ${settlementAsset.symbol}` + ); + }); +}); diff --git a/apps/trading-e2e/src/integration/deposit.cy.ts b/apps/trading-e2e/src/integration/deposit.cy.ts index 815fd58c7..7be01169f 100644 --- a/apps/trading-e2e/src/integration/deposit.cy.ts +++ b/apps/trading-e2e/src/integration/deposit.cy.ts @@ -101,7 +101,7 @@ describe('deposit actions', { tags: '@smoke' }, () => { cy.mockTradingPage(); cy.mockSubscription(); cy.setVegaWallet(); - cy.visit('/'); + cy.visit('/#/markets/market-1'); cy.wait('@MarketsCandles'); cy.getByTestId('dialog-close').click(); }); @@ -112,7 +112,6 @@ describe('deposit actions', { tags: '@smoke' }, () => { 'be.visible' ); cy.contains('[data-testid="deposit"]', 'Deposit to trade').click(); - connectEthereumWallet('MetaMask'); cy.getByTestId('deposit-submit').should('be.visible'); }); }); diff --git a/apps/trading-e2e/src/integration/home.cy.ts b/apps/trading-e2e/src/integration/home.cy.ts index 43144738c..7dc59dccc 100644 --- a/apps/trading-e2e/src/integration/home.cy.ts +++ b/apps/trading-e2e/src/integration/home.cy.ts @@ -153,7 +153,7 @@ describe('home', { tags: '@regression' }, () => { // the choose market overlay is no longer showing cy.contains('Select a market to get started').should('not.exist'); cy.contains('Loading...').should('not.exist'); - cy.url().should('eq', Cypress.config().baseUrl + '/#/markets/market-1'); + cy.url().should('eq', Cypress.config().baseUrl + '/#/markets/market-0'); }); }); @@ -172,6 +172,7 @@ describe('home', { tags: '@regression' }, () => { ], }, }; + // @ts-ignore partial deep check failing const data = marketsDataQuery(override); cy.mockGQL((req) => { aliasGQLQuery(req, 'MarketsData', data); diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index 1ebeb1d32..a189ba737 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -222,6 +222,7 @@ describe('markets table', { tags: '@smoke' }, () => { ], }, }; + // @ts-ignore partial deep check failing const market = marketsQuery(override); aliasGQLQuery(req, 'Market', market); aliasGQLQuery(req, 'ProposalOfMarket', { diff --git a/apps/trading-e2e/src/support/order-update-subscription.ts b/apps/trading-e2e/src/support/order-update-subscription.ts index 72aee6961..3d9095324 100644 --- a/apps/trading-e2e/src/support/order-update-subscription.ts +++ b/apps/trading-e2e/src/support/order-update-subscription.ts @@ -26,6 +26,7 @@ export function updateOrder( override?: PartialDeep ): void { const update: OrdersUpdateSubscription = orderUpdateSubscription({ + // @ts-ignore partial deep check failing orders: [override], }); if (!sendOrderUpdate) { diff --git a/apps/trading-e2e/src/support/trading.ts b/apps/trading-e2e/src/support/trading.ts index 8d8202d6d..99691e270 100644 --- a/apps/trading-e2e/src/support/trading.ts +++ b/apps/trading-e2e/src/support/trading.ts @@ -46,7 +46,9 @@ const marketDataOverride = ( { node: { data: { + // @ts-ignore conflict between incoming and outgoing types trigger: data.trigger, + // @ts-ignore same as above marketTradingMode: data.tradingMode, marketState: data.state, }, @@ -63,6 +65,7 @@ const marketsDataOverride = ( edges: [ { node: { + // @ts-ignore conflict between incoming and outgoing types tradingMode: data.tradingMode, state: data.state, }, diff --git a/apps/trading/client-pages/markets/closed.spec.tsx b/apps/trading/client-pages/markets/closed.spec.tsx new file mode 100644 index 000000000..294ba9009 --- /dev/null +++ b/apps/trading/client-pages/markets/closed.spec.tsx @@ -0,0 +1,335 @@ +import { act, render, screen, within } from '@testing-library/react'; +import { Closed } from './closed'; +import { MarketStateMapping } from '@vegaprotocol/types'; +import { PositionStatus } from '@vegaprotocol/types'; +import { MarketState } from '@vegaprotocol/types'; +import { subDays } from 'date-fns'; +import type { MockedResponse } from '@apollo/client/testing'; +import { MockedProvider } from '@apollo/client/testing'; +import type { OracleSpecDataConnectionQuery } from '@vegaprotocol/oracles'; +import { OracleSpecDataConnectionDocument } from '@vegaprotocol/oracles'; +import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; +import { VegaWalletContext } from '@vegaprotocol/wallet'; +import type { + PositionsQuery, + PositionFieldsFragment, +} from '@vegaprotocol/positions'; +import { PositionsDocument } from '@vegaprotocol/positions'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import type { MarketsDataQuery, MarketsQuery } from '@vegaprotocol/market-list'; +import { MarketsDataDocument } from '@vegaprotocol/market-list'; +import { MarketsDocument } from '@vegaprotocol/market-list'; +import { + createMarketFragment, + marketsQuery, + marketsDataQuery, + createMarketsDataFragment, +} from '@vegaprotocol/mock'; + +describe('Closed', () => { + let originalNow: typeof Date.now; + const mockNowTimestamp = 1672531200000; + const settlementDateMetaDate = subDays( + new Date(mockNowTimestamp), + 3 + ).toISOString(); + const settlementDateTag = `settlement-expiry-date:${settlementDateMetaDate}`; + const pubKey = 'pubKey'; + const marketId = 'market-0'; + const settlementDataProperty = 'spec-binding'; + const settlementDataId = 'settlement-data-oracle-id'; + + const market = createMarketFragment({ + id: marketId, + state: MarketState.STATE_SETTLED, + tradableInstrument: { + instrument: { + metadata: { + tags: [settlementDateTag], + }, + product: { + dataSourceSpecForSettlementData: { + id: settlementDataId, + }, + dataSourceSpecBinding: { + settlementDataProperty, + }, + }, + }, + }, + }); + const marketsMock: MockedResponse = { + request: { + query: MarketsDocument, + }, + result: { + data: marketsQuery({ + marketsConnection: { + edges: [ + { + node: market, + }, + ], + }, + }), + }, + }; + + const marketsData = createMarketsDataFragment({ + __typename: 'MarketData', + market: { + __typename: 'Market', + id: marketId, + }, + bestBidPrice: '1000', + bestOfferPrice: '2000', + markPrice: '1500', + }); + const marketsDataMock: MockedResponse = { + request: { + query: MarketsDataDocument, + }, + result: { + data: marketsDataQuery({ + marketsConnection: { + edges: [ + { + node: { + data: marketsData, + }, + }, + ], + }, + }), + }, + }; + + // Create mock oracle data + const property = { + __typename: 'Property' as const, + name: settlementDataProperty, + value: '12345', + }; + const oracleDataMock: MockedResponse = { + request: { + query: OracleSpecDataConnectionDocument, + variables: { + oracleSpecId: settlementDataId, + }, + }, + result: { + data: { + oracleSpec: { + dataConnection: { + edges: [ + { + node: { + externalData: { + data: { + data: [property], + }, + }, + }, + }, + ], + }, + }, + }, + }, + }; + + // Create mock position + const createPosition = (): PositionFieldsFragment => { + return { + __typename: 'Position' as const, + realisedPNL: '1000', + unrealisedPNL: '2000', + openVolume: '3000', + averageEntryPrice: '100', + updatedAt: new Date().toISOString(), + positionStatus: PositionStatus.POSITION_STATUS_UNSPECIFIED, + lossSocializationAmount: '1000', + market: { + __typename: 'Market', + id: marketId, + }, + }; + }; + const position = createPosition(); + const positionsMock: MockedResponse = { + request: { + query: PositionsDocument, + variables: { + partyId: pubKey, + }, + }, + result: { + data: { + party: { + __typename: 'Party', + id: pubKey, + positionsConnection: { + __typename: 'PositionConnection', + edges: [{ __typename: 'PositionEdge', node: position }], + }, + }, + }, + }, + }; + + beforeAll(() => { + originalNow = Date.now; + Date.now = jest.fn().mockReturnValue(mockNowTimestamp); + }); + + afterAll(() => { + Date.now = originalNow; + }); + + it('renders correctly formatted and filtered rows', async () => { + await act(async () => { + render( + + + + + + ); + }); + // screen.debug(document, Infinity); + + const headers = screen.getAllByRole('columnheader'); + const expectedHeaders = [ + 'Market', + 'Description', + 'Status', + 'Settlement date', + 'Best bid', + 'Best offer', + 'Mark price', + 'Settlement price', + 'Realised PNL', + 'Settlement asset', + 'Market ID', + ]; + expect(headers).toHaveLength(expectedHeaders.length); + expect(headers.map((h) => h.textContent?.trim())).toEqual(expectedHeaders); + + const cells = screen.getAllByRole('gridcell'); + const expectedValues = [ + market.tradableInstrument.instrument.code, + market.tradableInstrument.instrument.name, + MarketStateMapping[market.state], + '3 days ago', + /* eslint-disable @typescript-eslint/no-non-null-assertion */ + addDecimalsFormatNumber(marketsData.bestBidPrice, market.decimalPlaces), + addDecimalsFormatNumber( + marketsData!.bestOfferPrice, + market.decimalPlaces + ), + addDecimalsFormatNumber(marketsData!.markPrice, market.decimalPlaces), + /* eslint-enable @typescript-eslint/no-non-null-assertion */ + addDecimalsFormatNumber(property.value, market.decimalPlaces), + addDecimalsFormatNumber(position.realisedPNL, market.decimalPlaces), + market.tradableInstrument.instrument.product.settlementAsset.symbol, + market.id, + ]; + cells.forEach((cell, i) => { + expect(cell).toHaveTextContent(expectedValues[i]); + }); + }); + + it('only renders settled and terminated markets', async () => { + const mixedMarkets = [ + { + // inlclude as settled + __typename: 'MarketEdge' as const, + node: createMarketFragment({ + id: 'include-0', + state: MarketState.STATE_SETTLED, + }), + }, + { + // omit this market + __typename: 'MarketEdge' as const, + node: createMarketFragment({ + id: 'discard-0', + state: MarketState.STATE_SUSPENDED, + }), + }, + { + // include as terminated + __typename: 'MarketEdge' as const, + node: createMarketFragment({ + id: 'include-1', + state: MarketState.STATE_TRADING_TERMINATED, + }), + }, + { + // omit this market + __typename: 'MarketEdge' as const, + node: createMarketFragment({ + id: 'discard-1', + state: MarketState.STATE_ACTIVE, + }), + }, + ]; + const mixedMarketsMock: MockedResponse = { + request: { + query: MarketsDocument, + }, + result: { + data: { + marketsConnection: { + __typename: 'MarketConnection', + edges: mixedMarkets, + }, + }, + }, + }; + await act(async () => { + render( + + + + + + ); + }); + + // check that the number of rows in datagrid is 2 + const container = within( + document.querySelector('.ag-center-cols-container') as HTMLElement + ); + const expectedRows = mixedMarkets.filter((m) => { + return [ + MarketState.STATE_SETTLED, + MarketState.STATE_TRADING_TERMINATED, + ].includes(m.node.state); + }); + + // check rows length is correct + const rows = container.getAllByRole('row'); + expect(rows).toHaveLength(expectedRows.length); + + // check that only included ids are shown + const cells = screen + .getAllByRole('gridcell') + .filter((cell) => cell.getAttribute('col-id') === 'id') + .map((cell) => cell.textContent?.trim()); + expect(cells).toEqual(expectedRows.map((m) => m.node.id)); + }); +}); diff --git a/apps/trading/client-pages/markets/closed.tsx b/apps/trading/client-pages/markets/closed.tsx new file mode 100644 index 000000000..a3a55345f --- /dev/null +++ b/apps/trading/client-pages/markets/closed.tsx @@ -0,0 +1,285 @@ +import compact from 'lodash/compact'; +import { isAfter } from 'date-fns'; +import type { + VegaICellRendererParams, + VegaValueFormatterParams, +} from '@vegaprotocol/datagrid'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { useMemo } from 'react'; +import { t } from '@vegaprotocol/i18n'; +import { MarketState, MarketStateMapping } from '@vegaprotocol/types'; +import { + addDecimalsFormatNumber, + getMarketExpiryDate, +} from '@vegaprotocol/utils'; +import { usePositionsQuery } from '@vegaprotocol/positions'; +import type { MarketMaybeWithData } from '@vegaprotocol/market-list'; +import { closedMarketsWithDataProvider } from '@vegaprotocol/market-list'; +import { useVegaWallet } from '@vegaprotocol/wallet'; +import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; +import type { ColDef } from 'ag-grid-community'; +import { SettlementDateCell } from './settlement-date-cell'; +import { SettlementPriceCell } from './settlement-price-cell'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; + +type SettlementAsset = + MarketMaybeWithData['tradableInstrument']['instrument']['product']['settlementAsset']; + +interface Row { + id: string; + code: string; + name: string; + decimalPlaces: number; + state: MarketState; + metadata: string[]; + closeTimestamp: string | null; + bestBidPrice: string | undefined; + bestOfferPrice: string | undefined; + markPrice: string | undefined; + settlementDataOracleId: string; + settlementDataSpecBinding: string; + tradingTerminationOracleId: string; + settlementAsset: SettlementAsset; + realisedPNL: string | undefined; +} + +export const Closed = () => { + const { pubKey } = useVegaWallet(); + const { + data: marketData, + loading, + error, + reload, + } = useDataProvider({ + dataProvider: closedMarketsWithDataProvider, + variables: undefined, + }); + const { data: positionData } = usePositionsQuery({ + variables: { + partyId: pubKey || '', + }, + skip: !pubKey, + }); + + // find a position for each market and add the realised pnl to + // a normalized object + const rowData = compact(marketData).map((market) => { + const position = positionData?.party?.positionsConnection?.edges?.find( + (edge) => { + return edge.node.market.id === market.id; + } + ); + + const row: Row = { + id: market.id, + code: market.tradableInstrument.instrument.code, + name: market.tradableInstrument.instrument.name, + decimalPlaces: market.decimalPlaces, + state: market.state, + metadata: market.tradableInstrument.instrument.metadata.tags ?? [], + closeTimestamp: market.marketTimestamps.close, + bestBidPrice: market.data?.bestBidPrice, + bestOfferPrice: market.data?.bestOfferPrice, + markPrice: market.data?.markPrice, + settlementDataOracleId: + market.tradableInstrument.instrument.product + .dataSourceSpecForSettlementData.id, + settlementDataSpecBinding: + market.tradableInstrument.instrument.product.dataSourceSpecBinding + .settlementDataProperty, + tradingTerminationOracleId: + market.tradableInstrument.instrument.product + .dataSourceSpecForTradingTermination.id, + settlementAsset: + market.tradableInstrument.instrument.product.settlementAsset, + realisedPNL: position?.node.realisedPNL, + }; + + return row; + }); + return ( +
+ +
+ +
+
+ ); +}; + +const ClosedMarketsDataGrid = ({ rowData }: { rowData: Row[] }) => { + const openAssetDialog = useAssetDetailsDialogStore((store) => store.open); + const colDefs = useMemo(() => { + const cols: ColDef[] = [ + { + headerName: t('Market'), + field: 'code', + }, + { + headerName: t('Description'), + field: 'name', + }, + { + headerName: t('Status'), + field: 'state', + valueFormatter: ({ value }: VegaValueFormatterParams) => { + if (!value) return '-'; + return MarketStateMapping[value]; + }, + }, + { + headerName: t('Settlement date'), + colId: 'settlementDate', // colId needed if no field property provided otherwise column order is ruined in tests + valueGetter: ({ data }: { data: Row }) => { + return getMarketExpiryDate(data.metadata); + }, + cellRenderer: ({ value, data }: { value: Date | null; data: Row }) => { + return ( + + ); + }, + cellClassRules: { + 'text-danger': ({ + value, + data, + }: { + value: Date | null; + data: Row; + }) => { + const date = data.closeTimestamp + ? new Date(data.closeTimestamp) + : value; + + if (!date) return false; + + if ( + // expiry has passed and market is not yet settled + isAfter(new Date(), date) && + data.state !== MarketState.STATE_SETTLED + ) { + return true; + } + return false; + }, + }, + }, + { + headerName: t('Best bid'), + field: 'bestBidPrice', + type: 'numericColumn', + cellClass: 'font-mono ag-right-aligned-cell', + valueFormatter: ({ + value, + data, + }: VegaValueFormatterParams) => { + if (!value || !data) return '-'; + return addDecimalsFormatNumber(value, data.decimalPlaces); + }, + }, + { + headerName: t('Best offer'), + field: 'bestOfferPrice', + cellClass: 'font-mono ag-right-aligned-cell', + type: 'numericColumn', + valueFormatter: ({ + value, + data, + }: VegaValueFormatterParams) => { + if (!value || !data) return '-'; + return addDecimalsFormatNumber(value, data.decimalPlaces); + }, + }, + { + headerName: t('Mark price'), + field: 'markPrice', + cellClass: 'font-mono ag-right-aligned-cell', + type: 'numericColumn', + valueFormatter: ({ + value, + data, + }: VegaValueFormatterParams) => { + if (!value || !data) return '-'; + return addDecimalsFormatNumber(value, data.decimalPlaces); + }, + }, + { + headerName: t('Settlement price'), + type: 'numericColumn', + field: 'settlementDataOracleId', + // 'tradableInstrument.instrument.product.dataSourceSpecForSettlementData.id', + cellRenderer: ({ + value, + data, + }: VegaICellRendererParams) => ( + + ), + }, + { + headerName: t('Realised PNL'), + field: 'realisedPNL', + cellClass: 'font-mono ag-right-aligned-cell', + type: 'numericColumn', + valueFormatter: ({ + value, + data, + }: VegaValueFormatterParams) => { + if (!value || !data) return '-'; + return addDecimalsFormatNumber(value, data.decimalPlaces); + }, + }, + { + headerName: t('Settlement asset'), + field: 'settlementAsset', + cellRenderer: ({ + value, + data, + }: VegaValueFormatterParams) => ( + + ), + }, + { + headerName: t('Market ID'), + field: 'id', + }, + ]; + return cols; + }, [openAssetDialog]); + + return ( + data.id} + defaultColDef={{ + flex: 1, + resizable: true, + }} + overlayNoRowsTemplate="No data" + /> + ); +}; diff --git a/apps/trading/client-pages/markets/markets-page.tsx b/apps/trading/client-pages/markets/markets-page.tsx index e2c61dcc0..24e9020c4 100644 --- a/apps/trading/client-pages/markets/markets-page.tsx +++ b/apps/trading/client-pages/markets/markets-page.tsx @@ -5,6 +5,7 @@ import { LocalStoragePersistTabs as Tabs, Tab } from '@vegaprotocol/ui-toolkit'; import { Markets } from './markets'; import { Proposed } from './proposed'; import { usePageTitleStore } from '../../stores'; +import { Closed } from './closed'; export const MarketsPage = () => { const { updateTitle } = usePageTitleStore((store) => ({ @@ -21,6 +22,9 @@ export const MarketsPage = () => { + + + ); }; diff --git a/apps/trading/client-pages/markets/settlement-date-cell.spec.tsx b/apps/trading/client-pages/markets/settlement-date-cell.spec.tsx new file mode 100644 index 000000000..43c6c9552 --- /dev/null +++ b/apps/trading/client-pages/markets/settlement-date-cell.spec.tsx @@ -0,0 +1,105 @@ +import { render, screen } from '@testing-library/react'; +import { MarketState } from '@vegaprotocol/types'; +import { addDays, subDays } from 'date-fns'; +import type { SettlementDataCellProps } from './settlement-date-cell'; +import { SettlementDateCell } from './settlement-date-cell'; + +describe('SettlementDateCell', () => { + let originalNow: typeof Date.now; + const mockNowTimestamp = 1672531200000; + + const createProps = (): SettlementDataCellProps => { + return { + oracleSpecId: 'oracle-spec-id', + metaDate: null, + closeTimestamp: null, + marketState: MarketState.STATE_SETTLED, + }; + }; + + beforeAll(() => { + originalNow = Date.now; + Date.now = jest.fn().mockReturnValue(mockNowTimestamp); + }); + + afterAll(() => { + Date.now = originalNow; + }); + + it('renders unknown if date cannot be determined', () => { + const props = createProps(); + render(); + + const link = screen.getByRole('link'); + expect(link).toHaveTextContent('Unknown'); + expect(link).toHaveAttribute( + 'href', + expect.stringContaining(`/oracles/${props.oracleSpecId}`) + ); + }); + + it('renders using close timestamp if provided', () => { + const daysAgo = 3; + const props = createProps(); + props.closeTimestamp = subDays( + new Date(mockNowTimestamp), + daysAgo + ).toISOString(); + + render(); + + const link = screen.getByRole('link'); + expect(link).toHaveTextContent(`${daysAgo} days ago`); + expect(link).toHaveAttribute( + 'href', + expect.stringContaining(`/oracles/${props.oracleSpecId}`) + ); + }); + + it('renders using meta tag date if no close timestamp provided', () => { + const daysAgo = 4; + const props = createProps(); + props.metaDate = subDays(new Date(mockNowTimestamp), daysAgo); + + render(); + + const link = screen.getByRole('link'); + expect(link).toHaveTextContent(`${daysAgo} days ago`); + expect(link).toHaveAttribute( + 'href', + expect.stringContaining(`/oracles/${props.oracleSpecId}`) + ); + }); + + it('renders past expected settlement date', () => { + const daysAgo = 3; + const props = createProps(); + props.metaDate = subDays(new Date(mockNowTimestamp), daysAgo); + props.marketState = MarketState.STATE_TRADING_TERMINATED; + + render(); + + const link = screen.getByRole('link'); + expect(link).toHaveTextContent(`Expected ${daysAgo} days ago`); + expect(link).toHaveAttribute( + 'href', + expect.stringContaining(`/oracles/${props.oracleSpecId}`) + ); + }); + + it('renders future expected settlement date', () => { + const daysAgo = 3; + const props = createProps(); + props.metaDate = addDays(new Date(mockNowTimestamp), daysAgo); + props.marketState = MarketState.STATE_TRADING_TERMINATED; + + render(); + + const link = screen.getByRole('link'); + expect(link).toHaveTextContent(`Expected in ${daysAgo} days`); + expect(link).toHaveAttribute( + 'href', + expect.stringContaining(`/oracles/${props.oracleSpecId}`) + ); + }); +}); diff --git a/apps/trading/client-pages/markets/settlement-date-cell.tsx b/apps/trading/client-pages/markets/settlement-date-cell.tsx new file mode 100644 index 000000000..80fb9cf5c --- /dev/null +++ b/apps/trading/client-pages/markets/settlement-date-cell.tsx @@ -0,0 +1,55 @@ +import { DApp, EXPLORER_ORACLE, useLinks } from '@vegaprotocol/environment'; +import { t } from '@vegaprotocol/i18n'; +import { MarketState } from '@vegaprotocol/types'; +import { Link } from '@vegaprotocol/ui-toolkit'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; +import { formatDistanceToNowStrict, isAfter } from 'date-fns'; + +export interface SettlementDataCellProps { + oracleSpecId: string; + metaDate: Date | null; + closeTimestamp: string | null; + marketState: MarketState; +} + +export const SettlementDateCell = ({ + oracleSpecId, + metaDate, + closeTimestamp, + marketState, +}: SettlementDataCellProps) => { + const linkCreator = useLinks(DApp.Explorer); + const date = closeTimestamp ? new Date(closeTimestamp) : metaDate; + + let text = ''; + if (!date) { + text = t('Unknown'); + } else { + // pass Date.now() to date constructor for easier mocking + const expiryHasPassed = isAfter(new Date(Date.now()), date); + const distance = formatDistanceToNowStrict(date); // X days/mins ago + + if (expiryHasPassed) { + if (marketState !== MarketState.STATE_SETTLED) { + text = t('Expected %s ago', distance); + } else { + text = t('%s ago', distance); + } + } else { + text = t('Expected in %s', distance); + } + } + + return ( + + {text} + + ); +}; diff --git a/apps/trading/client-pages/markets/settlement-price-cell.spec.tsx b/apps/trading/client-pages/markets/settlement-price-cell.spec.tsx new file mode 100644 index 000000000..cfd1c6ed9 --- /dev/null +++ b/apps/trading/client-pages/markets/settlement-price-cell.spec.tsx @@ -0,0 +1,113 @@ +import { render, screen } from '@testing-library/react'; +import type { Property } from '@vegaprotocol/types'; +import type { MockedResponse } from '@apollo/client/testing'; +import { MockedProvider } from '@apollo/client/testing'; +import type { OracleSpecDataConnectionQuery } from '@vegaprotocol/oracles'; +import { OracleSpecDataConnectionDocument } from '@vegaprotocol/oracles'; +import type { SettlementPriceCellProps } from './settlement-price-cell'; +import { SettlementPriceCell } from './settlement-price-cell'; + +describe('SettlementPriceCell', () => { + const createMock = ( + id: string, + property: Property + ): MockedResponse => { + return { + request: { + query: OracleSpecDataConnectionDocument, + variables: { + oracleSpecId: id, + }, + }, + result: { + data: { + oracleSpec: { + dataConnection: { + edges: [ + { + node: { + externalData: { + data: { + data: [property], + }, + }, + }, + }, + ], + }, + }, + }, + }, + }; + }; + const createProps = (): SettlementPriceCellProps => { + return { + oracleSpecId: 'oracle-spec-id', + decimalPlaces: 2, + settlementDataSpecBinding: 'settlement-data-spec-binding', + }; + }; + it('renders fetches and renders the settlment data value', async () => { + const props = createProps(); + const property = { + __typename: 'Property' as const, + name: props.settlementDataSpecBinding as string, + value: '1234', + }; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const mock = createMock(props.oracleSpecId!, property); + + render( + + + + ); + + expect(screen.getByText('-')).toBeInTheDocument(); + const link = await screen.findByRole('link'); + expect(link).toHaveTextContent('12.34'); + expect(link).toHaveAttribute( + 'href', + expect.stringContaining(`/oracles/${props.oracleSpecId}`) + ); + }); + + it('renders "-" if no spec value is found', async () => { + const props = createProps(); + const property = { + __typename: 'Property' as const, + name: 'no matching spec binding', + value: '1234', + }; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const mock = createMock(props.oracleSpecId!, property); + + render( + + + + ); + + expect(screen.getByText('-')).toBeInTheDocument(); + const link = await screen.findByRole('link'); + expect(link).toHaveTextContent('-'); + expect(link).toHaveAttribute( + 'href', + expect.stringContaining(`/oracles/${props.oracleSpecId}`) + ); + }); + + it('renders "-" with no link if oracle spec id is not provided', () => { + const props = createProps(); + props.oracleSpecId = undefined; + + render( + + + + ); + + expect(screen.getByText('-')).toBeInTheDocument(); + expect(screen.queryByRole('link')).not.toBeInTheDocument(); + }); +}); diff --git a/apps/trading/client-pages/markets/settlement-price-cell.tsx b/apps/trading/client-pages/markets/settlement-price-cell.tsx new file mode 100644 index 000000000..03cf6d6e8 --- /dev/null +++ b/apps/trading/client-pages/markets/settlement-price-cell.tsx @@ -0,0 +1,39 @@ +import { DApp, EXPLORER_ORACLE, useLinks } from '@vegaprotocol/environment'; +import { t } from '@vegaprotocol/i18n'; +import { useOracleSpecBindingData } from '@vegaprotocol/oracles'; +import { Link } from '@vegaprotocol/ui-toolkit'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; + +export interface SettlementPriceCellProps { + oracleSpecId: string | undefined; + decimalPlaces: number; + settlementDataSpecBinding: string | undefined; +} + +export const SettlementPriceCell = ({ + oracleSpecId, + decimalPlaces, + settlementDataSpecBinding, +}: SettlementPriceCellProps) => { + const linkCreator = useLinks(DApp.Explorer); + const { property, loading } = useOracleSpecBindingData( + oracleSpecId, + settlementDataSpecBinding + ); + + if (!oracleSpecId || loading) { + return -; + } + + return ( + + {property + ? addDecimalsFormatNumber(property.value, decimalPlaces) + : t('-')} + + ); +}; diff --git a/apps/trading/components/select-market/select-market.spec.tsx b/apps/trading/components/select-market/select-market.spec.tsx index e7fec9a86..4340bb1e5 100644 --- a/apps/trading/components/select-market/select-market.spec.tsx +++ b/apps/trading/components/select-market/select-market.spec.tsx @@ -39,7 +39,17 @@ const MARKET_A: PartialMarket = { symbol: 'ABC', }, dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, }, metadata: { @@ -115,7 +125,17 @@ const MARKET_B: PartialMarket = { symbol: 'XYZ', }, dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, }, metadata: { diff --git a/apps/trading/components/welcome-dialog/welcome-landing-dialog.spec.tsx b/apps/trading/components/welcome-dialog/welcome-landing-dialog.spec.tsx index 924aed57e..72f435a5e 100644 --- a/apps/trading/components/welcome-dialog/welcome-landing-dialog.spec.tsx +++ b/apps/trading/components/welcome-dialog/welcome-landing-dialog.spec.tsx @@ -41,7 +41,17 @@ const MARKET_A: PartialMarket = { symbol: 'ABC', }, dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, }, metadata: { @@ -117,7 +127,17 @@ const MARKET_B: PartialMarket = { symbol: 'XYZ', }, dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, }, metadata: { diff --git a/libs/cypress/mock.ts b/libs/cypress/mock.ts index 5a6a4df26..085659195 100644 --- a/libs/cypress/mock.ts +++ b/libs/cypress/mock.ts @@ -17,6 +17,7 @@ export * from '../market-list/src/lib/market-data.mock'; export * from '../market-list/src/lib/markets-candles.mock'; export * from '../market-list/src/lib/markets-data.mock'; export * from '../market-list/src/lib/markets.mock'; +export * from '../oracles/src/lib/oracle-spec-data-connection.mock'; export * from '../orders/src/lib/components/order-data-provider/orders.mock'; export * from '../positions/src/lib/positions.mock'; export * from '../react-helpers/src/hooks/network-params.mock'; diff --git a/libs/deal-ticket/src/test-helpers.ts b/libs/deal-ticket/src/test-helpers.ts index 4f69433fa..2357124e5 100644 --- a/libs/deal-ticket/src/test-helpers.ts +++ b/libs/deal-ticket/src/test-helpers.ts @@ -35,7 +35,17 @@ export function generateMarket(override?: PartialDeep): Market { __typename: 'Asset', }, dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, quoteName: 'BTC', __typename: 'Future', diff --git a/libs/environment/src/hooks/use-links.ts b/libs/environment/src/hooks/use-links.ts index 828c95771..674f29c46 100644 --- a/libs/environment/src/hooks/use-links.ts +++ b/libs/environment/src/hooks/use-links.ts @@ -100,6 +100,7 @@ export const TOKEN_VALIDATOR = '/validators/:id'; // Explorer pages export const EXPLORER_TX = '/txs/:hash'; +export const EXPLORER_ORACLE = '/oracles/:id'; // Etherscan pages export const ETHERSCAN_ADDRESS = '/address/:hash'; diff --git a/libs/fills/src/lib/test-helpers.ts b/libs/fills/src/lib/test-helpers.ts index b9cb91b1f..a9041ab18 100644 --- a/libs/fills/src/lib/test-helpers.ts +++ b/libs/fills/src/lib/test-helpers.ts @@ -78,7 +78,17 @@ export const generateFill = (override?: PartialDeep) => { }, quoteName: '', dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, }, }, diff --git a/libs/market-list/src/lib/__generated__/markets.ts b/libs/market-list/src/lib/__generated__/markets.ts index 58a8df387..e238c6f4b 100644 --- a/libs/market-list/src/lib/__generated__/markets.ts +++ b/libs/market-list/src/lib/__generated__/markets.ts @@ -3,12 +3,12 @@ import * as Types from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; const defaultOptions = {} as const; -export type MarketFieldsFragment = { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any } }; +export type MarketFieldsFragment = { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any } }; export type MarketsQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type MarketsQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any } } }> } | null }; +export type MarketsQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any } } }> } | null }; export const MarketFieldsFragmentDoc = gql` fragment MarketFields on Market { @@ -44,6 +44,13 @@ export const MarketFieldsFragmentDoc = gql` dataSourceSpecForTradingTermination { id } + dataSourceSpecForSettlementData { + id + } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } } } } diff --git a/libs/market-list/src/lib/markets-data.mock.ts b/libs/market-list/src/lib/markets-data.mock.ts index 99df096b3..39aab494e 100644 --- a/libs/market-list/src/lib/markets-data.mock.ts +++ b/libs/market-list/src/lib/markets-data.mock.ts @@ -25,8 +25,10 @@ export const marketsDataQuery = ( return merge(defaultResult, override); }; -const marketsDataFieldsFragments: MarketsDataFieldsFragment[] = [ - { +export const createMarketsDataFragment = ( + override?: PartialDeep +): MarketsDataFieldsFragment => { + const defaultResult = { market: { id: 'market-0', __typename: 'Market', @@ -42,56 +44,28 @@ const marketsDataFieldsFragments: MarketsDataFieldsFragment[] = [ markPrice: '4612690058', trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, __typename: 'MarketData', - }, - { + }; + return merge(defaultResult, override); +}; + +const marketsDataFieldsFragments: MarketsDataFieldsFragment[] = [ + createMarketsDataFragment(), + createMarketsDataFragment({ market: { id: 'market-1', - __typename: 'Market', }, - marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, - staticMidPrice: '0', - indicativePrice: '0', - bestStaticBidPrice: '0', - bestStaticOfferPrice: '0', - indicativeVolume: '0', - bestBidPrice: '0', - bestOfferPrice: '0', markPrice: '8441', - trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, - __typename: 'MarketData', - }, - { + }), + createMarketsDataFragment({ market: { id: 'market-2', - __typename: 'Market', }, - marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, - staticMidPrice: '0', - indicativePrice: '0', - bestStaticBidPrice: '0', - bestStaticOfferPrice: '0', - indicativeVolume: '0', - bestBidPrice: '0', - bestOfferPrice: '0', - markPrice: '4612690058', trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET, - __typename: 'MarketData', - }, - { + }), + createMarketsDataFragment({ market: { id: 'market-3', - __typename: 'Market', }, - marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, - staticMidPrice: '0', - indicativePrice: '0', - bestStaticBidPrice: '0', - bestStaticOfferPrice: '0', - indicativeVolume: '0', - bestBidPrice: '0', - bestOfferPrice: '0', - markPrice: '4612690058', trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET, - __typename: 'MarketData', - }, + }), ]; diff --git a/libs/market-list/src/lib/markets-provider.ts b/libs/market-list/src/lib/markets-provider.ts index 253d973ec..ebe2845a4 100644 --- a/libs/market-list/src/lib/markets-provider.ts +++ b/libs/market-list/src/lib/markets-provider.ts @@ -13,7 +13,7 @@ import type { MarketData } from './market-data-provider'; import type { MarketCandles } from './markets-candles-provider'; import { useMemo } from 'react'; import * as Schema from '@vegaprotocol/types'; -import { filterAndSortMarkets } from './utils'; +import { filterAndSortClosedMarkets, filterAndSortMarkets } from './utils'; import { MarketsDocument } from './__generated__/markets'; import type { Candle } from './market-candles-provider'; @@ -72,6 +72,11 @@ export const activeMarketsProvider = makeDerivedDataProvider( ([markets]) => filterAndSortMarkets(markets) ); +export const closedMarketsProvider = makeDerivedDataProvider( + [marketsProvider], + ([markets]) => filterAndSortClosedMarkets(markets) +); + export type MarketMaybeWithCandles = Market & { candles?: Candle[] }; const addCandles = ( @@ -111,6 +116,13 @@ export const marketsWithDataProvider = makeDerivedDataProvider< addData(parts[0] as Market[], parts[1] as MarketData[]) ); +export const closedMarketsWithDataProvider = makeDerivedDataProvider< + MarketMaybeWithData[], + never +>([closedMarketsProvider, marketsDataProvider], (parts) => + addData(parts[0] as Market[], parts[1] as MarketData[]) +); + export type MarketMaybeWithDataAndCandles = MarketMaybeWithData & MarketMaybeWithCandles; diff --git a/libs/market-list/src/lib/markets.graphql b/libs/market-list/src/lib/markets.graphql index 445f6a90c..334023978 100644 --- a/libs/market-list/src/lib/markets.graphql +++ b/libs/market-list/src/lib/markets.graphql @@ -31,6 +31,13 @@ fragment MarketFields on Market { dataSourceSpecForTradingTermination { id } + dataSourceSpecForSettlementData { + id + } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } } } } diff --git a/libs/market-list/src/lib/markets.mock.ts b/libs/market-list/src/lib/markets.mock.ts index 02d4cf013..e8b5ca485 100644 --- a/libs/market-list/src/lib/markets.mock.ts +++ b/libs/market-list/src/lib/markets.mock.ts @@ -22,8 +22,10 @@ export const marketsQuery = ( return merge(defaultResult, override); }; -const marketFieldsFragments: MarketFieldsFragment[] = [ - { +export const createMarketFragment = ( + override?: PartialDeep +): MarketFieldsFragment => { + const defaultFragment = { id: 'market-0', decimalPlaces: 5, positionDecimalPlaces: 0, @@ -61,8 +63,18 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ __typename: 'Asset', }, dataSourceSpecForTradingTermination: { + __typename: 'DataSourceSpec', id: 'oracleId', }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', + }, quoteName: 'DAI', __typename: 'Future', }, @@ -71,36 +83,20 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ __typename: 'TradableInstrument', }, __typename: 'Market', - }, - { + }; + + return merge(defaultFragment, override); +}; + +const marketFieldsFragments: MarketFieldsFragment[] = [ + createMarketFragment({ id: 'market-0' }), + createMarketFragment({ id: 'market-1', decimalPlaces: 2, - positionDecimalPlaces: 0, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, - state: Schema.MarketState.STATE_ACTIVE, - marketTimestamps: { - __typename: 'MarketTimestamps', - close: '', - open: '', - }, - fees: { - __typename: 'Fees', - factors: { - __typename: 'FeeFactors', - makerFee: '', - infrastructureFee: '', - liquidityFee: '', - }, - }, tradableInstrument: { instrument: { - id: 'SOLUSD', name: 'SUSPENDED MARKET', code: 'SOLUSD', - metadata: { - __typename: 'InstrumentMetadata', - tags: [], - }, product: { settlementAsset: { id: 'asset-1', @@ -109,33 +105,19 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ decimals: 5, __typename: 'Asset', }, - dataSourceSpecForTradingTermination: { - id: 'oracleId', - }, - quoteName: 'USD', - __typename: 'Future', }, - __typename: 'Instrument', }, - __typename: 'TradableInstrument', }, - __typename: 'Market', - }, - { + }), + createMarketFragment({ id: 'market-2', - decimalPlaces: 5, - positionDecimalPlaces: 0, tradingMode: Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, state: Schema.MarketState.STATE_SUSPENDED, marketTimestamps: { - __typename: 'MarketTimestamps', close: '2022-08-26T11:36:32.252490405Z', - open: null, }, fees: { - __typename: 'Fees', factors: { - __typename: 'FeeFactors', makerFee: '0.0002', infrastructureFee: '0.0005', liquidityFee: '0.001', @@ -143,13 +125,8 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ }, tradableInstrument: { instrument: { - id: '', code: 'AAPL.MF21', name: 'Apple Monthly (30 Jun 2022)', - metadata: { - __typename: 'InstrumentMetadata', - tags: [], - }, product: { settlementAsset: { id: 'asset-2', @@ -158,33 +135,18 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ decimals: 5, __typename: 'Asset', }, - dataSourceSpecForTradingTermination: { - id: 'oracleId', - }, quoteName: 'USDC', - __typename: 'Future', }, - __typename: 'Instrument', }, - __typename: 'TradableInstrument', }, - __typename: 'Market', - }, - { + }), + createMarketFragment({ id: 'market-3', - decimalPlaces: 5, - positionDecimalPlaces: 0, - tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, - state: Schema.MarketState.STATE_ACTIVE, marketTimestamps: { - __typename: 'MarketTimestamps', close: '2022-08-26T11:36:32.252490405Z', - open: null, }, fees: { - __typename: 'Fees', factors: { - __typename: 'FeeFactors', makerFee: '0.0002', infrastructureFee: '0.0005', liquidityFee: '0.001', @@ -192,13 +154,8 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ }, tradableInstrument: { instrument: { - id: '', code: 'ETHBTC.QM21', name: 'ETHBTC Quarterly (30 Jun 2022)', - metadata: { - __typename: 'InstrumentMetadata', - tags: [], - }, product: { settlementAsset: { id: 'asset-3', @@ -207,16 +164,9 @@ const marketFieldsFragments: MarketFieldsFragment[] = [ decimals: 5, __typename: 'Asset', }, - dataSourceSpecForTradingTermination: { - id: 'oracleId', - }, quoteName: 'BTC', - __typename: 'Future', }, - __typename: 'Instrument', }, - __typename: 'TradableInstrument', }, - __typename: 'Market', - }, + }), ]; diff --git a/libs/market-list/src/lib/utils/market-utils.ts b/libs/market-list/src/lib/utils/market-utils.ts index e58fc86c1..2af9ec6c0 100644 --- a/libs/market-list/src/lib/utils/market-utils.ts +++ b/libs/market-list/src/lib/utils/market-utils.ts @@ -43,6 +43,15 @@ export const filterAndSortMarkets = (markets: Market[]) => { ); }; +export const filterAndSortClosedMarkets = (markets: Market[]) => { + return markets.filter((m) => { + return [ + MarketState.STATE_SETTLED, + MarketState.STATE_TRADING_TERMINATED, + ].includes(m.state); + }); +}; + export const calcCandleLow = (candles: Candle[]): string | undefined => { return candles ?.reduce((acc: BigNumber, c) => { diff --git a/libs/oracles/.eslintrc.json b/libs/oracles/.eslintrc.json index 734ddacee..de2a9b877 100644 --- a/libs/oracles/.eslintrc.json +++ b/libs/oracles/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/oracles/src/index.ts b/libs/oracles/src/index.ts index ecc267fe3..75a4b1258 100644 --- a/libs/oracles/src/index.ts +++ b/libs/oracles/src/index.ts @@ -1,2 +1,4 @@ export * from './lib/oracle-schema'; export * from './lib/use-oracle-proofs'; +export * from './lib/use-oracle-spec-binding-data'; +export * from './lib/__generated__/OracleSpecDataConnection'; diff --git a/libs/oracles/src/lib/OracleSpecDataConnection.graphql b/libs/oracles/src/lib/OracleSpecDataConnection.graphql new file mode 100644 index 000000000..3fe50d671 --- /dev/null +++ b/libs/oracles/src/lib/OracleSpecDataConnection.graphql @@ -0,0 +1,18 @@ +query OracleSpecDataConnection($oracleSpecId: ID!) { + oracleSpec(oracleSpecId: $oracleSpecId) { + dataConnection { + edges { + node { + externalData { + data { + data { + name + value + } + } + } + } + } + } + } +} diff --git a/libs/oracles/src/lib/__generated__/OracleSpecDataConnection.ts b/libs/oracles/src/lib/__generated__/OracleSpecDataConnection.ts new file mode 100644 index 000000000..c977be66d --- /dev/null +++ b/libs/oracles/src/lib/__generated__/OracleSpecDataConnection.ts @@ -0,0 +1,61 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type OracleSpecDataConnectionQueryVariables = Types.Exact<{ + oracleSpecId: Types.Scalars['ID']; +}>; + + +export type OracleSpecDataConnectionQuery = { __typename?: 'Query', oracleSpec?: { __typename?: 'OracleSpec', dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } } | null }; + + +export const OracleSpecDataConnectionDocument = gql` + query OracleSpecDataConnection($oracleSpecId: ID!) { + oracleSpec(oracleSpecId: $oracleSpecId) { + dataConnection { + edges { + node { + externalData { + data { + data { + name + value + } + } + } + } + } + } + } +} + `; + +/** + * __useOracleSpecDataConnectionQuery__ + * + * To run a query within a React component, call `useOracleSpecDataConnectionQuery` and pass it any options that fit your needs. + * When your component renders, `useOracleSpecDataConnectionQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useOracleSpecDataConnectionQuery({ + * variables: { + * oracleSpecId: // value for 'oracleSpecId' + * }, + * }); + */ +export function useOracleSpecDataConnectionQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(OracleSpecDataConnectionDocument, options); + } +export function useOracleSpecDataConnectionLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(OracleSpecDataConnectionDocument, options); + } +export type OracleSpecDataConnectionQueryHookResult = ReturnType; +export type OracleSpecDataConnectionLazyQueryHookResult = ReturnType; +export type OracleSpecDataConnectionQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/oracles/src/lib/oracle-spec-data-connection.mock.ts b/libs/oracles/src/lib/oracle-spec-data-connection.mock.ts new file mode 100644 index 000000000..3341ec9ce --- /dev/null +++ b/libs/oracles/src/lib/oracle-spec-data-connection.mock.ts @@ -0,0 +1,38 @@ +import merge from 'lodash/merge'; +import type { PartialDeep } from 'type-fest'; +import type { OracleSpecDataConnectionQuery } from './__generated__/OracleSpecDataConnection'; +import type { OracleData } from '@vegaprotocol/types'; + +export function createDataConnection( + override?: PartialDeep +): OracleData { + const defaultDataConnection = { + externalData: { + data: { + broadcastAt: new Date().toISOString(), + data: [ + { + name: 'settlement-data-property', + value: '100', + }, + ], + }, + }, + }; + + return merge(defaultDataConnection, override); +} + +export function oracleSpecDataConnectionQuery( + override?: PartialDeep +): OracleSpecDataConnectionQuery { + const defaultResult = { + oracleSpec: { + dataConnection: { + edges: [{ node: createDataConnection() }], + }, + }, + }; + + return merge(defaultResult, override); +} diff --git a/libs/oracles/src/lib/use-oracle-spec-binding-data.spec.tsx b/libs/oracles/src/lib/use-oracle-spec-binding-data.spec.tsx new file mode 100644 index 000000000..57c19d63e --- /dev/null +++ b/libs/oracles/src/lib/use-oracle-spec-binding-data.spec.tsx @@ -0,0 +1,105 @@ +import { renderHook, waitFor } from '@testing-library/react'; +import type { MockedResponse } from '@apollo/client/testing'; +import { MockedProvider } from '@apollo/client/testing'; +import type { ReactNode } from 'react'; +import { useOracleSpecBindingData } from './use-oracle-spec-binding-data'; +import type { Property } from '@vegaprotocol/types'; +import type { OracleSpecDataConnectionQuery } from './__generated__/OracleSpecDataConnection'; +import { OracleSpecDataConnectionDocument } from './__generated__/OracleSpecDataConnection'; + +describe('useSettlementPrice', () => { + const setup = ( + oracleSpecId: string, + specBinding: string, + mocks: MockedResponse[] + ) => { + const wrapper = ({ children }: { children: ReactNode }) => ( + {children} + ); + return renderHook( + () => useOracleSpecBindingData(oracleSpecId, specBinding), + { + wrapper, + } + ); + }; + const createMock = ( + id: string, + property: Property + ): MockedResponse => { + return { + request: { + query: OracleSpecDataConnectionDocument, + variables: { + oracleSpecId: id, + }, + }, + result: { + data: { + oracleSpec: { + dataConnection: { + edges: [ + { + node: { + externalData: { + data: { + data: [property], + }, + }, + }, + }, + ], + }, + }, + }, + }, + }; + }; + + it('should returns the matching value for the spec binding', async () => { + const oracleSpecId = 'oracle-spec-id'; + const specBinding = 'spec-binding'; + const value = '123456'; + const property = { + __typename: 'Property' as const, + name: specBinding, + value, + }; + const mock = createMock(oracleSpecId, property); + + const { result } = setup(oracleSpecId, specBinding, [mock]); + + expect(result.current.property).toEqual(undefined); + expect(result.current.data).toBe(undefined); + expect(result.current.loading).toBe(true); + expect(result.current.error).toBe(undefined); + + await waitFor(() => { + expect(result.current.property).toEqual(property); + expect(result.current.loading).toBe(false); + }); + }); + + it('returns nothing if matching poperty not found', async () => { + const oracleSpecId = 'oracle-spec-id'; + const specBinding = 'spec-binding'; + const value = '123456'; + const property = { + __typename: 'Property' as const, + name: 'does not match', + value, + }; + const mock = createMock(oracleSpecId, property); + + const { result } = setup(oracleSpecId, specBinding, [mock]); + expect(result.current.property).toEqual(undefined); + expect(result.current.data).toBe(undefined); + expect(result.current.loading).toBe(true); + expect(result.current.error).toBe(undefined); + + await waitFor(() => { + expect(result.current.property).toEqual(undefined); + expect(result.current.loading).toBe(false); + }); + }); +}); diff --git a/libs/oracles/src/lib/use-oracle-spec-binding-data.ts b/libs/oracles/src/lib/use-oracle-spec-binding-data.ts new file mode 100644 index 000000000..fa9afac50 --- /dev/null +++ b/libs/oracles/src/lib/use-oracle-spec-binding-data.ts @@ -0,0 +1,26 @@ +import { useOracleSpecDataConnectionQuery } from './__generated__/OracleSpecDataConnection'; + +export const useOracleSpecBindingData = ( + oracleSpecId: string | undefined, + specBinding: string | undefined +) => { + const { data, loading, error } = useOracleSpecDataConnectionQuery({ + variables: { + oracleSpecId: oracleSpecId || '', + }, + skip: !oracleSpecId, + }); + + const dataConnectionEdges = data?.oracleSpec?.dataConnection.edges; + const firstDataConnection = dataConnectionEdges?.[0]?.node; + const property = firstDataConnection?.externalData.data.data?.find( + (d) => d.name === specBinding + ); + + return { + property, + data, + loading, + error, + }; +}; diff --git a/libs/oracles/tsconfig.spec.json b/libs/oracles/tsconfig.spec.json index ff08addd6..e13a2c78f 100644 --- a/libs/oracles/tsconfig.spec.json +++ b/libs/oracles/tsconfig.spec.json @@ -15,6 +15,7 @@ "**/*.spec.js", "**/*.test.jsx", "**/*.spec.jsx", - "**/*.d.ts" + "**/*.d.ts", + "src/lib/use-oracle-spec-binding-data.spec.tsx" ] } diff --git a/libs/orders/src/lib/components/mocks/generate-orders.ts b/libs/orders/src/lib/components/mocks/generate-orders.ts index 9b033885c..a84ec7033 100644 --- a/libs/orders/src/lib/components/mocks/generate-orders.ts +++ b/libs/orders/src/lib/components/mocks/generate-orders.ts @@ -49,7 +49,17 @@ export const generateOrder = (partialOrder?: PartialDeep) => { name: 'XYZ', }, dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, }, }, diff --git a/libs/withdraws/src/lib/withdraw-form-container.spec.tsx b/libs/withdraws/src/lib/withdraw-form-container.spec.tsx index c1e625909..5ca9483e9 100644 --- a/libs/withdraws/src/lib/withdraw-form-container.spec.tsx +++ b/libs/withdraws/src/lib/withdraw-form-container.spec.tsx @@ -148,7 +148,17 @@ describe('WithdrawFormContainer', () => { decimals: 5, }, dataSourceSpecForTradingTermination: { - id: '', + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', + id: 'oracleId', + }, + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', + tradingTerminationProperty: 'trading-termination-property', + settlementDataProperty: 'settlement-data-property', }, quoteName: 'USD', }, diff --git a/package.json b/package.json index 35ba287e7..d2003915a 100644 --- a/package.json +++ b/package.json @@ -195,7 +195,7 @@ "ts-jest": "27.1.4", "ts-node": "10.9.1", "tslib": "^2.0.0", - "type-fest": "^2.12.2", + "type-fest": "^3.8.0", "typescript": "^5.0.4", "url-loader": "^3.0.0" }, diff --git a/yarn.lock b/yarn.lock index 0bfb9d0d5..d456252e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23637,10 +23637,10 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-fest@^2.12.2: - version "2.19.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" - integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== +type-fest@^3.8.0: + version "3.8.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.8.0.tgz#ce80d1ca7c7d11c5540560999cbd410cb5b3a385" + integrity sha512-FVNSzGQz9Th+/9R6Lvv7WIAkstylfHN2/JYxkyhhmKFYh9At2DST8t6L6Lref9eYO8PXFTfG9Sg1Agg0K3vq3Q== type-is@~1.6.18: version "1.6.18" From a4f41eabb6e1ca7fb7e5fe925bf00ebdda902b06 Mon Sep 17 00:00:00 2001 From: dexturr Date: Tue, 2 May 2023 18:09:46 +0000 Subject: [PATCH 30/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index e19da81e3..dbd5a5d7c 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "11220.861086998456172475", + "locked_amount": "11059.8716106288557203875", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "1691.19907407407385", + "locked_amount": "1569.7173148148150604", "deposits": [ { "amount": "111", @@ -4703,7 +4703,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51404.799340902463537955", + "locked_amount": "51345.2025208637158034647", "deposits": [ { "amount": "86666.297", @@ -4769,7 +4769,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "405.14028795278795", + "locked_amount": "401.6925493487994", "deposits": [ { "amount": "2500", @@ -4802,7 +4802,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14877.245621980677014877245621980677", + "locked_amount": "14856.784042874397014856784042874397", "deposits": [ { "amount": "1.5e-14", @@ -4890,7 +4890,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11555.1561241948475", + "locked_amount": "11531.2842819041875", "deposits": [ { "amount": "12500", @@ -5157,7 +5157,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18748.80102823818", + "locked_amount": "18696.7992249846525", "deposits": [ { "amount": "7500", @@ -5565,7 +5565,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51357.898929503744408733", + "locked_amount": "51298.356484064521076805", "deposits": [ { "amount": "129999.45", @@ -5598,7 +5598,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49483.90980760125352528846", + "locked_amount": "49446.77842598627044105244", "deposits": [ { "amount": "54144.7663", @@ -5631,7 +5631,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21180.103373921867602", + "locked_amount": "21137.055948756977236", "deposits": [ { "amount": "10000", @@ -5824,7 +5824,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1883.48236935565685", + "locked_amount": "1880.04407661085725", "deposits": [ { "amount": "5000", @@ -6882,7 +6882,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "162072.8469934678874854318", + "locked_amount": "160738.8386585907252020642", "deposits": [ { "amount": "1852091.69", @@ -40754,7 +40754,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "273550.862786203377517877189", + "locked_amount": "271500.956427869947647461593", "deposits": [ { "amount": "1998.95815", @@ -42147,7 +42147,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "866687.25765937723884852", - "locked_amount": "6269681.38143663317600286992855265041416594", + "locked_amount": "6262412.5451065502253329937129099416653149", "deposits": [ { "amount": "16249.93", @@ -48725,7 +48725,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6167911.210808830654624182", - "locked_amount": "66684.5927583919648233980957995734", + "locked_amount": "59974.04947041707925080152290790785", "deposits": [ { "amount": "129284.449", @@ -58802,7 +58802,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "43345.697891869583547956391273456", + "locked_amount": "43020.878511627320456269410857424", "deposits": [ { "amount": "3000", From 5a73b7e7699bca80fc7bfddc609afe7841e657ad Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 2 May 2023 14:01:33 -0700 Subject: [PATCH 31/42] feat(trading): add generic welcome message for non mainnet networks (#3584) --- .../client-pages/settings/settings.tsx | 6 +- apps/trading/components/constants.ts | 2 +- .../risk-notice-dialog.spec.tsx | 39 ++++---- .../welcome-dialog/risk-notice-dialog.tsx | 99 ++++++++++++++++--- .../telemetry-approval.spec.tsx | 5 +- .../welcome-dialog/telemetry-approval.tsx | 14 +-- .../welcome-dialog/welcome-dialog.tsx | 9 +- 7 files changed, 126 insertions(+), 48 deletions(-) diff --git a/apps/trading/client-pages/settings/settings.tsx b/apps/trading/client-pages/settings/settings.tsx index cb14ffde2..6a9dd38d0 100644 --- a/apps/trading/client-pages/settings/settings.tsx +++ b/apps/trading/client-pages/settings/settings.tsx @@ -36,7 +36,11 @@ export const Settings = () => { />
- +
diff --git a/apps/trading/components/constants.ts b/apps/trading/components/constants.ts index 5a41d2910..3aa00c63d 100644 --- a/apps/trading/components/constants.ts +++ b/apps/trading/components/constants.ts @@ -1,6 +1,6 @@ import { t } from '@vegaprotocol/i18n'; export const THROTTLE_UPDATE_TIME = 500; -export const RISK_ACCEPTED_KEY = 'vega-risk-accepted'; +export const RISK_ACCEPTED_KEY = 'vega_risk_accepted'; export const MAINNET_WELCOME_HEADER = t( 'Trade cash settled futures on the fully decentralised Vega network.' ); diff --git a/apps/trading/components/welcome-dialog/risk-notice-dialog.spec.tsx b/apps/trading/components/welcome-dialog/risk-notice-dialog.spec.tsx index 9b476130b..c4a9af049 100644 --- a/apps/trading/components/welcome-dialog/risk-notice-dialog.spec.tsx +++ b/apps/trading/components/welcome-dialog/risk-notice-dialog.spec.tsx @@ -1,9 +1,6 @@ -import { BrowserRouter } from 'react-router-dom'; import { render, screen, fireEvent } from '@testing-library/react'; -import { MockedProvider } from '@apollo/client/testing'; import { Networks, useEnvironment } from '@vegaprotocol/environment'; import { RiskNoticeDialog } from './risk-notice-dialog'; -import { WelcomeDialog } from './welcome-dialog'; jest.mock('@vegaprotocol/environment'); @@ -14,7 +11,6 @@ const mockEnvDefinitions = { }; describe('Risk notice dialog', () => { - const introText = 'Regulation may apply to use of this app'; const mockOnClose = jest.fn(); afterEach(() => { jest.clearAllMocks(); @@ -22,13 +18,12 @@ describe('Risk notice dialog', () => { it.each` assertion | network - ${'displays'} | ${Networks.MAINNET} ${'displays'} | ${Networks.CUSTOM} ${'displays'} | ${Networks.DEVNET} ${'displays'} | ${Networks.STAGNET3} ${'displays'} | ${Networks.TESTNET} `( - '$assertion the risk notice on $network', + '$assertion a generic message on $network', async ({ assertion, network }) => { // @ts-ignore ignore mock implementation useEnvironment.mockImplementation(() => ({ @@ -36,27 +31,37 @@ describe('Risk notice dialog', () => { VEGA_ENV: network, })); - render( - - - , - { wrapper: BrowserRouter } - ); + render(); - expect(screen.queryByText(introText)).toBeInTheDocument(); + expect( + screen.getByText( + new RegExp( + `This application for trading on Vega is connected to ${network}` + ) + ) + ).toBeInTheDocument(); + + const button = screen.getByRole('button', { + name: 'Continue', + }); + fireEvent.click(button); + expect(mockOnClose).toHaveBeenCalled(); } ); - it("doesn't display the risk notice when previously acknowledged", () => { + it('displays a risk message for mainnet', () => { + const introText = 'Regulation may apply to use of this app'; + const network = Networks.MAINNET; + // @ts-ignore ignore mock implementation useEnvironment.mockImplementation(() => ({ ...mockEnvDefinitions, - VEGA_ENV: Networks.MAINNET, + VEGA_ENV: network, })); - render(); + render(); - expect(screen.queryByText(introText)).toBeInTheDocument(); + expect(screen.getByText(introText)).toBeInTheDocument(); const button = screen.getByRole('button', { name: 'I understand, Continue', diff --git a/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx b/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx index 6c5531b2b..57e9bda43 100644 --- a/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx +++ b/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx @@ -1,25 +1,100 @@ -import { useCallback } from 'react'; import { t } from '@vegaprotocol/i18n'; -import { Button } from '@vegaprotocol/ui-toolkit'; -import { LocalStorage } from '@vegaprotocol/utils'; +import { + Button, + Link, + VegaIcon, + VegaIconNames, +} from '@vegaprotocol/ui-toolkit'; import { RISK_ACCEPTED_KEY } from '../constants'; import { TelemetryApproval } from './telemetry-approval'; +import { Networks, useEnvironment } from '@vegaprotocol/environment'; +import { useLocalStorage } from '@vegaprotocol/react-helpers'; interface Props { onClose: () => void; + network: Networks; } -export const RiskNoticeDialog = ({ onClose }: Props) => { - const handleAcceptRisk = useCallback(() => { - onClose(); - LocalStorage.setItem(RISK_ACCEPTED_KEY, 'true'); - }, [onClose]); +export const RiskNoticeDialog = ({ onClose, network }: Props) => { + const [, setValue] = useLocalStorage(RISK_ACCEPTED_KEY); + const handleAcceptRisk = () => { + onClose(); + setValue('true'); + }; + + return ( + <> + {network === Networks.MAINNET ? ( + + ) : ( + + )} +
+ +
+ + + ); +}; + +const TestnetContent = ({ network }: { network: Networks }) => { + const { VEGA_DOCS_URL, GITHUB_FEEDBACK_URL, VEGA_WALLET_URL } = + useEnvironment(); + return ( + <> +

+ {t( + 'This application for trading on Vega is connected to %s, meaning you are free to try out trading with virtual assets and no risk.', + [network] + )} +

+

+ {t( + 'Your Vega wallet must also be connected to %s, and your Ethereum wallet must be connected to Sepolia.', + [network] + )} +

+ {VEGA_DOCS_URL && GITHUB_FEEDBACK_URL && VEGA_WALLET_URL && ( +
    +
  • + + {t('Learn about Vega wallet')}{' '} + + +
  • +
  • + + {t('View documentation')}{' '} + + +
  • +
  • + + {t('Provide feedback')}{' '} + + +
  • +
+ )} + + ); +}; + +const MainnetContent = () => { return ( <>

{t('Regulation may apply to use of this app')}

-

+

{t( 'This decentralised application allows you to connect to and use publicly available blockchain services operated by third parties that may include trading, financial products, or other services that may be subject to legal and regulatory restrictions in your jurisdiction. This application is a front end only and does not hold any funds or provide any products or services. It is available to anyone with an internet connection via IPFS and other methods, and the ability to access it does not imply any right to use any services or that it is legal for you to do so. By using this application you accept that it is your responsibility to ensure that your use of the application and any blockchain services accessed through it is compliant with applicable laws and regulations in your jusrisdiction.' )} @@ -27,15 +102,11 @@ export const RiskNoticeDialog = ({ onClose }: Props) => {

{t('Technical and financial risk of loss')}

-

+

{t( 'The public blockchain services accessible via this decentralised application are operated by third parties and may carry significant risks including the potential loss of all funds that you deposit or hold with these services. Technical risks include the risk of loss in the event of the failure or compromise of the public blockchain infrastructure or smart contracts that provide any services you use. Financial risks include but are not limited to losses due to volatility, excessive leverage, low liquidity, and your own lack of understanding of the services you use. By using this decentralised application you accept that it is your responsibility to ensure that you understand any services you use and the technical and financial risks inherent in your use. Do not risk what you cannot afford to lose.' )}

- -
- -
); }; diff --git a/apps/trading/components/welcome-dialog/telemetry-approval.spec.tsx b/apps/trading/components/welcome-dialog/telemetry-approval.spec.tsx index dc5ff93a9..3061845aa 100644 --- a/apps/trading/components/welcome-dialog/telemetry-approval.spec.tsx +++ b/apps/trading/components/welcome-dialog/telemetry-approval.spec.tsx @@ -3,7 +3,8 @@ import { TelemetryApproval } from './telemetry-approval'; describe('TelemetryApproval', () => { it('click on checkbox should be properly handled', () => { - render(); + const helpText = 'My help text'; + render(); expect(screen.getByRole('checkbox')).toHaveAttribute( 'data-state', 'unchecked' @@ -15,5 +16,7 @@ describe('TelemetryApproval', () => { 'data-state', 'checked' ); + expect(screen.getByText('Share usage data')).toBeInTheDocument(); + expect(screen.getByText(helpText)).toBeInTheDocument(); }); }); diff --git a/apps/trading/components/welcome-dialog/telemetry-approval.tsx b/apps/trading/components/welcome-dialog/telemetry-approval.tsx index e4464418e..4dbee1cfe 100644 --- a/apps/trading/components/welcome-dialog/telemetry-approval.tsx +++ b/apps/trading/components/welcome-dialog/telemetry-approval.tsx @@ -2,11 +2,7 @@ import { Checkbox } from '@vegaprotocol/ui-toolkit'; import { t } from '@vegaprotocol/i18n'; import { useTelemetryApproval } from '../../lib/hooks/use-telemetry-approval'; -export const TelemetryApproval = ({ - isSettingsPage, -}: { - isSettingsPage?: boolean; -}) => { +export const TelemetryApproval = ({ helpText }: { helpText: string }) => { const [isApproved, setIsApproved] = useTelemetryApproval(); return (
@@ -19,13 +15,7 @@ export const TelemetryApproval = ({ />
- - {t( - 'Help identify bugs and improve the service by sharing anonymous usage data.' - )} - {!isSettingsPage && - ' ' + t('You can change this in your settings at any time.')} - + {helpText}
); diff --git a/apps/trading/components/welcome-dialog/welcome-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-dialog.tsx index 722f02c1a..dd48ed2eb 100644 --- a/apps/trading/components/welcome-dialog/welcome-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-dialog.tsx @@ -9,8 +9,11 @@ import { RiskNoticeDialog } from './risk-notice-dialog'; import { WelcomeNoticeDialog } from './welcome-notice-dialog'; import { WelcomeLandingDialog } from './welcome-landing-dialog'; import { useGlobalStore } from '../../stores'; +import { useEnvironment } from '@vegaprotocol/environment'; +import { Networks } from '@vegaprotocol/environment'; export const WelcomeDialog = () => { + const { VEGA_ENV } = useEnvironment(); const { pathname } = useLocation(); let dialogContent: React.ReactNode; let title = ''; @@ -33,8 +36,10 @@ export const WelcomeDialog = () => { }, [update, isRiskDialogNeeded]); if (isRiskDialogNeeded) { - dialogContent = ; - title = t('WARNING'); + dialogContent = ( + + ); + title = VEGA_ENV === Networks.MAINNET ? t('WARNING') : t('Vega Console'); size = 'medium'; } else if (isWelcomeDialogNeeded && data?.length === 0) { dialogContent = ; From cd969549ab83c6a93b340e44f0c65b6c36f293ee Mon Sep 17 00:00:00 2001 From: dexturr Date: Wed, 3 May 2023 00:13:45 +0000 Subject: [PATCH 32/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 49 ++++++++++++-------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index dbd5a5d7c..657cd95d8 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "11059.8716106288557203875", + "locked_amount": "10897.75373804012412195", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "1569.7173148148150604", + "locked_amount": "1447.384074074074092", "deposits": [ { "amount": "111", @@ -4703,7 +4703,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51345.2025208637158034647", + "locked_amount": "51285.1879789469814740392", "deposits": [ { "amount": "86666.297", @@ -4769,7 +4769,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "401.6925493487994", + "locked_amount": "398.2206450956452", "deposits": [ { "amount": "2500", @@ -4802,7 +4802,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14856.784042874397014856784042874397", + "locked_amount": "14836.1790458937195148361790458937195", "deposits": [ { "amount": "1.5e-14", @@ -4890,7 +4890,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11531.2842819041875", + "locked_amount": "11507.24511876006375", "deposits": [ { "amount": "12500", @@ -5157,7 +5157,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18696.7992249846525", + "locked_amount": "18644.4329343155325", "deposits": [ { "amount": "7500", @@ -5565,7 +5565,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51298.356484064521076805", + "locked_amount": "51238.396697865980858325", "deposits": [ { "amount": "129999.45", @@ -5598,7 +5598,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49446.77842598627044105244", + "locked_amount": "49409.38678567878513785191", "deposits": [ { "amount": "54144.7663", @@ -5631,7 +5631,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21137.055948756977236", + "locked_amount": "21093.70679857940184", "deposits": [ { "amount": "10000", @@ -5824,7 +5824,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1880.04407661085725", + "locked_amount": "1876.58168442415", "deposits": [ { "amount": "5000", @@ -6882,7 +6882,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "160738.8386585907252020642", + "locked_amount": "159395.480085454013995997", "deposits": [ { "amount": "1852091.69", @@ -40754,7 +40754,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "271500.956427869947647461593", + "locked_amount": "269436.682008738382980312835", "deposits": [ { "amount": "1998.95815", @@ -42147,7 +42147,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "866687.25765937723884852", - "locked_amount": "6262412.5451065502253329937129099416653149", + "locked_amount": "6255092.7605553962497458068608386305893485", "deposits": [ { "amount": "16249.93", @@ -48724,8 +48724,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "6167911.210808830654624182", - "locked_amount": "59974.04947041707925080152290790785", + "total_removed": "6168897.174282186485373182", + "locked_amount": "53216.4711100568717726007485005767", "deposits": [ { "amount": "129284.449", @@ -48979,6 +48979,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x2c531bd9c61e0a3705f161bba2c03703722f1e41533725684fcccb9176117e0e" }, + { + "amount": "985.963473355830749", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x53d67a8df4d069f956ae1eb76d5e099642dcc8d7e40fa9357be0b8ae879b90c4" + }, { "amount": "1360.32447632896938825", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -52315,6 +52320,12 @@ "tranche_id": 3, "tx": "0x2c531bd9c61e0a3705f161bba2c03703722f1e41533725684fcccb9176117e0e" }, + { + "amount": "985.963473355830749", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x53d67a8df4d069f956ae1eb76d5e099642dcc8d7e40fa9357be0b8ae879b90c4" + }, { "amount": "1360.32447632896938825", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -55137,8 +55148,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "356806.4980412878832315", - "remaining_tokens": "2316.9715337121167685" + "withdrawn_tokens": "357792.4615146437139805", + "remaining_tokens": "1331.0080603562860195" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -58802,7 +58813,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "43020.878511627320456269410857424", + "locked_amount": "42693.782430020278413924185793996", "deposits": [ { "amount": "3000", From 4a4cdaa2b8356ada09540e0cfdf246da1f3ed222 Mon Sep 17 00:00:00 2001 From: dexturr Date: Wed, 3 May 2023 06:07:16 +0000 Subject: [PATCH 33/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 49 ++++++++++++-------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 657cd95d8..a8404b603 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "10897.75373804012412195", + "locked_amount": "10740.2904998553229338", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "1447.384074074074092", + "locked_amount": "1328.5631944444439712", "deposits": [ { "amount": "111", @@ -4703,7 +4703,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51285.1879789469814740392", + "locked_amount": "51226.896539776924515462", "deposits": [ { "amount": "86666.297", @@ -4769,7 +4769,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "398.2206450956452", + "locked_amount": "394.848424145299", "deposits": [ { "amount": "2500", @@ -4802,7 +4802,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14836.1790458937195148361790458937195", + "locked_amount": "14816.165647644927014816165647644927", "deposits": [ { "amount": "1.5e-14", @@ -4890,7 +4890,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11507.24511876006375", + "locked_amount": "11483.8961541364725", "deposits": [ { "amount": "12500", @@ -5157,7 +5157,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18644.4329343155325", + "locked_amount": "18593.57015423572875", "deposits": [ { "amount": "7500", @@ -5565,7 +5565,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51238.396697865980858325", + "locked_amount": "51180.15844229965399674", "deposits": [ { "amount": "129999.45", @@ -5598,7 +5598,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49409.38678567878513785191", + "locked_amount": "49373.06871247784644592557", "deposits": [ { "amount": "54144.7663", @@ -5631,7 +5631,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21093.70679857940184", + "locked_amount": "21051.60226407915008", "deposits": [ { "amount": "10000", @@ -5824,7 +5824,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1876.58168442415", + "locked_amount": "1873.218702435312", "deposits": [ { "amount": "5000", @@ -6882,7 +6882,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "159395.480085454013995997", + "locked_amount": "158090.6912451388393129414", "deposits": [ { "amount": "1852091.69", @@ -40754,7 +40754,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "269436.682008738382980312835", + "locked_amount": "267431.675840398797767447499", "deposits": [ { "amount": "1998.95815", @@ -42147,7 +42147,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "866687.25765937723884852", - "locked_amount": "6255092.7605553962497458068608386305893485", + "locked_amount": "6247983.1374161640607671780970752321127332", "deposits": [ { "amount": "16249.93", @@ -48725,7 +48725,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6168897.174282186485373182", - "locked_amount": "53216.4711100568717726007485005767", + "locked_amount": "46652.9124232901388230326056764886", "deposits": [ { "amount": "129284.449", @@ -56618,7 +56618,7 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "3480709.486904665102263769", + "total_removed": "3480901.398845846498418769", "locked_amount": "0", "deposits": [ { @@ -56768,6 +56768,11 @@ "user": "0x83b1a48376E045D26420200345414e6b93066396", "tx": "0xeb193da202cd833a574a524eff7f1dd13a0ee8669e51a7db36984ef4d6735fd6" }, + { + "amount": "191.911941181396155", + "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", + "tx": "0xb741f4e653131d11eed34bc9c5f3f8425d23cf054b336f3dc61fbd936b39744a" + }, { "amount": "219.945520329711288", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -57790,6 +57795,12 @@ } ], "withdrawals": [ + { + "amount": "191.911941181396155", + "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", + "tranche_id": 4, + "tx": "0xb741f4e653131d11eed34bc9c5f3f8425d23cf054b336f3dc61fbd936b39744a" + }, { "amount": "10509.407528939748325", "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", @@ -57900,8 +57911,8 @@ } ], "total_tokens": "110499.5291", - "withdrawn_tokens": "110307.617158818603845", - "remaining_tokens": "191.911941181396155" + "withdrawn_tokens": "110499.5291", + "remaining_tokens": "0" }, { "address": "0xdbC5d439F373EB646345e1c67D1d46231ACE7dD3", @@ -58813,7 +58824,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "42693.782430020278413924185793996", + "locked_amount": "42376.077741542987921938344901044", "deposits": [ { "amount": "3000", From 7a99ded8e9e6fbdf2be44aaa3a50b6bccba9f745 Mon Sep 17 00:00:00 2001 From: Maciek Date: Wed, 3 May 2023 10:44:45 +0200 Subject: [PATCH 34/42] feat(trading): market view persistent pane sizes (#3537) --- .../client-pages/market/trade-grid.tsx | 45 +++++++++++------- .../client-pages/portfolio/portfolio.tsx | 7 +-- libs/react-helpers/src/hooks/index.ts | 1 + .../src/hooks/use-pane-layout.spec.ts | 19 ++++++++ .../src/hooks/use-pane-layout.ts | 47 +++++++++++++++++++ .../connect-dialog/connect-dialog.spec.tsx | 13 +++-- nx.json | 3 +- 7 files changed, 110 insertions(+), 25 deletions(-) create mode 100644 libs/react-helpers/src/hooks/use-pane-layout.spec.ts create mode 100644 libs/react-helpers/src/hooks/use-pane-layout.ts diff --git a/apps/trading/client-pages/market/trade-grid.tsx b/apps/trading/client-pages/market/trade-grid.tsx index ef31ef630..4026972e0 100644 --- a/apps/trading/client-pages/market/trade-grid.tsx +++ b/apps/trading/client-pages/market/trade-grid.tsx @@ -27,7 +27,10 @@ import { NO_MARKET } from './constants'; import { LiquidityContainer } from '../liquidity/liquidity'; import { useNavigate } from 'react-router-dom'; import type { PinnedAsset } from '@vegaprotocol/accounts'; -import { useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { + usePaneLayout, + useScreenDimensions, +} from '@vegaprotocol/react-helpers'; import { useMarketClickHandler, useMarketLiquidityClickHandler, @@ -83,15 +86,20 @@ interface BottomPanelProps { const MarketBottomPanel = memo( ({ marketId, pinnedAsset }: BottomPanelProps) => { + const [sizes, handleOnLayoutChange] = usePaneLayout({ id: 'bottom' }); const { screenSize } = useScreenDimensions(); const onMarketClick = useMarketClickHandler(true); const onOrderTypeClick = useMarketLiquidityClickHandler(true); return 'xxxl' === screenSize ? ( - + @@ -119,7 +127,7 @@ const MarketBottomPanel = memo( @@ -186,22 +194,29 @@ MarketBottomPanel.displayName = 'MarketBottomPanel'; const MainGrid = memo( ({ marketId, - onSelect, pinnedAsset, }: { marketId: string; - onSelect: (marketId: string, metaKey?: boolean) => void; pinnedAsset?: PinnedAsset; }) => { const navigate = useNavigate(); + const [sizes, handleOnLayoutChange] = usePaneLayout({ id: 'top' }); + const [sizesMiddle, handleOnMiddleLayoutChange] = usePaneLayout({ + id: 'middle', + }); + return ( - + - + @@ -219,7 +234,7 @@ const MainGrid = memo( @@ -238,7 +253,7 @@ const MainGrid = memo( @@ -256,7 +271,7 @@ const MainGrid = memo( @@ -278,11 +293,7 @@ export const TradeGrid = ({ - + ); }; diff --git a/apps/trading/client-pages/portfolio/portfolio.tsx b/apps/trading/client-pages/portfolio/portfolio.tsx index b3b4a8dc9..5b8d26807 100644 --- a/apps/trading/client-pages/portfolio/portfolio.tsx +++ b/apps/trading/client-pages/portfolio/portfolio.tsx @@ -7,6 +7,7 @@ import { WithdrawalsContainer } from './withdrawals-container'; import { FillsContainer } from '@vegaprotocol/fills'; import type { ReactNode } from 'react'; import { useEffect } from 'react'; +import { usePaneLayout } from '@vegaprotocol/react-helpers'; import { VegaWalletContainer } from '../../components/vega-wallet-container'; import { DepositsContainer } from './deposits-container'; import { LayoutPriority } from 'allotment'; @@ -34,11 +35,11 @@ export const Portfolio = () => { const onMarketClick = useMarketClickHandler(true); const onOrderTypeClick = useMarketLiquidityClickHandler(true); - + const [sizes, handleOnLayoutChange] = usePaneLayout({ id: 'portfolio' }); const wrapperClasses = 'h-full max-h-full flex flex-col'; return (
- + @@ -78,7 +79,7 @@ export const Portfolio = () => { diff --git a/libs/react-helpers/src/hooks/index.ts b/libs/react-helpers/src/hooks/index.ts index cc54cc063..92d319aa5 100644 --- a/libs/react-helpers/src/hooks/index.ts +++ b/libs/react-helpers/src/hooks/index.ts @@ -17,3 +17,4 @@ export * from './use-yesterday'; export * from './use-previous'; export * from './use-logger'; export * from './use-bottom-placeholder'; +export * from './use-pane-layout'; diff --git a/libs/react-helpers/src/hooks/use-pane-layout.spec.ts b/libs/react-helpers/src/hooks/use-pane-layout.spec.ts new file mode 100644 index 000000000..8db8a27e1 --- /dev/null +++ b/libs/react-helpers/src/hooks/use-pane-layout.spec.ts @@ -0,0 +1,19 @@ +import { renderHook, act, waitFor } from '@testing-library/react'; +import { usePaneLayout } from './use-pane-layout'; + +describe('usePaneLayout', () => { + it('should return proper values', () => { + const ret = renderHook(() => usePaneLayout({ id: 'testid' })); + expect(ret.result.current[0]).toStrictEqual([]); + expect(ret.result.current[1]).toStrictEqual(expect.any(Function)); + }); + it('setter should change value', async () => { + const ret = renderHook(() => usePaneLayout({ id: 'testid' })); + await act(() => { + ret.result.current[1]([100, 50, 50]); + }); + await waitFor(() => { + expect(ret.result.current[0]).toStrictEqual(['50%', '25%', '25%']); + }); + }); +}); diff --git a/libs/react-helpers/src/hooks/use-pane-layout.ts b/libs/react-helpers/src/hooks/use-pane-layout.ts new file mode 100644 index 000000000..69832407e --- /dev/null +++ b/libs/react-helpers/src/hooks/use-pane-layout.ts @@ -0,0 +1,47 @@ +import { useCallback } from 'react'; +import debounce from 'lodash/debounce'; +import { create } from 'zustand'; +import { persist } from 'zustand/middleware'; +import { immer } from 'zustand/middleware/immer'; + +const STORAGE_KEY = 'vega_pane_store'; +const PANELS_SET_DEBOUNCE_TIME = 300; + +export const usePaneLayoutStore = create<{ + sizes: Record; + valueSetter: (id: string, value: string[]) => void; +}>()( + persist( + immer((set) => ({ + sizes: {}, + valueSetter: (id, value) => + set((state) => { + state.sizes[id] = value; + return state; + }), + })), + { name: STORAGE_KEY } + ) +); + +interface UsePaneLayoutProps { + id: string; +} +export const usePaneLayout = ({ + id, +}: UsePaneLayoutProps): [string[], (sizes: number[]) => void] => { + const sizes = usePaneLayoutStore((store) => store.sizes[id]) || []; + const valueSetter = usePaneLayoutStore((store) => store.valueSetter); + // eslint-disable-next-line react-hooks/exhaustive-deps + const handleOnChange = useCallback( + debounce((args) => { + if (args.length) { + const all = args.reduce((agg: number, item: number) => agg + item, 0); + const sizesArr = args.map((arg: number) => `${(arg / all) * 100}%`); + valueSetter(id, sizesArr); + } + }, PANELS_SET_DEBOUNCE_TIME), + [valueSetter, id] + ); + return [sizes, handleOnChange]; +}; diff --git a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx index f4ca36a07..60aed606c 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx @@ -120,7 +120,11 @@ describe('VegaConnectDialog', () => { .mockImplementation(() => Promise.resolve({ success: true, error: null }) ); - + jest + .spyOn(connectors.rest, 'connect') + .mockImplementation(() => + Promise.resolve([{ publicKey: 'pubkey', name: 'test key 1' }]) + ); render(generateJSX()); // Switches to rest form fireEvent.click(await screen.findByText('Hosted Fairground wallet')); @@ -138,10 +142,11 @@ describe('VegaConnectDialog', () => { await act(async () => { fireEvent.submit(screen.getByTestId('rest-connector-form')); }); + await waitFor(() => { + expect(spy).toHaveBeenCalledWith(fields); - expect(spy).toHaveBeenCalledWith(fields); - - expect(mockCloseVegaDialog).toHaveBeenCalled(); + expect(mockCloseVegaDialog).toHaveBeenCalled(); + }); }); it('handles failed connection', async () => { diff --git a/nx.json b/nx.json index c0d4efa30..53753cc36 100644 --- a/nx.json +++ b/nx.json @@ -24,7 +24,8 @@ "echo $NX_TENDERMINT_WEBSOCKET_URL", "echo $NX_USE_ENV_OVERRIDES", "echo $NX_ETHEREUM_PROVIDER_URL" - ] + ], + "url": "https://cloud.nx.app" } } }, From eefcc96149b906c4ce755c4f81891b27ec3c7a03 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Wed, 3 May 2023 01:45:14 -0700 Subject: [PATCH 35/42] fix(datagrid): prevent unmount of aggrid on theme change (#3588) --- .../app/components/assets/assets-table.tsx | 2 +- .../app/components/markets/markets-table.tsx | 2 +- .../components/proposals/proposals-table.tsx | 2 +- apps/explorer/src/styles.css | 44 ++++++++++++++ .../consensus-validators-table.tsx | 9 +-- .../staking/home/validator-tables/shared.tsx | 11 ---- .../standby-pending-validators-table.tsx | 9 +-- apps/governance/src/styles.css | 44 ++++++++++++++ apps/trading/client-pages/markets/closed.tsx | 2 +- .../trading/client-pages/markets/proposed.tsx | 4 +- apps/trading/pages/styles.css | 47 ++++++++++++++- .../src/lib/accounts-manager.spec.tsx | 8 +-- libs/accounts/src/lib/accounts-table.tsx | 2 +- libs/accounts/src/lib/breakdown-table.tsx | 2 +- libs/datagrid/src/index.ts | 1 - .../datagrid/src/lib/ag-grid/ag-grid-dark.tsx | 50 ---------------- .../lib/ag-grid/ag-grid-dynamic-themed.tsx | 59 ------------------- .../src/lib/ag-grid/ag-grid-dynamic.tsx | 29 --------- .../src/lib/ag-grid/ag-grid-lazy-themed.tsx | 59 +++++++------------ .../datagrid/src/lib/ag-grid/ag-grid-lazy.tsx | 15 +++-- .../src/lib/ag-grid/ag-grid-light.tsx | 50 ---------------- libs/deposits/src/lib/deposits-table.tsx | 2 +- libs/fills/src/lib/fills-table.tsx | 2 +- libs/ledger/src/lib/ledger-table.tsx | 2 +- libs/liquidity/src/lib/liquidity-table.tsx | 2 +- .../markets-container/market-list-table.tsx | 2 +- .../lib/components/order-list/order-list.tsx | 2 +- libs/positions/src/lib/positions-table.tsx | 2 +- .../src/lib/proposals-list/proposals-list.tsx | 10 +--- libs/trades/src/lib/trades-table.tsx | 2 +- libs/withdraws/src/lib/withdrawals-table.tsx | 2 +- 31 files changed, 199 insertions(+), 280 deletions(-) delete mode 100644 libs/datagrid/src/lib/ag-grid/ag-grid-dark.tsx delete mode 100644 libs/datagrid/src/lib/ag-grid/ag-grid-dynamic-themed.tsx delete mode 100644 libs/datagrid/src/lib/ag-grid/ag-grid-dynamic.tsx delete mode 100644 libs/datagrid/src/lib/ag-grid/ag-grid-light.tsx diff --git a/apps/explorer/src/app/components/assets/assets-table.tsx b/apps/explorer/src/app/components/assets/assets-table.tsx index 6f9afc60b..a8d76beb2 100644 --- a/apps/explorer/src/app/components/assets/assets-table.tsx +++ b/apps/explorer/src/app/components/assets/assets-table.tsx @@ -4,7 +4,7 @@ import { t } from '@vegaprotocol/i18n'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import type { VegaICellRendererParams } from '@vegaprotocol/datagrid'; import { useRef, useLayoutEffect } from 'react'; import { BREAKPOINT_MD } from '../../config/breakpoints'; diff --git a/apps/explorer/src/app/components/markets/markets-table.tsx b/apps/explorer/src/app/components/markets/markets-table.tsx index dd3c52127..d08a2c5fa 100644 --- a/apps/explorer/src/app/components/markets/markets-table.tsx +++ b/apps/explorer/src/app/components/markets/markets-table.tsx @@ -3,7 +3,7 @@ import { t } from '@vegaprotocol/i18n'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import type { VegaICellRendererParams, VegaValueGetterParams, diff --git a/apps/explorer/src/app/components/proposals/proposals-table.tsx b/apps/explorer/src/app/components/proposals/proposals-table.tsx index 25aea5de5..e4e092a42 100644 --- a/apps/explorer/src/app/components/proposals/proposals-table.tsx +++ b/apps/explorer/src/app/components/proposals/proposals-table.tsx @@ -3,7 +3,7 @@ import { VoteProgress } from '@vegaprotocol/proposals'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import type { VegaICellRendererParams, VegaValueFormatterParams, diff --git a/apps/explorer/src/styles.css b/apps/explorer/src/styles.css index 9a930982b..c7fb57bb3 100644 --- a/apps/explorer/src/styles.css +++ b/apps/explorer/src/styles.css @@ -1,3 +1,7 @@ +@import 'ag-grid-community/dist/styles/ag-grid.css'; +@import 'ag-grid-community/dist/styles/ag-theme-balham.css'; +@import 'ag-grid-community/dist/styles/ag-theme-balham-dark.css'; + /* You can add global styles to this file, and also import other style files */ @tailwind base; @tailwind components; @@ -11,3 +15,43 @@ .react-markdown-container a:before { content: '🔗 '; } + +/* AG GRID - Do not edit without updating other global stylesheets for each app */ + +.vega-ag-grid .ag-root-wrapper { + border: solid 0px; +} + +.vega-ag-grid .ag-react-container { + overflow: hidden; + text-overflow: ellipsis; +} + +.vega-ag-grid .ag-cell, +.vega-ag-grid .ag-full-width-row .ag-cell-wrapper.ag-row-group { + line-height: calc(min(var(--ag-line-height, 26px), 26px) - 4px); +} + +/* Light variables */ +.ag-theme-balham { + --ag-background-color: theme(colors.white); + --ag-border-color: theme(colors.neutral[300]); + --ag-header-background-color: theme(colors.white); + --ag-odd-row-background-color: theme(colors.white); + --ag-header-column-separator-color: theme(colors.neutral[300]); + --ag-row-border-color: theme(colors.white); + --ag-row-hover-color: theme(colors.neutral[100]); + --ag-font-size: 12px; +} + +/* Dark variables */ +.ag-theme-balham-dark { + --ag-background-color: theme(colors.black); + --ag-border-color: theme(colors.neutral[700]); + --ag-header-background-color: theme(colors.black); + --ag-odd-row-background-color: theme(colors.black); + --ag-header-column-separator-color: theme(colors.neutral[600]); + --ag-row-border-color: theme(colors.black); + --ag-row-hover-color: theme(colors.neutral[800]); + --ag-font-size: 12px; +} diff --git a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx index f09e1944a..388683bac 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx @@ -3,7 +3,7 @@ import { forwardRef, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import { Button, Icon } from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import { useAppState } from '../../../../contexts/app-state/app-state-context'; import { BigNumber } from '../../../../lib/bignumber'; import { @@ -17,7 +17,6 @@ import { } from '../../shared'; import { defaultColDef, - NODE_LIST_GRID_STYLES, PendingStakeRenderer, stakedTotalPercentage, StakeShareRenderer, @@ -382,12 +381,14 @@ export const ConsensusValidatorsTable = ({ ); return ( -
+
{nodes.length > 0 && ( getRowHeight(params)} defaultColDef={defaultColDef} tooltipShowDelay={0} diff --git a/apps/governance/src/routes/staking/home/validator-tables/shared.tsx b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx index 1388b1cb4..ec8514802 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/shared.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx @@ -79,17 +79,6 @@ export interface ValidatorsTableProps { validatorsView: ValidatorsView; } -// Custom styling to account for the scrollbar. This is needed because the -// AG Grid places the scrollbar over the bottom validator, which obstructs -export const NODE_LIST_GRID_STYLES = ` - .ag-theme-balham-dark .ag-body-horizontal-scroll { - opacity: 0.75; - } - .ag-theme-balham-dark *:hover { - cursor: pointer; - } -`; - export const stakedTotalPercentage = (stakeScore: string) => formatNumberPercentage(toBigNum(stakeScore, 0).times(100), 2); diff --git a/apps/governance/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx b/apps/governance/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx index 9c7cd5405..b150cfcdb 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx @@ -1,7 +1,7 @@ import { forwardRef, useMemo, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import { useAppState } from '../../../../contexts/app-state/app-state-context'; import { BigNumber } from '../../../../lib/bignumber'; import { @@ -13,7 +13,6 @@ import { } from '../../shared'; import { defaultColDef, - NODE_LIST_GRID_STYLES, StakeNeededForPromotionRenderer, stakedTotalPercentage, ValidatorFields, @@ -248,11 +247,13 @@ export const StandbyPendingValidatorsTable = ({ ); return ( -
+
{ const externalLink = tokenLink(TOKEN_NEW_MARKET_PROPOSAL); return ( <> - +
+ +
{t('Propose a new market')} diff --git a/apps/trading/pages/styles.css b/apps/trading/pages/styles.css index 0ed581582..e0663446b 100644 --- a/apps/trading/pages/styles.css +++ b/apps/trading/pages/styles.css @@ -1,3 +1,7 @@ +@import 'ag-grid-community/dist/styles/ag-grid.css'; +@import 'ag-grid-community/dist/styles/ag-theme-balham.css'; +@import 'ag-grid-community/dist/styles/ag-theme-balham-dark.css'; + @tailwind base; @tailwind components; @tailwind utilities; @@ -24,7 +28,8 @@ html.dark { @apply border-vega-light-200 dark:border-vega-dark-200; } -/* Styles for charts */ +/* PENNANT */ + html [data-theme='dark'] { --pennant-color-danger: theme('colors.vega.pink.DEFAULT'); @@ -71,3 +76,43 @@ html [data-theme='light'] { --pennant-color-depth-sell-fill: theme('colors.vega.pink.400'); --pennant-color-depth-sell-stroke: theme('colors.vega.pink.550'); } + +/* AG GRID - Do not edit without updating other global stylesheets for each app */ + +.vega-ag-grid .ag-root-wrapper { + border: solid 0px; +} + +.vega-ag-grid .ag-react-container { + overflow: hidden; + text-overflow: ellipsis; +} + +.vega-ag-grid .ag-cell, +.vega-ag-grid .ag-full-width-row .ag-cell-wrapper.ag-row-group { + line-height: calc(min(var(--ag-line-height, 26px), 26px) - 4px); +} + +/* Light variables */ +.ag-theme-balham { + --ag-background-color: theme(colors.white); + --ag-border-color: theme(colors.neutral[300]); + --ag-header-background-color: theme(colors.white); + --ag-odd-row-background-color: theme(colors.white); + --ag-header-column-separator-color: theme(colors.neutral[300]); + --ag-row-border-color: theme(colors.white); + --ag-row-hover-color: theme(colors.neutral[100]); + --ag-font-size: 12px; +} + +/* Dark variables */ +.ag-theme-balham-dark { + --ag-background-color: theme(colors.black); + --ag-border-color: theme(colors.neutral[700]); + --ag-header-background-color: theme(colors.black); + --ag-odd-row-background-color: theme(colors.black); + --ag-header-column-separator-color: theme(colors.neutral[600]); + --ag-row-border-color: theme(colors.black); + --ag-row-hover-color: theme(colors.neutral[800]); + --ag-font-size: 12px; +} diff --git a/libs/accounts/src/lib/accounts-manager.spec.tsx b/libs/accounts/src/lib/accounts-manager.spec.tsx index 0cef83081..7f3fce85f 100644 --- a/libs/accounts/src/lib/accounts-manager.spec.tsx +++ b/libs/accounts/src/lib/accounts-manager.spec.tsx @@ -23,7 +23,7 @@ describe('AccountManager', () => { data: [], }; }) - .mockImplementationOnce((args) => { + .mockImplementation((args) => { return { data: [ { asset: { id: 'a1' }, party: { id: 't1' } }, @@ -49,7 +49,7 @@ describe('AccountManager', () => { (helpers.useDataProvider as jest.Mock).mock.calls[0][0].variables .partyId ).toEqual('partyOne'); - await act(() => { + await act(async () => { rerender( { it('update method should return proper result', async () => { let rerenderer: (ui: React.ReactElement) => void; - await act(() => { + await act(async () => { const { rerender } = render( { await waitFor(() => { expect(screen.getByText('No accounts')).toBeInTheDocument(); }); - await act(() => { + await act(async () => { rerenderer( ( - <> - - {customThemeParams && } - {children} - -); diff --git a/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic-themed.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic-themed.tsx deleted file mode 100644 index 621d596a7..000000000 --- a/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic-themed.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import type { ReactNode, FunctionComponent } from 'react'; -import dynamic from 'next/dynamic'; -import type { AgGridReactProps, AgReactUiProps } from 'ag-grid-react'; -import { AgGridReact } from 'ag-grid-react'; -import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; -import 'ag-grid-community/dist/styles/ag-grid.css'; - -interface GridProps { - children: ReactNode; - customThemeParams: string; -} - -const AgGridLightTheme = dynamic( - () => import('./ag-grid-light').then((mod) => mod.AgGrid), - { ssr: false } -) as FunctionComponent; - -const AgGridDarkTheme = dynamic( - () => import('./ag-grid-dark').then((mod) => mod.AgGrid), - { ssr: false } -) as FunctionComponent; - -export const AgGridThemed = ({ - style, - className, - gridRef, - customThemeParams = '', - ...props -}: (AgGridReactProps | AgReactUiProps) & { - style?: React.CSSProperties; - className?: string; - gridRef?: React.ForwardedRef; - customThemeParams?: string; -}) => { - const { theme } = useThemeSwitcher(); - const defaultProps = { - rowHeight: 22, - headerHeight: 22, - enableCellTextSelection: true, - }; - return ( -
- {theme === 'dark' ? ( - - - - ) : ( - - - - )} -
- ); -}; diff --git a/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic.tsx deleted file mode 100644 index e722af2ec..000000000 --- a/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import * as React from 'react'; -import dynamic from 'next/dynamic'; - -import type { - AgGridReactProps, - AgReactUiProps, - AgGridReact, -} from 'ag-grid-react'; - -type Props = (AgGridReactProps | AgReactUiProps) & { - style?: React.CSSProperties; - className?: string; - gridRef?: React.Ref; - customThemeParams?: string; -}; - -// https://stackoverflow.com/questions/69433673/nextjs-reactdomserver-does-not-yet-support-suspense -const AgGridDynamicInternal = dynamic( - () => import('./ag-grid-dynamic-themed').then((mod) => mod.AgGridThemed), - { - ssr: false, - // https://nextjs.org/docs/messages/invalid-dynamic-suspense - // suspense: true - } -) as React.FunctionComponent; - -export const AgGridDynamic = React.forwardRef( - (props, ref) => -); diff --git a/libs/datagrid/src/lib/ag-grid/ag-grid-lazy-themed.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-lazy-themed.tsx index 40b27c308..60b691624 100644 --- a/libs/datagrid/src/lib/ag-grid/ag-grid-lazy-themed.tsx +++ b/libs/datagrid/src/lib/ag-grid/ag-grid-lazy-themed.tsx @@ -1,45 +1,30 @@ -import * as React from 'react'; import type { AgGridReactProps, AgReactUiProps } from 'ag-grid-react'; import { AgGridReact } from 'ag-grid-react'; import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; -import 'ag-grid-community/dist/styles/ag-grid.css'; +import classNames from 'classnames'; -const AgGridLightTheme = React.lazy(() => - import('./ag-grid-light').then((module) => ({ - default: module.AgGrid, - })) -); - -const AgGridDarkTheme = React.lazy(() => - import('./ag-grid-dark').then((module) => ({ - default: module.AgGrid, - })) -); - -export const AgGridThemed = React.forwardRef< - AgGridReact, - (AgGridReactProps | AgReactUiProps) & { - style?: React.CSSProperties; - className?: string; - } ->(({ style, className, ...props }, ref) => { +export const AgGridThemed = ({ + style, + gridRef, + ...props +}: (AgGridReactProps | AgReactUiProps) & { + style?: React.CSSProperties; + gridRef?: React.ForwardedRef; +}) => { const { theme } = useThemeSwitcher(); + const defaultProps = { + rowHeight: 22, + headerHeight: 22, + enableCellTextSelection: true, + }; + const wrapperClasses = classNames('vega-ag-grid', { + 'ag-theme-balham': theme === 'light', + 'ag-theme-balham-dark': theme === 'dark', + }); + return ( -
- {theme === 'dark' ? ( - - - - ) : ( - - - - )} +
+
); -}); +}; diff --git a/libs/datagrid/src/lib/ag-grid/ag-grid-lazy.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-lazy.tsx index 75bc5218b..5d550d940 100644 --- a/libs/datagrid/src/lib/ag-grid/ag-grid-lazy.tsx +++ b/libs/datagrid/src/lib/ag-grid/ag-grid-lazy.tsx @@ -1,12 +1,17 @@ -import * as React from 'react'; -import type { AgGridReact } from 'ag-grid-react'; +import { forwardRef, lazy } from 'react'; +import type { AgGridReactProps, AgGridReact } from 'ag-grid-react'; -export const AgGridLazyInternal = React.lazy(() => +type Props = AgGridReactProps & { + style?: React.CSSProperties; + gridRef?: React.Ref; +}; + +export const AgGridLazyInternal = lazy(() => import('./ag-grid-lazy-themed').then((module) => ({ default: module.AgGridThemed, })) ); -export const AgGridLazy = React.forwardRef((props, ref) => ( - +export const AgGridLazy = forwardRef((props, ref) => ( + )); diff --git a/libs/datagrid/src/lib/ag-grid/ag-grid-light.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-light.tsx deleted file mode 100644 index a71f6136a..000000000 --- a/libs/datagrid/src/lib/ag-grid/ag-grid-light.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import type { ReactNode } from 'react'; -import colors from 'tailwindcss/colors'; -import 'ag-grid-community/dist/styles/ag-theme-balham.css'; - -const agGridLightVariables = ` - .ag-theme-balham { - --ag-background-color: ${colors.white}; - --ag-border-color: ${colors.neutral[300]}; - --ag-header-background-color: ${colors.white}; - --ag-odd-row-background-color: ${colors.white}; - --ag-header-column-separator-color: ${colors.neutral[300]}; - --ag-row-border-color: ${colors.white}; - --ag-row-hover-color: ${colors.neutral[100]}; - --ag-font-size: 12px; - } - - .ag-theme-balham .ag-root-wrapper { - border: 0; - } - - .ag-theme-balham .ag-row { - border-width: 1px 0; - border-bottom: 1px solid transparent; - } - .ag-theme-balham .ag-row.no-hover, .ag-theme-balham .ag-row.no-hover:hover { - background: white; - } - .ag-theme-balham .ag-react-container { - overflow: hidden; - text-overflow: ellipsis; - } - - .ag-theme-balham .ag-cell, .ag-theme-balham .ag-full-width-row .ag-cell-wrapper.ag-row-group { - line-height: calc(min(var(--ag-line-height, 26px), 26px) - 4px); - } -`; - -export const AgGrid = ({ - children, - customThemeParams, -}: { - children: ReactNode; - customThemeParams?: string; -}) => ( - <> - - {customThemeParams && } - {children} - -); diff --git a/libs/deposits/src/lib/deposits-table.tsx b/libs/deposits/src/lib/deposits-table.tsx index 792f6029a..798b815ad 100644 --- a/libs/deposits/src/lib/deposits-table.tsx +++ b/libs/deposits/src/lib/deposits-table.tsx @@ -8,7 +8,7 @@ import { } from '@vegaprotocol/utils'; import { t } from '@vegaprotocol/i18n'; import type { AgGridReact } from 'ag-grid-react'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import type { VegaICellRendererParams, VegaValueFormatterParams, diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx index 9f0e7167b..1b22473f8 100644 --- a/libs/fills/src/lib/fills-table.tsx +++ b/libs/fills/src/lib/fills-table.tsx @@ -15,7 +15,7 @@ import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { AgGridColumn } from 'ag-grid-react'; import { - AgGridDynamic as AgGrid, + AgGridLazy as AgGrid, positiveClassNames, negativeClassNames, MarketNameCell, diff --git a/libs/ledger/src/lib/ledger-table.tsx b/libs/ledger/src/lib/ledger-table.tsx index a0ca5c18d..57ceb5581 100644 --- a/libs/ledger/src/lib/ledger-table.tsx +++ b/libs/ledger/src/lib/ledger-table.tsx @@ -10,7 +10,7 @@ import type { TypedDataAgGrid, } from '@vegaprotocol/datagrid'; import { - AgGridDynamic as AgGrid, + AgGridLazy as AgGrid, DateRangeFilter, SetFilter, } from '@vegaprotocol/datagrid'; diff --git a/libs/liquidity/src/lib/liquidity-table.tsx b/libs/liquidity/src/lib/liquidity-table.tsx index 13f834513..e9b408681 100644 --- a/libs/liquidity/src/lib/liquidity-table.tsx +++ b/libs/liquidity/src/lib/liquidity-table.tsx @@ -9,7 +9,7 @@ import type { VegaValueFormatterParams, TypedDataAgGrid, } from '@vegaprotocol/datagrid'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import { TooltipCellComponent } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; diff --git a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx index b3002d283..53e4e928a 100644 --- a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx +++ b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx @@ -8,7 +8,7 @@ import type { TypedDataAgGrid, } from '@vegaprotocol/datagrid'; import { - AgGridDynamic as AgGrid, + AgGridLazy as AgGrid, PriceFlashCell, MarketNameCell, SetFilter, diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx index 30c22d4a5..d8b08ded4 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -10,7 +10,7 @@ import { AgGridColumn } from 'ag-grid-react'; import BigNumber from 'bignumber.js'; import { memo, forwardRef } from 'react'; import { - AgGridDynamic as AgGrid, + AgGridLazy as AgGrid, SetFilter, DateRangeFilter, negativeClassNames, diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx index 152fee096..0d7fc3cf9 100644 --- a/libs/positions/src/lib/positions-table.tsx +++ b/libs/positions/src/lib/positions-table.tsx @@ -10,7 +10,7 @@ import type { } from '@vegaprotocol/datagrid'; import { ProgressBarCell } from '@vegaprotocol/datagrid'; import { - AgGridDynamic as AgGrid, + AgGridLazy as AgGrid, DateRangeFilter, PriceFlashCell, signedNumberCssClass, diff --git a/libs/proposals/src/lib/proposals-list/proposals-list.tsx b/libs/proposals/src/lib/proposals-list/proposals-list.tsx index 6e157ce95..1e421679a 100644 --- a/libs/proposals/src/lib/proposals-list/proposals-list.tsx +++ b/libs/proposals/src/lib/proposals-list/proposals-list.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid'; import { useDataProvider } from '@vegaprotocol/react-helpers'; import { t } from '@vegaprotocol/i18n'; import * as Types from '@vegaprotocol/types'; @@ -9,13 +9,6 @@ import type { AgGridReact } from 'ag-grid-react'; import { useColumnDefs } from './use-column-defs'; import type { ProposalListFieldsFragment } from '../proposals-data-provider/__generated__/Proposals'; -// prevent cutting filter windows by auto-height layout -const CUSTOM_GRID_STYLES = ` - .ag-layout-auto-height { - min-height: 200px !important; - } -`; - export const getNewMarketProposals = (data: ProposalListFieldsFragment[]) => data.filter((proposal) => [ @@ -58,7 +51,6 @@ export const ProposalsList = () => { suppressLoadingOverlay suppressNoRowsOverlay onFilterChanged={onFilterChanged} - customThemeParams={CUSTOM_GRID_STYLES} />
Date: Wed, 3 May 2023 13:07:39 +0300 Subject: [PATCH 36/42] feat(oracles): oracle basic profile (#3544) --- .../app/components/markets/market-details.tsx | 28 ++-- .../src/integration/market-info.cy.ts | 28 ++-- .../market-info/__generated__/MarketInfo.ts | 2 +- .../market-info/market-info-accordion.tsx | 11 +- .../market-info/market-info-panels.tsx | 87 ++++------ libs/oracles/.storybook/main.js | 28 ++++ libs/oracles/.storybook/preview-head.html | 1 + libs/oracles/.storybook/preview.js | 90 ++++++++++ libs/oracles/.storybook/tsconfig.json | 20 +++ libs/oracles/jest.config.ts | 1 + libs/oracles/postcss.config.js | 10 ++ libs/oracles/project.json | 38 +++++ libs/oracles/src/index.ts | 5 +- libs/oracles/src/lib/__generated__/index.ts | 1 + libs/oracles/src/lib/components/index.ts | 1 + .../components/oracle-basic-profile/index.ts | 2 + .../oracle-basic-profile.spec.tsx | 45 +++++ .../oracle-basic-profile.stories.tsx | 41 +++++ .../oracle-basic-profile.tsx | 158 ++++++++++++++++++ libs/oracles/src/lib/index.ts | 6 + libs/oracles/src/lib/oracle-data.json | 73 ++++++++ libs/oracles/src/setup-tests.ts | 4 + libs/oracles/tailwind.config.js | 18 ++ libs/oracles/tsconfig.json | 6 +- libs/oracles/tsconfig.lib.json | 8 +- libs/oracles/tsconfig.spec.json | 5 +- .../src/components/icon/icons/icon-forum.svg | 3 + .../src/components/icon/icons/icon-globe.svg | 3 + .../components/icon/icons/icon-linkedin.svg | 3 + .../src/components/icon/icons/icon-moon.svg | 5 + .../icon/icons/icon-question-mark.svg | 3 + .../components/icon/icons/icon-twitter.svg | 3 + .../icon/vega-icons/svg-icons/icon-globe.tsx | 4 +- .../components/icon/vega-icons/vega-icon.tsx | 2 +- libs/wallet/src/setup-tests.ts | 3 + 35 files changed, 647 insertions(+), 99 deletions(-) create mode 100644 libs/oracles/.storybook/main.js create mode 100644 libs/oracles/.storybook/preview-head.html create mode 100644 libs/oracles/.storybook/preview.js create mode 100644 libs/oracles/.storybook/tsconfig.json create mode 100644 libs/oracles/postcss.config.js create mode 100644 libs/oracles/src/lib/__generated__/index.ts create mode 100644 libs/oracles/src/lib/components/index.ts create mode 100644 libs/oracles/src/lib/components/oracle-basic-profile/index.ts create mode 100644 libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.spec.tsx create mode 100644 libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.stories.tsx create mode 100644 libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.tsx create mode 100644 libs/oracles/src/lib/index.ts create mode 100644 libs/oracles/src/lib/oracle-data.json create mode 100644 libs/oracles/src/setup-tests.ts create mode 100644 libs/oracles/tailwind.config.js create mode 100644 libs/ui-toolkit/src/components/icon/icons/icon-forum.svg create mode 100644 libs/ui-toolkit/src/components/icon/icons/icon-globe.svg create mode 100644 libs/ui-toolkit/src/components/icon/icons/icon-linkedin.svg create mode 100644 libs/ui-toolkit/src/components/icon/icons/icon-moon.svg create mode 100644 libs/ui-toolkit/src/components/icon/icons/icon-question-mark.svg create mode 100644 libs/ui-toolkit/src/components/icon/icons/icon-twitter.svg diff --git a/apps/explorer/src/app/components/markets/market-details.tsx b/apps/explorer/src/app/components/markets/market-details.tsx index 218371b63..3f8c02a00 100644 --- a/apps/explorer/src/app/components/markets/market-details.tsx +++ b/apps/explorer/src/app/components/markets/market-details.tsx @@ -14,7 +14,6 @@ import { SettlementAssetInfoPanel, } from '@vegaprotocol/market-info'; import { MarketInfoTable } from '@vegaprotocol/market-info'; -import { Link } from 'react-router-dom'; export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => { if (!market) return null; @@ -97,22 +96,19 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => { ), }, { - title: t('Oracle'), + title: t('Settlement Oracle'), content: ( - - - {t('View settlement data oracle specification')} - - - {t('View termination oracle specification')} - - + + ), + }, + { + title: t('Termination Oracle'), + content: ( + ), }, ]; diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index ea34519d1..f507a47ee 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -180,25 +180,21 @@ describe('market info is displayed', { tags: '@smoke' }, () => { it('oracle displayed', () => { cy.getByTestId(marketTitle).contains('Oracle').click(); - validateMarketDataRow(0, 'Settlement Data Property', 'prices.BTC.value'); - validateMarketDataRow( - 1, - 'Trading Termination Property', - 'termination.BTC.value' - ); - - // check that links to github for oracle proofs are shown cy.getByTestId(accordionContent) - .getByTestId('oracle-proof-links') - .find(`[data-testid="${externalLink}"]`) - .should('have.attr', 'href') - .and('contain', 'https://github.com/vegaprotocol/well-known'); + .getByTestId('provider-name') + .and('contain', 'Another oracle'); cy.getByTestId(accordionContent) - .getByTestId('oracle-spec-links') - .find(`[data-testid="${externalLink}"]`) - .should('have.attr', 'href') - .and('contain', '/oracles'); + .getByTestId('signed-proofs') + .and('contain', '1'); + + cy.getByTestId(accordionContent) + .getByTestId('verified-proofs') + .and('contain', '1'); + + cy.getByTestId(accordionContent) + .getByTestId('signed-proofs') + .and('contain', '1'); }); it('proposal displayed', () => { diff --git a/libs/market-info/src/components/market-info/__generated__/MarketInfo.ts b/libs/market-info/src/components/market-info/__generated__/MarketInfo.ts index 51c75dc13..6825b5d7c 100644 --- a/libs/market-info/src/components/market-info/__generated__/MarketInfo.ts +++ b/libs/market-info/src/components/market-info/__generated__/MarketInfo.ts @@ -198,4 +198,4 @@ export function useMarketInfoLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions } export type MarketInfoQueryHookResult = ReturnType; export type MarketInfoLazyQueryHookResult = ReturnType; -export type MarketInfoQueryResult = Apollo.QueryResult; \ No newline at end of file +export type MarketInfoQueryResult = Apollo.QueryResult; diff --git a/libs/market-info/src/components/market-info/market-info-accordion.tsx b/libs/market-info/src/components/market-info/market-info-accordion.tsx index c6dc747cb..1b8c3cff0 100644 --- a/libs/market-info/src/components/market-info/market-info-accordion.tsx +++ b/libs/market-info/src/components/market-info/market-info-accordion.tsx @@ -103,6 +103,7 @@ const MarketInfoAccordion = ({ content: , })), ]; + const product = market.tradableInstrument.instrument.product; const marketSpecPanels = [ { @@ -113,9 +114,13 @@ const MarketInfoAccordion = ({ title: t('Instrument'), content: , }, - { - title: t('Oracle'), - content: , + product.dataSourceSpecForSettlementData && { + title: t('Settlement Oracle'), + content: , + }, + product.dataSourceSpecForTradingTermination && { + title: t('Termination Oracle'), + content: , }, { title: t('Settlement asset'), diff --git a/libs/market-info/src/components/market-info/market-info-panels.tsx b/libs/market-info/src/components/market-info/market-info-panels.tsx index c965935f2..ccaccc984 100644 --- a/libs/market-info/src/components/market-info/market-info-panels.tsx +++ b/libs/market-info/src/components/market-info/market-info-panels.tsx @@ -26,7 +26,7 @@ import { ConditionOperatorMapping } from '@vegaprotocol/types'; import { MarketTradingModeMapping } from '@vegaprotocol/types'; import { useEnvironment } from '@vegaprotocol/environment'; import type { Provider } from '@vegaprotocol/oracles'; -import { useOracleProofs } from '@vegaprotocol/oracles'; +import { OracleBasicProfile, useOracleProofs } from '@vegaprotocol/oracles'; import { useDataProvider } from '@vegaprotocol/react-helpers'; type PanelProps = Pick< @@ -449,49 +449,38 @@ export const LiquidityPriceRangeInfoPanel = ({ export const OracleInfoPanel = ({ market, - ...props -}: MarketInfoProps & PanelProps) => { + type, +}: MarketInfoProps & + PanelProps & { type: 'settlementData' | 'termination' }) => { const product = market.tradableInstrument.instrument.product; const { VEGA_EXPLORER_URL, ORACLE_PROOFS_URL } = useEnvironment(); const { data } = useOracleProofs(ORACLE_PROOFS_URL); + return ( - -
+ + - - -
-
- - {t('View settlement data specification')} - - - {t('View termination specification')} - -
-
+ {type === 'settlementData' + ? t('View settlement data specification') + : t('View termination specification')} + +
); }; @@ -551,20 +540,13 @@ const OracleLink = ({ providers, signer, type, - index, }: { providers: Provider[]; signer: SignerKind; type: 'settlementData' | 'termination'; index: number; }) => { - const text = - type === 'settlementData' - ? t('View settlement oracle details') - : t('View termination oracle details'); - const textWithCount = index > 0 ? `${text} (${index + 1})` : text; - - const provider = providers.find((p) => { + const signerProviders = providers.filter((p) => { if (signer.__typename === 'PubKey') { if ( p.oracle.type === 'public_key' && @@ -586,14 +568,19 @@ const OracleLink = ({ return false; }); - if (!provider) { + if (!signerProviders.length) { return ; } return ( -

- {textWithCount} -

+
+ {signerProviders.map((provider) => ( + + ))} +
); }; diff --git a/libs/oracles/.storybook/main.js b/libs/oracles/.storybook/main.js new file mode 100644 index 000000000..01ae9b323 --- /dev/null +++ b/libs/oracles/.storybook/main.js @@ -0,0 +1,28 @@ +const rootMain = require('../../../.storybook/main'); + +module.exports = { + ...rootMain, + + core: { ...rootMain.core, builder: 'webpack5' }, + + stories: [ + ...rootMain.stories, + '../src/**/*.stories.mdx', + '../src/**/*.stories.@(js|jsx|ts|tsx)', + ], + addons: [ + ...rootMain.addons, + '@nrwl/react/plugins/storybook', + 'storybook-addon-themes', + ], + webpackFinal: async (config, { configType }) => { + // apply any global webpack configs that might have been specified in .storybook/main.js + if (rootMain.webpackFinal) { + config = await rootMain.webpackFinal(config, { configType }); + } + + // add your own webpack tweaks if needed + + return config; + }, +}; diff --git a/libs/oracles/.storybook/preview-head.html b/libs/oracles/.storybook/preview-head.html new file mode 100644 index 000000000..dd2e70030 --- /dev/null +++ b/libs/oracles/.storybook/preview-head.html @@ -0,0 +1 @@ + diff --git a/libs/oracles/.storybook/preview.js b/libs/oracles/.storybook/preview.js new file mode 100644 index 000000000..59e6d1d77 --- /dev/null +++ b/libs/oracles/.storybook/preview.js @@ -0,0 +1,90 @@ +import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; +import classNames from 'classnames'; +import { useEffect } from 'react'; +import '../src/styles.css'; +export const parameters = { + actions: { argTypesRegex: '^on[A-Z].*' }, + backgrounds: { disable: true }, + layout: 'fullscreen', + a11y: { + config: { + rules: [ + { + // Disabled only for storybook because we display both the dark and light variants of the components on the same page without differentiating the ids, so it will always error. + id: 'duplicate-id-aria', + selector: '[data-testid="form-group"] > label', + }, + { + // Disabled because we can't control the radix radio group component and it claims to be accessible to begin with, so hopefully no issues. + id: 'button-name', + selector: '[role=radiogroup] > button', + }, + ], + }, + }, +}; + +export const globalTypes = { + theme: { + name: 'Theme', + description: 'Global theme for components', + defaultValue: 'dark', + toolbar: { + icon: 'circlehollow', + items: [ + { value: 'light', title: 'Light' }, + { value: 'dark', title: 'Dark' }, + { value: 'sideBySide', title: 'Side by side' }, + ], + showName: true, + }, + }, +}; + +const StoryWrapper = ({ children, fill }) => { + const classes = classNames( + 'p-4', + 'bg-white dark:bg-black', + 'text-neutral-800 dark:text-neutral-200', + { + 'w-screen h-screen': fill, + } + ); + return
{children}
; +}; + +const ThemeWrapper = (Story, context) => { + const theme = context.parameters.theme || context.globals.theme; + const { setTheme } = useThemeSwitcher(); + + useEffect(() => { + // in side by side mode a 'dark' class on the html tag will interfere + // making the light 'side' dark, so remove it in that case + if (theme === 'sideBySide') { + document.documentElement.classList.remove('dark'); + } else { + setTheme(theme); + } + }, [setTheme, theme]); + + return theme === 'sideBySide' ? ( + <> +
+ + + +
+
+ + + +
+ + ) : ( + + + + ); +}; + +export const decorators = [ThemeWrapper]; diff --git a/libs/oracles/.storybook/tsconfig.json b/libs/oracles/.storybook/tsconfig.json new file mode 100644 index 000000000..a33db6100 --- /dev/null +++ b/libs/oracles/.storybook/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "emitDecoratorMetadata": true, + "outDir": "" + }, + "files": [ + "../../../node_modules/@nrwl/react/typings/styled-jsx.d.ts", + "../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": [ + "../**/*.spec.ts", + "../**/*.spec.js", + "../**/*.spec.tsx", + "../**/*.spec.jsx", + "jest.config.ts" + ], + "include": ["../src/**/*", "*.js"] +} diff --git a/libs/oracles/jest.config.ts b/libs/oracles/jest.config.ts index b08b7a5bc..aadf9082a 100644 --- a/libs/oracles/jest.config.ts +++ b/libs/oracles/jest.config.ts @@ -7,4 +7,5 @@ export default { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/oracles', + setupFilesAfterEnv: ['./src/setup-tests.ts'], }; diff --git a/libs/oracles/postcss.config.js b/libs/oracles/postcss.config.js new file mode 100644 index 000000000..cbdd9c22c --- /dev/null +++ b/libs/oracles/postcss.config.js @@ -0,0 +1,10 @@ +const { join } = require('path'); + +module.exports = { + plugins: { + tailwindcss: { + config: join(__dirname, 'tailwind.config.js'), + }, + autoprefixer: {}, + }, +}; diff --git a/libs/oracles/project.json b/libs/oracles/project.json index b796a2027..1b83c0def 100644 --- a/libs/oracles/project.json +++ b/libs/oracles/project.json @@ -38,6 +38,44 @@ "jestConfig": "libs/oracles/jest.config.ts", "passWithNoTests": true } + }, + "storybook": { + "executor": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/react", + "port": 4400, + "config": { + "configFolder": "libs/oracles/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-storybook": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/react", + "outputPath": "dist/storybook/oracles", + "config": { + "configFolder": "libs/oracles/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-spec": { + "executor": "@nrwl/workspace:run-commands", + "outputs": [], + "options": { + "command": "yarn tsc --project ./libs/oracles/tsconfig.spec.json" + } } } } diff --git a/libs/oracles/src/index.ts b/libs/oracles/src/index.ts index 75a4b1258..f41a696fd 100644 --- a/libs/oracles/src/index.ts +++ b/libs/oracles/src/index.ts @@ -1,4 +1 @@ -export * from './lib/oracle-schema'; -export * from './lib/use-oracle-proofs'; -export * from './lib/use-oracle-spec-binding-data'; -export * from './lib/__generated__/OracleSpecDataConnection'; +export * from './lib'; diff --git a/libs/oracles/src/lib/__generated__/index.ts b/libs/oracles/src/lib/__generated__/index.ts new file mode 100644 index 000000000..c1a71b9a0 --- /dev/null +++ b/libs/oracles/src/lib/__generated__/index.ts @@ -0,0 +1 @@ +export * from './OracleSpecDataConnection'; diff --git a/libs/oracles/src/lib/components/index.ts b/libs/oracles/src/lib/components/index.ts new file mode 100644 index 000000000..8706f7f57 --- /dev/null +++ b/libs/oracles/src/lib/components/index.ts @@ -0,0 +1 @@ +export * from './oracle-basic-profile'; diff --git a/libs/oracles/src/lib/components/oracle-basic-profile/index.ts b/libs/oracles/src/lib/components/oracle-basic-profile/index.ts new file mode 100644 index 000000000..f7202883f --- /dev/null +++ b/libs/oracles/src/lib/components/oracle-basic-profile/index.ts @@ -0,0 +1,2 @@ +export * from './oracle-basic-profile.stories'; +export * from './oracle-basic-profile'; diff --git a/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.spec.tsx b/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.spec.tsx new file mode 100644 index 000000000..1a513e7dd --- /dev/null +++ b/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.spec.tsx @@ -0,0 +1,45 @@ +import { OracleBasicProfile } from './oracle-basic-profile'; +import type { Provider } from '../../oracle-schema'; +import { render, screen } from '@testing-library/react'; + +describe('OracleBasicProfile', () => { + const testProvider = { + name: 'Test oracle', + url: 'https://zombo.com', + description_markdown: + 'Some markdown describing the oracle provider.\n\nTwitter: @FacesPics2\n', + oracle: { + status: 'GOOD', + status_reason: '', + first_verified: '2023-02-28T00:00:00.000Z', + last_verified: '2023-02-28T00:00:00.000Z', + type: 'eth_address', + eth_address: '0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC', + }, + proofs: [ + { + format: 'signed_message', + available: true, + type: 'eth_address', + eth_address: '0x949AF81E51D57831AE52591d17fBcdd1014a5f52', + message: 'SOMEHEX', + }, + ], + github_link: + 'https://github.com/vegaprotocol/well-known/blob/main/oracle-providers/eth_address-0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC.toml', + } as Provider; + + it('should render successfully', () => { + const component = ; + expect(component).toBeTruthy(); + }); + + it('should render the name', () => { + render(); + expect(screen.getByTestId('provider-name')).toHaveTextContent( + 'Test oracle' + ); + expect(screen.getByTestId('verified-proofs')).toHaveTextContent('1'); + expect(screen.getByTestId('signed-proofs')).toHaveTextContent('1'); + }); +}); diff --git a/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.stories.tsx b/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.stories.tsx new file mode 100644 index 000000000..4265a3424 --- /dev/null +++ b/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.stories.tsx @@ -0,0 +1,41 @@ +import type { Story, Meta } from '@storybook/react'; +import { OracleBasicProfile } from './oracle-basic-profile'; + +export default { + component: OracleBasicProfile, + title: 'OracleBasicProfile', +} as Meta; + +const Template: Story = (args) => ( + +); + +export const Default = Template.bind({}); + +Default.args = { + provider: { + name: 'Test oracle', + url: 'https://zombo.com', + description_markdown: + 'Some markdown describing the oracle provider.\n\nTwitter: @FacesPics2\n', + oracle: { + status: 'GOOD', + status_reason: '', + first_verified: '2023-02-28T00:00:00.000Z', + last_verified: '2023-02-28T00:00:00.000Z', + type: 'eth_address', + eth_address: '0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC', + }, + proofs: [ + { + format: 'signed_message', + available: true, + type: 'eth_address', + eth_address: '0x949AF81E51D57831AE52591d17fBcdd1014a5f52', + message: 'SOMEHEX', + }, + ], + github_link: + 'https://github.com/vegaprotocol/well-known/blob/main/oracle-providers/eth_address-0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC.toml', + }, +}; diff --git a/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.tsx b/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.tsx new file mode 100644 index 000000000..3da3d0ea9 --- /dev/null +++ b/libs/oracles/src/lib/components/oracle-basic-profile/oracle-basic-profile.tsx @@ -0,0 +1,158 @@ +import { t } from '@vegaprotocol/i18n'; +import type { Provider } from '../../oracle-schema'; +import { + ExternalLink, + Icon, + Intent, + Link, + VegaIcon, + VegaIconNames, +} from '@vegaprotocol/ui-toolkit'; +import type { IconName } from '@blueprintjs/icons'; +import { IconNames } from '@blueprintjs/icons'; +import classNames from 'classnames'; + +const getVerifiedStatusIcon = (provider: Provider) => { + const getIconIntent = () => { + switch (provider.oracle.status) { + case 'GOOD': + return { icon: IconNames.TICK_CIRCLE, intent: Intent.Success }; + case 'RETIRED': + return { icon: IconNames.MOON, intent: Intent.None }; + case 'UNKNOWN': + return { icon: IconNames.HELP, intent: Intent.Primary }; + case 'MALICIOUS': + return { icon: IconNames.ERROR, intent: Intent.Danger }; + case 'SUSPICIOUS': + return { icon: IconNames.ERROR, intent: Intent.Danger }; + case 'COMPROMISED': + return { icon: IconNames.ERROR, intent: Intent.Danger }; + default: + return { icon: IconNames.HELP, intent: Intent.Primary }; + } + }; + + if (!provider.oracle.first_verified || !provider.oracle.last_verified) { + return { + message: t('Not verified'), + ...getIconIntent(), + }; + } + + const lastVerified = provider.oracle.last_verified + ? new Date(provider.oracle.last_verified) + : new Date(provider.oracle.first_verified); + return { + ...getIconIntent(), + message: t( + 'Verified since %s', + lastVerified.toLocaleDateString(undefined, { + year: 'numeric', + month: 'long', + }) + ), + }; +}; + +export const OracleBasicProfile = ({ provider }: { provider: Provider }) => { + const { icon, message, intent } = getVerifiedStatusIcon(provider); + + const verifiedProofs = provider.proofs.filter( + (proof) => proof.available === true + ); + + const signedProofs = provider.proofs.filter( + (proof) => proof.format === 'signed_message' && proof.available === true + ); + + const links = provider.proofs + .filter((proof) => proof.format === 'url' && proof.available === true) + .map((proof) => ({ + ...proof, + url: 'url' in proof ? proof.url : '', + icon: getLinkIcon(proof.type), + })); + + return ( + <> + + {provider.url && ( + + + + {provider.name} + + + ({verifiedProofs.length}) + + + + )} + + + + +

{message}

+

+ {t('Involved in %s %s', [ + signedProofs.length.toString(), + signedProofs.length !== 1 ? t('markets') : t('market'), + ])} +

+ {links.length > 0 && ( +
+ {links.map((link) => ( + + + + + + {link.type}{' '} + + + + ))} +
+ )} + + ); +}; + +export const getLinkIcon = (type: string) => { + switch (type) { + case 'twitter': + return VegaIconNames.TWITTER; + case 'github': + return VegaIconNames.GLOBE; + case 'linkedin': + return VegaIconNames.LINKEDIN; + default: + return VegaIconNames.GLOBE; + } +}; diff --git a/libs/oracles/src/lib/index.ts b/libs/oracles/src/lib/index.ts new file mode 100644 index 000000000..e45917945 --- /dev/null +++ b/libs/oracles/src/lib/index.ts @@ -0,0 +1,6 @@ +export * from './__generated__'; +export * from './components'; +export * from './oracle-schema'; +export * from './oracle-spec-data-connection.mock'; +export * from './use-oracle-proofs'; +export * from './use-oracle-spec-binding-data'; diff --git a/libs/oracles/src/lib/oracle-data.json b/libs/oracles/src/lib/oracle-data.json new file mode 100644 index 000000000..284d06d54 --- /dev/null +++ b/libs/oracles/src/lib/oracle-data.json @@ -0,0 +1,73 @@ +[ + { + "name": "Test oracle", + "url": "https://zombo.com", + "description_markdown": "Some markdown describing the oracle provider.\n\nTwitter: @FacesPics2\n", + "oracle": { + "status": "GOOD", + "status_reason": "", + "first_verified": "2023-02-28T00:00:00.000Z", + "last_verified": "2023-02-28T00:00:00.000Z", + "type": "eth_address", + "eth_address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC" + }, + "proofs": [ + { + "format": "signed_message", + "available": true, + "type": "eth_address", + "eth_address": "0x949AF81E51D57831AE52591d17fBcdd1014a5f52", + "message": "SOMEHEX" + } + ], + "github_link": "https://github.com/vegaprotocol/well-known/blob/main/oracle-providers/eth_address-0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC.toml" + }, + { + "name": "Vega Admin Oracle for Testnet", + "url": "https://fairground.wtf", + "description_markdown": "The Vega Fairground admin oracle, uses a json file to settle based on Binance Spot price.\nE.g. in case the market is BTC/USDC the spot price for BTC/USDC on Binance will be used.\n\nTwitter: @VegaFairground\n", + "oracle": { + "status": "GOOD", + "status_reason": "", + "first_verified": "2022-01-01T00:00:00.000Z", + "last_verified": "2022-12-31T00:00:00.000Z", + "type": "public_key", + "public_key": "69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f" + }, + "proofs": [ + { + "format": "url", + "available": true, + "type": "twitter", + "url": "https://twitter.com/vegaprotocol/status/956833487230730241" + }, + { + "format": "url", + "available": true, + "type": "web", + "url": "https://fairground.wtf/" + }, + { + "format": "url", + "available": true, + "type": "github", + "url": "https://github.com" + }, + { + "format": "signed_message", + "available": true, + "type": "public_key", + "public_key": "69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f", + "message": "SOMEHEX" + }, + { + "format": "signed_message", + "available": true, + "type": "eth_address", + "eth_address": "0x0b38D0e7391CF427d309991A110a84daF37114eF", + "message": "SOMEHEX" + } + ], + "github_link": "https://github.com/vegaprotocol/well-known/blob/main/oracle-providers/public_key-69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f.toml" + } +] diff --git a/libs/oracles/src/setup-tests.ts b/libs/oracles/src/setup-tests.ts new file mode 100644 index 000000000..68773380a --- /dev/null +++ b/libs/oracles/src/setup-tests.ts @@ -0,0 +1,4 @@ +import '@testing-library/jest-dom'; +import ResizeObserver from 'resize-observer-polyfill'; + +global.ResizeObserver = ResizeObserver; diff --git a/libs/oracles/tailwind.config.js b/libs/oracles/tailwind.config.js new file mode 100644 index 000000000..20447f23e --- /dev/null +++ b/libs/oracles/tailwind.config.js @@ -0,0 +1,18 @@ +const { join } = require('path'); +const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); +const theme = require('../tailwindcss-config/src/theme'); +const vegaCustomClasses = require('../tailwindcss-config/src/vega-custom-classes'); + +module.exports = { + content: [ + join(__dirname, 'src/**/*.{ts,tsx,html,mdx}'), + join(__dirname, 'src/utils/shared.ts'), + join(__dirname, '.storybook/preview.js'), + ...createGlobPatternsForDependencies(__dirname), + ], + darkMode: 'class', + theme: { + extend: theme, + }, + plugins: [vegaCustomClasses], +}; diff --git a/libs/oracles/tsconfig.json b/libs/oracles/tsconfig.json index 4c089585e..36b41cfd5 100644 --- a/libs/oracles/tsconfig.json +++ b/libs/oracles/tsconfig.json @@ -8,11 +8,10 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, + "noPropertyAccessFromIndexSignature": false, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true }, - "files": [], "include": [], "references": [ { @@ -20,6 +19,9 @@ }, { "path": "./tsconfig.spec.json" + }, + { + "path": "./.storybook/tsconfig.json" } ] } diff --git a/libs/oracles/tsconfig.lib.json b/libs/oracles/tsconfig.lib.json index af84f21cf..6a440c7bd 100644 --- a/libs/oracles/tsconfig.lib.json +++ b/libs/oracles/tsconfig.lib.json @@ -9,7 +9,6 @@ "../../node_modules/@nrwl/react/typings/image.d.ts" ], "exclude": [ - "jest.config.ts", "**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", @@ -17,7 +16,12 @@ "**/*.spec.js", "**/*.test.js", "**/*.spec.jsx", - "**/*.test.jsx" + "**/*.test.jsx", + "**/*.stories.ts", + "**/*.stories.js", + "**/*.stories.jsx", + "**/*.stories.tsx", + "jest.config.ts" ], "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] } diff --git a/libs/oracles/tsconfig.spec.json b/libs/oracles/tsconfig.spec.json index e13a2c78f..ba70e5966 100644 --- a/libs/oracles/tsconfig.spec.json +++ b/libs/oracles/tsconfig.spec.json @@ -3,10 +3,9 @@ "compilerOptions": { "outDir": "../../dist/out-tsc", "module": "commonjs", - "types": ["jest", "node"] + "types": ["jest", "node", "@testing-library/jest-dom"] }, "include": [ - "jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", @@ -16,6 +15,8 @@ "**/*.test.jsx", "**/*.spec.jsx", "**/*.d.ts", + "jest.config.ts", + "../../index.d.ts", "src/lib/use-oracle-spec-binding-data.spec.tsx" ] } diff --git a/libs/ui-toolkit/src/components/icon/icons/icon-forum.svg b/libs/ui-toolkit/src/components/icon/icons/icon-forum.svg new file mode 100644 index 000000000..3c91093f7 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icons/icon-forum.svg @@ -0,0 +1,3 @@ + + + diff --git a/libs/ui-toolkit/src/components/icon/icons/icon-globe.svg b/libs/ui-toolkit/src/components/icon/icons/icon-globe.svg new file mode 100644 index 000000000..dbb191d13 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icons/icon-globe.svg @@ -0,0 +1,3 @@ + + + diff --git a/libs/ui-toolkit/src/components/icon/icons/icon-linkedin.svg b/libs/ui-toolkit/src/components/icon/icons/icon-linkedin.svg new file mode 100644 index 000000000..7532ebce0 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icons/icon-linkedin.svg @@ -0,0 +1,3 @@ + + + diff --git a/libs/ui-toolkit/src/components/icon/icons/icon-moon.svg b/libs/ui-toolkit/src/components/icon/icons/icon-moon.svg new file mode 100644 index 000000000..fe7feb598 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icons/icon-moon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/libs/ui-toolkit/src/components/icon/icons/icon-question-mark.svg b/libs/ui-toolkit/src/components/icon/icons/icon-question-mark.svg new file mode 100644 index 000000000..db93e84ce --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icons/icon-question-mark.svg @@ -0,0 +1,3 @@ + + + diff --git a/libs/ui-toolkit/src/components/icon/icons/icon-twitter.svg b/libs/ui-toolkit/src/components/icon/icons/icon-twitter.svg new file mode 100644 index 000000000..d7e656b91 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icons/icon-twitter.svg @@ -0,0 +1,3 @@ + + + diff --git a/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-globe.tsx b/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-globe.tsx index 64137f532..466499b75 100644 --- a/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-globe.tsx +++ b/libs/ui-toolkit/src/components/icon/vega-icons/svg-icons/icon-globe.tsx @@ -8,8 +8,8 @@ export const IconGlobe = ({ size = 24 }: { size: number }) => { xmlns="http://www.w3.org/2000/svg" > diff --git a/libs/ui-toolkit/src/components/icon/vega-icons/vega-icon.tsx b/libs/ui-toolkit/src/components/icon/vega-icons/vega-icon.tsx index a5f497278..c82e7e229 100644 --- a/libs/ui-toolkit/src/components/icon/vega-icons/vega-icon.tsx +++ b/libs/ui-toolkit/src/components/icon/vega-icons/vega-icon.tsx @@ -5,7 +5,7 @@ import { VegaIconNameMap } from './vega-icon-record'; export interface VegaIconProps { name: VegaIconNames; - size?: 16 | 24 | 32; + size?: 8 | 10 | 12 | 13 | 14 | 16 | 24 | 32; } export const VegaIcon = ({ size = 16, name }: VegaIconProps) => { diff --git a/libs/wallet/src/setup-tests.ts b/libs/wallet/src/setup-tests.ts index 7b0828bfa..68773380a 100644 --- a/libs/wallet/src/setup-tests.ts +++ b/libs/wallet/src/setup-tests.ts @@ -1 +1,4 @@ import '@testing-library/jest-dom'; +import ResizeObserver from 'resize-observer-polyfill'; + +global.ResizeObserver = ResizeObserver; From ca46861fd887118532afa159eff88aee659c28f1 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Wed, 3 May 2023 11:23:03 +0100 Subject: [PATCH 37/42] feat(governance): add local time zone abbreviation data to proposal form (#3577) --- .../proposal-change-table.spec.tsx | 24 ++++++++----------- .../proposal-change-table.tsx | 14 +++++------ libs/utils/src/lib/format/date.ts | 14 +++++++++++ package.json | 3 ++- yarn.lock | 5 ++++ 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx b/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx index 63d9ca8e1..1b538be80 100644 --- a/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx @@ -1,8 +1,7 @@ import { render, screen } from '@testing-library/react'; import { ProposalRejectionReason, ProposalState } from '@vegaprotocol/types'; -import { format } from 'date-fns'; +import { formatDateWithLocalTimezone } from '@vegaprotocol/utils'; -import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; import { generateProposal } from '../../test-helpers/generate-proposals'; import { ProposalChangeTable } from './proposal-change-table'; @@ -24,16 +23,15 @@ it('Renders all data for table', () => { expect(screen.getByText('Closes on')).toBeInTheDocument(); expect( screen.getByText( - format(new Date(proposal?.terms.closingDatetime), DATE_FORMAT_DETAILED) + formatDateWithLocalTimezone(new Date(proposal?.terms.closingDatetime)) ) ).toBeInTheDocument(); expect(screen.getByText('Proposed enactment')).toBeInTheDocument(); expect( screen.getByText( - format( - new Date(proposal?.terms.enactmentDatetime || 0), - DATE_FORMAT_DETAILED + formatDateWithLocalTimezone( + new Date(proposal?.terms.enactmentDatetime || 0) ) ) ).toBeInTheDocument(); @@ -43,7 +41,7 @@ it('Renders all data for table', () => { expect(screen.getByText('Proposed on')).toBeInTheDocument(); expect( - screen.getByText(format(new Date(proposal?.datetime), DATE_FORMAT_DETAILED)) + screen.getByText(formatDateWithLocalTimezone(new Date(proposal?.datetime))) ).toBeInTheDocument(); expect(screen.getByText('Type')).toBeInTheDocument(); @@ -62,16 +60,15 @@ it('Changes data based on if data is in future or past', () => { expect(screen.getByText('Closed on')).toBeInTheDocument(); expect( screen.getByText( - format(new Date(proposal?.terms.closingDatetime), DATE_FORMAT_DETAILED) + formatDateWithLocalTimezone(new Date(proposal?.terms.closingDatetime)) ) ).toBeInTheDocument(); expect(screen.getByText('Enacted on')).toBeInTheDocument(); expect( screen.getByText( - format( - new Date(proposal?.terms.enactmentDatetime || 0), - DATE_FORMAT_DETAILED + formatDateWithLocalTimezone( + new Date(proposal?.terms.enactmentDatetime || 0) ) ) ).toBeInTheDocument(); @@ -91,9 +88,8 @@ it('Does not render enactment time for freeform proposal', () => { expect(screen.queryByText('Enacted on')).not.toBeInTheDocument(); expect( screen.queryByText( - format( - new Date(proposal?.terms.enactmentDatetime || 0), - DATE_FORMAT_DETAILED + formatDateWithLocalTimezone( + new Date(proposal?.terms.enactmentDatetime || 0) ) ) ).not.toBeInTheDocument(); diff --git a/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx b/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx index 36992991f..fd10d8537 100644 --- a/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx @@ -1,12 +1,11 @@ -import { format, isFuture } from 'date-fns'; +import { isFuture } from 'date-fns'; import { useTranslation } from 'react-i18next'; - +import { formatDateWithLocalTimezone } from '@vegaprotocol/utils'; import { KeyValueTable, KeyValueTableRow, RoundedWrapper, } from '@vegaprotocol/ui-toolkit'; -import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; import { CurrentProposalState } from '../current-proposal-state'; import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals'; import type { ProposalQuery } from '../../proposal/__generated__/Proposal'; @@ -35,16 +34,15 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => { {isFuture(new Date(terms?.closingDatetime)) ? t('closesOn') : t('closedOn')} - {format(new Date(terms?.closingDatetime), DATE_FORMAT_DETAILED)} + {formatDateWithLocalTimezone(new Date(terms?.closingDatetime))} {terms?.change.__typename !== 'NewFreeform' ? ( {isFuture(new Date(terms?.enactmentDatetime || 0)) ? t('proposedEnactment') : t('enactedOn')} - {format( - new Date(terms?.enactmentDatetime || 0), - DATE_FORMAT_DETAILED + {formatDateWithLocalTimezone( + new Date(terms?.enactmentDatetime || 0) )} ) : null} @@ -54,7 +52,7 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => { {t('proposedOn')} - {format(new Date(proposal?.datetime), DATE_FORMAT_DETAILED)} + {formatDateWithLocalTimezone(new Date(proposal?.datetime))} {proposal?.rejectionReason ? ( diff --git a/libs/utils/src/lib/format/date.ts b/libs/utils/src/lib/format/date.ts index 151d34410..46518d9f2 100644 --- a/libs/utils/src/lib/format/date.ts +++ b/libs/utils/src/lib/format/date.ts @@ -1,5 +1,6 @@ import once from 'lodash/once'; import { getUserLocale } from '../get-user-locale'; +import { utcToZonedTime, format as tzFormat } from 'date-fns-tz'; export const isValidDate = (date: Date) => date instanceof Date && !isNaN(date.getTime()); @@ -51,3 +52,16 @@ export const formatForInput = (date: Date) => { return `${year}-${month}-${day}T${hours}:${minutes}:${secs}`; }; + +/** Format a user's local date and time with the time zone abbreviation */ +export const formatDateWithLocalTimezone = ( + date: Date, + formatStr = 'dd MMMM yyyy HH:mm (z)' +) => { + const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; + const localDatetime = utcToZonedTime(date, userTimeZone); + + return tzFormat(localDatetime, formatStr, { + timeZone: userTimeZone, + }); +}; diff --git a/package.json b/package.json index d2003915a..721c29aed 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "classnames": "^2.3.1", "core-js": "^3.6.5", "date-fns": "^2.28.0", + "date-fns-tz": "^2.0.0", "duration-js": "^4.0.0", "ethers": "^5.6.0", "graphql": "^15.7.2", @@ -154,8 +155,8 @@ "autoprefixer": "10.4.8", "babel-jest": "27.5.1", "babel-loader": "8.1.0", - "cypress-mochawesome-reporter": "^3.3.0", "cypress": "^12.9.0", + "cypress-mochawesome-reporter": "^3.3.0", "cypress-real-events": "^1.7.6", "dotenv": "^16.0.1", "eslint": "8.15.0", diff --git a/yarn.lock b/yarn.lock index d456252e8..e7e9b910f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12070,6 +12070,11 @@ dataloader@2.1.0: resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.1.0.tgz#c69c538235e85e7ac6c6c444bae8ecabf5de9df7" integrity sha512-qTcEYLen3r7ojZNgVUaRggOI+KM7jrKxXeSHhogh/TWxYMeONEMqY+hmkobiYQozsGIyg9OYVzO4ZIfoB4I0pQ== +date-fns-tz@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/date-fns-tz/-/date-fns-tz-2.0.0.tgz#1b14c386cb8bc16fc56fe333d4fc34ae1d1099d5" + integrity sha512-OAtcLdB9vxSXTWHdT8b398ARImVwQMyjfYGkKD2zaGpHseG2UPHbHjXELReErZFxWdSLph3c2zOaaTyHfOhERQ== + date-fns@^1.27.2: version "1.30.1" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" From 288f075cacbcc083d2be86767584ea9ce9033374 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Wed, 3 May 2023 11:23:17 +0100 Subject: [PATCH 38/42] test(governance): e2e tests updated to cypress 12 (#3582) --- .../src/fixtures/proposals/new-market.json | 2 +- .../integration/flow/proposal-details.cy.ts | 13 +- .../integration/flow/proposal-enacted.cy.ts | 14 +- .../src/integration/flow/proposal-flow.cy.ts | 1 + .../src/integration/flow/proposal-forms.cy.ts | 23 +- .../src/integration/flow/proposal-list.cy.ts | 6 +- .../src/integration/flow/rewards-flow.cy.ts | 17 +- .../src/integration/flow/staking-flow.cy.ts | 2 +- .../flow/token-association-flow.cy.ts | 197 ++++++++++++------ .../integration/flow/withdrawal-flow.cy.ts | 91 ++++---- .../src/support/governance.functions.ts | 5 +- .../src/support/wallet-teardown.functions.ts | 77 ++++--- 12 files changed, 281 insertions(+), 167 deletions(-) diff --git a/apps/governance-e2e/src/fixtures/proposals/new-market.json b/apps/governance-e2e/src/fixtures/proposals/new-market.json index d9875eabb..eb3368324 100644 --- a/apps/governance-e2e/src/fixtures/proposals/new-market.json +++ b/apps/governance-e2e/src/fixtures/proposals/new-market.json @@ -9,7 +9,7 @@ "name": "Token test market", "code": "Token.24h", "future": { - "settlementAsset": "fBTC", + "settlementAsset": "73174a6fb1d5802ba0ac7bd7ab79e0a3a4837b262de0a4e80815a55442692bd0", "quoteName": "fBTC", "dataSourceSpecForSettlementData": { "external": { diff --git a/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts index 5e9de85ec..611568056 100644 --- a/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts +++ b/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts @@ -49,6 +49,7 @@ describe( }); beforeEach('visit proposals tab', function () { + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); cy.connectVegaWallet(); @@ -217,9 +218,9 @@ describe( vegaWalletSetSpecifiedApprovalAmount('1000'); createRawProposal(); cy.get('@rawProposal').then((rawProposal) => { - getSubmittedProposalFromProposalList(rawProposal.rationale.title) - .as('submittedProposal') - .within(() => cy.get(viewProposalButton).click()); + getSubmittedProposalFromProposalList( + rawProposal.rationale.title + ).within(() => cy.get(viewProposalButton).click()); }); voteForProposal('for'); // 3001-VOTE-079 @@ -237,9 +238,9 @@ describe( ); navigateTo(navigation.proposals); cy.get('@rawProposal').then((rawProposal) => { - getSubmittedProposalFromProposalList(rawProposal.rationale.title) - .as('submittedProposal') - .within(() => cy.get(viewProposalButton).click()); + getSubmittedProposalFromProposalList( + rawProposal.rationale.title + ).within(() => cy.get(viewProposalButton).click()); }); cy.get(proposalVoteProgressForPercentage) .contains('100.00%') diff --git a/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts index 5f1fa01d9..293437d45 100644 --- a/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts +++ b/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts @@ -16,6 +16,7 @@ import { import { ethereumWalletConnect } from '../../support/wallet-eth.functions'; import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions'; +const proposalListItem = '[data-testid="proposals-list-item"]'; const closedProposals = '[data-testid="closed-proposals"]'; const proposalStatus = '[data-testid="proposal-status"]'; const viewProposalButton = '[data-testid="view-proposal-btn"]'; @@ -35,6 +36,7 @@ context( }); beforeEach('visit proposals', function () { + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); cy.connectVegaWallet(); @@ -51,7 +53,8 @@ context( waitForSpinner(); cy.get(closedProposals).within(() => { cy.contains(proposalTitle) - .parentsUntil('[data-testid="proposals-list-item"]') + .parentsUntil(proposalListItem) + .last() .within(() => { cy.get(proposalStatus).should('have.text', 'Enacted '); cy.get(viewProposalButton).click(); @@ -78,7 +81,8 @@ context( waitForSpinner(); cy.get(openProposals).within(() => { cy.contains(proposalTitle) - .parentsUntil('[data-testid="proposals-list-item"]') + .parentsUntil(proposalListItem) + .last() .within(() => cy.get(viewProposalButton).click()); }); getProposalInformationFromTable('State') @@ -111,7 +115,8 @@ context( waitForSpinner(); cy.get(openProposals, { timeout: 6000 }).within(() => { cy.contains(proposalTitle) - .parentsUntil('[data-testid="proposals-list-item"]') + .parentsUntil(proposalListItem) + .last() .within(() => cy.get(viewProposalButton).click()); }); getProposalInformationFromTable('State') @@ -133,7 +138,8 @@ context( waitForSpinner(); cy.get(openProposals).within(() => { cy.contains(proposalTitle) - .parentsUntil('[data-testid="proposals-list-item"]') + .parentsUntil(proposalListItem) + .last() .within(() => cy.get(viewProposalButton).click()); }); getProposalInformationFromTable('State') diff --git a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts index da5278d03..e810e63d4 100644 --- a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts @@ -84,6 +84,7 @@ context( }); beforeEach('visit governance tab', function () { + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); cy.connectVegaWallet(); diff --git a/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts index 557f6c31e..3855eaf24 100644 --- a/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts +++ b/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts @@ -76,6 +76,7 @@ context( }); beforeEach('visit governance tab', function () { + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); cy.connectVegaWallet(); @@ -304,7 +305,10 @@ context( cy.get('dd').eq(0).should('have.text', 'Test market 1'); cy.get('dd').eq(1).should('have.text', 'TEST.24h'); cy.get('dd').eq(2).should('not.be.empty'); - cy.get('dd').eq(2).invoke('text').as('EnactedMarketId'); + cy.get('dd') + .eq(2) + .invoke('text') + .as('EnactedMarketId', { type: 'static' }); }); cy.get('@EnactedMarketId').then((marketId) => { cy.VegaWalletSubmitLiquidityProvision(String(marketId), '1'); @@ -322,6 +326,7 @@ context( cy.get('@EnactedMarketId').then((marketId) => { cy.contains(String(marketId)) .parentsUntil(proposalListItem) + .last() .within(() => { cy.getByTestId(viewProposalBtn).click(); }); @@ -375,16 +380,19 @@ context( cy.get(newProposalSubmitButton).should('be.visible').click(); // cannot submit a proposal with ERC20 address already in use cy.contains('Proposal rejected', proposalTimeout).should('be.visible'); - cy.getByTestId('dialog-content').within(() => { - cy.get('p').should( - 'have.text', - 'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE' - ); - }); + cy.getByTestId('dialog-content') + .last() + .within(() => { + cy.get('p').should( + 'have.text', + 'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE' + ); + }); closeDialog(); navigateTo(navigation.proposals); cy.contains(proposalTitle) .parentsUntil(proposalListItem) + .last() .within(() => { cy.getByTestId(viewProposalBtn).click(); }); @@ -422,6 +430,7 @@ context( cy.get(proposalType) .contains('Update asset') .parentsUntil(proposalListItem) + .last() .within(() => { cy.get(proposalDetails).should('contain.text', assetId); // 3001-VOTE-029 cy.getByTestId(viewProposalBtn).click(); diff --git a/apps/governance-e2e/src/integration/flow/proposal-list.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-list.cy.ts index e6da93eaa..bbae98c34 100644 --- a/apps/governance-e2e/src/integration/flow/proposal-list.cy.ts +++ b/apps/governance-e2e/src/integration/flow/proposal-list.cy.ts @@ -35,6 +35,7 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () { }); beforeEach('visit proposals tab', function () { + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); cy.connectVegaWallet(); @@ -59,7 +60,10 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () { cy.get(openProposals).within(() => { cy.get(proposalClosingDate).first().should('contain.text', 'year'); cy.get(proposalClosingDate).should('contain.text', 'months'); - cy.get(proposalClosingDate).last().should('contain.text', 'days'); + cy.get(proposalClosingDate) + .last() + .invoke('text') + .should('match', /days|minutes/); }); }); diff --git a/apps/governance-e2e/src/integration/flow/rewards-flow.cy.ts b/apps/governance-e2e/src/integration/flow/rewards-flow.cy.ts index 2f33aadfa..be874a12e 100644 --- a/apps/governance-e2e/src/integration/flow/rewards-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/rewards-flow.cy.ts @@ -25,9 +25,10 @@ const rewardsTimeOut = { timeout: 60000 }; context('rewards - flow', { tags: '@slow' }, function () { before('set up environment to allow rewards', function () { + cy.clearLocalStorage(); cy.visit('/'); waitForSpinner(); - depositAsset(vegaAssetAddress, '1000'); + depositAsset(vegaAssetAddress, '1000', 18); cy.validatorsSelfDelegate(); ethereumWalletConnect(); cy.connectVegaWallet(); @@ -56,7 +57,7 @@ context('rewards - flow', { tags: '@slow' }, function () { cy.getByTestId(rewardsTable) .first() .within(() => { - cy.getByTestId('asset').should('have.text', 'Vega'); + cy.getByTestId('asset', rewardsTimeOut).should('have.text', 'Vega'); cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD').should('have.text', '1'); cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE').should( 'have.text', @@ -93,13 +94,13 @@ context('rewards - flow', { tags: '@slow' }, function () { .within(() => { cy.get('h2').first().should('contain.text', 'EPOCH'); cy.getByTestId('individual-rewards-asset').should('have.text', 'Vega'); - cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD') - .should('contain.text', '0.1177') - .and('contain.text', '(11.7733%)'); + cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD', rewardsTimeOut) + .should('contain.text', '0.4415') + .and('contain.text', '(44.15%)'); cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE') - .should('contain.text', '0.0001') - .and('contain.text', '(11.7733%)'); - cy.getByTestId('total').should('have.text', '0.1179'); + .should('contain.text', '0.0004') + .and('contain.text', '(44.15%)'); + cy.getByTestId('total').should('have.text', '0.4419'); }); }); }); diff --git a/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts b/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts index 7722c6c8d..f7683bb31 100644 --- a/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts @@ -66,7 +66,7 @@ context( beforeEach( 'teardown wallet & drill into a specific validator', function () { - cy.clearAllLocalStorage(); + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); cy.connectVegaWallet(); diff --git a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts index 9bb79171a..3eb6ce5d6 100644 --- a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts @@ -53,6 +53,7 @@ context( beforeEach( 'teardown wallet & drill into a specific validator', function () { + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); cy.connectVegaWallet(); @@ -90,9 +91,14 @@ context( verifyEthWalletTotalAssociatedBalance('2.0'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0); - }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0 + ); + }); cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0); }); @@ -128,26 +134,38 @@ context( stakingPageAssociateTokens('1001', { approve: true }); verifyEthWalletAssociatedBalance('1,001.00'); verifyEthWalletTotalAssociatedBalance('1,001.00'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should( - 'contain', - '1,001.00' - ); - }); + cy.get(vegaWallet) + .last() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + '1,001.00' + ); + }); }); it('Able to disassociate a partial amount of tokens currently associated', function () { stakingPageAssociateTokens('2'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0); - }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0 + ); + }); cy.get('button').contains('Select a validator to nominate').click(); stakingPageDisassociateTokens('1'); verifyEthWalletAssociatedBalance('1.0'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 1.0); - }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 1.0 + ); + }); }); it('Able to disassociate all tokens - using max', function () { @@ -155,26 +173,40 @@ context( const warningText = 'Warning: Any tokens that have been nominated to a node will sacrifice rewards they are due for the current epoch. If you do not wish to sacrifice these, you should remove stake from a node at the end of an epoch before disassociation.'; stakingPageAssociateTokens('2'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0); - }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0 + ); + }); cy.get('button').contains('Select a validator to nominate').click(); cy.get(ethWalletDissociateButton).click(); cy.get(disassociationWarning).should('contain', warningText); stakingPageDisassociateAllTokens(); - cy.get(ethWalletContainer).within(() => { - cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should( - 'not.exist' - ); - }); - cy.get(ethWalletContainer).within(() => { - cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should( - 'not.exist' - ); - }); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 0.0); - }); + cy.get(ethWalletContainer) + .first() + .within(() => { + cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should( + 'not.exist' + ); + }); + cy.get(ethWalletContainer) + .first() + .within(() => { + cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should( + 'not.exist' + ); + }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 0.0 + ); + }); }); it('Able to associate and disassociate vesting contract tokens', function () { @@ -200,9 +232,14 @@ context( cy.getByTestId('currency-title', txTimeout).should('have.length', 6); verifyEthWalletAssociatedBalance('2.0'); verifyEthWalletTotalAssociatedBalance('2.0'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0); - }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0 + ); + }); cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0); stakingPageDisassociateTokens('1', { type: 'contract', @@ -228,38 +265,61 @@ context( stakingPageAssociateTokens('21', { type: 'wallet' }); cy.get('button').contains('Select a validator to nominate').click(); stakingPageAssociateTokens('37', { type: 'contract' }); - cy.get(vestingContractSection).within(() => { - cy.get(associatedKey).should( - 'contain', - Cypress.env('vegaWalletPublicKeyShort') - ); - cy.get(associatedAmount, txTimeout).should('contain', 37); - }); - cy.get(vegaInWalletSection).within(() => { - cy.get(associatedKey).should( - 'contain', - Cypress.env('vegaWalletPublicKeyShort') - ); - cy.get(associatedAmount, txTimeout).should('contain', 21); - }); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 58); - }); + cy.get(vestingContractSection) + .first() + .within(() => { + cy.get(associatedKey).should( + 'contain', + Cypress.env('vegaWalletPublicKeyShort') + ); + cy.get(associatedAmount, txTimeout).should('contain', 37); + }); + cy.get(vegaInWalletSection) + .first() + .within(() => { + cy.get(associatedKey).should( + 'contain', + Cypress.env('vegaWalletPublicKeyShort') + ); + cy.get(associatedAmount, txTimeout).should('contain', 21); + }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 58 + ); + }); stakingPageDisassociateTokens('6', { type: 'contract' }); - cy.get(vestingContractSection).within(() => { - cy.get(associatedAmount, txTimeout).should('contain', 31); - }); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 52); - }); + cy.get(vestingContractSection) + .first() + .within(() => { + cy.get(associatedAmount, txTimeout).should('contain', 31); + }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 52 + ); + }); navigateTo(navigation.validators); stakingPageDisassociateTokens('9', { type: 'wallet' }); - cy.get(vegaInWalletSection).within(() => { - cy.get(associatedAmount, txTimeout).should('contain', 12); - }); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 43); - }); + cy.get(vegaInWalletSection) + .first() + .within(() => { + cy.get(associatedAmount, txTimeout).should('contain', 12); + }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 43 + ); + }); }); it('Not able to associate more tokens than owned', function () { @@ -318,9 +378,14 @@ context( Cypress.env('vegaWalletPublicKey2') ); stakingPageAssociateTokens('2'); - cy.get(vegaWallet).within(() => { - cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0); - }); + cy.get(vegaWallet) + .first() + .within(() => { + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0 + ); + }); cy.get(associateCompleteText).should( 'have.text', `Vega key ${Cypress.env( diff --git a/apps/governance-e2e/src/integration/flow/withdrawal-flow.cy.ts b/apps/governance-e2e/src/integration/flow/withdrawal-flow.cy.ts index ebd2f619b..733899622 100644 --- a/apps/governance-e2e/src/integration/flow/withdrawal-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/withdrawal-flow.cy.ts @@ -4,10 +4,7 @@ import { waitForSpinner, } from '../../support/common.functions'; import { ethereumWalletConnect } from '../../support/wallet-eth.functions'; -import { - depositAsset, - vegaWalletTeardown, -} from '../../support/wallet-teardown.functions'; +import { depositAsset } from '../../support/wallet-teardown.functions'; const withdraw = 'withdraw'; const withdrawalForm = 'withdraw-form'; @@ -25,6 +22,13 @@ const withdrawalAmount = 'withdrawal-amount'; const withdrawalRecipient = 'withdrawal-recipient'; const withdrawFundsButton = 'withdraw-funds'; const completeWithdrawalButton = 'complete-withdrawal'; +const tableTxHash = '[col-id="txHash"]'; +const tableAssetSymbol = '[col-id="asset.symbol"]'; +const tableAmount = '[col-id="amount"]'; +const tableReceiverAddress = '[col-id="details.receiverAddress"]'; +const tableWithdrawnTimeStamp = '[col-id="withdrawnTimestamp"]'; +const tableWithdrawnStatus = '[col-id="status"]'; +const tableCreatedTimeStamp = '[col-id="createdTimestamp"]'; const usdtName = 'USDC (local)'; const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0'; const usdcSymbol = 'tUSDC'; @@ -42,26 +46,23 @@ context( cy.visit('/'); // When running tests locally, will fail if run without restarting capsule cy.updateCapsuleMultiSig().then(() => { - depositAsset(usdcEthAddress, '100'); + ethereumWalletConnect(); + depositAsset(usdcEthAddress, '1000', 5); }); }); beforeEach('Navigate to withdrawal page', function () { + cy.clearLocalStorage(); cy.reload(); waitForSpinner(); navigateTo(navigation.withdraw); cy.connectVegaWallet(); ethereumWalletConnect(); - vegaWalletTeardown(); }); it('Able to open withdrawal form with vega wallet connected', function () { - // needs to reload page for withdrawal form to be displayed in ci - not reproducible outside of ci - cy.reload(); - waitForSpinner(); - ethereumWalletConnect(); cy.getByTestId(withdraw).should('be.visible').click(); - cy.getByTestId(withdrawalForm).within(() => { + cy.getByTestId(withdrawalForm, txTimeout).within(() => { cy.get('select').find('option').should('have.length.at.least', 2); cy.getByTestId(ethAddressInput).should('be.visible'); cy.getByTestId(amountInput).should('be.visible'); @@ -70,7 +71,7 @@ context( it('Unable to submit withdrawal with invalid fields', function () { cy.getByTestId(withdraw).should('be.visible').click(); - cy.getByTestId(withdrawalForm).within(() => { + cy.getByTestId(withdrawalForm, txTimeout).within(() => { cy.get('select').select(usdtSelectValue, { force: true }); cy.getByTestId(balanceAvailable, txTimeout).should('exist'); cy.getByTestId(submitWithdrawalButton).click(); @@ -94,7 +95,7 @@ context( it('Able to withdraw asset: -eth wallet connected -withdraw funds button', function () { // fill in withdrawal form cy.getByTestId(withdraw).should('be.visible').click(); - cy.getByTestId(withdrawalForm).within(() => { + cy.getByTestId(withdrawalForm, txTimeout).within(() => { cy.get('select').select(usdtSelectValue, { force: true }); cy.getByTestId(balanceAvailable, txTimeout).should('exist'); cy.getByTestId(withdrawalThreshold).should( @@ -102,7 +103,7 @@ context( '100,000.00000T' ); cy.getByTestId(delayTime).should('have.text', 'None'); - cy.getByTestId(amountInput).click().type('100'); + cy.getByTestId(amountInput).click().type('120'); cy.getByTestId(submitWithdrawalButton).click(); }); @@ -116,7 +117,7 @@ context( .should('have.attr', 'href') .and('contain', '/txs/'); cy.getByTestId(withdrawalAssetSymbol).should('have.text', usdcSymbol); - cy.getByTestId(withdrawalAmount).should('have.text', '100.00'); + cy.getByTestId(withdrawalAmount).should('have.text', '120.00'); cy.getByTestId(withdrawalRecipient) .should('have.text', truncatedWithdrawalEthAddress) .and('have.attr', 'href') @@ -128,26 +129,20 @@ context( 'Withdraw asset complete' ); cy.getByTestId(dialogClose).click(); - - // need to reload page to see withdrawal history complete - cy.reload(); - waitForAssetsDisplayed(usdtName); - // withdrawal history for complete withdrawal displayed - cy.get('[col-id="txHash"]', txTimeout) - .should('have.length.above', 1) - .eq(1) + cy.get(tableWithdrawnStatus) + .eq(1, txTimeout) + .should('have.text', 'Completed') .parent() .within(() => { - cy.get('[col-id="asset.symbol"]').should('have.text', usdcSymbol); - cy.get('[col-id="amount"]').should('have.text', '100.00'); - cy.get('[col-id="details.receiverAddress"]') + cy.get(tableAssetSymbol).should('have.text', usdcSymbol); + cy.get(tableAmount).should('have.text', '120.00'); + cy.get(tableReceiverAddress) .find('a') .should('have.attr', 'href') .and('contain', 'https://sepolia.etherscan.io/address/'); - cy.get('[col-id="withdrawnTimestamp"]').should('not.be.empty'); - cy.get('[col-id="status"]').should('have.text', 'Completed'); - cy.get('[col-id="txHash"]') + cy.get(tableWithdrawnTimeStamp).should('not.be.empty'); + cy.get(tableTxHash) .find('a') .should('have.attr', 'href') .and('contain', 'https://sepolia.etherscan.io/tx/'); @@ -155,16 +150,16 @@ context( }); // Skipping because of bug #1857 - it.skip('Able to withdraw asset: -eth wallet not connected', function () { + it('Able to withdraw asset: -eth wallet not connected', function () { const ethWalletAddress = Cypress.env('ethWalletPublicKey'); cy.reload(); waitForAssetsDisplayed(usdtName); // fill in withdrawal form cy.getByTestId(withdraw).should('be.visible').click(); - cy.getByTestId(withdrawalForm).within(() => { + cy.getByTestId(withdrawalForm, txTimeout).within(() => { cy.get('select').select(usdtSelectValue, { force: true }); cy.getByTestId(ethAddressInput).should('be.empty'); - cy.getByTestId(amountInput).click().type('100'); + cy.getByTestId(amountInput).click().type('110'); cy.getByTestId(submitWithdrawalButton).click(); // Need eth address to submit withdrawal @@ -180,20 +175,20 @@ context( 'Transaction complete' ); cy.getByTestId(dialogClose).click(); - - cy.getByTestId(completeWithdrawalButton) - .eq(0) - .parent() + cy.get(tableTxHash) + .eq(1) + .should('have.text', 'Complete withdrawal') .parent() .within(() => { - cy.get('[col-id="asset.symbol"]').should('have.text', usdcSymbol); - cy.get('[col-id="amount"]').should('have.text', '100.00'); - cy.get('[col-id="details.receiverAddress"]') + cy.get(tableAssetSymbol).should('have.text', usdcSymbol); + cy.get(tableAmount).should('have.text', '110.00'); + cy.get(tableReceiverAddress) .find('a') .should('have.attr', 'href') .and('contain', 'https://sepolia.etherscan.io/address/'); - cy.get('[col-id="createdTimestamp"]').should('not.be.empty'); + cy.get(tableCreatedTimeStamp).should('not.be.empty'); cy.getByTestId(completeWithdrawalButton).click(); + // Unable to complete withdrawal in Capsule }); }); @@ -202,26 +197,28 @@ context( 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.`; // Disconnect vega wallet - cy.getByTestId('manage-vega-wallet').click(); + cy.getByTestId('manage-vega-wallet').last().click(); cy.getByTestId('disconnect').click(); cy.connectPublicKey(vegaWalletPubKey); cy.getByTestId(withdraw).should('be.visible').click(); - cy.getByTestId(withdrawalForm).within(() => { + cy.getByTestId(withdrawalForm, txTimeout).within(() => { cy.get('select').select(usdtSelectValue, { force: true }); cy.getByTestId(balanceAvailable, txTimeout).should('exist'); cy.getByTestId(amountInput).click().type('100'); cy.getByTestId(submitWithdrawalButton).click(); }); - cy.getByTestId('dialog-content').within(() => { - cy.get('h1').should('have.text', 'Transaction failed'); - cy.getByTestId('Error').should('have.text', expectedErrorTxt); - }); + cy.getByTestId('dialog-content') + .last() + .within(() => { + cy.get('h1').should('have.text', 'Transaction failed'); + cy.getByTestId('Error').should('have.text', expectedErrorTxt); + }); }); function waitForAssetsDisplayed(expectedAsset: string) { - cy.contains(expectedAsset, txTimeout).should('be.visible'); + cy.getByTestId('currency-title').should('contain.text', expectedAsset); } } ); diff --git a/apps/governance-e2e/src/support/governance.functions.ts b/apps/governance-e2e/src/support/governance.functions.ts index 318d53cdf..d3634c062 100644 --- a/apps/governance-e2e/src/support/governance.functions.ts +++ b/apps/governance-e2e/src/support/governance.functions.ts @@ -90,6 +90,7 @@ export function getSubmittedProposalFromProposalList(proposalTitle: string) { export function getProposalIdFromList(proposalTitle: string) { cy.contains(proposalTitle) .parentsUntil(proposalListItem) + .last() .within(() => { cy.get(proposalDetails) .invoke('text') @@ -133,7 +134,7 @@ export function waitForProposalSync() { // before proposal appears in the list - so rather than hard coded wait - we just wait on the // delegation checks that are performed on the governance page. - cy.intercept('POST', '/query', (req) => { + cy.intercept('POST', '/graphql', (req) => { if (req.body.operationName === 'Delegations') { req.alias = 'proposalDelegationsCompletion'; } @@ -143,7 +144,7 @@ export function waitForProposalSync() { cy.wait(['@proposalDelegationsCompletion', '@proposalDelegationsCompletion']); // Turn off this intercept from here on in - cy.intercept('POST', '/query', (req) => { + cy.intercept('POST', '/graphql', (req) => { if (req.body.operationName === 'Delegations') { req.continue(); } diff --git a/apps/governance-e2e/src/support/wallet-teardown.functions.ts b/apps/governance-e2e/src/support/wallet-teardown.functions.ts index 1560c2233..5c80fca9a 100644 --- a/apps/governance-e2e/src/support/wallet-teardown.functions.ts +++ b/apps/governance-e2e/src/support/wallet-teardown.functions.ts @@ -35,18 +35,25 @@ const stakingBridgeContract = new StakingBridge( ); const vestingContract = new TokenVesting(vegaTokenContractAddress, signer); -export async function depositAsset(assetEthAddress: string, amount: string) { +export async function depositAsset( + assetEthAddress: string, + amount: string, + decimalPlaces: number +) { // Approve asset const faucet = new TokenFaucetable(assetEthAddress, signer); - cy.wrap(faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(19)), { - timeout: transactionTimeout, - log: false, - }).then(() => { + cy.wrap( + faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(decimalPlaces + 1)), + { + timeout: transactionTimeout, + log: false, + } + ).then(() => { const collateralBridge = new CollateralBridge(Erc20BridgeAddress, signer); cy.wrap( collateralBridge.deposit_asset( assetEthAddress, - amount + '0'.repeat(18), + amount + '0'.repeat(decimalPlaces), '0x' + vegaWalletPubKey ), { timeout: transactionTimeout, log: false } @@ -102,27 +109,49 @@ async function vegaWalletTeardownStaking(stakingBridgeContract: StakingBridge) { cy.highlight('Tearing down staking tokens from vega wallet if present'); cy.wrap( stakingBridgeContract.stake_balance(ethWalletPubKey, vegaWalletPubKey), - { timeout: transactionTimeout, log: false } + { timeout: transactionTimeout } ).then((stakeBalance) => { if (Number(stakeBalance) != 0) { - cy.get('[data-testid="vega-wallet-balance-unstaked"]:visible').within( - () => { - cy.get(associatedAmountInWallet) - .invoke('text') - .then(($walletAmount) => { - cy.wrap( - stakingBridgeContract.remove_stake( - String(stakeBalance), - vegaWalletPubKey - ), - { timeout: transactionTimeout, log: false } - ); - cy.get(associatedAmountInWallet, { + cy.get(vegaWalletContainer).within(() => { + cy.getByTestId('currency-value') + .first() + .invoke('text') + .then(($associatedAmount) => { + cy.wrap( + stakingBridgeContract.remove_stake( + String(stakeBalance), + vegaWalletPubKey + ), + { timeout: transactionTimeout } + ); + cy.wrap( + vestingContract.stake_balance(ethWalletPubKey, vegaWalletPubKey), + { timeout: transactionTimeout, - }).should('not.have.text', $walletAmount); + log: false, + } + ).then((vestingAmount) => { + if (Number(vestingAmount) != 0) { + cy.contains('Associated', { + timeout: transactionTimeout, + }) + .parent() + .parent() + .within(() => { + cy.getByTestId('currency-value', { + timeout: transactionTimeout, + }) + .should('have.length', 1) + .invoke('text') + .as('displayedAmount'); + cy.get('@displayedAmount', { + timeout: transactionTimeout, + }).should('not.eq', $associatedAmount); + }); + } }); - } - ); + }); + }); } }); } @@ -136,7 +165,7 @@ async function vegaWalletTeardownVesting(vestingContract: TokenVesting) { if (Number(vestingAmount) != 0) { cy.wrap( vestingContract.remove_stake(String(vestingAmount), vegaWalletPubKey), - { timeout: transactionTimeout, log: false } + { timeout: transactionTimeout } ); } }); From f5fe3cc18dc7492be58f3be69938b3bc7023a831 Mon Sep 17 00:00:00 2001 From: dexturr Date: Wed, 3 May 2023 12:10:31 +0000 Subject: [PATCH 39/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 69 +++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index a8404b603..523fcc395 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "10740.2904998553229338", + "locked_amount": "10578.4844209587189695125", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "1328.5631944444439712", + "locked_amount": "1206.465231481482324", "deposits": [ { "amount": "111", @@ -1680,7 +1680,7 @@ "tranche_start": "2023-03-06T00:00:00.000Z", "tranche_end": "2023-04-06T00:00:00.000Z", "total_added": "14099", - "total_removed": "3142.49002352036", + "total_removed": "3722.49002352036", "locked_amount": "0", "deposits": [ { @@ -2450,6 +2450,11 @@ "user": "0xBe9F912Ad481C61B653463E8F1D2b2b310D49861", "tx": "0x191a1901917ada560c9c30efd3d24c0ec116b9dc131a6966cc67ad7e3701df3b" }, + { + "amount": "580", + "user": "0xAA4110D07E062bAA025BECb15B795447F58B8d2E", + "tx": "0x795e8308c0001ad97f322ea94c382cc1799cfd8231a0c492fa8d54f16d2eef56" + }, { "amount": "30", "user": "0x8499411Bff99ddE9A02903008F917EEa0E27B42A", @@ -3599,10 +3604,17 @@ "tx": "0x46d80a145d2f49ef3152cbfaa6d2bb054deabe21396ab43553a3f076e2db62e1" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "580", + "user": "0xAA4110D07E062bAA025BECb15B795447F58B8d2E", + "tranche_id": 53, + "tx": "0x795e8308c0001ad97f322ea94c382cc1799cfd8231a0c492fa8d54f16d2eef56" + } + ], "total_tokens": "580", - "withdrawn_tokens": "0", - "remaining_tokens": "580" + "withdrawn_tokens": "580", + "remaining_tokens": "0" }, { "address": "0x674038f225586317f3959C00D696Cb53cd52c16C", @@ -4703,7 +4715,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51226.896539776924515462", + "locked_amount": "51166.9974210106919556663", "deposits": [ { "amount": "86666.297", @@ -4769,7 +4781,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "394.848424145299", + "locked_amount": "391.38319724257215", "deposits": [ { "amount": "2500", @@ -4802,7 +4814,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14816.165647644927014816165647644927", + "locked_amount": "14795.60027928744001479560027928744", "deposits": [ { "amount": "1.5e-14", @@ -4890,7 +4902,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11483.8961541364725", + "locked_amount": "11459.903224386071", "deposits": [ { "amount": "12500", @@ -5157,7 +5169,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18593.57015423572875", + "locked_amount": "18541.30457719459875", "deposits": [ { "amount": "7500", @@ -5565,7 +5577,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51180.15844229965399674", + "locked_amount": "51120.313973942497539045", "deposits": [ { "amount": "129999.45", @@ -5598,7 +5610,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49373.06871247784644592557", + "locked_amount": "49335.74898575644407623565", "deposits": [ { "amount": "54144.7663", @@ -5631,7 +5643,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21051.60226407915008", + "locked_amount": "21008.336485286656638", "deposits": [ { "amount": "10000", @@ -5824,7 +5836,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1873.218702435312", + "locked_amount": "1869.76296930492115", "deposits": [ { "amount": "5000", @@ -6882,7 +6894,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "158090.6912451388393129414", + "locked_amount": "156749.9162904687626235986", "deposits": [ { "amount": "1852091.69", @@ -40754,7 +40766,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "267431.675840398797767447499", + "locked_amount": "265371.371543329369775774863", "deposits": [ { "amount": "1998.95815", @@ -42146,8 +42158,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "866687.25765937723884852", - "locked_amount": "6247983.1374161640607671780970752321127332", + "total_removed": "867610.78878511272497352", + "locked_amount": "6240677.4306629368200704822080834181008381", "deposits": [ { "amount": "16249.93", @@ -42696,6 +42708,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x2e3b57da0245aea9164e96cd7421d82a3f34df2ab34bc9a64b91e629fb5cb31c" }, + { + "amount": "923.531125735486125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xc5cea08b124cdf6264d5b0c7494d63d9de264b429822d9a4e4cfadc43e611a1b" + }, { "amount": "981.387731774910625", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -44840,6 +44857,12 @@ "tranche_id": 2, "tx": "0x2e3b57da0245aea9164e96cd7421d82a3f34df2ab34bc9a64b91e629fb5cb31c" }, + { + "amount": "923.531125735486125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xc5cea08b124cdf6264d5b0c7494d63d9de264b429822d9a4e4cfadc43e611a1b" + }, { "amount": "981.387731774910625", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -46348,8 +46371,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "156789.08944273708375", - "remaining_tokens": "103209.79805726291625" + "withdrawn_tokens": "157712.620568472569875", + "remaining_tokens": "102286.266931527430125" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -48725,7 +48748,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6168897.174282186485373182", - "locked_amount": "46652.9124232901388230326056764886", + "locked_amount": "39908.33059608817917720398993360406", "deposits": [ { "amount": "129284.449", @@ -58824,7 +58847,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "42376.077741542987921938344901044", + "locked_amount": "42049.610748470926039581595332312", "deposits": [ { "amount": "3000", From f37a8720a222386ac185e17cba2830f92386be51 Mon Sep 17 00:00:00 2001 From: daro-maj <119658839+daro-maj@users.noreply.github.com> Date: Wed, 3 May 2023 14:16:55 +0200 Subject: [PATCH 40/42] test(trading): handle unspecified side in fills table - e2e tests (#3594) --- apps/trading-e2e/src/integration/trading-fills.cy.ts | 2 +- libs/fills/src/lib/fills.mock.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/trading-e2e/src/integration/trading-fills.cy.ts b/apps/trading-e2e/src/integration/trading-fills.cy.ts index b05aa09e7..dbfdfa35a 100644 --- a/apps/trading-e2e/src/integration/trading-fills.cy.ts +++ b/apps/trading-e2e/src/integration/trading-fills.cy.ts @@ -85,7 +85,7 @@ describe('fills', { tags: '@regression' }, () => { cy.wrap($role) .invoke('text') .then((text) => { - const roles = ['Maker', 'Taker']; + const roles = ['Maker', 'Taker', '-']; expect(roles.indexOf(text.trim())).to.be.greaterThan(-1); }); }); diff --git a/libs/fills/src/lib/fills.mock.ts b/libs/fills/src/lib/fills.mock.ts index 9e6f9b274..68f665955 100644 --- a/libs/fills/src/lib/fills.mock.ts +++ b/libs/fills/src/lib/fills.mock.ts @@ -152,6 +152,16 @@ const fills = (id?: string): FillFieldsFragment[] => [ id: id || 'buyer-id', }, }), + fillFieldsFragment({ + id: '4', + aggressor: Schema.Side.SIDE_UNSPECIFIED, + market: { + id: 'market-2', + }, + buyer: { + id: id || 'buyer-id', + }, + }), ]; export const fillsEventSubscription = ( From 2460a62a3efa6dedf8b56a57847fc09bedc24dad Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Wed, 3 May 2023 08:05:55 -0700 Subject: [PATCH 41/42] fix(governance): add custom styles for validators table (#3597) --- apps/governance/src/styles.css | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/governance/src/styles.css b/apps/governance/src/styles.css index 9ffe6df73..54536c9c0 100644 --- a/apps/governance/src/styles.css +++ b/apps/governance/src/styles.css @@ -40,18 +40,6 @@ line-height: calc(min(var(--ag-line-height, 26px), 26px) - 4px); } -/* Light variables */ -.ag-theme-balham { - --ag-background-color: theme(colors.white); - --ag-border-color: theme(colors.neutral[300]); - --ag-header-background-color: theme(colors.white); - --ag-odd-row-background-color: theme(colors.white); - --ag-header-column-separator-color: theme(colors.neutral[300]); - --ag-row-border-color: theme(colors.white); - --ag-row-hover-color: theme(colors.neutral[100]); - --ag-font-size: 12px; -} - /* Dark variables */ .ag-theme-balham-dark { --ag-background-color: theme(colors.black); @@ -63,3 +51,10 @@ --ag-row-hover-color: theme(colors.neutral[800]); --ag-font-size: 12px; } + +.validators-table .ag-theme-balham-dark .ag-body-horizontal-scroll { + opacity: 0.75; +} +.validators-table .ag-theme-balham-dark *:hover { + cursor: pointer; +} From ce22da1c9adbafb8a36231e3efcabcb71335f8c6 Mon Sep 17 00:00:00 2001 From: dexturr Date: Wed, 3 May 2023 18:09:05 +0000 Subject: [PATCH 42/42] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 523fcc395..6daac815b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "10578.4844209587189695125", + "locked_amount": "10418.7792376543211777", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "1206.465231481482324", + "locked_amount": "1085.952592592592978", "deposits": [ { "amount": "111", @@ -4715,7 +4715,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51166.9974210106919556663", + "locked_amount": "51107.876034425155701037", "deposits": [ { "amount": "86666.297", @@ -4781,7 +4781,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "391.38319724257215", + "locked_amount": "387.962962962963", "deposits": [ { "amount": "2500", @@ -4814,7 +4814,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14795.60027928744001479560027928744", + "locked_amount": "14775.301932367149014775301932367149", "deposits": [ { "amount": "1.5e-14", @@ -4902,7 +4902,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11459.903224386071", + "locked_amount": "11436.2218196457315", "deposits": [ { "amount": "12500", @@ -5169,7 +5169,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18541.30457719459875", + "locked_amount": "18489.717618170655", "deposits": [ { "amount": "7500", @@ -5577,7 +5577,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51120.313973942497539045", + "locked_amount": "51061.24652818329987399", "deposits": [ { "amount": "129999.45", @@ -5610,7 +5610,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49335.74898575644407623565", + "locked_amount": "49298.9138196269965560045", "deposits": [ { "amount": "54144.7663", @@ -5643,7 +5643,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21008.336485286656638", + "locked_amount": "20965.63247082699134", "deposits": [ { "amount": "10000", @@ -5836,7 +5836,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1869.76296930492115", + "locked_amount": "1866.352105530188", "deposits": [ { "amount": "5000", @@ -6894,7 +6894,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "156749.9162904687626235986", + "locked_amount": "155426.5500030847769098336", "deposits": [ { "amount": "1852091.69", @@ -40766,7 +40766,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "265371.371543329369775774863", + "locked_amount": "263337.818306825404305623187", "deposits": [ { "amount": "1998.95815", @@ -42159,7 +42159,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "867610.78878511272497352", - "locked_amount": "6240677.4306629368200704822080834181008381", + "locked_amount": "6233466.5814528903248765151216390212111382", "deposits": [ { "amount": "16249.93", @@ -48748,7 +48748,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6168897.174282186485373182", - "locked_amount": "39908.33059608817917720398993360406", + "locked_amount": "33251.32064708015607663338925032586", "deposits": [ { "amount": "129284.449", @@ -58847,7 +58847,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "42049.610748470926039581595332312", + "locked_amount": "41727.382613860946149215697311012", "deposits": [ { "amount": "3000",