Compare commits

..
Author SHA1 Message Date
Dexter 7edb5d20c3 chore: hack fallbaclk to imaginary vesting contract 2023-01-31 19:42:05 +00:00
mattrussell36 f7f00dc7bb chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-31 18:07:31 +00:00
macqbat d151b6e923 chore(trading): add sub statuses of opening auction trading mode (#2797) 2023-01-31 17:31:55 +01:00
Sam Keen 8f8e9c1061 feat(ui-toolkit): announcement banner to highlight mainnet sims (#2800) 2023-01-31 16:12:44 +00:00
m.ray b40358a723 fix(trading): consolidate view as user mode (#2778) 2023-01-31 16:04:52 +00:00
Art 01f0934da3 chore(ui-toolkit): new colour palette (#2783) 2023-01-31 16:33:16 +01:00
mattrussell36 df7755dbc4 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-31 12:06:33 +00:00
Joe Tsang 9073234040 test(ci): fix tags in cypress workflow (#2788) 2023-01-31 11:35:42 +00:00
Art 053cd0fa27 fix(trading): asset option on mobile got overflown (#2782) 2023-01-31 11:10:55 +01:00
mattrussell36 961dc88dc7 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-31 06:08:30 +00:00
mattrussell36 b16607a844 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-31 00:13:30 +00:00
Matthew Russell d0d804631c chore(ci): add nx scope linting for pr title (#2781) 2023-01-30 21:06:18 +00:00
daro-maj 3e778a88dc chore: capsule tests refactor and increase deposit ac (#2773) 2023-01-30 20:35:58 +01:00
Edd dbb09c9c79 fix(explorer): correct calculation for whether party txs list has more txs (#2774) 2023-01-30 18:23:09 +00:00
Edd 06f44b67de fix(explorer): tx viewer dropdown did not correctly represent state (#2780) 2023-01-30 18:17:47 +00:00
Joe Tsang 1861852852 test(2704): proposals with market (#2775) 2023-01-30 18:06:04 +00:00
mattrussell36 3ee0eee80d chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-30 12:09:00 +00:00
mattrussell36 69ce870a81 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-30 06:06:56 +00:00
mattrussell36 d8467c3206 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-30 00:12:51 +00:00
mattrussell36 de87f40a01 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-29 18:08:12 +00:00
69 changed files with 1435 additions and 482 deletions
+1 -2
View File
@@ -64,12 +64,11 @@ jobs:
######
- name: Run Cypress tests
run: yarn nx run ${{ matrix.project }}:e2e ${{ env.SKIP_CACHE }} --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome
run: yarn nx run ${{ matrix.project }}:e2e ${{ env.SKIP_CACHE }} --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome --env.grepTags="${{ inputs.tags }}"
working-directory: frontend-monorepo
env:
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
CYPRESS_VEGA_WALLET_API_TOKEN: ${{ steps.setup-vega.outputs.token }}
CYPRESS_grepTags: ${{ inputs.tags }}
######
## Upload logs
+7 -5
View File
@@ -8,14 +8,16 @@ jobs:
lint_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 16
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.14.0
- name: Install commitlint cli and config
run: npm install @commitlint/cli @commitlint/config-conventional
- name: Create config
run: echo "module.exports = {extends:['@commitlint/config-conventional']};" > commitlint.config.js
- name: Install root dependencies
run: yarn install
- name: Check PR title
run: echo "${{ github.event.pull_request.title }}" | npx commitlint
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --config ./commitlint.config-ci.js
@@ -63,7 +63,7 @@ export const TxDataView = ({ txData, blockData }: TxDataViewProps) => {
<Select
placeholder="View as..."
onChange={(v) => setShowTxData(v.target.value as ShowTxDataType)}
value={'JSON'}
value={showTxData}
>
<option value={'JSON'}>JSON</option>
<option value={'base64'}>Base64</option>
+5 -4
View File
@@ -5,6 +5,7 @@ import type {
BlockExplorerTransactions,
} from '../routes/types/block-explorer-response';
import { DATA_SOURCES } from '../config';
import isNumber from 'lodash/isNumber';
export interface TxsStateProps {
txsData: BlockExplorerTransactionResult[];
@@ -54,15 +55,15 @@ export const useTxsData = ({ limit, filters }: IUseTxsData) => {
} = useFetch<BlockExplorerTransactions>(url, {}, false);
useEffect(() => {
if (data?.transactions?.length) {
if (data && isNumber(data?.transactions?.length)) {
setTxsState((prev) => ({
txsData: [...prev.txsData, ...data.transactions],
hasMoreTxs: true,
hasMoreTxs: data.transactions.length > 0,
lastCursor:
data.transactions[data.transactions.length - 1].cursor || '',
data.transactions[data.transactions.length - 1]?.cursor || '',
}));
}
}, [setTxsState, data?.transactions]);
}, [setTxsState, data]);
const loadTxs = useCallback(() => {
return refetch({
Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

+323 -64
View File
@@ -1,11 +1,77 @@
[
{
"tranche_id": 50,
"tranche_start": "2023-10-01T00:00:00.000Z",
"tranche_end": "2024-04-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "2500",
"deposits": [
{
"amount": "2500",
"user": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"tx": "0x0e229459260c2e74579e12e05ffd21cb4e470e3a4eacf85b7f924778b4f1c8a6"
}
],
"withdrawals": [],
"users": [
{
"address": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"deposits": [
{
"amount": "2500",
"user": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"tranche_id": 50,
"tx": "0x0e229459260c2e74579e12e05ffd21cb4e470e3a4eacf85b7f924778b4f1c8a6"
}
],
"withdrawals": [],
"total_tokens": "2500",
"withdrawn_tokens": "0",
"remaining_tokens": "2500"
}
]
},
{
"tranche_id": 51,
"tranche_start": "2024-01-01T00:00:00.000Z",
"tranche_end": "2024-07-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "2500",
"deposits": [
{
"amount": "2500",
"user": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"tx": "0x0e229459260c2e74579e12e05ffd21cb4e470e3a4eacf85b7f924778b4f1c8a6"
}
],
"withdrawals": [],
"users": [
{
"address": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"deposits": [
{
"amount": "2500",
"user": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"tranche_id": 51,
"tx": "0x0e229459260c2e74579e12e05ffd21cb4e470e3a4eacf85b7f924778b4f1c8a6"
}
],
"withdrawals": [],
"total_tokens": "2500",
"withdrawn_tokens": "0",
"remaining_tokens": "2500"
}
]
},
{
"tranche_id": 49,
"tranche_start": "2022-12-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
"locked_amount": "73487.251446645509463922",
"locked_amount": "72952.7900446204316134035",
"deposits": [
{
"amount": "86666.297",
@@ -71,7 +137,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "1682.6333244301995",
"locked_amount": "1651.7141712454215",
"deposits": [
{
"amount": "2500",
@@ -265,12 +331,34 @@
"tranche_id": 42,
"tranche_start": "2023-07-01T00:00:00.000Z",
"tranche_end": "2024-01-01T00:00:00.000Z",
"total_added": "0",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "0",
"deposits": [],
"locked_amount": "2500",
"deposits": [
{
"amount": "2500",
"user": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"tx": "0x0e229459260c2e74579e12e05ffd21cb4e470e3a4eacf85b7f924778b4f1c8a6"
}
],
"withdrawals": [],
"users": []
"users": [
{
"address": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"deposits": [
{
"amount": "2500",
"user": "0x6ad69157EfB1E17EBf6614D352D098589EaE3060",
"tranche_id": 42,
"tx": "0x0e229459260c2e74579e12e05ffd21cb4e470e3a4eacf85b7f924778b4f1c8a6"
}
],
"withdrawals": [],
"total_tokens": "2500",
"withdrawn_tokens": "0",
"remaining_tokens": "2500"
}
]
},
{
"tranche_id": 43,
@@ -450,7 +538,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
"locked_amount": "73420.20357622098315111",
"locked_amount": "72886.229802976735885635",
"deposits": [
{
"amount": "129999.45",
@@ -516,7 +604,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
"locked_amount": "37130.49642947742434",
"locked_amount": "36744.44920091324704",
"deposits": [
{
"amount": "10000",
@@ -709,7 +797,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
"locked_amount": "3157.4754249112125",
"locked_amount": "3126.64098173516",
"deposits": [
{
"amount": "5000",
@@ -920,7 +1008,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "97499.58",
"total_removed": "0",
"locked_amount": "15240.5819298544871083824",
"locked_amount": "14716.8034002088306102026",
"deposits": [
{
"amount": "97499.58",
@@ -953,7 +1041,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "135173.4239508",
"total_removed": "98230.390980249184455396",
"locked_amount": "20831.244321407448710024671284",
"locked_amount": "20115.329497972601377405487628",
"deposits": [
{
"amount": "135173.4239508",
@@ -999,7 +1087,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "32499.86",
"total_removed": "0",
"locked_amount": "6411.4496271174975967098",
"locked_amount": "6191.105044866968902606",
"deposits": [
{
"amount": "32499.86",
@@ -1032,7 +1120,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "10833.29",
"total_removed": "0",
"locked_amount": "2086.8646383922243299952",
"locked_amount": "2015.1446150428923522868",
"deposits": [
{
"amount": "10833.29",
@@ -1065,7 +1153,7 @@
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "22749.93",
"total_removed": "0",
"locked_amount": "7801.1661111092940288519",
"locked_amount": "7533.0606454515702272178",
"deposits": [
{
"amount": "6500",
@@ -1204,7 +1292,7 @@
"tranche_end": "2023-05-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "3707.308452225",
"locked_amount": "11373.775610036832",
"locked_amount": "11093.96581491712725",
"deposits": [
{
"amount": "7500",
@@ -1380,7 +1468,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "928642.9598472029154",
"locked_amount": "656363.903872495430316328",
"locked_amount": "644400.581592751114092338",
"deposits": [
{
"amount": "1852091.69",
@@ -1732,7 +1820,7 @@
"tranche_end": "2023-02-01T00:00:00.000Z",
"total_added": "42500",
"total_removed": "24434.0787288",
"locked_amount": "576.45383579911392",
"locked_amount": "56.5415534420304905",
"deposits": [
{
"amount": "12500",
@@ -1830,7 +1918,7 @@
"tranche_start": "2021-09-03T00:00:00.000Z",
"tranche_end": "2022-03-03T00:00:00.000Z",
"total_added": "3145.41",
"total_removed": "1726.74",
"total_removed": "1736.74",
"locked_amount": "0",
"deposits": [
{
@@ -1995,6 +2083,11 @@
}
],
"withdrawals": [
{
"amount": "10",
"user": "0x4cBC0C88d8FE503f62823B42f30a4900292C13bE",
"tx": "0xa0ad93f116b5a6098ceda7e07141f806a90d5fb94f0c0555ac7049709a7fb3b7"
},
{
"amount": "20",
"user": "0xE9F41a0090fcc7eaf626037003AAD44B17098E7C",
@@ -2241,10 +2334,17 @@
"tx": "0xf6ffe87368413b25eb480d979745c5f7c32444318abb1c75e0c3bf3dba3410cd"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "10",
"user": "0x4cBC0C88d8FE503f62823B42f30a4900292C13bE",
"tranche_id": 12,
"tx": "0xa0ad93f116b5a6098ceda7e07141f806a90d5fb94f0c0555ac7049709a7fb3b7"
}
],
"total_tokens": "10",
"withdrawn_tokens": "0",
"remaining_tokens": "10"
"withdrawn_tokens": "10",
"remaining_tokens": "0"
},
{
"address": "0xF3638a47940B4d8c4b7F0AabB44Dc6DB8313a03A",
@@ -6722,8 +6822,8 @@
"tranche_id": 11,
"tranche_start": "2021-09-03T00:00:00.000Z",
"tranche_end": "2022-09-03T00:00:00.000Z",
"total_added": "53995.000000000000000003",
"total_removed": "42939.21518131551",
"total_added": "54025.000000000000000003",
"total_removed": "43035.21518131551",
"locked_amount": "0",
"deposits": [
{
@@ -6781,6 +6881,16 @@
"user": "0xa7d3D2CC58e1E82e3ff2C2Cd3B750442522aBbfb",
"tx": "0x6957b2bd0f9f04f7cc124c11638be50ff5e2a26412e0be0c16f7aac1f1b73bc6"
},
{
"amount": "15",
"user": "0xB12Cdb63E38f9a6ff2C0F68aBC3CA9beFCb7148c",
"tx": "0x7a0b7cc2723724de05fc2185b23021413450f47d40e27bcfa6b26f0872e94c9f"
},
{
"amount": "15",
"user": "0xB12Cdb63E38f9a6ff2C0F68aBC3CA9beFCb7148c",
"tx": "0xcbf45579767dff34e84484629ee3fb3355232245f30ad259443e3864db80a707"
},
{
"amount": "20",
"user": "0xB12Cdb63E38f9a6ff2C0F68aBC3CA9beFCb7148c",
@@ -16728,6 +16838,11 @@
"user": "0xa10aD7E7712617fc4ABe0811D8a30fD96cE48F9f",
"tx": "0x7ffe3e795b50a8449052143a739d53aec81c2f53c7981f31496b8c121bd4ec81"
},
{
"amount": "96",
"user": "0x4cBC0C88d8FE503f62823B42f30a4900292C13bE",
"tx": "0x51d8ec749dbb4148d170869bca8a6b8ce679bfea0686f9582c3a58f3f31fd77a"
},
{
"amount": "200",
"user": "0xa7d3D2CC58e1E82e3ff2C2Cd3B750442522aBbfb",
@@ -17799,6 +17914,18 @@
{
"address": "0xB12Cdb63E38f9a6ff2C0F68aBC3CA9beFCb7148c",
"deposits": [
{
"amount": "15",
"user": "0xB12Cdb63E38f9a6ff2C0F68aBC3CA9beFCb7148c",
"tranche_id": 11,
"tx": "0x7a0b7cc2723724de05fc2185b23021413450f47d40e27bcfa6b26f0872e94c9f"
},
{
"amount": "15",
"user": "0xB12Cdb63E38f9a6ff2C0F68aBC3CA9beFCb7148c",
"tranche_id": 11,
"tx": "0xcbf45579767dff34e84484629ee3fb3355232245f30ad259443e3864db80a707"
},
{
"amount": "20",
"user": "0xB12Cdb63E38f9a6ff2C0F68aBC3CA9beFCb7148c",
@@ -18570,9 +18697,9 @@
"tx": "0x6940787f6ceaac0846e69f1bc93ad9efee8c39774b91ea29f84328ae64fc9969"
}
],
"total_tokens": "2600",
"total_tokens": "2630",
"withdrawn_tokens": "2585",
"remaining_tokens": "15"
"remaining_tokens": "45"
},
{
"address": "0xE9F41a0090fcc7eaf626037003AAD44B17098E7C",
@@ -30450,10 +30577,17 @@
"tx": "0xe7518eaa0fe2385aec5ab0f8617ba0b62d71d82e8be39586763020ec04c98422"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "96",
"user": "0x4cBC0C88d8FE503f62823B42f30a4900292C13bE",
"tranche_id": 11,
"tx": "0x51d8ec749dbb4148d170869bca8a6b8ce679bfea0686f9582c3a58f3f31fd77a"
}
],
"total_tokens": "96",
"withdrawn_tokens": "0",
"remaining_tokens": "96"
"withdrawn_tokens": "96",
"remaining_tokens": "0"
},
{
"address": "0xaf487ccD027742705EC1B2DD1adCFAb0eBccDeAb",
@@ -33294,8 +33428,8 @@
"tranche_start": "2022-03-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "442882.3484327902809",
"locked_amount": "1033104.123341510407167357286",
"total_removed": "589730.8667090699299",
"locked_amount": "1014720.66218397269192838495",
"deposits": [
{
"amount": "1998.95815",
@@ -33464,6 +33598,16 @@
}
],
"withdrawals": [
{
"amount": "144779.049152",
"user": "0x1da69E9C22d77Ef8Ccbf5a1F2d83eDBc5Dcc20fA",
"tx": "0x0b7e2937cd20679a8b18424808e50d0bfa356895b08fcac7afeb5166214a6134"
},
{
"amount": "2069.469124279649",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tx": "0x8a19d30e4686bca650aa1c4e84a82d8a16d607e07828706cb758a6e17cab0190"
},
{
"amount": "2536.282963529438",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
@@ -33813,6 +33957,12 @@
}
],
"withdrawals": [
{
"amount": "2069.469124279649",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tranche_id": 1,
"tx": "0x8a19d30e4686bca650aa1c4e84a82d8a16d607e07828706cb758a6e17cab0190"
},
{
"amount": "2536.282963529438",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
@@ -34079,8 +34229,8 @@
}
],
"total_tokens": "187637.95",
"withdrawn_tokens": "134424.6460800270605",
"remaining_tokens": "53213.3039199729395"
"withdrawn_tokens": "136494.1152043067095",
"remaining_tokens": "51143.8347956932905"
},
{
"address": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e",
@@ -34184,10 +34334,17 @@
"tx": "0xeb14f907c987ad54eed8697ec95c8a674c9034a4cbee43b013f947bb0e398ce5"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "144779.049152",
"user": "0x1da69E9C22d77Ef8Ccbf5a1F2d83eDBc5Dcc20fA",
"tranche_id": 1,
"tx": "0x0b7e2937cd20679a8b18424808e50d0bfa356895b08fcac7afeb5166214a6134"
}
],
"total_tokens": "200000",
"withdrawn_tokens": "0",
"remaining_tokens": "200000"
"withdrawn_tokens": "144779.049152",
"remaining_tokens": "55220.950848"
},
{
"address": "0x4d50f66eF38892248Bb4Badbbf993dE965BDb029",
@@ -34586,8 +34743,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "549182.48543502092691952",
"locked_amount": "8963008.4753852283836950014010192461651798",
"total_removed": "551396.87737862765567952",
"locked_amount": "8897821.9024516211694110022588123882238443",
"deposits": [
{
"amount": "16249.93",
@@ -35101,6 +35258,21 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x6c49f9f742a84f7889b90e6f978f3fb1f642ea447f737f348b3fac91716b9717"
},
{
"amount": "687.93046004616176",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tx": "0x137cf963adc7f889f2b24bb3d55716cb6b8581bf13040f13e65f1d16c52e2f9f"
},
{
"amount": "1412.763584",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tx": "0x606ddaa3882cccb0062bc2827cfcfceb64cef8a6c4df41d06747ae651e5dd52e"
},
{
"amount": "113.697899560567",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tx": "0xeb5f2401c9402d58fa4a7549ce2045a48a2c3b90ec6e812ca2f0059f1275e213"
},
{
"amount": "858.360074993579125",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -38006,6 +38178,12 @@
"tranche_id": 2,
"tx": "0x7882fc86536accee89368b825b374eb365ee5f051cb89fb3710c7e2d24b0d29d"
},
{
"amount": "687.93046004616176",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tranche_id": 2,
"tx": "0x137cf963adc7f889f2b24bb3d55716cb6b8581bf13040f13e65f1d16c52e2f9f"
},
{
"amount": "1293.67099136315494",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
@@ -38206,8 +38384,8 @@
}
],
"total_tokens": "150551.801",
"withdrawn_tokens": "65072.74657224015982",
"remaining_tokens": "85479.05442775984018"
"withdrawn_tokens": "65760.67703228632158",
"remaining_tokens": "84791.12396771367842"
},
{
"address": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148",
@@ -38409,6 +38587,12 @@
}
],
"withdrawals": [
{
"amount": "1412.763584",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tranche_id": 2,
"tx": "0x606ddaa3882cccb0062bc2827cfcfceb64cef8a6c4df41d06747ae651e5dd52e"
},
{
"amount": "1099.300488",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
@@ -38591,8 +38775,8 @@
}
],
"total_tokens": "200000",
"withdrawn_tokens": "86015.962928",
"remaining_tokens": "113984.037072"
"withdrawn_tokens": "87428.726512",
"remaining_tokens": "112571.273488"
},
{
"address": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01",
@@ -39052,6 +39236,12 @@
}
],
"withdrawals": [
{
"amount": "113.697899560567",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
"tranche_id": 2,
"tx": "0xeb5f2401c9402d58fa4a7549ce2045a48a2c3b90ec6e812ca2f0059f1275e213"
},
{
"amount": "139.3487773806265",
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
@@ -39300,8 +39490,8 @@
}
],
"total_tokens": "12362.05",
"withdrawn_tokens": "5310.2045398579465",
"remaining_tokens": "7051.8454601420535"
"withdrawn_tokens": "5423.9024394185135",
"remaining_tokens": "6938.1475605814865"
},
{
"address": "0xb091D456d0dFCB94dcba6f355379056C5bb995fC",
@@ -39933,7 +40123,7 @@
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "3709441.39326687814680893",
"locked_amount": "2553146.968835877717601199418901287",
"locked_amount": "2492966.831482503696801792718375116",
"deposits": [
{
"amount": "129284.449",
@@ -46655,8 +46845,8 @@
"tranche_start": "2021-10-05T00:00:00.000Z",
"tranche_end": "2023-04-05T00:00:00.000Z",
"total_added": "5778205.3912159303",
"total_removed": "2622261.560853924298939789",
"locked_amount": "691860.405151183386025619771012724",
"total_removed": "2645595.987385819383764789",
"locked_amount": "668082.868916425011638062631735106",
"deposits": [
{
"amount": "552496.6455",
@@ -46800,6 +46990,16 @@
}
],
"withdrawals": [
{
"amount": "19117.297184565582142",
"user": "0x1dD2718fd01d05C9F50Fce8Bb723A4C7483A1E15",
"tx": "0xf86662bab80d05690accd866da9bbe8e7a82e1b62133350789d7a863f1019211"
},
{
"amount": "4217.129347329502683",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
"tx": "0x687f74292db1a9d0c79bedca56eb5dd57d5d338a2d536b355cd2d1022dc4889b"
},
{
"amount": "3634.58269967002683",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
@@ -47602,6 +47802,12 @@
}
],
"withdrawals": [
{
"amount": "19117.297184565582142",
"user": "0x1dD2718fd01d05C9F50Fce8Bb723A4C7483A1E15",
"tranche_id": 4,
"tx": "0xf86662bab80d05690accd866da9bbe8e7a82e1b62133350789d7a863f1019211"
},
{
"amount": "376.2625308599198808",
"user": "0x1dD2718fd01d05C9F50Fce8Bb723A4C7483A1E15",
@@ -47610,8 +47816,8 @@
}
],
"total_tokens": "22099.90582",
"withdrawn_tokens": "376.2625308599198808",
"remaining_tokens": "21723.6432891400801192"
"withdrawn_tokens": "19493.5597154255020228",
"remaining_tokens": "2606.3461045744979772"
},
{
"address": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
@@ -48224,6 +48430,12 @@
}
],
"withdrawals": [
{
"amount": "4217.129347329502683",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
"tranche_id": 4,
"tx": "0x687f74292db1a9d0c79bedca56eb5dd57d5d338a2d536b355cd2d1022dc4889b"
},
{
"amount": "3634.58269967002683",
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
@@ -48454,8 +48666,8 @@
}
],
"total_tokens": "331498.5873",
"withdrawn_tokens": "288277.339276030741737",
"remaining_tokens": "43221.248023969258263"
"withdrawn_tokens": "292494.46862336024442",
"remaining_tokens": "39004.11867663975558"
},
{
"address": "0x16da609341ed67750A8BCC5AAa2005471006Cd77",
@@ -48550,8 +48762,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "31616.1712341930685",
"locked_amount": "163701.253818397273052118746829",
"total_removed": "31901.3891584672685",
"locked_amount": "160788.274335342977388499684830024",
"deposits": [
{
"amount": "3000",
@@ -55170,6 +55382,21 @@
}
],
"withdrawals": [
{
"amount": "13.1116203702",
"user": "0x4cBC0C88d8FE503f62823B42f30a4900292C13bE",
"tx": "0xf712a2417c5e58f65ac39422766fd902301f905f41e9eed0dc097e1dfa641b1c"
},
{
"amount": "262.76406646",
"user": "0xD3ec605d078326B0a636ca90d496Ebb5Eb457a27",
"tx": "0xc3734fbb0982f35d4add052e69d6b997f92364ac75654253f4abdc62a4245d1e"
},
{
"amount": "9.342237444",
"user": "0x479F059c46c6873C6B970A92911084b3eA036d56",
"tx": "0x36fe6a597bd0be532236bf13e1e2575fbb56536666438d07a006a9df0c9b0a13"
},
{
"amount": "78.261187214",
"user": "0x479F059c46c6873C6B970A92911084b3eA036d56",
@@ -63244,10 +63471,17 @@
"tx": "0xc7dd4c2b995cc486fcd8b7892cd79f8fb393ada004dc68cf66ec82d99b35763c"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "262.76406646",
"user": "0xD3ec605d078326B0a636ca90d496Ebb5Eb457a27",
"tranche_id": 5,
"tx": "0xc3734fbb0982f35d4add052e69d6b997f92364ac75654253f4abdc62a4245d1e"
}
],
"total_tokens": "400",
"withdrawn_tokens": "0",
"remaining_tokens": "400"
"withdrawn_tokens": "262.76406646",
"remaining_tokens": "137.23593354"
},
{
"address": "0x7f6aba7563Cb5d31980D440337D3d1A6e3dB58F3",
@@ -63409,10 +63643,17 @@
"tx": "0x057f65938b1360b6d2c4ebf5e789c67897cf60cb6a13f947004def03891afbd8"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "13.1116203702",
"user": "0x4cBC0C88d8FE503f62823B42f30a4900292C13bE",
"tranche_id": 5,
"tx": "0xf712a2417c5e58f65ac39422766fd902301f905f41e9eed0dc097e1dfa641b1c"
}
],
"total_tokens": "20",
"withdrawn_tokens": "0",
"remaining_tokens": "20"
"withdrawn_tokens": "13.1116203702",
"remaining_tokens": "6.8883796298"
},
{
"address": "0x9999099991E044E3538379C80F00308E430881AA",
@@ -73105,6 +73346,12 @@
}
],
"withdrawals": [
{
"amount": "9.342237444",
"user": "0x479F059c46c6873C6B970A92911084b3eA036d56",
"tranche_id": 5,
"tx": "0x36fe6a597bd0be532236bf13e1e2575fbb56536666438d07a006a9df0c9b0a13"
},
{
"amount": "78.261187214",
"user": "0x479F059c46c6873C6B970A92911084b3eA036d56",
@@ -73119,8 +73366,8 @@
}
],
"total_tokens": "200",
"withdrawn_tokens": "122.354712074",
"remaining_tokens": "77.645287926"
"withdrawn_tokens": "131.696949518",
"remaining_tokens": "68.303050482"
},
{
"address": "0x311944e80915b08248111173671093623Fd74851",
@@ -77036,7 +77283,7 @@
"tranche_start": "2021-12-05T00:00:00.000Z",
"tranche_end": "2022-06-05T00:00:00.000Z",
"total_added": "171288.42",
"total_removed": "64226.1049690697989",
"total_removed": "64476.1049690697989",
"locked_amount": "0",
"deposits": [
{
@@ -81266,6 +81513,11 @@
"user": "0x4A13d4dC5e06ACdA81C011D55a7DaAc332bC5Dbf",
"tx": "0x72e95b2e51cae897d2c09ca7294c630fb3b969aea950a53e10158570faee89c7"
},
{
"amount": "250",
"user": "0x0428D82D3C4d8C616Dac3862E9Fc88af9A294b83",
"tx": "0x01dfb567e73d420d9370ba42ec1399e159e56fb50457cbe1b2d28e20da2f1dc9"
},
{
"amount": "250",
"user": "0xbd09687340A09BeB0B5EE0D3C2bCa8d78eBF6E63",
@@ -93866,10 +94118,17 @@
"tx": "0x9f916cf09e8a3c4ade0ffce5190db464d0a2b1dadba78e1ee7ba5d6e751d6148"
}
],
"withdrawals": [],
"withdrawals": [
{
"amount": "250",
"user": "0x0428D82D3C4d8C616Dac3862E9Fc88af9A294b83",
"tranche_id": 6,
"tx": "0x01dfb567e73d420d9370ba42ec1399e159e56fb50457cbe1b2d28e20da2f1dc9"
}
],
"total_tokens": "250",
"withdrawn_tokens": "0",
"remaining_tokens": "250"
"withdrawn_tokens": "250",
"remaining_tokens": "0"
},
{
"address": "0xA715676aBD2aebb2aa6392D3Dc4e9e0521b823Ef",
+13 -1
View File
@@ -16,4 +16,16 @@ NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
#Test configuration variables
CYPRESS_FAIRGROUND=false
CYPRESS_VEGA_URL=http://localhost:3028/query
CYPRESS_VEGA_WALLET_API_TOKEN=
CYPRESS_VEGA_WALLET_API_TOKEN=jpeAkxcffzTLCzBX2m5TZIp3hF500YZhHwESwNKOGksdGPXeeIznXypaDfpNe2M9
CYPRESS_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit supply green clown session
CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545
CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf
CYPRESS_FAUCET_URL=http://localhost:1790/api/v1/mint
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY=02ecea…342f65
CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY2=7f9cf0…c25535
CYPRESS_VEGA_ENV=CUSTOM
CYPRESS_VEGA_PUBLIC_KEY=02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65
CYPRESS_VEGA_PUBLIC_KEY2=7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535
CYPRESS_VEGA_TOKEN_URL=https://token.fairground.wtf
CYPRESS_VEGA_URL=http://localhost:3028/query
CYPRESS_VEGA_WALLET_URL=http://localhost:1789
@@ -2,56 +2,59 @@
"changes": {
"decimalPlaces": "5",
"positionDecimalPlaces": "5",
"lpPriceRange": "10",
"instrument": {
"name": "Oranges Daily",
"code": "ORANGES.24h",
"name": "Token test market",
"code": "Token.24h",
"future": {
"settlementAsset": "8b52d4a3a4b0ffe733cddbc2b67be273816cfeb6ca4c8b339bac03ffba08e4e4",
"quoteName": "tEuro",
"settlementDataDecimals": 5,
"settlementAsset": "fBTC",
"quoteName": "fBTC",
"dataSourceSpecForSettlementData": {
"signers": [
{
"signer": {
"__typename": "ETHAddress",
"address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"
}
}
],
"filters": [
{
"key": {
"name": "prices.BTC.value",
"type": "TYPE_INTEGER"
},
"conditions": [
"external": {
"oracle": {
"signers": [
{
"operator": "OPERATOR_GREATER_THAN",
"value": "0"
"pubKey": {
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
}
}
],
"filters": [
{
"key": {
"name": "prices.ETH.value",
"type": "TYPE_INTEGER",
"numberDecimalPlaces": "0"
},
"conditions": [
{
"operator": "OPERATOR_GREATER_THAN",
"value": "0"
}
]
}
]
}
]
}
},
"dataSourceSpecForTradingTermination": {
"signers": [
{
"signer": {
"__typename": "ETHAddress",
"address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"
"pubKey": {
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
}
}
],
"filters": [
{
"key": {
"name": "vegaprotocol.builtin.timestamp",
"type": "TYPE_TIMESTAMP"
"name": "trading.terminated.ETH5",
"type": "TYPE_BOOLEAN"
},
"conditions": [
{
"operator": "OPERATOR_GREATER_THAN_OR_EQUAL",
"value": "1648684800000000000"
"operator": "OPERATOR_EQUALS",
"value": "true"
}
]
}
@@ -59,7 +62,7 @@
},
"dataSourceSpecBinding": {
"settlementPriceProperty": "prices.BTC.value",
"tradingTerminationProperty": "vegaprotocol.builtin.timestamp"
"tradingTerminationProperty": "trading.terminated.ETH5"
}
}
},
@@ -1,83 +1,78 @@
{
"marketId": "315a8e48db0a292c92b617264728048c82c20efc922c75fd292fc54e5c727c81",
"changes": {
"instrument": {
"code": "ORANGES.24h",
"future": {
"quoteName": "tEuro",
"settlementDataDecimals": 5,
"dataSourceSpecForSettlementData": {
"signers": [
{
"signer": {
"__typename": "ETHAddress",
"address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"
"instrument": {
"code": "TEST.24h",
"future": {
"quoteName": "fUSDC",
"settlementDataDecimals": 5,
"dataSourceSpecForSettlementData": {
"signers": [
{
"pubKey": {
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
}
}
],
"filters": [
{
"key": {
"name": "prices.ETH.value",
"type": "TYPE_INTEGER"
},
"conditions": [
{
"operator": "OPERATOR_GREATER_THAN",
"value": "0"
}
]
}
]
},
"dataSourceSpecForTradingTermination": {
"signers": [
{
"pubKey": {
"key": "70d14a321e02e71992fd115563df765000ccc4775cbe71a0e2f9ff5a3b9dc680"
}
],
"filters": [
{
"key": {
"name": "prices.BTC.value",
"type": "TYPE_INTEGER"
},
"conditions": [
{
"operator": "OPERATOR_GREATER_THAN",
"value": "0"
}
]
}
]
},
"dataSourceSpecForTradingTermination": {
"signers": [
{
"signer": {
"__typename": "ETHAddress",
"address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"
}
],
"filters": [
{
"key": {
"name": "trading.terminated.ETH5",
"type": "TYPE_BOOLEAN"
},
"conditions": [
{
"operator": "OPERATOR_GREATER_THAN_OR_EQUAL",
"value": "1648684800000000000"
}
}
],
"filters": [
{
"key": {
"name": "vegaprotocol.builtin.timestamp",
"type": "TYPE_TIMESTAMP"
},
"conditions": [
{
"operator": "OPERATOR_GREATER_THAN_OR_EQUAL",
"value": "1648684800000000000"
}
]
}
]
},
"dataSourceSpecBinding": {
"settlementPriceProperty": "prices.BTC.value",
"tradingTerminationProperty": "vegaprotocol.builtin.timestamp"
}
]
}
]
},
"dataSourceSpecBinding": {
"settlementPriceProperty": "prices.ETH.value",
"tradingTerminationProperty": "trading.terminated.ETH5"
}
},
"metadata": ["sector:energy", "sector:food", "source:docs.vega.xyz"],
"priceMonitoringParameters": {
"triggers": [
{
"horizon": "43200",
"probability": "0.9999999",
"auctionExtension": "600"
}
]
},
"logNormal": {
"tau": 0.0001140771161,
"riskAversionParameter": 0.001,
"params": {
"mu": 0,
"r": 0.016,
"sigma": 0.3
}
},
"metadata": ["sector:energy", "sector:food", "source:docs.vega.xyz"],
"priceMonitoringParameters": {
"triggers": [
{
"horizon": "43200",
"probability": "0.9999999",
"auctionExtension": "600"
}
]
},
"logNormal": {
"tau": 0.0001140771161,
"riskAversionParameter": 0.001,
"params": {
"mu": 0,
"r": 0.016,
"sigma": 0.3
}
}
}
@@ -1 +1 @@
123
0123245
@@ -11,6 +11,7 @@ const newProposalSubmitButton = '[data-testid="proposal-submit"]';
const dialogCloseButton = '[data-testid="dialog-close"]';
const viewProposalButton = '[data-testid="view-proposal-btn"]';
const openProposals = '[data-testid="open-proposals"]';
const closedProposals = '[data-testid="closed-proposals"]';
const proposalVoteProgressForPercentage =
'[data-testid="vote-progress-indicator-percentage-for"]';
const proposalVoteProgressAgainstPercentage =
@@ -22,7 +23,9 @@ const proposalVoteProgressAgainstTokens =
const changeVoteButton = '[data-testid="change-vote-button"]';
const proposalDetailsTitle = '[data-testid="proposal-title"]';
const proposalDetailsDescription = '[data-testid="proposal-description"]';
const proposalStatus = '[data-testid="proposal-status"]';
const rawProposalData = '[data-testid="proposal-data"]';
const votesTable = '[data-testid="votes-table"]';
const minVoteButton = '[data-testid="min-vote"]';
const maxVoteButton = '[data-testid="max-vote"]';
const voteButtons = '[data-testid="vote-buttons"]';
@@ -37,6 +40,10 @@ const txTimeout = Cypress.env('txTimeout');
const epochTimeout = Cypress.env('epochTimeout');
const proposalTimeout = { timeout: 14000 };
const minCloseDays = 2;
const maxCloseDays = 3;
const requiredParticipation = 0.001;
const governanceProposalType = {
NETWORK_PARAMETER: 'Network parameter',
NEW_MARKET: 'New market',
@@ -65,21 +72,6 @@ context(
network_parameters['governance.proposal.freeform.requiredMajority'] *
100
).as('requiredMajority');
cy.wrap(
network_parameters[
'governance.proposal.freeform.requiredParticipation'
] * 100
).as('requiredParticipation');
cy.wrap(
network_parameters['governance.proposal.freeform.minClose'].split(
'h'
)[0] / 24
).as('minCloseDays');
cy.wrap(
network_parameters['governance.proposal.freeform.maxClose'].split(
'h'
)[0] / 24
).as('maxCloseDays');
cy.wrap(
network_parameters['governance.proposal.freeform.minClose'].split(
'h'
@@ -108,21 +100,6 @@ context(
0.00001,
'Asserting that value is at least 0.00001 for network parameter minVoterBalance'
);
assert.isAtLeast(
parseFloat(this.requiredParticipation),
0.00001,
'Asserting that value is at least 0.00001 for network parameter requiredParticipation'
);
assert.isAtLeast(
parseInt(this.minCloseDays),
1,
'Asserting that value is at least 1 for network parameter minCloseDays'
);
assert.isAtLeast(
parseInt(this.maxCloseDays),
parseInt(this.minCloseDays + 1),
'Asserting that network parameter maxCloseDays is at least 1 day higher than minCloseDays'
);
// workaround for first eth tx hanging
associateTokenStartOfTests();
}
@@ -182,10 +159,10 @@ context(
this.minProposerBalance
);
let proposalDays = [
this.minCloseDays + 1,
this.maxCloseDays,
this.minCloseDays + 3,
this.minCloseDays + 2,
minCloseDays + 1,
maxCloseDays,
minCloseDays + 3,
minCloseDays + 2,
];
for (var index = 0; index < proposalDays.length; index++) {
cy.go_to_make_new_proposal(governanceProposalType.RAW);
@@ -227,6 +204,7 @@ context(
cy.navigate_to('validators');
cy.click_on_validator_from_list(0);
cy.staking_validator_page_add_stake('2');
cy.close_staking_dialog();
cy.get(vegaWalletStakedBalances, txTimeout).should('contain', '2');
@@ -297,10 +275,12 @@ context(
});
});
// Skipping test due to bug: #1320
it.skip('Newly created freeform proposals list - shows proposal participation - both met and not', function () {
createFreeformProposal(this.minProposerBalance);
cy.get_submitted_proposal_from_proposal_list()
// 3001-VOTE-071
it('Newly created freeform proposals list - shows proposal participation - both met and not', function () {
const proposalTitle = generateProposalTitle();
createFreeformProposal(this.minProposerBalance, proposalTitle);
cy.get_submitted_proposal_from_proposal_list(proposalTitle)
.as('submittedProposal')
.within(() => {
// 3001-VOTE-039
@@ -312,7 +292,7 @@ context(
.invoke('text')
.then((totalSupply) => {
let tokensRequiredToAchieveResult = parseFloat(
(totalSupply.replace(/,/g, '') * this.requiredParticipation) / 100
(totalSupply.replace(/,/g, '') * requiredParticipation) / 100
).toFixed(2);
cy.ensure_specified_unstaked_tokens_are_associated(
tokensRequiredToAchieveResult
@@ -321,16 +301,17 @@ context(
cy.get('@submittedProposal').within(() =>
cy.get(viewProposalButton).click()
);
cy.get_proposal_information_from_table('Participation met')
cy.get_proposal_information_from_table('Token participation met')
.contains('👍')
.should('be.visible');
cy.navigate_to('proposals');
cy.get('@submittedProposal').within(() =>
cy.get(voteStatus).should('have.text', 'Participation met')
cy.get(voteStatus).should('have.text', 'Set to pass')
);
});
});
// 3001-VOTE-055
it('Newly created raw proposal details - shows proposal title and full description', function () {
createRawProposal(this.minProposerBalance);
cy.get('@rawProposal').then((rawProposal) => {
@@ -357,6 +338,7 @@ context(
});
});
// 3001-VOTE-043
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
const closingVoteHrs = '72';
const proposalTitle = generateProposalTitle();
@@ -399,6 +381,7 @@ context(
it('Newly created proposal details - shows default status set to fail', function () {
// 3001-VOTE-037
// 3001-VOTE-040
// 3001-VOTE-067
createRawProposal(this.minProposerBalance);
cy.get('@rawProposal').then((rawProposal) => {
cy.get_submitted_proposal_from_proposal_list(
@@ -413,15 +396,17 @@ context(
.should('be.visible');
// 3001-VOTE-062
// 3001-VOTE-040
// 3001-VOTE-070
cy.get_proposal_information_from_table('Token majority met')
.contains('👎')
.should('be.visible');
// 3001-VOTE-068
cy.get_proposal_information_from_table('Token participation met')
.contains('👎')
.should('be.visible');
});
// 3001-VOTE-080 3001-VOTE-090
// 3001-VOTE-080 3001-VOTE-090 3001-VOTE-069 3001-VOTE-072 3001-VOTE-073
it('Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', function () {
createRawProposal(this.minProposerBalance);
cy.get('@rawProposal').then((rawProposal) => {
@@ -446,7 +431,7 @@ context(
.contains(votedDate)
.should('be.visible');
});
cy.get(proposalVoteProgressForPercentage)
cy.get(proposalVoteProgressForPercentage) // 3001-VOTE-072
.contains('100.00%')
.and('be.visible');
cy.get(proposalVoteProgressAgainstPercentage)
@@ -466,10 +451,10 @@ context(
.and('be.visible');
// 3001-VOTE-061
cy.get_proposal_information_from_table('Participation required')
.contains(`${this.requiredParticipation}%`)
.contains(`${requiredParticipation}%`)
.should('be.visible');
// 3001-VOTE-066
cy.get_proposal_information_from_table('Majority Required')
cy.get_proposal_information_from_table('Majority Required') // 3001-VOTE-073
.contains(`${parseFloat(this.requiredMajority).toFixed(2)}%`)
.should('be.visible');
cy.get_proposal_information_from_table('Number of voting parties')
@@ -512,7 +497,7 @@ context(
.invoke('text')
.then((totalSupply) => {
let tokensRequiredToAchieveResult = parseFloat(
(totalSupply.replace(/,/g, '') * this.requiredParticipation) / 100
(totalSupply.replace(/,/g, '') * requiredParticipation) / 100
).toFixed(2);
cy.ensure_specified_unstaked_tokens_are_associated(
tokensRequiredToAchieveResult
@@ -536,6 +521,11 @@ context(
cy.get(proposalVoteProgressAgainstTokens)
.contains('0.00')
.and('be.visible');
cy.get_proposal_information_from_table(
'Total tokens voted percentage'
)
.should('have.text', '0.00%')
.and('be.visible');
cy.get_proposal_information_from_table('Tokens for proposal')
.should('have.text', tokensRequiredToAchieveResult)
.and('be.visible');
@@ -588,6 +578,7 @@ context(
);
});
// 3001-VOTE-006
it('Creating a proposal - proposal rejected - able to access rejected proposals', function () {
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
@@ -649,6 +640,7 @@ context(
cy.get(dialogCloseButton).click();
});
// 3002-PROP-009
it('Unable to create a proposal - when some but not enough tokens are associated', function () {
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance - 0.000001
@@ -669,7 +661,7 @@ context(
});
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
// 3001-VOTE-038
// 3001-VOTE-038 3002-PROP-013 3002-PROP-014
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
@@ -695,6 +687,9 @@ context(
'Invalid params: the transaction is malformed'
);
cy.get(dialogCloseButton).click();
cy.get(rawProposalData)
.invoke('val')
.should('contain', "i shouldn't be here");
});
it('Unable to create a freeform proposal - when json terms section contains unexpected field', function () {
@@ -792,6 +787,107 @@ context(
cy.contains('You voted: Against').should('be.visible');
});
// 3001-VOTE-006
it('Able to view enacted proposal', function () {
cy.createMarket();
cy.reload();
cy.wait_for_spinner();
cy.get(closedProposals).within(() => {
cy.get(proposalDetailsTitle).should(
'have.text',
'Add Lorem Ipsum market'
);
cy.get(proposalStatus).should('have.text', 'Enacted ');
cy.get(viewProposalButton).click();
});
cy.getByTestId('proposal-type').should('have.text', 'New market');
cy.get_proposal_information_from_table('State')
.contains('Enacted')
.and('be.visible');
cy.get(votesTable).within(() => {
cy.contains('Vote passed.').should('be.visible');
cy.contains('Voting has ended.').should('be.visible');
});
});
// 3001-VOTE-047
it('Able to enact freeform proposal', function () {
const proposalTitle = 'Add New free form proposal with short enactment';
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.sendWalletTxFreeFormProposal();
cy.navigate_to('proposals');
cy.reload();
cy.wait_for_spinner();
cy.contains(proposalTitle)
.parentsUntil('[data-testid="proposals-list-item"]')
.within(() => cy.get(viewProposalButton).click());
cy.get_proposal_information_from_table('State')
.contains('Open')
.and('be.visible');
cy.vote_for_proposal('for');
cy.get_proposal_information_from_table('State')
.contains('Enacted', epochTimeout)
.and('be.visible');
});
// 3001-VOTE-046 3001-VOTE-044 3001-VOTE-074 3001-VOTE-074
it('Able to enact proposal by voting', function () {
const proposalTitle = 'Add New proposal with short enactment';
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.sendWalletTxUpdateNetworkProposal();
cy.navigate_to('proposals');
cy.reload();
cy.wait_for_spinner();
cy.contains(proposalTitle)
.parentsUntil('[data-testid="proposals-list-item"]')
.within(() => cy.get(viewProposalButton).click());
cy.get_proposal_information_from_table('State')
.contains('Open')
.and('be.visible');
cy.vote_for_proposal('for');
cy.get_proposal_information_from_table('State') // 3001-VOTE-047
.contains('Passed', txTimeout)
.and('be.visible');
cy.get_proposal_information_from_table('State')
.contains('Enacted', epochTimeout)
.and('be.visible');
cy.get(votesTable).within(() => {
cy.contains('Vote passed.').should('be.visible');
cy.contains('Voting has ended.').should('be.visible');
});
cy.get(proposalVoteProgressForPercentage)
.contains('100.00%')
.and('be.visible');
});
// 3001-VOTE-048 3001-VOTE-049
it('Able to fail proposal due to lack of participation', function () {
const proposalTitle = 'Add New free form proposal with short enactment';
cy.ensure_specified_unstaked_tokens_are_associated(
this.minProposerBalance
);
cy.sendWalletTxFreeFormProposal();
cy.navigate_to('proposals');
cy.reload();
cy.wait_for_spinner();
cy.contains(proposalTitle)
.parentsUntil('[data-testid="proposals-list-item"]')
.within(() => cy.get(viewProposalButton).click());
cy.get_proposal_information_from_table('State')
.contains('Open')
.and('be.visible');
cy.get_proposal_information_from_table('State') // 3001-VOTE-047
.contains('Declined', txTimeout)
.and('be.visible');
cy.get_proposal_information_from_table('Rejection reason')
.contains('PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED')
.and('be.visible');
});
function createRawProposal(proposerBalance) {
if (proposerBalance)
cy.ensure_specified_unstaked_tokens_are_associated(proposerBalance);
@@ -1,3 +1,7 @@
const proposalListItem = '[data-testid="proposals-list-item"]';
const openProposals = '[data-testid="open-proposals"]';
const proposalType = '[data-testid="proposal-type"]';
const proposalDetails = '[data-testid="proposal-details"]';
const newProposalSubmitButton = '[data-testid="proposal-submit"]';
const proposalVoteDeadline = '[data-testid="proposal-vote-deadline"]';
const proposalValidationDeadline =
@@ -209,18 +213,15 @@ context(
);
});
// skipped because no markets available to select in capsule
it.skip('Able to submit update market proposal', function () {
const marketId =
'315a8e48db0a292c92b617264728048c82c20efc922c75fd292fc54e5c727c81';
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_MARKET);
cy.get(newProposalTitle).type('Test update asset proposal');
cy.get(newProposalTitle).type('Test update market proposal');
cy.get(newProposalDescription).type('E2E test for proposals');
cy.get(proposalMarketSelect).select(marketId);
cy.get(proposalMarketSelect).select('Test market 1');
cy.get('[data-testid="update-market-details"]').within(() => {
cy.get('dd').eq(0).should('have.text', 'Oranges Daily');
cy.get('dd').eq(1).should('have.text', 'ORANGES.24h');
cy.get('dd').eq(2).should('have.text', marketId);
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.fixture('/proposals/update-market').then((updateMarketProposal) => {
let newUpdateMarketProposal = JSON.stringify(updateMarketProposal);
@@ -281,12 +282,28 @@ context(
});
it('Able to submit update asset proposal using min deadline', function () {
const assetId =
'ebcd94151ae1f0d39a4bde3b21a9c7ae81a80ea4352fb075a92e07608d9c953d';
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_ASSET);
enterUpdateAssetProposalDetails();
cy.get(minVoteDeadline).click();
cy.get(minEnactDeadline).click();
cy.get(newProposalSubmitButton).should('be.visible').click();
cy.wait_for_proposal_submitted();
cy.navigate_to('proposals');
cy.get(openProposals).within(() => {
cy.get(proposalType)
.contains('Update asset')
.parentsUntil(proposalListItem)
.within(() => {
cy.get(proposalDetails).should('contain.text', assetId); // 3001-VOTE-029
cy.getByTestId('view-proposal-btn').click();
});
});
cy.get_proposal_information_from_table('Proposed enactment') // 3001-VOTE-044
.invoke('text')
.should('not.be.empty');
});
it('Able to submit update asset proposal using max deadline', function () {
@@ -20,7 +20,10 @@ context('View functionality with public key', { tags: '@smoke' }, function () {
it('Able to connect public key via wallet', function () {
verifyConnectedToPubKey();
cy.getByTestId('currency-title').should('contain.text', 'USDC (fake)');
cy.getByTestId('currency-title', Cypress.env('epochTimeout')).should(
'contain.text',
'USDC (fake)'
);
});
it('Able to connect public key using url', function () {
@@ -46,6 +46,6 @@ Cypress.Commands.add('verify_page_header', (text) => {
});
Cypress.Commands.add('wait_for_spinner', () => {
cy.get(navigation.pageSpinner).should('exist');
cy.get(navigation.pageSpinner, Cypress.env('epochTimeout')).should('exist');
cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist');
});
+1
View File
@@ -6,6 +6,7 @@ import './governance.functions.js';
import './wallet-eth.functions.js';
import './wallet-teardown.functions.js';
import './wallet-vega.functions.js';
import './proposal.functions.js';
import registerCypressGrep from '@cypress/grep';
import { aliasGQLQuery } from '@vegaprotocol/cypress';
import { chainIdQuery, statisticsQuery } from '@vegaprotocol/mock';
@@ -0,0 +1,103 @@
import { addSeconds, millisecondsToSeconds } from 'date-fns';
const walletName = Cypress.env('vegaWalletName');
const walletPubKey = Cypress.env('vegaWalletPublicKey');
const walletLocation = Cypress.env('vegaWalletLocation');
const walletPassphraseFile = './src/fixtures/wallet/passphrase';
Cypress.Commands.add('sendWalletTxUpdateNetworkProposal', () => {
const MIN_CLOSE_SEC = 8;
const MIN_ENACT_SEC = 5;
const closingDate = addSeconds(new Date(), MIN_CLOSE_SEC);
const enactmentDate = addSeconds(closingDate, MIN_ENACT_SEC);
const closingTimestamp = millisecondsToSeconds(closingDate.getTime());
const enactmentTimestamp = millisecondsToSeconds(enactmentDate.getTime());
cy.exec(
`vegawallet transaction send --wallet ${walletName} --pubkey ${walletPubKey} -p ${walletPassphraseFile} --network DV '{
"proposalSubmission": {
"rationale": {
"title": "Add New proposal with short enactment",
"description": "E2E enactment test"
},
"terms": {
"updateNetworkParameter": {
"changes": {
"key": "governance.proposal.updateNetParam.minProposerBalance",
"value": "2"
}
},
"closingTimestamp": ${closingTimestamp},
"enactmentTimestamp": ${enactmentTimestamp}
}
}
}' --home ${walletLocation}`,
{ failOnNonZeroExit: false }
)
.its('stderr')
.should('contain', '');
});
Cypress.Commands.add('sendWalletTxUpdateAssetProposal', () => {
const MIN_CLOSE_SEC = 8;
const MIN_ENACT_SEC = 5;
const closingDate = addSeconds(new Date(), MIN_CLOSE_SEC);
const enactmentDate = addSeconds(closingDate, MIN_ENACT_SEC);
const closingTimestamp = millisecondsToSeconds(closingDate.getTime());
const enactmentTimestamp = millisecondsToSeconds(enactmentDate.getTime());
cy.exec(
`vegawallet transaction send --wallet ${walletName} --pubkey ${walletPubKey} -p ${walletPassphraseFile} --network DV '{
"proposalSubmission": {
"rationale": {
"title": "Update Asset set to fail",
"description": "E2E fail test"
},
"terms": {
"updateAsset": {
"assetId": "ebcd94151ae1f0d39a4bde3b21a9c7ae81a80ea4352fb075a92e07608d9c953d",
"changes": {
"quantum": "1",
"erc20": {
"withdrawThreshold": "10",
"lifetimeLimit": "10"
}
}
},
"closingTimestamp": ${closingTimestamp},
"enactmentTimestamp": ${enactmentTimestamp}
}
}
}' --home ${walletLocation}`,
{ failOnNonZeroExit: false }
)
.its('stderr')
.should('contain', '');
});
Cypress.Commands.add('sendWalletTxFreeFormProposal', () => {
const MIN_CLOSE_SEC = 5;
const closingDate = addSeconds(new Date(), MIN_CLOSE_SEC);
const closingTimestamp = millisecondsToSeconds(closingDate.getTime());
cy.exec(
`vegawallet transaction send --wallet ${walletName} --pubkey ${walletPubKey} -p ${walletPassphraseFile} --network DV '{
"proposalSubmission": {
"rationale": {
"title": "Add New free form proposal with short enactment",
"description": "E2E enactment test"
},
"terms": {
"newFreeform": {},
"closingTimestamp": ${closingTimestamp}
}
}
}' --home ${walletLocation}`,
{ failOnNonZeroExit: false }
)
.its('stderr')
.should('contain', '');
});
@@ -72,8 +72,8 @@ export const LockedProgress = ({
unlocked,
leftLabel,
rightLabel,
leftColor = Colors.vega.pink,
rightColor = Colors.vega.green,
leftColor = Colors.vega.pink.DEFAULT,
rightColor = Colors.vega.green.DEFAULT,
decimals = 2,
}: LockedProgressProps) => {
const lockedPercentage = React.useMemo(() => {
@@ -63,7 +63,8 @@ export const ContractsProvider = ({ children }: { children: JSX.Element }) => {
signer || provider
),
vesting: new TokenVesting(
config.token_vesting_contract.address,
config.token_vesting_contract?.address ||
'0xadFcb7f93a24F8743a8e548d74d2ecB373c92866',
signer || provider
),
claim: new Claim(ENV.addresses.claimAddress, signer || provider),
+7 -4
View File
@@ -30,9 +30,12 @@ export function useAnimateValue(
) {
elRef.current?.animate(
[
{ backgroundColor: customColors.vega.pink, color: colors.white },
{
backgroundColor: customColors.vega.pink,
backgroundColor: customColors.vega.pink.DEFAULT,
color: colors.white,
},
{
backgroundColor: customColors.vega.pink.DEFAULT,
color: colors.white,
offset: 0.8,
},
@@ -53,11 +56,11 @@ export function useAnimateValue(
elRef.current?.animate(
[
{
backgroundColor: customColors.vega.green,
backgroundColor: customColors.vega.green.DEFAULT,
color: colors.white,
},
{
backgroundColor: customColors.vega.green,
backgroundColor: customColors.vega.green.DEFAULT,
color: colors.white,
offset: 0.8,
},
@@ -102,7 +102,7 @@ export const VoteDetails = ({
</table>
</section>
)}
<section>
<section data-testid="votes-table">
<SubHeading title={t('tokenVotes')} />
<p>
<span>
@@ -67,10 +67,14 @@ export const TokenDetails = ({
data-testid="token-contract"
title={t('View on Etherscan (opens in a new tab)')}
className="font-mono text-white text-right"
href={`${ETHERSCAN_URL}/address/${config.token_vesting_contract.address}`}
href={`${ETHERSCAN_URL}/address/${
config.token_vesting_contract?.address ||
'0xadFcb7f93a24F8743a8e548d74d2ecB373c92866'
}`}
target="_blank"
>
{config.token_vesting_contract.address}
{config.token_vesting_contract?.address ||
'0xadFcb7f93a24F8743a8e548d74d2ecB373c92866'}
</Link>
</KeyValueTableRow>
<KeyValueTableRow>
@@ -29,7 +29,7 @@ export const TrancheProgress = ({
<span className="tranches__progress-title">{t('Locked')}</span>
<ProgressBar
width={220}
color={Colors.vega.pink}
color={Colors.vega.pink.DEFAULT}
percentage={lockedPercentage}
/>
<span className="tranches__progress-numbers">
@@ -40,7 +40,7 @@ export const TrancheProgress = ({
<span className="tranches__progress-title">{t('Redeemed')}</span>
<ProgressBar
width={220}
color={Colors.vega.green}
color={Colors.vega.green.DEFAULT}
percentage={removedPercentage}
/>
<span className="tranches__progress-numbers">
@@ -34,10 +34,10 @@ export const VestingChart = () => {
<AreaChart data={data}>
<defs>
{[
['pink', Colors.vega.pink],
['green', Colors.vega.green],
['pink', Colors.vega.pink.DEFAULT],
['green', Colors.vega.green.DEFAULT],
['orange', Colors.warning],
['yellow', Colors.vega.yellow],
['yellow', Colors.vega.yellow.DEFAULT],
].map(([key, color]) => (
<linearGradient key={key} id={key} x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor={color} stopOpacity={0.85} />
@@ -97,7 +97,7 @@ export const VestingChart = () => {
dot={false}
type="linear"
dataKey="team"
stroke={Colors.vega.pink}
stroke={Colors.vega.pink.DEFAULT}
fill="url(#pink)"
yAxisId={0}
strokeWidth={2}
@@ -109,7 +109,7 @@ export const VestingChart = () => {
dot={false}
type="monotone"
dataKey="earlyInvestors"
stroke={Colors.vega.green}
stroke={Colors.vega.green.DEFAULT}
fill="url(#green)"
yAxisId={0}
strokeWidth={2}
@@ -121,7 +121,7 @@ export const VestingChart = () => {
dot={false}
type="monotone"
dataKey="publicSale"
stroke={Colors.vega.yellow}
stroke={Colors.vega.yellow.DEFAULT}
fill="url(#yellow)"
yAxisId={0}
strokeWidth={2}
@@ -1,4 +1,7 @@
import * as Schema from '@vegaprotocol/types';
import { aliasGQLQuery } from '@vegaprotocol/cypress';
import { marketQuery } from '@vegaprotocol/mock';
import { getDateTimeFormat } from '@vegaprotocol/react-helpers';
describe('markets table', { tags: '@smoke' }, () => {
beforeEach(() => {
@@ -111,6 +114,53 @@ describe('markets table', { tags: '@smoke' }, () => {
`${Cypress.env('VEGA_TOKEN_URL')}/proposals/propose/new-market`
);
});
it('opening auction subsets should be properly displayed', () => {
cy.mockTradingPage(
Schema.MarketState.STATE_ACTIVE,
Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION
);
cy.mockGQL((req) => {
const override = {
market: {
tradableInstrument: {
instrument: {
name: `opening auction MARKET`,
},
},
state: Schema.MarketState.STATE_ACTIVE,
tradingMode: Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION,
},
};
const market = marketQuery(override);
aliasGQLQuery(req, 'Market', market);
aliasGQLQuery(req, 'ProposalOfMarket', {
proposal: { terms: { enactmentDatetime: '2023-01-31 12:00:01' } },
});
});
cy.visit('/');
cy.visit('#/markets/market-0');
cy.getByTestId('item-value').contains('Opening auction').realHover();
cy.getByTestId('opening-auction-sub-status').should(
'contain.text',
'Opening auction: Not enough liquidity to open'
);
const now = new Date(Date.parse('2023-01-30 12:00:01')).getTime();
cy.clock(now, ['Date']); // Set "now" to BEFORE reservation
cy.visit('/');
cy.visit('#/markets/market-0');
cy.getByTestId('item-value').contains('Opening auction').realHover();
cy.getByTestId('opening-auction-sub-status').should(
'contain.text',
`Opening auction: Closing on ${getDateTimeFormat().format(
new Date('2023-01-31 12:00:01')
)}`
);
cy.clock().then((clock) => {
clock.restore();
});
});
});
function openMarketDropDown() {
@@ -5,7 +5,7 @@ import { t, useDataProvider } from '@vegaprotocol/react-helpers';
import { useVegaWallet } from '@vegaprotocol/wallet';
export const DepositsContainer = () => {
const { pubKey } = useVegaWallet();
const { pubKey, isReadOnly } = useVegaWallet();
const { data, loading, error } = useDataProvider({
dataProvider: depositsProvider,
variables: { partyId: pubKey || '' },
@@ -30,15 +30,17 @@ export const DepositsContainer = () => {
/>
</div>
</div>
<div className="w-full dark:bg-black bg-white absolute bottom-0 h-auto flex justify-end px-[11px] py-2">
<Button
size="sm"
onClick={() => openDepositDialog()}
data-testid="deposit-button"
>
{t('Deposit')}
</Button>
</div>
{!isReadOnly && (
<div className="w-full dark:bg-black bg-white absolute bottom-0 h-auto flex justify-end px-[11px] py-2">
<Button
size="sm"
onClick={() => openDepositDialog()}
data-testid="deposit-button"
>
{t('Deposit')}
</Button>
</div>
)}
</div>
);
};
@@ -9,7 +9,7 @@ import { t, useDataProvider } from '@vegaprotocol/react-helpers';
import { VegaWalletContainer } from '../../components/vega-wallet-container';
export const WithdrawalsContainer = () => {
const { pubKey } = useVegaWallet();
const { pubKey, isReadOnly } = useVegaWallet();
const { data, loading, error } = useDataProvider({
dataProvider: withdrawalProvider,
variables: { partyId: pubKey || '' },
@@ -36,15 +36,17 @@ export const WithdrawalsContainer = () => {
/>
</div>
</div>
<div className="w-full dark:bg-black bg-white absolute bottom-0 h-auto flex justify-end px-[11px] py-2">
<Button
size="sm"
onClick={() => openWithdrawDialog()}
data-testid="withdraw-dialog-button"
>
{t('Make withdrawal')}
</Button>
</div>
{!isReadOnly && (
<div className="w-full dark:bg-black bg-white absolute bottom-0 h-auto flex justify-end px-[11px] py-2">
<Button
size="sm"
onClick={() => openWithdrawDialog()}
data-testid="withdraw-dialog-button"
>
{t('Make withdrawal')}
</Button>
</div>
)}
</div>
</VegaWalletContainer>
);
@@ -9,7 +9,7 @@ import { AccountManager } from '@vegaprotocol/accounts';
import { useDepositDialog } from '@vegaprotocol/deposits';
export const AccountsContainer = () => {
const { pubKey } = useVegaWallet();
const { pubKey, isReadOnly } = useVegaWallet();
const { open: openAssetDetailsDialog } = useAssetDetailsDialogStore();
const openWithdrawalDialog = useWithdrawalDialog((store) => store.open);
const openDepositDialog = useDepositDialog((store) => store.open);
@@ -37,13 +37,16 @@ export const AccountsContainer = () => {
onClickAsset={onClickAsset}
onClickWithdraw={openWithdrawalDialog}
onClickDeposit={openDepositDialog}
isReadOnly={isReadOnly}
/>
</div>
<div className="flex justify-end p-2 px-[11px]">
<Button size="sm" onClick={() => openDepositDialog()}>
{t('Deposit')}
</Button>
</div>
{!isReadOnly && (
<div className="flex justify-end p-2 px-[11px]">
<Button size="sm" onClick={() => openDepositDialog()}>
{t('Deposit')}
</Button>
</div>
)}
</div>
);
};
+22 -22
View File
@@ -10,49 +10,49 @@ body,
/* Styles for allotment */
html {
--focus-border: theme('colors.vega.pink');
--separator-border: theme('colors.neutral.300');
--pennant-color-danger: theme('colors.vega.pink');
--focus-border: theme('colors.vega.pink.500');
--separator-border: theme('colors.vega.light.200');
--pennant-color-danger: theme('colors.vega.pink.500');
}
html.dark {
--focus-border: theme('colors.vega.yellow');
--separator-border: theme('colors.neutral.600');
--focus-border: theme('colors.vega.yellow.500');
--separator-border: theme('colors.vega.dark.200');
}
.border-default {
@apply border-neutral-300 dark:border-neutral-600;
@apply border-vega-light-200 dark:border-vega-dark-200;
}
/* Styles for charts */
html [data-theme='dark'] {
--pennant-color-danger: theme('colors.vega.pink');
--pennant-color-danger: theme('colors.vega.pink.DEFAULT');
/* candles */
--pennant-color-buy-fill: theme('colors.vega.green-data-dark');
--pennant-color-buy-stroke: theme('colors.vega.green');
--pennant-color-buy-fill: theme('colors.vega.green.650');
--pennant-color-buy-stroke: theme('colors.vega.green.500');
/* sell candles only use stroke as the candle is solid (without border) */
--pennant-color-sell-stroke: theme('colors.vega.pink');
--pennant-color-sell-stroke: theme('colors.vega.pink.500');
/* depth chart */
--pennant-color-depth-buy-fill: theme('colors.vega.green-data-dark');
--pennant-color-depth-buy-stroke: theme('colors.vega.green');
--pennant-color-depth-sell-fill: theme('colors.vega.pink-data-dark');
--pennant-color-depth-sell-stroke: theme('colors.vega.pink');
--pennant-color-depth-buy-fill: theme('colors.vega.green.650');
--pennant-color-depth-buy-stroke: theme('colors.vega.green.500');
--pennant-color-depth-sell-fill: theme('colors.vega.pink.650');
--pennant-color-depth-sell-stroke: theme('colors.vega.pink.500');
}
html [data-theme='light'] {
--pennant-color-danger: theme('colors.vega.pink');
--pennant-color-danger: theme('colors.vega.pink.500');
/* candles */
--pennant-color-buy-fill: theme('colors.vega.green-data-light');
--pennant-color-buy-stroke: theme('colors.vega.green-dark');
--pennant-color-buy-fill: theme('colors.vega.green.400');
--pennant-color-buy-stroke: theme('colors.vega.green.550');
/* sell candles only use stroke as the candle is solid (without border) */
--pennant-color-sell-stroke: theme('colors.vega.pink-data-light');
--pennant-color-sell-stroke: theme('colors.vega.pink.400');
/* depth chart */
--pennant-color-depth-buy-fill: theme('colors.vega.green-data-light');
--pennant-color-depth-buy-stroke: theme('colors.vega.green-dark');
--pennant-color-depth-sell-fill: theme('colors.vega.pink-data-light');
--pennant-color-depth-sell-stroke: theme('colors.vega.pink-dark');
--pennant-color-depth-buy-fill: theme('colors.vega.green.400');
--pennant-color-depth-buy-stroke: theme('colors.vega.green.550');
--pennant-color-depth-sell-fill: theme('colors.vega.pink.400');
--pennant-color-depth-sell-stroke: theme('colors.vega.pink.550');
}
+13
View File
@@ -0,0 +1,13 @@
const { utils } = require('@commitlint/config-nx-scopes');
module.exports = {
extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'],
rules: {
'scope-empty': [2, 'never'],
'scope-enum': async (ctx) => [
2,
'always',
['ci', 'docs', ...(await utils.getProjects(ctx))],
],
},
};
@@ -23,13 +23,23 @@ jest.mock('@vegaprotocol/react-helpers', () => ({
describe('AccountManager', () => {
it('change partyId should reload data provider', async () => {
const { rerender } = render(
<AccountManager partyId="partyOne" onClickAsset={jest.fn} />
<AccountManager
partyId="partyOne"
onClickAsset={jest.fn}
isReadOnly={false}
/>
);
expect(
(helpers.useDataProvider as jest.Mock).mock.calls[0][0].variables.partyId
).toEqual('partyOne');
await act(() => {
rerender(<AccountManager partyId="partyTwo" onClickAsset={jest.fn} />);
rerender(
<AccountManager
partyId="partyTwo"
onClickAsset={jest.fn}
isReadOnly={false}
/>
);
});
expect(
(helpers.useDataProvider as jest.Mock).mock.calls[1][0].variables.partyId
@@ -38,7 +48,13 @@ describe('AccountManager', () => {
it('update method should return proper result', async () => {
await act(() => {
render(<AccountManager partyId="partyOne" onClickAsset={jest.fn} />);
render(
<AccountManager
partyId="partyOne"
onClickAsset={jest.fn}
isReadOnly={false}
/>
);
});
await waitFor(() => {
expect(screen.getByText('No accounts')).toBeInTheDocument();
@@ -16,6 +16,7 @@ interface AccountManagerProps {
onClickAsset: (assetId: string) => void;
onClickWithdraw?: (assetId?: string) => void;
onClickDeposit?: (assetId?: string) => void;
isReadOnly: boolean;
}
export const AccountManager = ({
@@ -23,6 +24,7 @@ export const AccountManager = ({
onClickWithdraw,
onClickDeposit,
partyId,
isReadOnly,
}: AccountManagerProps) => {
const gridRef = useRef<AgGridReact | null>(null);
const dataRef = useRef<AccountFields[] | null>(null);
@@ -58,6 +60,7 @@ export const AccountManager = ({
onClickAsset={onClickAsset}
onClickDeposit={onClickDeposit}
onClickWithdraw={onClickWithdraw}
isReadOnly={isReadOnly}
/>
<div className="pointer-events-none absolute inset-0">
<AsyncRenderer
+10 -2
View File
@@ -35,7 +35,11 @@ describe('AccountsTable', () => {
it('should render correct columns', async () => {
await act(async () => {
render(
<AccountTable rowData={singleRowData} onClickAsset={() => null} />
<AccountTable
rowData={singleRowData}
onClickAsset={() => null}
isReadOnly={false}
/>
);
});
const expectedHeaders = ['Asset', 'Total', 'Used', 'Available', ''];
@@ -49,7 +53,11 @@ describe('AccountsTable', () => {
it('should apply correct formatting', async () => {
await act(async () => {
render(
<AccountTable rowData={singleRowData} onClickAsset={() => null} />
<AccountTable
rowData={singleRowData}
onClickAsset={() => null}
isReadOnly={false}
/>
);
});
const cells = await screen.findAllByRole('gridcell');
+45 -42
View File
@@ -29,6 +29,7 @@ export interface AccountTableProps extends AgGridReactProps {
onClickAsset: (assetId: string) => void;
onClickWithdraw?: (assetId: string) => void;
onClickDeposit?: (assetId: string) => void;
isReadOnly: boolean;
}
export const AccountTable = forwardRef<AgGridReact, AccountTableProps>(
@@ -127,48 +128,50 @@ export const AccountTable = forwardRef<AgGridReact, AccountTableProps>(
}
maxWidth={300}
/>
<AgGridColumn
colId="breakdown"
headerName=""
sortable={false}
minWidth={200}
type="rightAligned"
cellRenderer={({
data,
}: VegaICellRendererParams<AccountFields>) => {
return data ? (
<>
<ButtonLink
data-testid="breakdown"
onClick={() => {
setOpenBreakdown(!openBreakdown);
setBreakdown(data.breakdown || null);
}}
>
{t('Breakdown')}
</ButtonLink>
<span className="mx-1" />
<ButtonLink
data-testid="deposit"
onClick={() => {
onClickDeposit && onClickDeposit(data.asset.id);
}}
>
{t('Deposit')}
</ButtonLink>
<span className="mx-1" />
<ButtonLink
data-testid="withdraw"
onClick={() =>
onClickWithdraw && onClickWithdraw(data.asset.id)
}
>
{t('Withdraw')}
</ButtonLink>
</>
) : null;
}}
/>
{!props.isReadOnly && (
<AgGridColumn
colId="breakdown"
headerName=""
sortable={false}
minWidth={200}
type="rightAligned"
cellRenderer={({
data,
}: VegaICellRendererParams<AccountFields>) => {
return data ? (
<>
<ButtonLink
data-testid="breakdown"
onClick={() => {
setOpenBreakdown(!openBreakdown);
setBreakdown(data.breakdown || null);
}}
>
{t('Breakdown')}
</ButtonLink>
<span className="mx-1" />
<ButtonLink
data-testid="deposit"
onClick={() => {
onClickDeposit && onClickDeposit(data.asset.id);
}}
>
{t('Deposit')}
</ButtonLink>
<span className="mx-1" />
<ButtonLink
data-testid="withdraw"
onClick={() =>
onClickWithdraw && onClickWithdraw(data.asset.id)
}
>
{t('Withdraw')}
</ButtonLink>
</>
) : null;
}}
/>
)}
</AgGrid>
<Dialog size="medium" open={openBreakdown} onChange={setOpenBreakdown}>
<div className="h-[35vh] w-full m-auto flex flex-col">
+15
View File
@@ -0,0 +1,15 @@
import { Option } from '@vegaprotocol/ui-toolkit';
import type { AssetFieldsFragment } from './__generated__/Asset';
export const AssetOption = ({ asset }: { asset: AssetFieldsFragment }) => {
return (
<Option key={asset.id} value={asset.id}>
<div className="flex flex-col items-start">
<span>{asset.name}</span>
<div className="text-[10px] font-mono w-full text-left break-all">
<span className="text-gray-500">{asset.id} -</span> {asset.symbol}
</div>
</div>
</Option>
);
};
+1
View File
@@ -4,3 +4,4 @@ export * from './asset-data-provider';
export * from './assets-data-provider';
export * from './asset-details-dialog';
export * from './asset-details-table';
export * from './asset-option';
@@ -45,7 +45,7 @@ export type DealTicketFormFields = OrderSubmissionBody['orderSubmission'] & {
};
export const DealTicket = ({ market, submit }: DealTicketProps) => {
const { pubKey } = useVegaWallet();
const { pubKey, isReadOnly } = useVegaWallet();
const { getPersistedOrder, setPersistedOrder } = usePersistedOrderStore(
(store) => ({
getPersistedOrder: store.getOrder,
@@ -158,7 +158,11 @@ export const DealTicket = ({ market, submit }: DealTicketProps) => {
);
return (
<form onSubmit={handleSubmit(onSubmit)} className="p-4" noValidate>
<form
onSubmit={isReadOnly ? () => null : handleSubmit(onSubmit)}
className="p-4"
noValidate
>
<Controller
name="type"
control={control}
@@ -220,13 +224,14 @@ export const DealTicket = ({ market, submit }: DealTicketProps) => {
/>
)}
<DealTicketButton
disabled={Object.keys(errors).length >= 1}
disabled={Object.keys(errors).length >= 1 || isReadOnly}
variant={order.side === Schema.Side.SIDE_BUY ? 'ternary' : 'secondary'}
/>
<SummaryMessage
errorMessage={errors.summary?.message}
market={market}
order={order}
isReadOnly={isReadOnly}
/>
<DealTicketFeeDetails order={order} market={market} />
</form>
@@ -241,9 +246,10 @@ interface SummaryMessageProps {
errorMessage?: string;
market: MarketDealTicket;
order: OrderSubmissionBody['orderSubmission'];
isReadOnly: boolean;
}
const SummaryMessage = memo(
({ errorMessage, market, order }: SummaryMessageProps) => {
({ errorMessage, market, order, isReadOnly }: SummaryMessageProps) => {
// Specific error UI for if balance is so we can
// render a deposit dialog
const asset = market.tradableInstrument.instrument.product.settlementAsset;
@@ -251,6 +257,17 @@ const SummaryMessage = memo(
market,
order,
});
if (isReadOnly) {
return (
<div className="mb-4">
<InputError data-testid="dealticket-error-message-summary">
{
'You need to connect your own wallet to start trading on this market'
}
</InputError>
</div>
);
}
if (errorMessage === SummaryValidationType.NoCollateral) {
return (
<ZeroBalanceError
@@ -1,6 +1,9 @@
import { useMemo } from 'react';
import { parseISO, isValid, isAfter } from 'date-fns';
import classNames from 'classnames';
import { useProposalOfMarketQuery } from '@vegaprotocol/governance';
import { useEnvironment } from '@vegaprotocol/environment';
import { DataGrid, t } from '@vegaprotocol/react-helpers';
import { DataGrid, getDateTimeFormat, t } from '@vegaprotocol/react-helpers';
import * as Schema from '@vegaprotocol/types';
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
import { createDocsLinks } from '@vegaprotocol/react-helpers';
@@ -21,14 +24,24 @@ export const TradingModeTooltip = ({
const { VEGA_DOCS_URL } = useEnvironment();
const market = useMarket(marketId);
const marketData = useStaticMarketData(marketId, skip);
const { marketTradingMode: tradingMode, trigger } = marketData || {};
const variables = useMemo(() => ({ marketId: marketId || '' }), [marketId]);
const { data: proposalData } = useProposalOfMarketQuery({
variables,
skip:
!tradingMode ||
Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION !== tradingMode,
});
if (!market || !marketData) {
return null;
}
const enactmentDate = parseISO(
proposalData?.proposal?.terms.enactmentDatetime
);
const compiledGrid =
onSelect && compileGridData(market, marketData, onSelect);
const { marketTradingMode: tradingMode, trigger } = marketData;
switch (tradingMode) {
case Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS: {
@@ -43,12 +56,47 @@ export const TradingModeTooltip = ({
case Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION: {
return (
<section data-testid="trading-mode-tooltip">
<p className={classNames({ 'mb-4': Boolean(compiledGrid) })}>
<span>
{t(
'This new market is in an opening auction to determine a fair mid-price before starting continuous trading.'
)}
</span>{' '}
<p
className={classNames('flex flex-col', {
'mb-4': Boolean(compiledGrid),
})}
>
{isValid(enactmentDate) && isAfter(new Date(), enactmentDate) ? (
<>
<span
className="justify-center font-bold my-2"
data-testid="opening-auction-sub-status"
>
{`${Schema.MarketTradingModeMapping[tradingMode]}: ${t(
'Not enough liquidity to open'
)}`}
</span>
<span>
{t(
'This market is in opening auction until it has reached enough liquidity to move into continuous trading.'
)}
</span>
</>
) : (
<>
{isValid(enactmentDate) && (
<span
className="justify-center font-bold my-2"
data-testid="opening-auction-sub-status"
>
{`${Schema.MarketTradingModeMapping[tradingMode]}: ${t(
'Closing on %s',
getDateTimeFormat().format(enactmentDate)
)}`}
</span>
)}
<span>
{t(
'This is a new market in an opening auction to determine a fair mid-price before starting continuous trading.'
)}
</span>
</>
)}
{VEGA_DOCS_URL && (
<ExternalLink
href={createDocsLinks(VEGA_DOCS_URL).AUCTION_TYPE_OPENING}
+2 -9
View File
@@ -1,4 +1,5 @@
import type { Asset } from '@vegaprotocol/assets';
import { AssetOption } from '@vegaprotocol/assets';
import {
ethereumAddress,
t,
@@ -17,7 +18,6 @@ import {
Input,
InputError,
RichSelect,
Option,
} from '@vegaprotocol/ui-toolkit';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { useWeb3React } from '@web3-react/core';
@@ -185,14 +185,7 @@ export const DepositForm = ({
hasError={Boolean(errors.asset?.message)}
>
{assets.filter(isAssetTypeERC20).map((a) => (
<Option key={a.id} value={a.id}>
<div className="flex flex-col items-start">
<span>{a.name}</span>
<span className="text-[10px] font-mono">
<span className="text-gray-500">{a.id} -</span> {a.symbol}
</span>
</div>
</Option>
<AssetOption asset={a} />
))}
</RichSelect>
)}
@@ -43,3 +43,12 @@ subscription OnUpdateNetworkParameters {
}
}
}
query ProposalOfMarket($marketId: ID!) {
proposal(id: $marketId) {
id
terms {
enactmentDatetime
}
}
}
@@ -19,6 +19,13 @@ export type OnUpdateNetworkParametersSubscriptionVariables = Types.Exact<{ [key:
export type OnUpdateNetworkParametersSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'AccountEvent' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransactionResult' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal' } }> | null };
export type ProposalOfMarketQueryVariables = Types.Exact<{
marketId: Types.Scalars['ID'];
}>;
export type ProposalOfMarketQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null } } | null };
export const ProposalEventFieldsFragmentDoc = gql`
fragment ProposalEventFields on Proposal {
id
@@ -113,4 +120,42 @@ export function useOnUpdateNetworkParametersSubscription(baseOptions?: Apollo.Su
return Apollo.useSubscription<OnUpdateNetworkParametersSubscription, OnUpdateNetworkParametersSubscriptionVariables>(OnUpdateNetworkParametersDocument, options);
}
export type OnUpdateNetworkParametersSubscriptionHookResult = ReturnType<typeof useOnUpdateNetworkParametersSubscription>;
export type OnUpdateNetworkParametersSubscriptionResult = Apollo.SubscriptionResult<OnUpdateNetworkParametersSubscription>;
export type OnUpdateNetworkParametersSubscriptionResult = Apollo.SubscriptionResult<OnUpdateNetworkParametersSubscription>;
export const ProposalOfMarketDocument = gql`
query ProposalOfMarket($marketId: ID!) {
proposal(id: $marketId) {
id
terms {
enactmentDatetime
}
}
}
`;
/**
* __useProposalOfMarketQuery__
*
* To run a query within a React component, call `useProposalOfMarketQuery` and pass it any options that fit your needs.
* When your component renders, `useProposalOfMarketQuery` 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 } = useProposalOfMarketQuery({
* variables: {
* marketId: // value for 'marketId'
* },
* });
*/
export function useProposalOfMarketQuery(baseOptions: Apollo.QueryHookOptions<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>(ProposalOfMarketDocument, options);
}
export function useProposalOfMarketLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>(ProposalOfMarketDocument, options);
}
export type ProposalOfMarketQueryHookResult = ReturnType<typeof useProposalOfMarketQuery>;
export type ProposalOfMarketLazyQueryHookResult = ReturnType<typeof useProposalOfMarketLazyQuery>;
export type ProposalOfMarketQueryResult = Apollo.QueryResult<ProposalOfMarketQuery, ProposalOfMarketQueryVariables>;
@@ -10,7 +10,7 @@ export const OrderListContainer = ({
marketId?: string;
onMarketClick?: (marketId: string) => void;
}) => {
const { pubKey } = useVegaWallet();
const { pubKey, isReadOnly } = useVegaWallet();
if (!pubKey) {
return <Splash>{t('Please connect Vega wallet')}</Splash>;
@@ -21,6 +21,7 @@ export const OrderListContainer = ({
partyId={pubKey}
marketId={marketId}
onMarketClick={onMarketClick}
isReadOnly={isReadOnly}
/>
);
};
@@ -13,7 +13,7 @@ const generateJsx = () => {
return (
<MockedProvider>
<VegaWalletContext.Provider value={{ pubKey } as VegaWalletContextShape}>
<OrderListManager partyId={pubKey} />
<OrderListManager partyId={pubKey} isReadOnly={false} />
</VegaWalletContext.Provider>
</MockedProvider>
);
@@ -31,6 +31,7 @@ export interface OrderListManagerProps {
partyId: string;
marketId?: string;
onMarketClick?: (marketId: string) => void;
isReadOnly: boolean;
}
export const TransactionComplete = ({
@@ -72,6 +73,7 @@ export const OrderListManager = ({
partyId,
marketId,
onMarketClick,
isReadOnly,
}: OrderListManagerProps) => {
const gridRef = useRef<AgGridReact | null>(null);
const scrolledToTop = useRef(true);
@@ -146,6 +148,7 @@ export const OrderListManager = ({
}}
setEditOrder={setEditOrder}
onMarketClick={onMarketClick}
isReadOnly={isReadOnly}
/>
<div className="pointer-events-none absolute inset-0">
<AsyncRenderer
@@ -19,6 +19,7 @@ const defaultProps: OrderListTableProps = {
rowData: [],
setEditOrder: jest.fn(),
cancel: jest.fn(),
isReadOnly: false,
};
const generateJsx = (
@@ -156,6 +157,29 @@ describe('OrderListTable', () => {
expect(mockCancel).toHaveBeenCalledWith(order);
});
it('does not allow cancelling and editing for permitted orders if read only', async () => {
const mockEdit = jest.fn();
const mockCancel = jest.fn();
const order = generateOrder({
type: Schema.OrderType.TYPE_LIMIT,
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
liquidityProvision: null,
peggedOrder: null,
});
await act(async () => {
render(
generateJsx({
rowData: [order],
setEditOrder: mockEdit,
cancel: mockCancel,
isReadOnly: true,
})
);
});
const amendCell = getAmendCell();
expect(amendCell.queryAllByRole('button')).toHaveLength(0);
});
it('shows if an order is a liquidity provision order and does not show order actions', async () => {
const order = generateOrder({
type: Schema.OrderType.TYPE_LIMIT,
@@ -22,6 +22,7 @@ const Template: Story = (args) => {
setEditOrder={() => {
return;
}}
isReadOnly={false}
/>
</div>
);
@@ -48,6 +49,7 @@ const Template2: Story = (args) => {
rowData={args.data}
cancel={cancel}
setEditOrder={setEditOrder}
isReadOnly={false}
/>
</div>
<VegaTransactionDialog
@@ -32,6 +32,7 @@ export type OrderListTableProps = OrderListProps & {
cancel: (order: Order) => void;
setEditOrder: (order: Order) => void;
onMarketClick?: (marketId: string) => void;
isReadOnly: boolean;
};
export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
@@ -248,7 +249,7 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
minWidth={100}
type="rightAligned"
cellRenderer={({ data, node }: VegaICellRendererParams<Order>) => {
return data && isOrderAmendable(data) ? (
return data && isOrderAmendable(data) && !props.isReadOnly ? (
<>
<ButtonLink
data-testid="edit"
@@ -8,7 +8,7 @@ export const PositionsContainer = ({
}: {
onMarketClick?: (marketId: string) => void;
}) => {
const { pubKey } = useVegaWallet();
const { pubKey, isReadOnly } = useVegaWallet();
if (!pubKey) {
return (
@@ -17,5 +17,11 @@ export const PositionsContainer = ({
</Splash>
);
}
return <PositionsManager partyId={pubKey} onMarketClick={onMarketClick} />;
return (
<PositionsManager
partyId={pubKey}
onMarketClick={onMarketClick}
isReadOnly={isReadOnly}
/>
);
};
+32 -25
View File
@@ -9,16 +9,45 @@ import { t } from '@vegaprotocol/react-helpers';
interface PositionsManagerProps {
partyId: string;
onMarketClick?: (marketId: string) => void;
isReadOnly: boolean;
}
export const PositionsManager = ({
partyId,
onMarketClick,
isReadOnly,
}: PositionsManagerProps) => {
const gridRef = useRef<AgGridReact | null>(null);
const { data, error, loading, getRows } = usePositionsData(partyId, gridRef);
const create = useVegaTransactionStore((store) => store.create);
const onClose = ({
marketId,
openVolume,
}: {
marketId: string;
openVolume: string;
}) =>
create({
batchMarketInstructions: {
cancellations: [
{
marketId,
orderId: '', // omit order id to cancel all active orders
},
],
submissions: [
{
marketId: marketId,
type: Schema.OrderType.TYPE_MARKET as const,
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_FOK as const,
side: openVolume.startsWith('-')
? Schema.Side.SIDE_BUY
: Schema.Side.SIDE_SELL,
size: openVolume.replace('-', ''),
},
],
},
});
return (
<div className="h-full relative">
<PositionsTable
@@ -26,31 +55,9 @@ export const PositionsManager = ({
ref={gridRef}
datasource={{ getRows }}
onMarketClick={onMarketClick}
onClose={({ marketId, openVolume }) =>
create({
batchMarketInstructions: {
cancellations: [
{
marketId,
orderId: '', // omit order id to cancel all active orders
},
],
submissions: [
{
marketId: marketId,
type: Schema.OrderType.TYPE_MARKET as const,
timeInForce: Schema.OrderTimeInForce
.TIME_IN_FORCE_FOK as const,
side: openVolume.startsWith('-')
? Schema.Side.SIDE_BUY
: Schema.Side.SIDE_SELL,
size: openVolume.replace('-', ''),
},
],
},
})
}
onClose={onClose}
noRowsOverlayComponent={() => null}
isReadOnly={isReadOnly}
/>
<div className="pointer-events-none absolute inset-0">
<AsyncRenderer
+30 -13
View File
@@ -32,14 +32,16 @@ const singleRowData = [singleRow];
it('should render successfully', async () => {
await act(async () => {
const { baseElement } = render(<PositionsTable rowData={[]} />);
const { baseElement } = render(
<PositionsTable rowData={[]} isReadOnly={false} />
);
expect(baseElement).toBeTruthy();
});
});
it('Render correct columns', async () => {
it('render correct columns', async () => {
await act(async () => {
render(<PositionsTable rowData={singleRowData} />);
render(<PositionsTable rowData={singleRowData} isReadOnly={true} />);
});
const headers = screen.getAllByRole('columnheader');
@@ -64,7 +66,7 @@ it('Render correct columns', async () => {
it('renders market name', async () => {
await act(async () => {
render(<PositionsTable rowData={singleRowData} />);
render(<PositionsTable rowData={singleRowData} isReadOnly={false} />);
});
expect(screen.getByText('ETH/BTC (31 july 2022)')).toBeTruthy();
});
@@ -75,7 +77,7 @@ it('Does not fail if the market name does not match the split pattern', async ()
Object.assign({}, singleRow, { marketName: breakingMarketName }),
];
await act(async () => {
render(<PositionsTable rowData={row} />);
render(<PositionsTable rowData={row} isReadOnly={false} />);
});
expect(screen.getByText(breakingMarketName)).toBeTruthy();
@@ -84,7 +86,9 @@ it('Does not fail if the market name does not match the split pattern', async ()
it('add color and sign to amount, displays positive notional value', async () => {
let result: RenderResult;
await act(async () => {
result = render(<PositionsTable rowData={singleRowData} />);
result = render(
<PositionsTable rowData={singleRowData} isReadOnly={false} />
);
});
let cells = screen.getAllByRole('gridcell');
@@ -94,7 +98,10 @@ it('add color and sign to amount, displays positive notional value', async () =>
expect(cells[1].textContent).toEqual('1,230.0');
await act(async () => {
result.rerender(
<PositionsTable rowData={[{ ...singleRow, openVolume: '-100' }]} />
<PositionsTable
rowData={[{ ...singleRow, openVolume: '-100' }]}
isReadOnly={false}
/>
);
});
cells = screen.getAllByRole('gridcell');
@@ -107,7 +114,9 @@ it('add color and sign to amount, displays positive notional value', async () =>
it('displays mark price', async () => {
let result: RenderResult;
await act(async () => {
result = render(<PositionsTable rowData={singleRowData} />);
result = render(
<PositionsTable rowData={singleRowData} isReadOnly={false} />
);
});
let cells = screen.getAllByRole('gridcell');
@@ -123,6 +132,7 @@ it('displays mark price', async () => {
Schema.MarketTradingMode.TRADING_MODE_OPENING_AUCTION,
},
]}
isReadOnly={false}
/>
);
});
@@ -134,14 +144,19 @@ it('displays mark price', async () => {
it("displays properly entry, liquidation price and liquidation bar and it's intent", async () => {
let result: RenderResult;
await act(async () => {
result = render(<PositionsTable rowData={singleRowData} />);
result = render(
<PositionsTable rowData={singleRowData} isReadOnly={false} />
);
});
let cells = screen.getAllByRole('gridcell');
const entryPrice = cells[5].firstElementChild?.firstElementChild?.textContent;
expect(entryPrice).toEqual('13.3');
await act(async () => {
result.rerender(
<PositionsTable rowData={[{ ...singleRow, lowMarginLevel: true }]} />
<PositionsTable
rowData={[{ ...singleRow, lowMarginLevel: true }]}
isReadOnly={false}
/>
);
});
cells = screen.getAllByRole('gridcell');
@@ -149,7 +164,7 @@ it("displays properly entry, liquidation price and liquidation bar and it's inte
it('displays leverage', async () => {
await act(async () => {
render(<PositionsTable rowData={singleRowData} />);
render(<PositionsTable rowData={singleRowData} isReadOnly={false} />);
});
const cells = screen.getAllByRole('gridcell');
expect(cells[7].textContent).toEqual('1.1');
@@ -157,7 +172,7 @@ it('displays leverage', async () => {
it('displays allocated margin', async () => {
await act(async () => {
render(<PositionsTable rowData={singleRowData} />);
render(<PositionsTable rowData={singleRowData} isReadOnly={false} />);
});
const cells = screen.getAllByRole('gridcell');
const cell = cells[8];
@@ -166,7 +181,7 @@ it('displays allocated margin', async () => {
it('displays realised and unrealised PNL', async () => {
await act(async () => {
render(<PositionsTable rowData={singleRowData} />);
render(<PositionsTable rowData={singleRowData} isReadOnly={false} />);
});
const cells = screen.getAllByRole('gridcell');
expect(cells[9].textContent).toEqual('1.23');
@@ -181,6 +196,7 @@ it('displays close button', async () => {
onClose={() => {
return;
}}
isReadOnly={false}
/>
);
});
@@ -196,6 +212,7 @@ it('do not display close button if openVolume is zero', async () => {
onClose={() => {
return;
}}
isReadOnly={false}
/>
);
});
+2 -1
View File
@@ -33,6 +33,7 @@ interface Props extends TypedDataAgGrid<Position> {
onClose?: (data: Position) => void;
onMarketClick?: (id: string) => void;
style?: CSSProperties;
isReadOnly: boolean;
}
export interface AmountCellProps {
@@ -378,7 +379,7 @@ export const PositionsTable = forwardRef<AgGridReact, Props>(
return getDateTimeFormat().format(new Date(value));
}}
/>
{onClose ? (
{onClose && !props.isReadOnly ? (
<AgGridColumn
type="rightAligned"
cellRenderer={({ data }: VegaICellRendererParams<Position>) =>
@@ -71,8 +71,8 @@ export const FlashCell = memo(({ children, value }: FlashCellProps) => {
if (value < previousValue) {
ref.current?.animate(
[
{ color: theme.colors.vega.pink },
{ color: theme.colors.vega.pink, offset: 0.8 },
{ color: theme.colors.vega.pink.DEFAULT },
{ color: theme.colors.vega.pink.DEFAULT, offset: 0.8 },
{ color: 'inherit' },
],
FLASH_DURATION
@@ -80,8 +80,8 @@ export const FlashCell = memo(({ children, value }: FlashCellProps) => {
} else if (value > previousValue) {
ref.current?.animate(
[
{ color: theme.colors.vega.green },
{ color: theme.colors.vega.green, offset: 0.8 },
{ color: theme.colors.vega.green.DEFAULT },
{ color: theme.colors.vega.green.DEFAULT, offset: 0.8 },
{ color: 'inherit' },
],
FLASH_DURATION
+4 -4
View File
@@ -19,16 +19,16 @@ export const Size = ({
data-testid="size"
className={classNames('text-right', {
// BUY
'text-vega-green-dark dark:text-vega-green':
'text-vega-green-550 dark:text-vega-green':
side === Schema.Side.SIDE_BUY && !forceTheme,
'text-vega-green-dark':
'text-vega-green-550':
side === Schema.Side.SIDE_BUY && forceTheme === 'light',
'text-vega-green':
side === Schema.Side.SIDE_BUY && forceTheme === 'dark',
// SELL
'text-vega-pink-dark dark:text-vega-pink':
'text-vega-pink-550 dark:text-vega-pink':
side === Schema.Side.SIDE_SELL && !forceTheme,
'text-vega-pink-dark':
'text-vega-pink-550':
side === Schema.Side.SIDE_SELL && forceTheme === 'light',
'text-vega-pink':
side === Schema.Side.SIDE_SELL && forceTheme === 'dark',
+2 -2
View File
@@ -20,8 +20,8 @@ export interface IVolCellProps extends ICellRendererParams {
valueFormatted: Omit<VolProps, 'value'>;
}
export const BID_COLOR = tailwind.theme.colors.vega['green'];
export const ASK_COLOR = tailwind.theme.colors.vega['pink'];
export const BID_COLOR = tailwind.theme.colors.vega.green.DEFAULT;
export const ASK_COLOR = tailwind.theme.colors.vega.pink.DEFAULT;
export const Vol = React.memo(
({ value, valueFormatted, relativeValue, type, testId }: VolProps) => {
+104 -13
View File
@@ -10,22 +10,113 @@ module.exports = {
colors: {
transparent: 'transparent',
current: 'currentColor',
black: '#000000',
white: '#FFFFFF',
vega: {
yellow: '#DFFF0B',
'yellow-dark': '#B6DC26',
pink: '#FF077F',
'pink-data-light': '#FF6AB2',
'pink-dark': '#CF0064',
'pink-data-dark': '#7A033D',
green: '#00F780',
'green-data-light': '#85FBC2',
'green-dark': '#00D46E',
'green-data-dark': '#006333',
orange: '#FF7A1A',
blue: '#1DA2FB',
// YELLOW
yellow: {
700: '#23290E',
650: '#515E1E',
600: '#7E932F',
550: '#ABC840',
DEFAULT: '#D7FB50',
500: '#D7FB50',
450: '#E0FC75',
400: '#E8FD9A',
350: '#F0FDBE',
300: '#F9FEE3',
},
// GREEN
green: {
700: '#012915',
650: '#015D30',
600: '#01914B',
550: '#01C566',
DEFAULT: '#00F780',
500: '#00F780',
450: '#37F99B',
400: '#6CFAB6',
350: '#A1FCD0',
300: '#D6FEEB',
},
// BLUE
blue: {
700: '#01142A',
650: '#012C60',
600: '#014595',
550: '#015ECB',
DEFAULT: '#0075FF',
500: '#0075FF',
450: '#3793FF',
400: '#6CAFFF',
350: '#A1CCFF',
300: '#D6E9FF',
},
// PURPLE
purple: {
700: '#15072A',
650: '#301060',
600: '#4B1895',
550: '#6620CB',
DEFAULT: '#8028FF',
500: '#8028FF',
450: '#9B56FF',
400: '#B683FF',
350: '#D0B0FF',
300: '#EBDDFF',
},
// PINK
pink: {
700: '#210215',
650: '#600330',
600: '#95054B',
550: '#CB0666',
DEFAULT: '#FF077F',
500: '#FF077F',
450: '#FF3C9A',
400: '#FF70B5',
350: '#FFA3D0',
300: '#FFD7EA',
},
// ORANGE
orange: {
700: '#2A1701',
650: '#603301',
600: '#954F01',
550: '#CB6C01',
DEFAULT: '#FF8700',
500: '#FF8700',
450: '#FFA137',
400: '#FFBA6C',
350: '#FFD3A1',
300: '#FFECD6',
},
// DARK
dark: {
400: '#161616',
300: '#262626',
200: '#404040',
150: '#8B8B8B',
100: '#C0C0C0',
},
// LIGHT
light: {
400: '#F0F0F0',
300: '#E9E9E9',
200: '#D2D2D2',
150: '#939393',
100: '#626262',
},
},
danger: '#FF077F',
warning: '#FF7A1A',
warning: '#FF8700',
success: '#00F780',
},
fontFamily: {
@@ -22,17 +22,17 @@ const vegaCustomClasses = plugin(function ({ addUtilities }) {
},
'.dark .syntax-highlighter-wrapper .hljs': {
background: colors.neutral[800],
color: theme.colors.vega.green,
color: theme.colors.vega.green.DEFAULT,
border: 0,
},
'.syntax-highlighter-wrapper .hljs-literal': {
color: theme.colors.vega.pink,
color: theme.colors.vega.pink.DEFAULT,
},
'.syntax-highlighter-wrapper .hljs-number': {
color: theme.colors.vega.orange,
color: theme.colors.vega.orange.DEFAULT,
},
'.syntax-highlighter-wrapper .hljs-string': {
color: theme.colors.vega.blue,
color: theme.colors.vega.blue.DEFAULT,
},
'.clip-path-rounded': {
clipPath: 'circle(50%)',
@@ -0,0 +1,9 @@
import { render } from '@testing-library/react';
import { AnnouncementBanner } from './announcement-banner';
describe('Banner', () => {
it('should render successfully', () => {
const { baseElement } = render(<AnnouncementBanner>Hi</AnnouncementBanner>);
expect(baseElement).toBeTruthy();
});
});
@@ -0,0 +1,18 @@
import type { Story, ComponentMeta } from '@storybook/react';
import { AnnouncementBanner } from './announcement-banner';
export default {
component: AnnouncementBanner,
title: 'Announcement Banner',
} as ComponentMeta<typeof AnnouncementBanner>;
const Template: Story = (args) => (
<div className="mb-8">
<AnnouncementBanner {...args} />
</div>
);
export const Default = Template.bind({});
Default.args = {
children: <div className="text-center">Banner text</div>,
};
@@ -0,0 +1,15 @@
import classnames from 'classnames';
import type { ReactNode } from 'react';
export interface BannerProps {
children?: ReactNode;
}
export const AnnouncementBanner = ({ children }: BannerProps) => {
const bannerClasses = classnames(
"bg-[url('https://static.vega.xyz/assets/img/banner-bg.jpg')] bg-cover bg-center bg-no-repeat",
'p-4'
);
return <div className={bannerClasses}>{children}</div>;
};
@@ -0,0 +1 @@
export * from './announcement-banner';
@@ -27,20 +27,20 @@ const primary = [
'text-black',
'border-vega-yellow',
'bg-vega-yellow',
'enabled:hover:bg-vega-yellow-dark enabled:hover:border-vega-yellow-dark',
'enabled:active:bg-vega-yellow-dark enabled:active:border-vega-yellow-dark',
'enabled:hover:bg-vega-yellow-550 enabled:hover:border-vega-yellow-550',
'enabled:active:bg-vega-yellow-550 enabled:active:border-vega-yellow-550',
];
const secondary = [
'text-white dark:text-black',
'border-vega-pink',
'dark:bg-vega-pink bg-vega-pink-dark',
'dark:bg-vega-pink bg-vega-pink-550',
'enabled:hover:bg-vega-pink enabled:hover:border-vega-pink',
'enabled:active:bg-vega-pink enabled:active:border-vega-pink',
];
const ternary = [
'text-white dark:text-black',
'border-vega-green',
'dark:bg-vega-green bg-vega-green-dark',
'dark:bg-vega-green bg-vega-green-550',
'enabled:hover:bg-vega-green enabled:hover:border-vega-green',
'enabled:active:bg-vega-green enabled:active:border-vega-green',
];
@@ -79,7 +79,7 @@ export function Dialog({
)}
<div className="flex gap-4 max-w-full">
{icon && <div className="fill-current">{icon}</div>}
<div data-testid="dialog-content" className="flex-1">
<div data-testid="dialog-content" className="flex-1 max-w-full">
{title && (
<h1
className="text-xl uppercase mb-4 pr-2"
+1
View File
@@ -3,6 +3,7 @@ export * from './ag-grid';
export * from './arrows';
export * from './async-renderer';
export * from './background-video';
export * from './announcement-banner';
export * from './button';
export * from './callout';
export * from './checkbox';
@@ -69,7 +69,8 @@ export const RichSelect = forwardRef<
data-testid={props['data-testid'] || 'rich-select-trigger'}
className={classNames(
defaultSelectElement(hasError),
'rounded-md pl-2 pr-11'
'rounded-md pl-2 pr-11',
'max-w-full overflow-hidden break-all'
)}
id={id}
ref={forwardedRef}
@@ -40,9 +40,9 @@ export const Toggle = ({
{
'peer-checked:bg-neutral-400 dark:peer-checked:bg-white dark:peer-checked:text-black':
type === 'primary',
'dark:peer-checked:bg-vega-green peer-checked:bg-vega-green-dark':
'dark:peer-checked:bg-vega-green peer-checked:bg-vega-green-550':
type === 'buy',
'dark:peer-checked:bg-vega-pink peer-checked:bg-vega-pink-dark':
'dark:peer-checked:bg-vega-pink peer-checked:bg-vega-pink-550':
type === 'sell',
},
'peer-checked:text-white dark:peer-checked:text-black',
@@ -14,32 +14,29 @@ import colors from 'tailwindcss/colors';
This project uses Tailwindcss so a lot of colour props are passed in as CSS classes that
Tailwind applies styling to i.e. `text-blue-500` to use the primary blue. You can find the
full colour palette [here](https://tailwindcss.com/docs/customizing-colors/#default-color-palette).
full tailiwnd's colour palette [here](https://tailwindcss.com/docs/customizing-colors/#default-color-palette).
The Vega's colour palette can be found [here](https://www.figma.com/file/8lCQ6iNK3dbw42bIKwGCRk/Foundations?node-id=3750%3A77046)
## Colours
### Shared
<ColorPalette>
<ColorItem title="White" colors={colors.white} />
<ColorItem title="Black" colors={colors.black} />
</ColorPalette>
### Vega
<ColorPalette>
<ColorItem
title="theme.color.vega"
subtitle="Vega colors"
colors={theme.colors.vega}
title="dark"
colors={{ ...theme.colors.vega.dark, black: theme.colors.black }}
/>
</ColorPalette>
### Intent
<ColorPalette>
<ColorItem
title="theme.color[danger|warning|success]"
title="light"
colors={{ ...theme.colors.vega.light, white: theme.colors.white }}
/>
<ColorItem title="yellow" colors={theme.colors.vega.yellow} />
<ColorItem title="green" colors={theme.colors.vega.green} />
<ColorItem title="blue" colors={theme.colors.vega.blue} />
<ColorItem title="purple" colors={theme.colors.vega.purple} />
<ColorItem title="pink" colors={theme.colors.vega.pink} />
<ColorItem title="orange" colors={theme.colors.vega.orange} />
<ColorItem
title="intent"
colors={{
danger: theme.colors.danger,
warning: theme.colors.warning,
@@ -47,3 +44,33 @@ full colour palette [here](https://tailwindcss.com/docs/customizing-colors/#defa
}}
/>
</ColorPalette>
# Replacement for legacy shades
<ColorPalette>
<ColorItem
title="legacy shades"
colors={{
'vega-yellow-dark': '#B6DC26', // vega-yellow-dark -> vega-yellow-550
'vega-pink-data-light': '#FF6AB2', // vega-pink-data-light -> vega-pink-400
'vega-pink-dark': '#CF0064', // vega-pink-dark -> vega-pink-550
'vega-pink-data-dark': '#7A033D', // vega-pink-data-dark -> vega-pink-650
'vega-green-data-light': '#85FBC2', // vega-green-data-light -> vega-green-400
'vega-green-dark': '#00D46E', // vega-green-dark -> vega-green-550
'vega-green-data-dark': '#006333', // vega-green-data-dark -> vega-green-650
}}
/>
<ColorItem
title="replacement"
colors={{
'vega-yellow-550': theme.colors.vega.yellow[550],
'vega-pink-400': theme.colors.vega.pink[400],
'vega-pink-550': theme.colors.vega.pink[550],
'vega-pink-650': theme.colors.vega.pink[650],
'vega-green-400': theme.colors.vega.green[400],
'vega-green-550': theme.colors.vega.green[550],
'vega-green-650': theme.colors.vega.green[650],
}}
/>
</ColorPalette>
+2 -9
View File
@@ -1,4 +1,5 @@
import type { Asset } from '@vegaprotocol/assets';
import { AssetOption } from '@vegaprotocol/assets';
import {
ethereumAddress,
minSafe,
@@ -14,7 +15,6 @@ import {
Input,
InputError,
RichSelect,
Option,
} from '@vegaprotocol/ui-toolkit';
import { useWeb3React } from '@web3-react/core';
import BigNumber from 'bignumber.js';
@@ -110,14 +110,7 @@ export const WithdrawForm = ({
hasError={Boolean(errors.asset?.message)}
>
{assets.filter(isAssetTypeERC20).map((a) => (
<Option key={a.id} value={a.id}>
<div className="flex flex-col items-start">
<span>{a.name}</span>
<span className="text-[10px] font-mono">
<span className="text-gray-500">{a.id} -</span> {a.symbol}
</span>
</div>
</Option>
<AssetOption asset={a} />
))}
</RichSelect>
);
+1
View File
@@ -95,6 +95,7 @@
"@babel/preset-typescript": "7.12.13",
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"@commitlint/config-nx-scopes": "^17.4.2",
"@cypress/grep": "^3.1.0",
"@ethersproject/experimental": "^5.6.0",
"@graphql-codegen/cli": "^2.11.8",
+2
View File
@@ -188,6 +188,8 @@
"governance.proposal.updateNetParam.minClose": "2s",
"governance.proposal.updateNetParam.minEnact": "2s",
"governance.proposal.updateNetParam.requiredParticipation": "0.00000000000000000000000015",
"governance.proposal.freeform.minClose": "2s",
"governance.proposal.freeform.requiredParticipation": "0.00000000000000000000000015",
"market.auction.minimumDuration": "3s",
"market.fee.factors.infrastructureFee": "0.001",
"market.fee.factors.makerFee": "0.004",
+5
View File
@@ -1618,6 +1618,11 @@
dependencies:
conventional-changelog-conventionalcommits "^4.3.1"
"@commitlint/config-nx-scopes@^17.4.2":
version "17.4.2"
resolved "https://registry.yarnpkg.com/@commitlint/config-nx-scopes/-/config-nx-scopes-17.4.2.tgz#365feba8d5f935517d4387381b8c90289a8596c7"
integrity sha512-xNbbLfFxK+U0LJv99PNP+qe1c3J8Q76gdtz9JIcUJL8FsRV5dDdxvYplNAs88WqCFViP0ipNTYljyigftr3nqg==
"@commitlint/config-validator@^16.2.1":
version "16.2.1"
resolved "https://registry.yarnpkg.com/@commitlint/config-validator/-/config-validator-16.2.1.tgz#794e769afd4756e4cf1bfd823b6612932e39c56d"