From b87b0f9ce03c428242f4bdb4b662736da2337541 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sat, 9 Jul 2022 18:05:26 +0000 Subject: [PATCH 01/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 213 ++++++++++++++++-- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 201 insertions(+), 18 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 89906dd3b..3abf61002 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121814.203346243275662375", + "locked_amount": "121754.97939769934196483", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62710.587599252519550582", + "locked_amount": "62652.494422691264096916", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85714.54671688684878975345576", + "locked_amount": "85635.14337389614122021921288", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26381.26124908313794121", + "locked_amount": "26356.822452919317178822", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8586.844538876974346587", + "locked_amount": "8578.889947874114798657", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "14000.856261322464", + "locked_amount": "13970.32806838767975", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1740598.83199851280435843", + "locked_amount": "1739271.959371781453849906", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12885.5761687131318989695117159034", + "locked_amount": "12846.5812583382282289404281359424", "deposits": [ { "amount": "2833.333333", @@ -5360,9 +5360,9 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "22675.000000000000000003", + "total_added": "23335.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3447.5872138191271475004561306126331811", + "locked_amount": "3531.9752703259765065004540786719939117", "deposits": [ { "amount": "25", @@ -5654,6 +5654,81 @@ "user": "0x7Eae1E0D58a8B1EAd803e2857Cc71262790BEF31", "tx": "0x9c4b31c46ccf46a8f5adf804c29b70bee174a52efa5551c2937527f276694120" }, + { + "amount": "25", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tx": "0xd4cd7cc10ebbfe143ff40dc3ef93a4832d23e9e6785b4bc33f5039ba1fd76946" + }, + { + "amount": "20", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tx": "0xe370ba99033dc4079338923b67da8e84d4ca5723b508fd46162f6e072b11cbb3" + }, + { + "amount": "20", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tx": "0x77437394f59f6eb88258449ae21c1dd447166779eed4b565fdefcf64686b9a8b" + }, + { + "amount": "20", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tx": "0xe88bf3aa7c87adfa65148183592f30bfe6d17e1ed31fdb7758604f6784f70be4" + }, + { + "amount": "25", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tx": "0xde28a1d3aa51121b8398580cfb7f09d03c7ff0a13d0e5bf12f088414a4ab49f4" + }, + { + "amount": "5", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tx": "0x13a798a6ae5a4b971e87864fa2fb3073879a09dd625bb4b621048684c278e7d7" + }, + { + "amount": "50", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x0ad493b8ba584c36fc6b74d67ae1836cc0359900cddc1a99e140ef1b19d551be" + }, + { + "amount": "30", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x79f2dfaa597a63643a3cdd74a6c4d7bbb3d762f61065efcc2dfe8360e0c77869" + }, + { + "amount": "60", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x443e4d4dbf20b1f57381ad5820bcb30fc6997d0ad24c5b893c14f5c2e2c1c8ff" + }, + { + "amount": "35", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0xd35b23d198f2fb974a9d54410a594586ead6bb73be6e03f39e1c2d985d139318" + }, + { + "amount": "35", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x7acbd6411084bb539a023d5f026dc830220e958957953673a75f108e1d09617f" + }, + { + "amount": "200", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0xbb38bbc96d8ea8cbd61cec953346a1e0329a0fcd34dbe494b3a88a5236b380de" + }, + { + "amount": "100", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0xc6e187cdfb25f8f5c01fc699d0759cf482e9df697dd44cdc98a953072a25d034" + }, + { + "amount": "25", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x7922f20988fd31e30e772696891a11ed4b244654f1084535e02c97bcb3146364" + }, + { + "amount": "10", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x9c37f4918ecc76ab41a2ea159caa921d433393aaa1b7e0323c30b6a009e770b2" + }, { "amount": "75", "user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", @@ -9611,6 +9686,114 @@ "withdrawn_tokens": "0", "remaining_tokens": "140" }, + { + "address": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "deposits": [ + { + "amount": "25", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tranche_id": 11, + "tx": "0xd4cd7cc10ebbfe143ff40dc3ef93a4832d23e9e6785b4bc33f5039ba1fd76946" + }, + { + "amount": "20", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tranche_id": 11, + "tx": "0xe370ba99033dc4079338923b67da8e84d4ca5723b508fd46162f6e072b11cbb3" + }, + { + "amount": "20", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tranche_id": 11, + "tx": "0x77437394f59f6eb88258449ae21c1dd447166779eed4b565fdefcf64686b9a8b" + }, + { + "amount": "20", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tranche_id": 11, + "tx": "0xe88bf3aa7c87adfa65148183592f30bfe6d17e1ed31fdb7758604f6784f70be4" + }, + { + "amount": "25", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tranche_id": 11, + "tx": "0xde28a1d3aa51121b8398580cfb7f09d03c7ff0a13d0e5bf12f088414a4ab49f4" + }, + { + "amount": "5", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tranche_id": 11, + "tx": "0x13a798a6ae5a4b971e87864fa2fb3073879a09dd625bb4b621048684c278e7d7" + } + ], + "withdrawals": [], + "total_tokens": "115", + "withdrawn_tokens": "0", + "remaining_tokens": "115" + }, + { + "address": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "deposits": [ + { + "amount": "50", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x0ad493b8ba584c36fc6b74d67ae1836cc0359900cddc1a99e140ef1b19d551be" + }, + { + "amount": "30", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x79f2dfaa597a63643a3cdd74a6c4d7bbb3d762f61065efcc2dfe8360e0c77869" + }, + { + "amount": "60", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x443e4d4dbf20b1f57381ad5820bcb30fc6997d0ad24c5b893c14f5c2e2c1c8ff" + }, + { + "amount": "35", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0xd35b23d198f2fb974a9d54410a594586ead6bb73be6e03f39e1c2d985d139318" + }, + { + "amount": "35", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x7acbd6411084bb539a023d5f026dc830220e958957953673a75f108e1d09617f" + }, + { + "amount": "200", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0xbb38bbc96d8ea8cbd61cec953346a1e0329a0fcd34dbe494b3a88a5236b380de" + }, + { + "amount": "100", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0xc6e187cdfb25f8f5c01fc699d0759cf482e9df697dd44cdc98a953072a25d034" + }, + { + "amount": "25", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x7922f20988fd31e30e772696891a11ed4b244654f1084535e02c97bcb3146364" + }, + { + "amount": "10", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x9c37f4918ecc76ab41a2ea159caa921d433393aaa1b7e0323c30b6a009e770b2" + } + ], + "withdrawals": [], + "total_tokens": "545", + "withdrawn_tokens": "0", + "remaining_tokens": "545" + }, { "address": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", "deposits": [ @@ -15431,7 +15614,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2699195.71736283573760081335", + "locked_amount": "2697156.77610353188373385317", "deposits": [ { "amount": "1998.95815", @@ -16144,7 +16327,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "12175.7143774436229", - "locked_amount": "14794728.4232451818250719454944430478169775", + "locked_amount": "14787535.4834172272890363148475979070546094", "deposits": [ { "amount": "16249.93", @@ -18372,7 +18555,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2164650.583392610391208927", - "locked_amount": "8007239.89262149386383419935049434", + "locked_amount": "8000565.24452034239605386238884828", "deposits": [ { "amount": "129284.449", @@ -22651,7 +22834,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2846805.505418249434976609440786892", + "locked_amount": "2844168.31158554849486031122274326", "deposits": [ { "amount": "552496.6455", @@ -23840,7 +24023,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "193.97337645", - "locked_amount": "427702.99067665172547620796854388", + "locked_amount": "427379.9087790299611551240537798", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 34af86644..81814dab2 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "38.375643708777274", + "locked_amount": "38.307245687468294", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "284.894035388127847", + "locked_amount": "284.141657153729067", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index cd9127b88..3b91a8c42 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "261.58452340182647770025899457762557077", + "locked_amount": "260.89370338660577970025831059741248097", "deposits": [ { "amount": "1000", From de40bc65d09360e5dc4a53f4198208839926307b Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 10 Jul 2022 00:10:23 +0000 Subject: [PATCH 02/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 28 +++++++++---------- apps/static/src/assets/stagnet1-tranches.json | 4 +-- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 3abf61002..3e903c966 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121754.97939769934196483", + "locked_amount": "121694.85761739026634438", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62652.494422691264096916", + "locked_amount": "62593.520556805218115446", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85635.14337389614122021921288", + "locked_amount": "85554.53628064312262586307344", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26356.822452919317178822", + "locked_amount": "26332.013165965251618578", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8578.889947874114798657", + "locked_amount": "8570.814765714188391794", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13970.32806838767975", + "locked_amount": "13939.33706974637775", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1739271.959371781453849906", + "locked_amount": "1737924.971429846509055876", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12846.5812583382282289404281359424", + "locked_amount": "12806.9951872914340533608341309838", "deposits": [ { "amount": "2833.333333", @@ -5362,7 +5362,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23335.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3531.9752703259765065004540786719939117", + "locked_amount": "3515.7726290588530590004519956240487062", "deposits": [ { "amount": "25", @@ -15614,7 +15614,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2697156.77610353188373385317", + "locked_amount": "2695086.92460816951174951737", "deposits": [ { "amount": "1998.95815", @@ -16327,7 +16327,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "12175.7143774436229", - "locked_amount": "14787535.4834172272890363148475979070546094", + "locked_amount": "14780233.4990216431338899061530697298648284", "deposits": [ { "amount": "16249.93", @@ -18555,7 +18555,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2164650.583392610391208927", - "locked_amount": "8000565.24452034239605386238884828", + "locked_amount": "7993789.40912530441971678110590041", "deposits": [ { "amount": "129284.449", @@ -22834,7 +22834,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2844168.31158554849486031122274326", + "locked_amount": "2841491.138041058051876632552106", "deposits": [ { "amount": "552496.6455", @@ -24023,7 +24023,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "193.97337645", - "locked_amount": "427379.9087790299611551240537798", + "locked_amount": "427051.9289778142047728937798072", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 81814dab2..c259fb389 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "38.307245687468294", + "locked_amount": "38.237788559107055", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "284.141657153729067", + "locked_amount": "283.37762874175546", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 3b91a8c42..d28db70c4 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "260.89370338660577970025831059741248097", + "locked_amount": "260.1921863901572860002576160261288686", "deposits": [ { "amount": "1000", From 898e86e92869d3124f2c53bfa82a7c436d838a64 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 10 Jul 2022 06:05:32 +0000 Subject: [PATCH 03/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 217 ++++++++++++++++-- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 203 insertions(+), 20 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 3e903c966..884307f5d 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121694.85761739026634438", + "locked_amount": "121636.350286860680374425", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62593.520556805218115446", + "locked_amount": "62536.1303157600847023", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85554.53628064312262586307344", + "locked_amount": "85476.09372914620261090407048", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26332.013165965251618578", + "locked_amount": "26307.870082634006974682", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8570.814765714188391794", + "locked_amount": "8562.956426368804673928", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13939.33706974637775", + "locked_amount": "13909.178272192029", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1737924.971429846509055876", + "locked_amount": "1736614.154146442856754716", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12806.9951872914340533608341309838", + "locked_amount": "12768.472120755561181706928602534", "deposits": [ { "amount": "2833.333333", @@ -5360,9 +5360,9 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "23335.000000000000000003", + "total_added": "23682.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3515.7726290588530590004519956240487062", + "locked_amount": "3552.05143512176527152044996851217656008", "deposits": [ { "amount": "25", @@ -5729,6 +5729,81 @@ "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", "tx": "0x9c37f4918ecc76ab41a2ea159caa921d433393aaa1b7e0323c30b6a009e770b2" }, + { + "amount": "20", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x0e7754b18eab077fc5c144a1a50358e2549baaf2981b53e583a8ad99061fa03c" + }, + { + "amount": "15", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tx": "0x5e26adc0060f0cc3a5a8507be33b703e9d00ab6a794fe2621b2d512bcec109a6" + }, + { + "amount": "25", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0xebadbc1f72b4dde201bb069be7dadba684cf6931a7cc8e37114d375b40567728" + }, + { + "amount": "20", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0xedf869f1b26b121bec11919818f4810bd0e0418ebb2b5aeb2282e668f9849314" + }, + { + "amount": "10", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0xe1f87658af57653bd74b9142930c2ebd5e4315210919240c567e8682bf128837" + }, + { + "amount": "15", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0xe5bfa8b23591735541e37a8b9520cf2246e6d38b4f3253e5df1bb543460337c4" + }, + { + "amount": "25", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0xf6ad63410fc6de02497fb025bf90274bc187bac9dfe8d1f58bd637460ffa4bea" + }, + { + "amount": "5", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0x5735e2acfa821261700d8635c2f90510627cb41b709ed8d9b3562eab01d7d0fc" + }, + { + "amount": "2", + "user": "0xEeFF517294d2aa759274703a1B1C5ac81f9a754B", + "tx": "0x4626fe9fb39350c366f423b1e3e56234f635f1de462aa6d4246e88167d6bf451" + }, + { + "amount": "25", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0x20f42a87a88b4a26a757d421c2441639c25d1930090f4fc9b9e05664521c7b7e" + }, + { + "amount": "30", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0x0b28570bb5ca732c7f9c78d1b99036692bd53312a4dc8aee9bcd5a3f98b095b3" + }, + { + "amount": "20", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0x628b0fa1dd10c38fb2df1555794fc48aa3355d8fbcef5861ec085c18d8cd1f98" + }, + { + "amount": "10", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0x7cc81c556e905eff3433d9e87cddc7d36655b5c525fd3e763623ce5362b737df" + }, + { + "amount": "50", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0x30b7a49c36dc037021ec26013dd1ace6335985557b6e2a1f46463a31a7a814cf" + }, + { + "amount": "75", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tx": "0x6a812385fe8e104cedcb81615bcf2f65aa4ca4400a94524774878047b505d5cc" + }, { "amount": "75", "user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", @@ -9787,12 +9862,120 @@ "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", "tranche_id": 11, "tx": "0x9c37f4918ecc76ab41a2ea159caa921d433393aaa1b7e0323c30b6a009e770b2" + }, + { + "amount": "20", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x0e7754b18eab077fc5c144a1a50358e2549baaf2981b53e583a8ad99061fa03c" + }, + { + "amount": "15", + "user": "0xf450648448be1117A854ab39FA30B398bAC88AEf", + "tranche_id": 11, + "tx": "0x5e26adc0060f0cc3a5a8507be33b703e9d00ab6a794fe2621b2d512bcec109a6" } ], "withdrawals": [], - "total_tokens": "545", + "total_tokens": "580", "withdrawn_tokens": "0", - "remaining_tokens": "545" + "remaining_tokens": "580" + }, + { + "address": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "deposits": [ + { + "amount": "25", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0xebadbc1f72b4dde201bb069be7dadba684cf6931a7cc8e37114d375b40567728" + }, + { + "amount": "20", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0xedf869f1b26b121bec11919818f4810bd0e0418ebb2b5aeb2282e668f9849314" + }, + { + "amount": "10", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0xe1f87658af57653bd74b9142930c2ebd5e4315210919240c567e8682bf128837" + }, + { + "amount": "15", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0xe5bfa8b23591735541e37a8b9520cf2246e6d38b4f3253e5df1bb543460337c4" + }, + { + "amount": "25", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0xf6ad63410fc6de02497fb025bf90274bc187bac9dfe8d1f58bd637460ffa4bea" + }, + { + "amount": "5", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0x5735e2acfa821261700d8635c2f90510627cb41b709ed8d9b3562eab01d7d0fc" + }, + { + "amount": "25", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0x20f42a87a88b4a26a757d421c2441639c25d1930090f4fc9b9e05664521c7b7e" + }, + { + "amount": "30", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0x0b28570bb5ca732c7f9c78d1b99036692bd53312a4dc8aee9bcd5a3f98b095b3" + }, + { + "amount": "20", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0x628b0fa1dd10c38fb2df1555794fc48aa3355d8fbcef5861ec085c18d8cd1f98" + }, + { + "amount": "10", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0x7cc81c556e905eff3433d9e87cddc7d36655b5c525fd3e763623ce5362b737df" + }, + { + "amount": "50", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0x30b7a49c36dc037021ec26013dd1ace6335985557b6e2a1f46463a31a7a814cf" + }, + { + "amount": "75", + "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", + "tranche_id": 11, + "tx": "0x6a812385fe8e104cedcb81615bcf2f65aa4ca4400a94524774878047b505d5cc" + } + ], + "withdrawals": [], + "total_tokens": "310", + "withdrawn_tokens": "0", + "remaining_tokens": "310" + }, + { + "address": "0xEeFF517294d2aa759274703a1B1C5ac81f9a754B", + "deposits": [ + { + "amount": "2", + "user": "0xEeFF517294d2aa759274703a1B1C5ac81f9a754B", + "tranche_id": 11, + "tx": "0x4626fe9fb39350c366f423b1e3e56234f635f1de462aa6d4246e88167d6bf451" + } + ], + "withdrawals": [], + "total_tokens": "2", + "withdrawn_tokens": "0", + "remaining_tokens": "2" }, { "address": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", @@ -15614,7 +15797,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2695086.92460816951174951737", + "locked_amount": "2693072.6548216838461324574", "deposits": [ { "amount": "1998.95815", @@ -16327,7 +16510,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "12175.7143774436229", - "locked_amount": "14780233.4990216431338899061530697298648284", + "locked_amount": "14773127.5947660129873774998655542415720465", "deposits": [ { "amount": "16249.93", @@ -18555,7 +18738,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2164650.583392610391208927", - "locked_amount": "7993789.40912530441971678110590041", + "locked_amount": "7987195.52519449688152068822559611", "deposits": [ { "amount": "129284.449", @@ -22834,7 +23017,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2841491.138041058051876632552106", + "locked_amount": "2838885.854620518390041287331048619", "deposits": [ { "amount": "552496.6455", @@ -24023,7 +24206,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "193.97337645", - "locked_amount": "427051.9289778142047728937798072", + "locked_amount": "426732.75641608857685633536276", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index c259fb389..597d88360 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "38.237788559107055", + "locked_amount": "38.17024036022324", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "283.37762874175546", + "locked_amount": "282.63459855403344", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index d28db70c4..1c8c95deb 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "260.1921863901572860002576160261288686", + "locked_amount": "259.5099495814307040002569405441400304", "deposits": [ { "amount": "1000", From 837435c28a048fe538c4fb745685adb29538a241 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 10 Jul 2022 12:04:27 +0000 Subject: [PATCH 04/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 92 ++++++++++++++----- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 71 insertions(+), 27 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 884307f5d..23a94f581 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121636.350286860680374425", + "locked_amount": "121577.22243651789764421", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62536.1303157600847023", + "locked_amount": "62478.131402582207847978", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85476.09372914620261090407048", + "locked_amount": "85396.81922792667722435619564", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26307.870082634006974682", + "locked_amount": "26283.470941447737784684", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8562.956426368804673928", + "locked_amount": "8555.014742676334094591", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13909.178272192029", + "locked_amount": "13878.69961503623175", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1736614.154146442856754716", + "locked_amount": "1735289.434535100206682764", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12768.472120755561181706928602534", + "locked_amount": "12729.540484458684190482945550934", "deposits": [ { "amount": "2833.333333", @@ -3319,10 +3319,15 @@ "tranche_id": 10, "tranche_start": "2021-07-15T23:37:11.000Z", "tranche_end": "2021-07-15T23:37:11.000Z", - "total_added": "3790968.150000000000000001", - "total_removed": "3782778.640000000000000001", + "total_added": "3904968.150000000000000001", + "total_removed": "3896778.640000000000000001", "locked_amount": "0", "deposits": [ + { + "amount": "114000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tx": "0x167fe6c654897398dcfdab9305133b4410b15bac8f5a30bb1260a94a14a65aad" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -3765,6 +3770,11 @@ } ], "withdrawals": [ + { + "amount": "114000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tx": "0x873061bbe5702251e087833b87033296fef9c6fb4f6c2be7586e1e74e20a4f52" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -4150,6 +4160,12 @@ { "address": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", "deposits": [ + { + "amount": "114000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tranche_id": 10, + "tx": "0x167fe6c654897398dcfdab9305133b4410b15bac8f5a30bb1260a94a14a65aad" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -4248,6 +4264,12 @@ } ], "withdrawals": [ + { + "amount": "114000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tranche_id": 10, + "tx": "0x873061bbe5702251e087833b87033296fef9c6fb4f6c2be7586e1e74e20a4f52" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -4339,8 +4361,8 @@ "tx": "0xac16a4ce688d40a482a59914d68c3a676592f8804ee8f0781b66a4ba5ccfbdfc" } ], - "total_tokens": "631651", - "withdrawn_tokens": "631651", + "total_tokens": "745651", + "withdrawn_tokens": "745651", "remaining_tokens": "0" }, { @@ -5362,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23682.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3552.05143512176527152044996851217656008", + "locked_amount": "3535.87969901065345872044791990106544888", "deposits": [ { "amount": "25", @@ -15797,7 +15819,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2693072.6548216838461324574", + "locked_amount": "2691036.92747071733354891906", "deposits": [ { "amount": "1998.95815", @@ -16509,8 +16531,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "12175.7143774436229", - "locked_amount": "14773127.5947660129873774998655542415720465", + "total_removed": "12560.12638799303295", + "locked_amount": "14765945.9929053324533617147890639589091646", "deposits": [ { "amount": "16249.93", @@ -17014,6 +17036,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x14590efea8cd53e0bc5e102f8b82d80370d3487b18aece11f3338a9fdca9afc0" }, + { + "amount": "384.41201054941005", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x0cf55e46d1acaa85666bd5153644bcb804370c46b9f7b45f79ab345f7e124f03" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17192,6 +17219,12 @@ "tranche_id": 2, "tx": "0x14590efea8cd53e0bc5e102f8b82d80370d3487b18aece11f3338a9fdca9afc0" }, + { + "amount": "384.41201054941005", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x0cf55e46d1acaa85666bd5153644bcb804370c46b9f7b45f79ab345f7e124f03" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17332,8 +17365,8 @@ } ], "total_tokens": "194999.1675", - "withdrawn_tokens": "12175.7143774436229", - "remaining_tokens": "182823.4531225563771" + "withdrawn_tokens": "12560.12638799303295", + "remaining_tokens": "182439.04111200696705" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -18737,8 +18770,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2164650.583392610391208927", - "locked_amount": "7987195.52519449688152068822559611", + "total_removed": "2165360.724351228236226177", + "locked_amount": "7980531.39809637781091757644025132", "deposits": [ { "amount": "129284.449", @@ -18957,6 +18990,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0xe7805f58cd369847197451266a778115f73cf37e0db5ebcc9f709fcc3921a39c" }, + { + "amount": "710.14095861784501725", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x7a12a85592f9696bb45f1f73672440fc3c1b3fbf151f5a8df5cf7ad260fce17a" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -20655,6 +20693,12 @@ "tranche_id": 3, "tx": "0xe7805f58cd369847197451266a778115f73cf37e0db5ebcc9f709fcc3921a39c" }, + { + "amount": "710.14095861784501725", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x7a12a85592f9696bb45f1f73672440fc3c1b3fbf151f5a8df5cf7ad260fce17a" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -22001,8 +22045,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "161944.3787235179023365", - "remaining_tokens": "197179.0908514820976635" + "withdrawn_tokens": "162654.51968213574735375", + "remaining_tokens": "196468.94989286425264625" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -23017,7 +23061,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2838885.854620518390041287331048619", + "locked_amount": "2836252.81769974675616491050907404", "deposits": [ { "amount": "552496.6455", @@ -24206,7 +24250,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "193.97337645", - "locked_amount": "426732.75641608857685633536276", + "locked_amount": "426410.183780614129741246194825", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 597d88360..a83c80157 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "38.17024036022324", + "locked_amount": "38.10193112633181", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "282.63459855403344", + "locked_amount": "281.883196981227754", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 1c8c95deb..435e5f7e4 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "259.5099495814307040002569405441400304", + "locked_amount": "258.82002631912730140025625745180111614", "deposits": [ { "amount": "1000", From 8c9ae5cc95a3b409e681329d37f5c57f46feba09 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 10 Jul 2022 18:04:43 +0000 Subject: [PATCH 05/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 177 ++++++++++++++---- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 143 insertions(+), 40 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 23a94f581..fe3fc8d00 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121577.22243651789764421", + "locked_amount": "121517.869441818094762125", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62478.131402582207847978", + "locked_amount": "62419.911643763258910966", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85396.81922792667722435619564", + "locked_amount": "85317.24286884322423263016116", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26283.470941447737784684", + "locked_amount": "26258.978894314062053658", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8555.014742676334094591", + "locked_amount": "8547.042818999522686459", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13878.69961503623175", + "locked_amount": "13848.10490262681225", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1735289.434535100206682764", + "locked_amount": "1733959.670716275447359824", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12729.540484458684190482945550934", + "locked_amount": "12690.460606036138777010822246218", "deposits": [ { "amount": "2833.333333", @@ -5382,9 +5382,9 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "23682.000000000000000003", + "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3535.87969901065345872044791990106544888", + "locked_amount": "3523.65915629756387037044586348934550979", "deposits": [ { "amount": "25", @@ -5826,6 +5826,16 @@ "user": "0xf144fcebdb84fD3Bc070108673D6290940AAD756", "tx": "0x6a812385fe8e104cedcb81615bcf2f65aa4ca4400a94524774878047b505d5cc" }, + { + "amount": "25", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tx": "0xaf417ee6513450b1c5e4dee7b96442fe2d4fd64da94c7f1c75bcf8c302e02f89" + }, + { + "amount": "2", + "user": "0x0F71cA78EFa7bc202EcB5d2BB10125F41c7a1911", + "tx": "0xe0c40d5c2812ccbb87d17074a4b90c07a3ce5c9905de9bd446711fc4cbb43569" + }, { "amount": "75", "user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", @@ -9821,12 +9831,18 @@ "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", "tranche_id": 11, "tx": "0x13a798a6ae5a4b971e87864fa2fb3073879a09dd625bb4b621048684c278e7d7" + }, + { + "amount": "25", + "user": "0x2f28F3Be9315cD7F2475F6500020262bd8505fA1", + "tranche_id": 11, + "tx": "0xaf417ee6513450b1c5e4dee7b96442fe2d4fd64da94c7f1c75bcf8c302e02f89" } ], "withdrawals": [], - "total_tokens": "115", + "total_tokens": "140", "withdrawn_tokens": "0", - "remaining_tokens": "115" + "remaining_tokens": "140" }, { "address": "0xf450648448be1117A854ab39FA30B398bAC88AEf", @@ -9999,6 +10015,21 @@ "withdrawn_tokens": "0", "remaining_tokens": "2" }, + { + "address": "0x0F71cA78EFa7bc202EcB5d2BB10125F41c7a1911", + "deposits": [ + { + "amount": "2", + "user": "0x0F71cA78EFa7bc202EcB5d2BB10125F41c7a1911", + "tranche_id": 11, + "tx": "0xe0c40d5c2812ccbb87d17074a4b90c07a3ce5c9905de9bd446711fc4cbb43569" + } + ], + "withdrawals": [], + "total_tokens": "2", + "withdrawn_tokens": "0", + "remaining_tokens": "2" + }, { "address": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", "deposits": [ @@ -15819,7 +15850,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2691036.92747071733354891906", + "locked_amount": "2688993.63798248756433412279", "deposits": [ { "amount": "1998.95815", @@ -16532,7 +16563,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "12560.12638799303295", - "locked_amount": "14765945.9929053324533617147890639589091646", + "locked_amount": "14758737.7134745904287223781621270466004325", "deposits": [ { "amount": "16249.93", @@ -18771,7 +18802,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2165360.724351228236226177", - "locked_amount": "7980531.39809637781091757644025132", + "locked_amount": "7973842.51569700372261473950197944", "deposits": [ { "amount": "129284.449", @@ -23061,7 +23092,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2836252.81769974675616491050907404", + "locked_amount": "2833609.999809729386537724166554832", "deposits": [ { "amount": "552496.6455", @@ -24249,8 +24280,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "193.97337645", - "locked_amount": "426410.183780614129741246194825", + "total_removed": "213.463831802", + "locked_amount": "426086.4128812635726774017402334", "deposits": [ { "amount": "3000", @@ -30874,6 +30905,11 @@ "user": "0xfeF4b56A370135A17Eef5ba8f5c308451a64Cf86", "tx": "0x7582fbf498c102fe792c436d1eed81e62295780af552caee732b3043a791ec4d" }, + { + "amount": "19.490455352", + "user": "0x0F71cA78EFa7bc202EcB5d2BB10125F41c7a1911", + "tx": "0x855e70f6d8fcced11047c4a93eeaf116ba5e67c01c72d56c47306ca0518d1d1a" + }, { "amount": "11.163032724", "user": "0xF5037DDA4A660d67560200f45380FF8364e35540", @@ -39011,10 +39047,17 @@ "tx": "0x96a22c369645e8945b4047374a05332f4054b50a492c43092e8bb8e974a006b9" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "19.490455352", + "user": "0x0F71cA78EFa7bc202EcB5d2BB10125F41c7a1911", + "tranche_id": 5, + "tx": "0x855e70f6d8fcced11047c4a93eeaf116ba5e67c01c72d56c47306ca0518d1d1a" + } + ], "total_tokens": "200", - "withdrawn_tokens": "0", - "remaining_tokens": "200" + "withdrawn_tokens": "19.490455352", + "remaining_tokens": "180.509544648" }, { "address": "0x6CaAD0A05F6e1AD7590f7c32d65d6fda8090A6E2", @@ -50000,7 +50043,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "34930.0423647506377", + "total_removed": "36080.0423647506377", "locked_amount": "0", "deposits": [ { @@ -54235,6 +54278,31 @@ "user": "0xc2AB91ad356B39307E7331c8900Efc4dBdbaF31F", "tx": "0xe9903a9a7d4f08e6a28c5f47719a75b5795aa7bf0e066b9289bcff76c9f514a7" }, + { + "amount": "250", + "user": "0x63F7e57dAa24bE6f8089442Ad0480d8cb6EAC9A7", + "tx": "0xcf7265db4128aef1b7199a5538d3e11333900aa48921416d8979aec7466a1fb9" + }, + { + "amount": "250", + "user": "0x52BDbCDc2A36778e49F8927D4b3F4e8BB240545f", + "tx": "0xf064ea5aa2586a564a3f560ef3edaeabb1398416ace3bdf8a027d644f4010313" + }, + { + "amount": "250", + "user": "0xcbc12eC06Bf59597818E531b0b002bD041b013b2", + "tx": "0xe98dc022b49a6fb74ba0ed11a8ba7c9ddf97478b93c753dc513986fe88a1cc90" + }, + { + "amount": "250", + "user": "0xb14972279FEc1b0D6C82B0b97595C6E47C07c45a", + "tx": "0x92205b946a3ad80a5932f3cebeba7456373097b48bdec1201e3349bd71353292" + }, + { + "amount": "150", + "user": "0x36C1803bddbE4DDF1CaEE6A3Ba7F935F4bC04CFE", + "tx": "0x64faa1c40a458e900ee051160b4aace05319a2aba230993a971be489c03489d1" + }, { "amount": "60.4448387275", "user": "0xEe3183EcE9ee7d73Fb7bA7F4eB262A2dE68C42B0", @@ -59281,10 +59349,17 @@ "tx": "0x5f6fbdcd43bd83bf0d7a4beb3a2c7d4aa493ef5e4c0c6eeb6a4eb6a0ae4df05e" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x52BDbCDc2A36778e49F8927D4b3F4e8BB240545f", + "tranche_id": 6, + "tx": "0xf064ea5aa2586a564a3f560ef3edaeabb1398416ace3bdf8a027d644f4010313" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0xcbc12eC06Bf59597818E531b0b002bD041b013b2", @@ -59296,10 +59371,17 @@ "tx": "0x5f6fbdcd43bd83bf0d7a4beb3a2c7d4aa493ef5e4c0c6eeb6a4eb6a0ae4df05e" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0xcbc12eC06Bf59597818E531b0b002bD041b013b2", + "tranche_id": 6, + "tx": "0xe98dc022b49a6fb74ba0ed11a8ba7c9ddf97478b93c753dc513986fe88a1cc90" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x94FB32e3D5b9DDc3DDcaf6F174CAEeF2BCc6a83d", @@ -59348,10 +59430,17 @@ "tx": "0x5f6fbdcd43bd83bf0d7a4beb3a2c7d4aa493ef5e4c0c6eeb6a4eb6a0ae4df05e" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0xb14972279FEc1b0D6C82B0b97595C6E47C07c45a", + "tranche_id": 6, + "tx": "0x92205b946a3ad80a5932f3cebeba7456373097b48bdec1201e3349bd71353292" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x0DCC2304f67eE437bd2f7bdA841450cBd1d267E8", @@ -62524,10 +62613,17 @@ "tx": "0x96a22c369645e8945b4047374a05332f4054b50a492c43092e8bb8e974a006b9" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "150", + "user": "0x36C1803bddbE4DDF1CaEE6A3Ba7F935F4bC04CFE", + "tranche_id": 6, + "tx": "0x64faa1c40a458e900ee051160b4aace05319a2aba230993a971be489c03489d1" + } + ], "total_tokens": "150", - "withdrawn_tokens": "0", - "remaining_tokens": "150" + "withdrawn_tokens": "150", + "remaining_tokens": "0" }, { "address": "0xfFBDcC50b8e897f9f38AC04F11bBB09Cc8306003", @@ -67008,10 +67104,17 @@ "tx": "0xd23813c30e93f3867eaa257b7aef7052a050b1ee1c1a90102a3f40c5d989fe82" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x63F7e57dAa24bE6f8089442Ad0480d8cb6EAC9A7", + "tranche_id": 6, + "tx": "0xcf7265db4128aef1b7199a5538d3e11333900aa48921416d8979aec7466a1fb9" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0xAD19C8eef5022966c6E601E6A4f2103C73f6B980", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index a83c80157..f208a9535 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "38.10193112633181", + "locked_amount": "38.033396752917303", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "281.883196981227754", + "locked_amount": "281.129318873668166", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 435e5f7e4..e7bb37546 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "258.82002631912730140025625745180111614", + "locked_amount": "258.12782914764077060025557210806697106", "deposits": [ { "amount": "1000", From 4d709a8c39dec37ffbcbfbae159bff941b665a4b Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Mon, 11 Jul 2022 00:09:36 +0000 Subject: [PATCH 06/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 28 +++++++++---------- apps/static/src/assets/stagnet1-tranches.json | 4 +-- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index fe3fc8d00..afb0c5712 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121517.869441818094762125", + "locked_amount": "121457.76138982347856554", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62419.911643763258910966", + "locked_amount": "62360.951244074857943604", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85317.24286884322423263016116", + "locked_amount": "85236.65418155752703394521364", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26258.978894314062053658", + "locked_amount": "26234.175272356786325198", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8547.042818999522686459", + "locked_amount": "8538.969480741080727489", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13848.10490262681225", + "locked_amount": "13817.120980525362", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1733959.670716275447359824", + "locked_amount": "1732612.990347967432057756", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12690.460606036138777010822246218", + "locked_amount": "12650.8835741433494569748140253116", "deposits": [ { "amount": "2833.333333", @@ -5384,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3523.65915629756387037044586348934550979", + "locked_amount": "3507.20058742389625842044378091704718414", "deposits": [ { "amount": "25", @@ -15850,7 +15850,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2688993.63798248756433412279", + "locked_amount": "2686924.25912070416921654353", "deposits": [ { "amount": "1998.95815", @@ -16563,7 +16563,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "12560.12638799303295", - "locked_amount": "14758737.7134745904287223781621270466004325", + "locked_amount": "14751437.3964271361035432580314392650135172", "deposits": [ { "amount": "16249.93", @@ -18802,7 +18802,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2165360.724351228236226177", - "locked_amount": "7973842.51569700372261473950197944", + "locked_amount": "7967068.22750829391117690270395264", "deposits": [ { "amount": "129284.449", @@ -23092,7 +23092,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2833609.999809729386537724166554832", + "locked_amount": "2830933.437575816791204335982421742", "deposits": [ { "amount": "552496.6455", @@ -24281,7 +24281,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "213.463831802", - "locked_amount": "426086.4128812635726774017402334", + "locked_amount": "425758.5079715401174503080466768", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index f208a9535..4dc631594 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "38.033396752917303", + "locked_amount": "37.96398401826484", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "281.129318873668166", + "locked_amount": "280.365778792491073", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index e7bb37546..57c05adf3 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "258.12782914764077060025557210806697106", + "locked_amount": "257.42679255454082440025487801243023844", "deposits": [ { "amount": "1000", From da14d2409a62a6ada4e72b2221c3d8cf9e4d1e2e Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Mon, 11 Jul 2022 06:05:04 +0000 Subject: [PATCH 07/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 28 +++++++++---------- apps/static/src/assets/stagnet1-tranches.json | 4 +-- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index afb0c5712..6d03d02d6 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121457.76138982347856554", + "locked_amount": "121399.19914603609389996", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62360.951244074857943604", + "locked_amount": "62303.507138239193223816", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85236.65418155752703394521364", + "locked_amount": "85158.13800619133495364383808", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26234.175272356786325198", + "locked_amount": "26210.009529038375854194", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8538.969480741080727489", + "locked_amount": "8531.10376578976030138", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13817.120980525362", + "locked_amount": "13786.933876811595", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1732612.990347967432057756", + "locked_amount": "1731300.94277005586779591", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12650.8835741433494569748140253116", + "locked_amount": "12612.324350991457163146565360653", "deposits": [ { "amount": "2833.333333", @@ -5384,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3507.20058742389625842044378091704718414", + "locked_amount": "3491.16528614916392148044175190258751916", "deposits": [ { "amount": "25", @@ -15850,7 +15850,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2686924.25912070416921654353", + "locked_amount": "2684908.0987999025961324574", "deposits": [ { "amount": "1998.95815", @@ -16563,7 +16563,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "12560.12638799303295", - "locked_amount": "14751437.3964271361035432580314392650135172", + "locked_amount": "14744324.8227789913738176171298621043092728", "deposits": [ { "amount": "16249.93", @@ -18802,7 +18802,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2165360.724351228236226177", - "locked_amount": "7967068.22750829391117690270395264", + "locked_amount": "7960468.15475217517315443634869405", "deposits": [ { "amount": "129284.449", @@ -23092,7 +23092,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2830933.437575816791204335982421742", + "locked_amount": "2828325.708912966201024260112622105", "deposits": [ { "amount": "552496.6455", @@ -24281,7 +24281,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "213.463831802", - "locked_amount": "425758.5079715401174503080466768", + "locked_amount": "425439.03584384537938432730796552", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 4dc631594..ff7884cc7 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "37.96398401826484", + "locked_amount": "37.896353373921865", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "280.365778792491073", + "locked_amount": "279.62184170471848", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 57c05adf3..8de9e1cbf 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "257.42679255454082440025487801243023844", + "locked_amount": "256.7437230466767870002542017059868087", "deposits": [ { "amount": "1000", From 73c059718bbf7580b4d43aebb111dd6b425ae827 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Mon, 11 Jul 2022 12:05:24 +0000 Subject: [PATCH 08/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 62 +++++++++++++------ apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 6d03d02d6..f4b28ecf8 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121399.19914603609389996", + "locked_amount": "121339.83791434763096349", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62303.507138239193223816", + "locked_amount": "62245.279299701672878272", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85158.13800619133495364383808", + "locked_amount": "85078.55060352749453145204648", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26210.009529038375854194", + "locked_amount": "26185.514082906624274106", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8531.10376578976030138", + "locked_amount": "8523.130735772058441178", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13786.933876811595", + "locked_amount": "13756.33491847826175", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1731300.94277005586779591", + "locked_amount": "1729970.99440705483438209", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12612.324350991457163146565360653", + "locked_amount": "12573.2390490765073743482905935048", "deposits": [ { "amount": "2833.333333", @@ -5384,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3491.16528614916392148044175190258751916", + "locked_amount": "3474.91120890410876085043969520547945195", "deposits": [ { "amount": "25", @@ -15850,7 +15850,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2684908.0987999025961324574", + "locked_amount": "2682864.43120481046654531866", "deposits": [ { "amount": "1998.95815", @@ -16562,8 +16562,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "12560.12638799303295", - "locked_amount": "14744324.8227789913738176171298621043092728", + "total_removed": "12911.590444155464175", + "locked_amount": "14737115.2094697464325356335801128575182482", "deposits": [ { "amount": "16249.93", @@ -17072,6 +17072,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x0cf55e46d1acaa85666bd5153644bcb804370c46b9f7b45f79ab345f7e124f03" }, + { + "amount": "351.464056162431225", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x6fe7c383d5b75c3a0fe9169a3d69217e604177711b37c01d2073002c2fd1c0aa" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17256,6 +17261,12 @@ "tranche_id": 2, "tx": "0x0cf55e46d1acaa85666bd5153644bcb804370c46b9f7b45f79ab345f7e124f03" }, + { + "amount": "351.464056162431225", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x6fe7c383d5b75c3a0fe9169a3d69217e604177711b37c01d2073002c2fd1c0aa" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17396,8 +17407,8 @@ } ], "total_tokens": "194999.1675", - "withdrawn_tokens": "12560.12638799303295", - "remaining_tokens": "182439.04111200696705" + "withdrawn_tokens": "12911.590444155464175", + "remaining_tokens": "182087.577055844535825" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -18801,8 +18812,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2165360.724351228236226177", - "locked_amount": "7960468.15475217517315443634869405", + "total_removed": "2166012.841486662889182427", + "locked_amount": "7953778.03458773767706984114364732", "deposits": [ { "amount": "129284.449", @@ -19026,6 +19037,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x7a12a85592f9696bb45f1f73672440fc3c1b3fbf151f5a8df5cf7ad260fce17a" }, + { + "amount": "652.11713543465295625", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x84bd672f790c5873c15d35e0cc0592ecc2041e1423e8b70a0f63e228c925847f" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -20730,6 +20746,12 @@ "tranche_id": 3, "tx": "0x7a12a85592f9696bb45f1f73672440fc3c1b3fbf151f5a8df5cf7ad260fce17a" }, + { + "amount": "652.11713543465295625", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x84bd672f790c5873c15d35e0cc0592ecc2041e1423e8b70a0f63e228c925847f" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -22076,8 +22098,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "162654.51968213574735375", - "remaining_tokens": "196468.94989286425264625" + "withdrawn_tokens": "163306.63681757040031", + "remaining_tokens": "195816.83275742959969" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -23092,7 +23114,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1539572.873831600560839727", - "locked_amount": "2828325.708912966201024260112622105", + "locked_amount": "2825682.40197448672662300311737747", "deposits": [ { "amount": "552496.6455", @@ -24281,7 +24303,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "213.463831802", - "locked_amount": "425439.03584384537938432730796552", + "locked_amount": "425115.20503130098139637358904112", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index ff7884cc7..baa6a8c8c 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "37.896353373921865", + "locked_amount": "37.82779363267377", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "279.62184170471848", + "locked_amount": "278.86768455098938", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 8de9e1cbf..597a6b1ba 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "256.7437230466767870002542017059868087", + "locked_amount": "256.0512376331811580002535160768645358", "deposits": [ { "amount": "1000", From 9cfcadd39b8f9cf573882688520bf3cb134c4acf Mon Sep 17 00:00:00 2001 From: macqbat Date: Mon, 11 Jul 2022 15:27:28 +0200 Subject: [PATCH 09/27] feat: [console-lite] - market selector (#726) * feat: [console-lite] - market selector - first commit * feat: [console-lite] - market selector - add strongly different mobile version * feat: [console-lite] - market selector - fix deal-market lint fail * feat: [console-lite] - market selector - add a bunch of improvements * feat: [console-lite] - market selector - add some int tests * feat: [console-lite] - market selector - fix dialog dimmensions Co-authored-by: maciek --- .../src/integration/market-selector.test.ts | 87 ++++++ .../deal-ticket/deal-ticket-steps.tsx | 20 +- .../simple-market-renderer.tsx | 14 +- .../src/app/hooks/use-column-definitions.tsx | 2 +- apps/simple-trading-app/tailwind.config.js | 3 +- .../components/__generated__/MarketNames.ts | 67 ++++ .../src/components/__generated__/index.ts | 1 + libs/deal-ticket/src/components/index.ts | 1 + .../src/components/market-selector.tsx | 292 ++++++++++++++++++ libs/react-helpers/src/hooks/index.ts | 2 + .../src/hooks/use-outside-click.ts | 27 ++ .../src/hooks/use-screen-dimensions.ts | 28 ++ libs/tailwindcss-config/src/theme-lite.js | 6 + .../src/vega-custom-classes-lite.js | 17 + 14 files changed, 557 insertions(+), 10 deletions(-) create mode 100644 apps/simple-trading-app-e2e/src/integration/market-selector.test.ts create mode 100644 libs/deal-ticket/src/components/__generated__/MarketNames.ts create mode 100644 libs/deal-ticket/src/components/market-selector.tsx create mode 100644 libs/react-helpers/src/hooks/use-outside-click.ts create mode 100644 libs/react-helpers/src/hooks/use-screen-dimensions.ts create mode 100644 libs/tailwindcss-config/src/vega-custom-classes-lite.js diff --git a/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts b/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts new file mode 100644 index 000000000..1b9dc07f9 --- /dev/null +++ b/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts @@ -0,0 +1,87 @@ +describe('market selector', () => { + let markets; + before(() => { + cy.intercept('POST', '/query', (req) => { + const { body } = req; + if (body.operationName === 'SimpleMarkets') { + req.alias = `gqlSimpleMarketsQuery`; + } + }); + cy.visit('/markets'); + cy.wait('@gqlSimpleMarketsQuery').then((response) => { + if (response.response?.body?.data?.markets?.length) { + markets = response.response?.body?.data?.markets; + } + }); + }); + + it('should be properly rendered', () => { + if (markets) { + cy.visit(`/trading/${markets[0].id}`); + cy.get('input[placeholder="Search"]').should( + 'have.value', + markets[0].name + ); + cy.getByTestId('arrow-button').click(); + cy.getByTestId('market-pane').should('be.visible'); + cy.getByTestId('market-pane') + .children() + .find('[role="button"]') + .should('contain.text', markets[0].name); + cy.getByTestId('market-pane').children().find('[role="button"]').click(); + cy.getByTestId('market-pane').should('not.be.visible'); + } + }); + + it('typing should change list', () => { + if (markets) { + cy.visit(`/trading/${markets[0].id}`); + cy.get('input[placeholder="Search"]').type('{backspace}'); + cy.getByTestId('market-pane') + .children() + .find('[role="button"]') + .should('have.length', 1); + cy.get('input[placeholder="Search"]').clear(); + cy.get('input[placeholder="Search"]').type('a'); + const filtered = markets.filter((market) => market.name.match(/a/i)); + cy.getByTestId('market-pane') + .children() + .find('[role="button"]') + .should('have.length', filtered.length); + cy.getByTestId('market-pane') + .children() + .find('[role="button"]') + .last() + .click(); + cy.location('pathname').should( + 'eq', + `/trading/${filtered[filtered.length - 1].id}` + ); + cy.get('input[placeholder="Search"]').should( + 'have.value', + filtered[filtered.length - 1].name + ); + } + }); + + it('mobile view', () => { + if (markets) { + cy.viewport('iphone-xr'); + cy.visit(`/trading/${markets[0].id}`); + cy.get('[role="dialog"]').should('not.exist'); + cy.getByTestId('arrow-button').click(); + cy.get('[role="dialog"]').should('be.visible'); + cy.get('input[placeholder="Search"]').clear(); + cy.getByTestId('market-pane') + .children() + .find('[role="button"]') + .should('have.length', markets.length); + cy.pause(); + cy.getByTestId('dialog-close').click(); + cy.get('input[placeholder="Search"]').should( + 'have.value', + markets[0].name + ); + } + }); +}); diff --git a/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-steps.tsx b/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-steps.tsx index 7a00b91dd..fae8c9234 100644 --- a/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-steps.tsx +++ b/apps/simple-trading-app/src/app/components/deal-ticket/deal-ticket-steps.tsx @@ -13,6 +13,7 @@ import { useOrderValidation, useOrderSubmit, DealTicketAmount, + MarketSelector, } from '@vegaprotocol/deal-ticket'; import { OrderTimeInForce, @@ -20,12 +21,23 @@ import { VegaTxStatus, } from '@vegaprotocol/wallet'; import { t, addDecimal, toDecimal } from '@vegaprotocol/react-helpers'; +import { useCallback } from 'react'; +import { useNavigate } from 'react-router-dom'; +import MarketNameRenderer from '../simple-market-list/simple-market-renderer'; interface DealTicketMarketProps { market: DealTicketQuery_market; } export const DealTicketSteps = ({ market }: DealTicketMarketProps) => { + const navigate = useNavigate(); + const setMarket = useCallback( + (marketId) => { + navigate(`/trading/${marketId}`); + }, + [navigate] + ); + const { register, control, @@ -70,7 +82,13 @@ export const DealTicketSteps = ({ market }: DealTicketMarketProps) => { { label: 'Select Asset', description: `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.`, - component:

{market.name}

, + component: ( + + ), }, { label: 'Select Order Type', diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-renderer.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-renderer.tsx index 5d26e330d..269cbe635 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-renderer.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-renderer.tsx @@ -1,23 +1,23 @@ import React from 'react'; -import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets'; +import type { MarketNames_markets } from '@vegaprotocol/deal-ticket'; import SimpleMarketExpires from './simple-market-expires'; interface Props { - data: SimpleMarkets_markets; + market: MarketNames_markets; } -const MarketNameRenderer = ({ data }: Props) => { +const MarketNameRenderer = ({ market }: Props) => { return (
- {data.name}{' '} + {market.name}{' '}
-
- {data.tradableInstrument.instrument.product.quoteName} +
+ {market.tradableInstrument.instrument.product.quoteName}
); diff --git a/apps/simple-trading-app/src/app/hooks/use-column-definitions.tsx b/apps/simple-trading-app/src/app/hooks/use-column-definitions.tsx index a3882fc93..b0f4b4457 100644 --- a/apps/simple-trading-app/src/app/hooks/use-column-definitions.tsx +++ b/apps/simple-trading-app/src/app/hooks/use-column-definitions.tsx @@ -21,7 +21,7 @@ const useColumnDefinitions = ({ onClick }: Props) => { minWidth: 300, field: 'name', cellRenderer: ({ data }: { data: SimpleMarketsType }) => ( - + ), }, { diff --git a/apps/simple-trading-app/tailwind.config.js b/apps/simple-trading-app/tailwind.config.js index d2fb3eb3d..e127aabb4 100644 --- a/apps/simple-trading-app/tailwind.config.js +++ b/apps/simple-trading-app/tailwind.config.js @@ -2,6 +2,7 @@ const { join } = require('path'); const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); const theme = require('../../libs/tailwindcss-config/src/theme-lite'); const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes'); +const vegaCustomClassesLite = require('../../libs/tailwindcss-config/src/vega-custom-classes-lite'); module.exports = { content: [ @@ -11,5 +12,5 @@ module.exports = { ], darkMode: 'class', theme, - plugins: [vegaCustomClasses], + plugins: [vegaCustomClasses, vegaCustomClassesLite], }; diff --git a/libs/deal-ticket/src/components/__generated__/MarketNames.ts b/libs/deal-ticket/src/components/__generated__/MarketNames.ts new file mode 100644 index 000000000..29335eed5 --- /dev/null +++ b/libs/deal-ticket/src/components/__generated__/MarketNames.ts @@ -0,0 +1,67 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: MarketNames +// ==================================================== + +export interface MarketNames_markets_tradableInstrument_instrument_metadata { + __typename: "InstrumentMetadata"; + /** + * An arbitrary list of tags to associated to associate to the Instrument (string list) + */ + tags: string[] | null; +} + +export interface MarketNames_markets_tradableInstrument_instrument_product { + __typename: "Future"; + /** + * String representing the quote (e.g. BTCUSD -> USD is quote) + */ + quoteName: string; +} + +export interface MarketNames_markets_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * Metadata for this instrument + */ + metadata: MarketNames_markets_tradableInstrument_instrument_metadata; + /** + * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) + */ + product: MarketNames_markets_tradableInstrument_instrument_product; +} + +export interface MarketNames_markets_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of or reference to a fully specified instrument. + */ + instrument: MarketNames_markets_tradableInstrument_instrument; +} + +export interface MarketNames_markets { + __typename: "Market"; + /** + * Market ID + */ + id: string; + /** + * Market full name + */ + name: string; + /** + * An instance of or reference to a tradable instrument. + */ + tradableInstrument: MarketNames_markets_tradableInstrument; +} + +export interface MarketNames { + /** + * One or more instruments that are trading on the VEGA network + */ + markets: MarketNames_markets[] | null; +} diff --git a/libs/deal-ticket/src/components/__generated__/index.ts b/libs/deal-ticket/src/components/__generated__/index.ts index b307559ae..b9d08aad0 100644 --- a/libs/deal-ticket/src/components/__generated__/index.ts +++ b/libs/deal-ticket/src/components/__generated__/index.ts @@ -1,2 +1,3 @@ export * from './DealTicketQuery'; export * from './MarketInfoQuery'; +export * from './MarketNames'; diff --git a/libs/deal-ticket/src/components/index.ts b/libs/deal-ticket/src/components/index.ts index 35b9f57ca..384200706 100644 --- a/libs/deal-ticket/src/components/index.ts +++ b/libs/deal-ticket/src/components/index.ts @@ -10,3 +10,4 @@ export * from './info-market'; export * from './side-selector'; export * from './time-in-force-selector'; export * from './type-selector'; +export * from './market-selector'; diff --git a/libs/deal-ticket/src/components/market-selector.tsx b/libs/deal-ticket/src/components/market-selector.tsx new file mode 100644 index 000000000..377f1cd98 --- /dev/null +++ b/libs/deal-ticket/src/components/market-selector.tsx @@ -0,0 +1,292 @@ +import React, { + useCallback, + useState, + useEffect, + useRef, + useMemo, +} from 'react'; +import { gql, useQuery } from '@apollo/client'; +import classNames from 'classnames'; +import type { DealTicketQuery_market } from './__generated__'; +import { + Button, + Dialog, + Icon, + Input, + Loader, + Splash, +} from '@vegaprotocol/ui-toolkit'; +import { + t, + useScreenDimensions, + useOutsideClick, +} from '@vegaprotocol/react-helpers'; +import type { + MarketNames, + MarketNames_markets, +} from './__generated__/MarketNames'; +import { IconNames } from '@blueprintjs/icons'; + +export const MARKET_NAMES_QUERY = gql` + query MarketNames { + markets { + id + name + tradableInstrument { + instrument { + metadata { + tags + } + product { + ... on Future { + quoteName + } + } + } + } + } + } +`; + +interface Props { + market: DealTicketQuery_market; + setMarket: (marketId: string) => void; + ItemRenderer?: React.FC<{ market: MarketNames_markets }>; +} + +function escapeRegExp(str: string) { + return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} + +export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { + const { isMobile } = useScreenDimensions(); + const contRef = useRef(null); + const inputRef = useRef(null); + const arrowButtonRef = useRef(null); + const [skip, setSkip] = useState(true); + const [results, setResults] = useState([]); + const [showPane, setShowPane] = useState(false); + const [lookup, setLookup] = useState(market.name || ''); + const [dialogContent, setDialogContent] = useState( + null + ); + + const { data, loading, error } = useQuery(MARKET_NAMES_QUERY, { + skip, + }); + + const outsideClickCb = useCallback(() => { + if (!isMobile) { + setShowPane(false); + } + }, [setShowPane, isMobile]); + + useOutsideClick({ refs: [contRef, arrowButtonRef], func: outsideClickCb }); + + const handleOnChange = useCallback( + (event: React.ChangeEvent) => { + const { + target: { value }, + } = event; + setLookup(value); + setShowPane(true); + if (value) { + setSkip(false); + } + }, + [setLookup, setShowPane, setSkip] + ); + + const handleMarketSelect = useCallback( + ({ id, name }) => { + setLookup(name); + setShowPane(false); + setMarket(id); + inputRef.current?.focus(); + }, + [setLookup, setShowPane, setMarket, inputRef] + ); + + const handleItemKeyDown = useCallback( + ( + event: React.KeyboardEvent, + market: MarketNames_markets, + index: number + ) => { + switch (event.key) { + case 'ArrowDown': + if (index < results.length - 1) { + (contRef.current?.children[index + 1] as HTMLDivElement).focus(); + } + break; + + case 'ArrowUp': + if (!index) { + inputRef.current?.focus(); + inputRef.current?.setSelectionRange( + inputRef.current?.value.length, + inputRef.current?.value.length + ); + return; + } + (contRef.current?.children[index - 1] as HTMLDivElement).focus(); + break; + + case 'Enter': + handleMarketSelect(market); + break; + } + }, + [results, handleMarketSelect] + ); + + const handleInputKeyDown = useCallback( + (event: React.KeyboardEvent) => { + if (event.key === 'ArrowDown') { + (contRef.current?.children[0] as HTMLDivElement).focus(); + } + }, + [contRef] + ); + + const handleOnBlur = useCallback(() => { + console.log('lookup, showPane', lookup, showPane); + if (!lookup && !showPane) { + console.log( + '2 lookup, showPane, market.name', + lookup, + showPane, + market.name + ); + setLookup(market.name); + } + }, [market, lookup, showPane, setLookup]); + + const openPane = useCallback(() => { + setShowPane(!showPane); + setSkip(false); + inputRef.current?.focus(); + }, [showPane, setShowPane, setSkip, inputRef]); + + const handleDialogOnchange = useCallback( + (isOpen) => { + setShowPane(isOpen); + if (!isOpen) { + setLookup(lookup || market.name); + inputRef.current?.focus(); + } + }, + [setShowPane, lookup, setLookup, market.name, inputRef] + ); + + const selectorContent = useMemo(() => { + return ( +
+
+ + +
+
+
+ {loading && } + {error && ( + {t(`Something went wrong: ${error.message}`)} + )} +
+ {results.map((market, i) => ( +
handleMarketSelect(market)} + onKeyDown={(e) => handleItemKeyDown(e, market, i)} + > + {ItemRenderer ? : market.name} +
+ ))} +
+
+
+ ); + }, [ + ItemRenderer, + error, + handleInputKeyDown, + handleItemKeyDown, + handleMarketSelect, + handleOnBlur, + handleOnChange, + loading, + lookup, + openPane, + results, + showPane, + ]); + + useEffect(() => { + setResults( + data?.markets?.filter((item: MarketNames_markets) => + item.name.match(new RegExp(escapeRegExp(lookup), 'i')) + ) || [] + ); + }, [data, lookup]); + + useEffect(() => { + inputRef.current?.focus(); + }, [inputRef]); + + useEffect(() => { + if (showPane && isMobile) { + setDialogContent(selectorContent); + inputRef.current?.focus(); + window.scrollTo(0, 0); + } else { + setDialogContent(null); + } + }, [selectorContent, showPane, isMobile, setDialogContent]); + + return ( + <> + {!dialogContent && selectorContent} + + {dialogContent} + + + ); +}; diff --git a/libs/react-helpers/src/hooks/index.ts b/libs/react-helpers/src/hooks/index.ts index 4269b816d..77aeb7866 100644 --- a/libs/react-helpers/src/hooks/index.ts +++ b/libs/react-helpers/src/hooks/index.ts @@ -3,3 +3,5 @@ export * from './use-data-provider'; export * from './use-theme-switcher'; export * from './use-fetch'; export * from './use-resize'; +export * from './use-outside-click'; +export * from './use-screen-dimensions'; diff --git a/libs/react-helpers/src/hooks/use-outside-click.ts b/libs/react-helpers/src/hooks/use-outside-click.ts new file mode 100644 index 000000000..2a29b74b3 --- /dev/null +++ b/libs/react-helpers/src/hooks/use-outside-click.ts @@ -0,0 +1,27 @@ +import { useEffect } from 'react'; +import type { RefObject } from 'react'; + +interface Props { + refs: RefObject[]; + func: (event: Event) => void; +} + +export const useOutsideClick = ({ refs, func }: Props) => { + useEffect(() => { + const handleClickOutside = (event: Event) => { + const found = refs.reduce((agg: boolean, item) => { + if (item.current && item.current.contains(event.target as Node)) { + agg = true; + } + return agg; + }, false); + if (!found) { + func(event); + } + }; + document.addEventListener('mousedown', handleClickOutside); + return () => { + document.removeEventListener('mousedown', handleClickOutside); + }; + }, [refs, func]); +}; diff --git a/libs/react-helpers/src/hooks/use-screen-dimensions.ts b/libs/react-helpers/src/hooks/use-screen-dimensions.ts new file mode 100644 index 000000000..fe4ca0596 --- /dev/null +++ b/libs/react-helpers/src/hooks/use-screen-dimensions.ts @@ -0,0 +1,28 @@ +import { useMemo } from 'react'; +import { theme } from '@vegaprotocol/tailwindcss-config'; +import { useResize } from './use-resize'; + +type Screen = keyof typeof theme.screens; + +interface Props { + isMobile: boolean; + screen: Screen; + width: number; +} + +export const useScreenDimensions = (): Props => { + const { width } = useResize(); + return useMemo( + () => ({ + width, + isMobile: width < parseInt(theme.screens.md), + screen: Object.entries(theme.screens).reduce((agg: Screen, entry) => { + if (width > parseInt(entry[1])) { + agg = entry[0] as Screen; + } + return agg; + }, 'xs'), + }), + [width] + ); +}; diff --git a/libs/tailwindcss-config/src/theme-lite.js b/libs/tailwindcss-config/src/theme-lite.js index 130706c98..ad0027a65 100644 --- a/libs/tailwindcss-config/src/theme-lite.js +++ b/libs/tailwindcss-config/src/theme-lite.js @@ -33,5 +33,11 @@ module.exports = { ...theme.boxShadow, 'inset-black': '', 'inset-white': '', + input: 'none', + 'input-focus': 'none', + 'input-dark': 'none', + 'input-focus-dark': 'none', + 'input-focus-error': 'none', + 'input-focus-error-dark': 'none', }, }; diff --git a/libs/tailwindcss-config/src/vega-custom-classes-lite.js b/libs/tailwindcss-config/src/vega-custom-classes-lite.js new file mode 100644 index 000000000..b4d136f4c --- /dev/null +++ b/libs/tailwindcss-config/src/vega-custom-classes-lite.js @@ -0,0 +1,17 @@ +const plugin = require('tailwindcss/plugin'); + +const vegaCustomClassesLite = plugin(function ({ addUtilities }) { + addUtilities({ + '.input-border': { + borderWidth: '0', + }, + '.input-border-dark': { + borderWidth: '0', + }, + '.shadow-input': { + boxShadow: 'none', + }, + }); +}); + +module.exports = vegaCustomClassesLite; From f9a91938fb94fd796194b3b088422317cb18d9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Szpiech?= Date: Mon, 11 Jul 2022 15:32:32 +0200 Subject: [PATCH 10/27] test(token): eth wallet widget validations with wallet connected (#731) * test(token): eth wallet widget validations with wallet connected * test(token): change currency tests to be more readable Co-authored-by: Rado --- apps/token-e2e/cypress.config.js | 1 + .../src/integration/flow/staking-flow.cy.js | 16 +- .../flow/token-association-flow.cy.js | 205 +++++++-------- .../src/integration/wallet-eth.cy.js | 241 ++++++++++++++++++ .../token-e2e/src/locators/common.locators.js | 3 + .../src/locators/wallet-eth.locators.js | 21 ++ .../src/locators/wallet-vega.locators.js | 9 + .../token-e2e/src/locators/wallet.locators.js | 14 - ...t.functions.js => wallet-eth.functions.js} | 24 +- ....functions.js => wallet-vega.functions.js} | 14 +- .../src/components/eth-wallet/eth-wallet.tsx | 44 ++-- .../locked-progress/locked-progress.tsx | 9 +- .../components/wallet-card/wallet-card.tsx | 15 +- .../src/components/dialog/dialog.tsx | 1 + 14 files changed, 456 insertions(+), 161 deletions(-) create mode 100644 apps/token-e2e/src/integration/wallet-eth.cy.js create mode 100644 apps/token-e2e/src/locators/wallet-eth.locators.js create mode 100644 apps/token-e2e/src/locators/wallet-vega.locators.js delete mode 100644 apps/token-e2e/src/locators/wallet.locators.js rename apps/token-e2e/src/support/{eth-wallet.functions.js => wallet-eth.functions.js} (68%) rename apps/token-e2e/src/support/{vega-wallet.functions.js => wallet-vega.functions.js} (81%) diff --git a/apps/token-e2e/cypress.config.js b/apps/token-e2e/cypress.config.js index 6cd68facd..0a2bcad52 100644 --- a/apps/token-e2e/cypress.config.js +++ b/apps/token-e2e/cypress.config.js @@ -18,6 +18,7 @@ module.exports = defineConfig({ env: { ethProviderUrl: 'http://localhost:8545/', ethWalletPublicKey: '0xEe7D375bcB50C26d52E1A4a472D8822A2A22d94F', + ethWalletPublicKeyTruncated: '0xEe7D…d94F', ethStakingBridgeContractAddress: '0x9135f5afd6F055e731bca2348429482eE614CFfA', vegaWalletName: 'capsule_wallet', diff --git a/apps/token-e2e/src/integration/flow/staking-flow.cy.js b/apps/token-e2e/src/integration/flow/staking-flow.cy.js index 87e094505..3f9cb8915 100644 --- a/apps/token-e2e/src/integration/flow/staking-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/staking-flow.cy.js @@ -1,15 +1,15 @@ /// import navigation from '../../locators/navigation.locators'; import staking from '../../locators/staking.locators'; -import wallet from '../../locators/wallet.locators'; +import vegaWallet from '../../locators/wallet-vega.locators'; import '../../support/staking.functions'; -import '../../support/vega-wallet.functions'; -import '../../support/eth-wallet.functions'; +import '../../support/wallet-vega.functions'; +import '../../support/wallet-eth.functions'; import '../../support/wallet-teardown.functions'; const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort'); -context('Staking Tab - with eth and vega wallets connected', function () { +context('Staking Flow - with eth and vega wallets connected', function () { before('visit staking tab and connect vega wallet', function () { cy.vega_wallet_import(); cy.visit('/'); @@ -287,7 +287,7 @@ context('Staking Tab - with eth and vega wallets connected', function () { cy.highlight( `Checking vega wallet - Stake Next Epoch Value for ${validatorName} is ${expectedVal}` ); - cy.get(wallet.vegawallet).within(() => { + cy.get(vegaWallet.walletContainer).within(() => { cy.contains(`${validatorName} (Next epoch)`, { timeout: 40000 }) .siblings() .contains(expectedVal, { timeout: 40000 }) @@ -302,7 +302,7 @@ context('Staking Tab - with eth and vega wallets connected', function () { cy.highlight( `Checking vega wallet - Stake This Epoch Value for ${validatorName} is ${expectedVal}` ); - cy.get(wallet.vegawallet).within(() => { + cy.get(vegaWallet.walletContainer).within(() => { cy.contains(`${validatorName} (This Epoch)`, { timeout: 40000 }) .siblings() .contains(expectedVal, { timeout: 40000 }) @@ -314,7 +314,7 @@ context('Staking Tab - with eth and vega wallets connected', function () { cy.highlight( `Checking Validator and therefore stake removed for ${validatorName}` ); - cy.get(wallet.vegawallet).within(() => { + cy.get(vegaWallet.walletContainer).within(() => { cy.contains(`${validatorName}`, { timeout: 40000 }).should('not.exist', { timeout: 40000, }); @@ -328,7 +328,7 @@ context('Staking Tab - with eth and vega wallets connected', function () { cy.highlight( `Checking Validator Stake Value for ${validatorName} is ${expectedVal}` ); - cy.get(wallet.vegawallet).within(() => { + cy.get(vegaWallet.walletContainer).within(() => { cy.contains(`${validatorName}`, { timeout: 40000 }) .siblings() .contains(expectedVal, { timeout: 40000 }) diff --git a/apps/token-e2e/src/integration/flow/token-association-flow.cy.js b/apps/token-e2e/src/integration/flow/token-association-flow.cy.js index ece1e8aa7..a4a967be8 100644 --- a/apps/token-e2e/src/integration/flow/token-association-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/token-association-flow.cy.js @@ -1,118 +1,121 @@ /// import navigation from '../../locators/navigation.locators'; import staking from '../../locators/staking.locators'; -import wallet from '../../locators/wallet.locators'; +import ethWallet from '../../locators/wallet-eth.locators'; import '../../support/staking.functions'; -import '../../support/vega-wallet.functions'; -import '../../support/eth-wallet.functions'; +import '../../support/wallet-vega.functions'; +import '../../support/wallet-eth.functions'; import '../../support/wallet-teardown.functions'; const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort'); -context('Staking Tab - with eth and vega wallets connected', function () { - before('visit staking tab and connect vega wallet', function () { - cy.vega_wallet_import(); - cy.visit('/'); - cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); - cy.vega_wallet_connect(); - cy.vega_wallet_set_specified_approval_amount('1000'); - cy.reload(); - cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); - cy.ethereum_wallet_connect(); - cy.get(navigation.staking).first().click(); - cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist'); - cy.get(staking.validatorNames).first().invoke('text').as('validatorName'); - }); - - describe('Eth wallet - contains VEGA tokens', function () { - beforeEach( - 'teardown wallet & drill into a specific validator', - function () { - cy.vega_wallet_teardown(); - cy.get(navigation.staking).first().click(); - cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist'); - } - ); - - it('Able to associate tokens - from staking page', function () { - cy.staking_page_associate_tokens('2'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '2.000000000000000000' - ); - cy.ethereum_wallet_check_associated_value_is('2.0'); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); +context( + 'Token association flow - with eth and vega wallets connected', + function () { + before('visit staking tab and connect vega wallet', function () { + cy.vega_wallet_import(); + cy.visit('/'); + cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); + cy.vega_wallet_connect(); + cy.vega_wallet_set_specified_approval_amount('1000'); + cy.reload(); + cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); + cy.ethereum_wallet_connect(); + cy.get(navigation.staking).first().click(); + cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist'); + cy.get(staking.validatorNames).first().invoke('text').as('validatorName'); }); - it('Able to disassociate tokens - from staking page', function () { - cy.staking_page_associate_tokens('2'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '2.000000000000000000' + describe('Eth wallet - contains VEGA tokens', function () { + beforeEach( + 'teardown wallet & drill into a specific validator', + function () { + cy.vega_wallet_teardown(); + cy.get(navigation.staking).first().click(); + cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist'); + } ); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - cy.get('button').contains('Select a validator to nominate').click(); - cy.staking_page_disassociate_tokens('1'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '1.000000000000000000' - ); - cy.ethereum_wallet_check_associated_value_is('1.0'); - cy.vega_wallet_check_associated_value_is('1.000000000000000000'); - }); - it('Able to access associate token form - from eth wallet', function () { - cy.get(wallet.ethWallet).within(() => - cy.get(wallet.ethWalletAssociate).click() - ); - cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).should( - 'be.enabled' - ); - }); + it('Able to associate tokens - from staking page', function () { + cy.staking_page_associate_tokens('2'); + cy.ethereum_wallet_check_associated_vega_key_value_is( + vegaWalletPublicKeyShort, + '2.000000000000000000' + ); + cy.ethereum_wallet_check_associated_value_is('2.0'); + cy.vega_wallet_check_associated_value_is('2.000000000000000000'); + cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); + }); - it('Able to access disassociate token form - from eth wallet', function () { - cy.get(wallet.ethWallet).within(() => - cy.get(wallet.ethWalletDisassociate).click() - ); - cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).should( - 'be.enabled' - ); - }); + it('Able to disassociate tokens - from staking page', function () { + cy.staking_page_associate_tokens('2'); + cy.ethereum_wallet_check_associated_vega_key_value_is( + vegaWalletPublicKeyShort, + '2.000000000000000000' + ); + cy.vega_wallet_check_associated_value_is('2.000000000000000000'); + cy.get('button').contains('Select a validator to nominate').click(); + cy.staking_page_disassociate_tokens('1'); + cy.ethereum_wallet_check_associated_vega_key_value_is( + vegaWalletPublicKeyShort, + '1.000000000000000000' + ); + cy.ethereum_wallet_check_associated_value_is('1.0'); + cy.vega_wallet_check_associated_value_is('1.000000000000000000'); + }); - it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () { - cy.staking_page_associate_tokens('1001', true); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '1,001.000000000000000000' - ); - cy.ethereum_wallet_check_associated_value_is('1,001.00'); - cy.vega_wallet_check_associated_value_is('1,001.000000000000000000'); - }); + it('Able to access associate token form - from eth wallet', function () { + cy.get(ethWallet.walletContainer).within(() => + cy.get(ethWallet.associate).click() + ); + cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).should( + 'be.enabled' + ); + }); - it('Able to disassociate a partial amount of tokens currently associated', function () { - cy.staking_page_associate_tokens('2'); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - cy.get('button').contains('Select a validator to nominate').click(); - cy.staking_page_disassociate_tokens('1'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '1.000000000000000000' - ); - cy.ethereum_wallet_check_associated_value_is('1.0'); - cy.vega_wallet_check_associated_value_is('1.000000000000000000'); - }); + it('Able to access disassociate token form - from eth wallet', function () { + cy.get(ethWallet.walletContainer).within(() => + cy.get(ethWallet.disassociate).click() + ); + cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).should( + 'be.enabled' + ); + }); - it('Able to disassociate all tokens', function () { - cy.staking_page_associate_tokens('2'); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - cy.get('button').contains('Select a validator to nominate').click(); - cy.staking_page_disassociate_all_tokens(); - cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing( - vegaWalletPublicKeyShort - ); - cy.ethereum_wallet_check_associated_value_is('0.0'); - cy.vega_wallet_check_associated_value_is('0.000000000000000000'); + it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () { + cy.staking_page_associate_tokens('1001', true); + cy.ethereum_wallet_check_associated_vega_key_value_is( + vegaWalletPublicKeyShort, + '1,001.000000000000000000' + ); + cy.ethereum_wallet_check_associated_value_is('1,001.00'); + cy.vega_wallet_check_associated_value_is('1,001.000000000000000000'); + }); + + it('Able to disassociate a partial amount of tokens currently associated', function () { + cy.staking_page_associate_tokens('2'); + cy.vega_wallet_check_associated_value_is('2.000000000000000000'); + cy.get('button').contains('Select a validator to nominate').click(); + cy.staking_page_disassociate_tokens('1'); + cy.ethereum_wallet_check_associated_vega_key_value_is( + vegaWalletPublicKeyShort, + '1.000000000000000000' + ); + cy.ethereum_wallet_check_associated_value_is('1.0'); + cy.vega_wallet_check_associated_value_is('1.000000000000000000'); + }); + + it('Able to disassociate all tokens', function () { + cy.staking_page_associate_tokens('2'); + cy.vega_wallet_check_associated_value_is('2.000000000000000000'); + cy.get('button').contains('Select a validator to nominate').click(); + cy.staking_page_disassociate_all_tokens(); + cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing( + vegaWalletPublicKeyShort + ); + cy.ethereum_wallet_check_associated_value_is('0.0'); + cy.vega_wallet_check_associated_value_is('0.000000000000000000'); + }); }); - }); -}); + } +); diff --git a/apps/token-e2e/src/integration/wallet-eth.cy.js b/apps/token-e2e/src/integration/wallet-eth.cy.js new file mode 100644 index 000000000..a0f7e64ad --- /dev/null +++ b/apps/token-e2e/src/integration/wallet-eth.cy.js @@ -0,0 +1,241 @@ +import ethWallet from '../locators/wallet-eth.locators'; +import '../support/wallet-eth.functions'; + +context('Ethereum Wallet - verify elements on widget', function () { + before('visit token home page', function () { + cy.visit('/'); + }); + + describe('with wallets disconnected', function () { + before('wait for widget to load', function () { + cy.get(ethWallet.walletContainer, { timeout: 10000 }).should( + 'be.visible' + ); + }); + + it('should have ETHEREUM KEY header visible', function () { + cy.get(ethWallet.walletContainer).within(() => { + cy.get(ethWallet.walletHeader) + .should('be.visible') + .and('have.text', 'Ethereum key'); + }); + }); + + it('should have Connect Ethereum button visible', function () { + cy.get(ethWallet.walletContainer).within(() => { + cy.get(ethWallet.connectToEthButton) + .should('be.visible') + .and('have.text', 'Connect Ethereum wallet to associate $VEGA'); + }); + }); + }); + + describe('when Connect Ethereum clicked', function () { + before('', function () { + cy.get(ethWallet.connectToEthButton).click(); + }); + + it('should have Connect Ethereum header visible', function () { + cy.get(ethWallet.dialog).within(() => { + cy.get(ethWallet.dialogHeader) + .should('be.visible') + .and('have.text', 'Connect to your Ethereum wallet'); + }); + }); + + it('should have connector list visible', function () { + const connectList = [ + 'Unknown', + 'MetaMask, Brave or other injected web wallet', + 'WalletConnect', + ]; + cy.get(ethWallet.connectorList).within(() => { + cy.get('button').each(($btn, i) => { + cy.wrap($btn).should('be.visible').and('have.text', connectList[i]); + }); + }); + }); + + after('close popup', function () { + cy.get(ethWallet.dialog) + .within(() => { + cy.get(ethWallet.dialogCloseBtn).click(); + }) + .should('not.exist'); + }); + }); + + describe('when Ethereum wallet connected', function () { + before('connect to Ethereum wallet', function () { + cy.ethereum_wallet_connect(); + }); + + it('should have ETHEREUM KEY header visible', function () { + cy.get(ethWallet.walletContainer).within(() => { + cy.get(ethWallet.walletHeader) + .should('be.visible') + .and('have.text', 'Ethereum key'); + }); + }); + + it('should have account number visible', function () { + cy.get(ethWallet.walletContainer).within(() => { + cy.get(ethWallet.accountNo) + .should('be.visible') + .and('have.text', Cypress.env('ethWalletPublicKeyTruncated')); + }); + }); + + it('should have Associate button visible', function () { + cy.get(ethWallet.walletContainer).within(() => { + cy.get(ethWallet.associate) + .should('be.visible') + .and('have.text', 'Associate'); + }); + }); + + it('should have Disassociate button visible', function () { + cy.get(ethWallet.walletContainer).within(() => { + cy.get(ethWallet.disassociate) + .should('be.visible') + .and('have.text', 'Disassociate'); + }); + }); + + it('should have Disconnect button visible', function () { + cy.get(ethWallet.walletContainer).within(() => { + cy.get(ethWallet.disconnect) + .should('be.visible') + .and('have.text', 'Disconnect'); + }); + }); + + describe('VEGA IN VESTING CONTRACT', function () { + it('should have currency title visible', function () { + cy.get(ethWallet.vegaInVesting).within(() => { + cy.get(ethWallet.currencyTitle) + .should('be.visible') + .and('have.text', 'VEGAIn vesting contract'); + }); + }); + + it('should have currency value visible', function () { + cy.get(ethWallet.vegaInVesting).within(() => { + cy.get(ethWallet.currencyValue) + .should('be.visible') + .invoke('text') + .should('match', /\d{0,3}(,\d{3})*\.\d{18}$/); + }); + }); + + it('should have progress bar visible', function () { + cy.get(ethWallet.vegaInVesting).within(() => { + cy.get(ethWallet.progressBar).should('be.visible'); + }); + }); + + it('should have locked currency visible', function () { + cy.get(ethWallet.vegaInVesting).within(() => { + cy.get(ethWallet.currencyLocked) + .should('be.visible') + .invoke('text') + .should('match', /\d{0,3}(,\d{3})*\.\d{2}$/); + }); + }); + + it('should have unlocked currency visible', function () { + cy.get(ethWallet.vegaInVesting).within(() => { + cy.get(ethWallet.currencyUnlocked) + .should('be.visible') + .invoke('text') + .should('match', /\d{0,3}(,\d{3})*\.\d{2}$/); + }); + }); + + it('should match total & locked/unlocked currency value', function () { + cy.get(ethWallet.vegaInVesting) + .within(() => { + cy.get(ethWallet.currencyValue) + .invoke('text') + .convertTokenValueToNumber() + .as('value'); + cy.get(ethWallet.currencyLocked) + .invoke('text') + .convertTokenValueToNumber() + .as('locked'); + cy.get(ethWallet.currencyUnlocked) + .invoke('text') + .convertTokenValueToNumber() + .as('unlocked'); + }) + .then(function () { + expect(this.value).to.equal(this.locked + this.unlocked); + }); + }); + }); + + describe('VEGA IN WALLET', function () { + it('should have currency title visible', function () { + cy.get(ethWallet.vegaInWallet).within(() => { + cy.get(ethWallet.currencyTitle) + .should('be.visible') + .and('have.text', 'VEGAIn Wallet'); + }); + }); + + it('should have currency value visible', function () { + cy.get(ethWallet.vegaInWallet).within(() => { + cy.get(ethWallet.currencyValue) + .should('be.visible') + .invoke('text') + .should('match', /\d{0,3}(,\d{3})*\.\d{18}$/); + }); + }); + + it('should have progress bar visible', function () { + cy.get(ethWallet.vegaInWallet).within(() => { + cy.get(ethWallet.progressBar).should('be.visible'); + }); + }); + + it('should have locked currency visible', function () { + cy.get(ethWallet.vegaInWallet).within(() => { + cy.get(ethWallet.currencyLocked) + .should('be.visible') + .invoke('text') + .should('match', /\d{0,3}(,\d{3})*\.\d{2}$/); + }); + }); + + it('should have unlocked currency visible', function () { + cy.get(ethWallet.vegaInWallet).within(() => { + cy.get(ethWallet.currencyUnlocked) + .should('be.visible') + .invoke('text') + .should('match', /\d{0,3}(,\d{3})*\.\d{2}$/); + }); + }); + + it('should match total & locked/unlocked currency value', function () { + cy.get(ethWallet.vegaInWallet) + .within(() => { + cy.get(ethWallet.currencyValue) + .invoke('text') + .convertTokenValueToNumber() + .as('value'); + cy.get(ethWallet.currencyLocked) + .invoke('text') + .convertTokenValueToNumber() + .as('locked'); + cy.get(ethWallet.currencyUnlocked) + .invoke('text') + .convertTokenValueToNumber() + .as('unlocked'); + }) + .then(function () { + expect(this.value).to.equal(this.locked + this.unlocked); + }); + }); + }); + }); +}); diff --git a/apps/token-e2e/src/locators/common.locators.js b/apps/token-e2e/src/locators/common.locators.js index 11eee5f21..77a133286 100644 --- a/apps/token-e2e/src/locators/common.locators.js +++ b/apps/token-e2e/src/locators/common.locators.js @@ -4,4 +4,7 @@ export default { link: '[data-testid="link"]', warning: '[data-testid="callout"]', connectToVegaBtn: '[data-testid="connect-to-vega-wallet-btn"]', + dialog: '[role="dialog"]', + dialogHeader: '[data-testid="dialog-title"]', + dialogCloseBtn: '[data-testid="dialog-close"]', }; diff --git a/apps/token-e2e/src/locators/wallet-eth.locators.js b/apps/token-e2e/src/locators/wallet-eth.locators.js new file mode 100644 index 000000000..ca15fac6b --- /dev/null +++ b/apps/token-e2e/src/locators/wallet-eth.locators.js @@ -0,0 +1,21 @@ +import common from './common.locators'; + +export default { + ...common, + walletContainer: '[data-testid="ethereum-wallet"]', + walletHeader: '[data-testid="wallet-header"] h1', + connectToEthButton: '[data-testid="connect-to-eth-wallet-button"]', + connectorList: '[data-testid="web3-connector-list"]', + connectorCapsule: '[data-testid="web3-connector-Unknown"]', + associate: '[href="/staking/associate"]', + disassociate: '[href="/staking/disassociate"]', + disconnect: '[data-testid="disconnect-from-eth-wallet-button"]', + accountNo: '[data-testid="ethereum-account-truncated"]', + currencyTitle: '[data-testid="currency-title"]', + currencyValue: '[data-testid="currency-value"]', + vegaInVesting: '[data-testid="vega-in-vesting-contract"]', + vegaInWallet: '[data-testid="vega-in-wallet"]', + progressBar: '[data-testid="progress-bar"]', + currencyLocked: '[data-testid="currency-locked"]', + currencyUnlocked: '[data-testid="currency-unlocked"]', +}; diff --git a/apps/token-e2e/src/locators/wallet-vega.locators.js b/apps/token-e2e/src/locators/wallet-vega.locators.js new file mode 100644 index 000000000..0be69d700 --- /dev/null +++ b/apps/token-e2e/src/locators/wallet-vega.locators.js @@ -0,0 +1,9 @@ +import common from './common.locators'; + +export default { + ...common, + walletContainer: '[data-testid="vega-wallet"]', + connectRestForm: '[data-testid="rest-connector-form"]', + name: '#wallet', + passphrase: '#passphrase', +}; diff --git a/apps/token-e2e/src/locators/wallet.locators.js b/apps/token-e2e/src/locators/wallet.locators.js deleted file mode 100644 index 94371a8aa..000000000 --- a/apps/token-e2e/src/locators/wallet.locators.js +++ /dev/null @@ -1,14 +0,0 @@ -import common from './common.locators'; - -export default { - ...common, - connectRestForm: '[data-testid="rest-connector-form"]', - name: '#wallet', - passphrase: '#passphrase', - vegawallet: '[data-testid="vega-wallet"]', - ethWallet: '[data-testid="ethereum-wallet"]', - ethWalletConnectToEth: '[data-testid="connect-to-eth-wallet-button"]', - ethWalletConnect: '[data-testid="web3-connector-Unknown"]', - ethWalletAssociate: '[href="/staking/associate"]', - ethWalletDisassociate: '[href="/staking/disassociate"]', -}; diff --git a/apps/token-e2e/src/support/eth-wallet.functions.js b/apps/token-e2e/src/support/wallet-eth.functions.js similarity index 68% rename from apps/token-e2e/src/support/eth-wallet.functions.js rename to apps/token-e2e/src/support/wallet-eth.functions.js index 451c39b1e..da6fcfb97 100644 --- a/apps/token-e2e/src/support/eth-wallet.functions.js +++ b/apps/token-e2e/src/support/wallet-eth.functions.js @@ -1,15 +1,15 @@ -import wallet from '../locators/wallet.locators'; +import ethWallet from '../locators/wallet-eth.locators'; cy.ethereum_wallet_connect = () => { cy.highlight('Connecting Eth Wallet'); - cy.get(wallet.ethWalletConnectToEth).within(() => { + cy.get(ethWallet.connectToEthButton).within(() => { cy.contains('Connect Ethereum wallet to associate $VEGA') .should('be.visible') .click(); }); - cy.get(wallet.ethWalletConnect).click(); - cy.get(wallet.ethWalletConnect, { timeout: 60000 }).should('not.exist'); - cy.get(wallet.ethWallet).within(() => { + cy.get(ethWallet.connectorCapsule).click(); + cy.get(ethWallet.connectorCapsule, { timeout: 60000 }).should('not.exist'); + cy.get(ethWallet.walletContainer).within(() => { // this check is required since it ensures the wallet is fully (not partially) loaded cy.contains('Locked', { timeout: 15000 }).should('be.visible'); }); @@ -17,7 +17,7 @@ cy.ethereum_wallet_connect = () => { cy.ethereum_wallet_check_associated_value_is = (expectedVal) => { cy.highlight(`Checking Eth Wallet - Associated Value is ${expectedVal}`); - cy.get(wallet.ethWallet).within(() => { + cy.get(ethWallet.walletContainer).within(() => { cy.contains('Associated', { timeout: 20000 }) .parent() .siblings() @@ -33,7 +33,7 @@ cy.ethereum_wallet_check_associated_vega_key_value_is = ( cy.highlight( `Checking Eth Wallet - Vega Key Associated Value is ${expectedVal} for key ${vegaShortPublicKey}` ); - cy.get(wallet.ethWallet).within(() => { + cy.get(ethWallet.walletContainer).within(() => { cy.contains(vegaShortPublicKey, { timeout: 20000 }) .parent() .contains(expectedVal, { timeout: 40000 }) @@ -45,7 +45,15 @@ cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing = ( vegaShortPublicKey ) => { cy.highlight('Checking Eth Wallet - Vega Key Associated is not showing'); - cy.get(wallet.ethWallet).within(() => { + cy.get(ethWallet.walletContainer).within(() => { cy.contains(vegaShortPublicKey, { timeout: 20000 }).should('not.exist'); }); }; + +Cypress.Commands.add( + 'convertTokenValueToNumber', + { prevSubject: true }, + (subject) => { + return parseFloat(subject.replace(/,/g, '')); + } +); diff --git a/apps/token-e2e/src/support/vega-wallet.functions.js b/apps/token-e2e/src/support/wallet-vega.functions.js similarity index 81% rename from apps/token-e2e/src/support/vega-wallet.functions.js rename to apps/token-e2e/src/support/wallet-vega.functions.js index ef350181e..684df9d66 100644 --- a/apps/token-e2e/src/support/vega-wallet.functions.js +++ b/apps/token-e2e/src/support/wallet-vega.functions.js @@ -1,4 +1,4 @@ -import wallet from '../locators/wallet.locators'; +import vegaWallet from '../locators/wallet-vega.locators'; const vegaWalletName = Cypress.env('vegaWalletName'); const vegaWalletLocation = Cypress.env('vegaWalletLocation'); @@ -18,7 +18,7 @@ cy.vega_wallet_import = () => { cy.vega_wallet_connect = () => { cy.highlight('Connecting Vega Wallet'); - cy.get(wallet.vegawallet).within(() => { + cy.get(vegaWallet.walletContainer).within(() => { cy.get('button') .contains('Connect Vega wallet to use associated $VEGA') .should('be.enabled') @@ -26,9 +26,9 @@ cy.vega_wallet_connect = () => { .click({ force: true }); }); cy.get('button').contains('rest provider').click(); - cy.get(wallet.connectRestForm).within(() => { - cy.get(wallet.name).click().type(vegaWalletName); - cy.get(wallet.passphrase).click().type(vegaWalletPassphrase); + cy.get(vegaWallet.connectRestForm).within(() => { + cy.get(vegaWallet.name).click().type(vegaWalletName); + cy.get(vegaWallet.passphrase).click().type(vegaWalletPassphrase); cy.get('button').contains('Connect').click(); }); cy.contains(`${vegaWalletName} key`, { timeout: 20000 }).should('be.visible'); @@ -36,7 +36,7 @@ cy.vega_wallet_connect = () => { cy.vega_wallet_check_unstaked_value_is = (expectedVal) => { cy.highlight(`Checking vega wallet - Unstaked Value is ${expectedVal}`); - cy.get(wallet.vegawallet).within(() => { + cy.get(vegaWallet.walletContainer).within(() => { cy.contains('Unstaked', { timeout: 40000 }) .siblings() .contains(expectedVal, { timeout: 40000 }) @@ -46,7 +46,7 @@ cy.vega_wallet_check_unstaked_value_is = (expectedVal) => { cy.vega_wallet_check_associated_value_is = (expectedVal) => { cy.highlight(`Checking vega wallet - Associated Value is ${expectedVal}`); - cy.get(wallet.vegawallet).within(() => { + cy.get(vegaWallet.walletContainer).within(() => { cy.contains('Associated', { timeout: 40000 }) .parent() .siblings() diff --git a/apps/token/src/components/eth-wallet/eth-wallet.tsx b/apps/token/src/components/eth-wallet/eth-wallet.tsx index 63e97b8af..509542acc 100644 --- a/apps/token/src/components/eth-wallet/eth-wallet.tsx +++ b/apps/token/src/components/eth-wallet/eth-wallet.tsx @@ -128,7 +128,7 @@ const ConnectedKey = () => { return ( <> {totalVestedBalance.plus(totalLockedBalance).isEqualTo(0) ? null : ( - <> +
{ rightLabel={t('Unlocked')} light={false} /> - +
)} {!Object.keys(appState.associationBreakdown.vestingAssociations) .length ? null : ( @@ -154,22 +154,24 @@ const ConnectedKey = () => { notAssociated={notAssociatedInContract} /> )} - - {!Object.keys( - appState.associationBreakdown.stakingAssociations - ) ? null : ( - + - )} + {!Object.keys( + appState.associationBreakdown.stakingAssociations + ) ? null : ( + + )} + {

{t('ethereumKey')}

{account && (
-
{truncateMiddle(account)}
+
+ {truncateMiddle(account)} +
{pendingTxs && (
diff --git a/apps/token/src/components/locked-progress/locked-progress.tsx b/apps/token/src/components/locked-progress/locked-progress.tsx index 2101e48ab..37fe0c5c2 100644 --- a/apps/token/src/components/locked-progress/locked-progress.tsx +++ b/apps/token/src/components/locked-progress/locked-progress.tsx @@ -99,6 +99,7 @@ export const LockedProgress = ({ 'border-black': light, 'border-white': !light, })} + data-testid="progress-bar" > @@ -119,8 +120,12 @@ export const LockedProgress = ({ - {formatNumber(locked, decimals)} - {formatNumber(unlocked, decimals)} + + {formatNumber(locked, decimals)} + + + {formatNumber(unlocked, decimals)} +
); diff --git a/apps/token/src/components/wallet-card/wallet-card.tsx b/apps/token/src/components/wallet-card/wallet-card.tsx index 0313decd3..9ea5b6c80 100644 --- a/apps/token/src/components/wallet-card/wallet-card.tsx +++ b/apps/token/src/components/wallet-card/wallet-card.tsx @@ -47,7 +47,10 @@ interface WalletCardHeaderProps { export const WalletCardHeader = ({ children }: WalletCardHeaderProps) => { return ( -
+
{children}
); @@ -151,7 +154,10 @@ export const WalletCardAsset = ({ }`} />
-
+

-
+
{integers}. {decimalsPlaces} diff --git a/libs/ui-toolkit/src/components/dialog/dialog.tsx b/libs/ui-toolkit/src/components/dialog/dialog.tsx index e6bf068b7..09f15aa88 100644 --- a/libs/ui-toolkit/src/components/dialog/dialog.tsx +++ b/libs/ui-toolkit/src/components/dialog/dialog.tsx @@ -53,6 +53,7 @@ export function Dialog({ {title && (

{title}

From fe8461a5784aa1d52d8a3ea3147dceac65c32810 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Mon, 11 Jul 2022 18:13:45 +0000 Subject: [PATCH 11/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 296 ++++++++++++++---- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 242 insertions(+), 60 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index f4b28ecf8..d98d3b001 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121339.83791434763096349", + "locked_amount": "121279.156018808930647995", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62245.279299701672878272", + "locked_amount": "62185.75601295245911797", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "85078.55060352749453145204648", + "locked_amount": "84997.19254680807659605484256", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26185.514082906624274106", + "locked_amount": "26160.473664083417227576", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8523.130735772058441178", + "locked_amount": "8514.980322431576960239", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13756.33491847826175", + "locked_amount": "13725.05519701086975", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1729970.99440705483438209", + "locked_amount": "1728611.457461139653171874", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12573.2390490765073743482905935048", + "locked_amount": "12533.284180546332636590396503227", "deposits": [ { "amount": "2833.333333", @@ -5384,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3474.91120890410876085043969520547945195", + "locked_amount": "3458.29551227169011877043759275114155259", "deposits": [ { "amount": "25", @@ -15849,8 +15849,8 @@ "tranche_start": "2022-03-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", - "total_removed": "74162.9780761646031", - "locked_amount": "2682864.43120481046654531866", + "total_removed": "106452.6400159857469", + "locked_amount": "2680775.29625942927217630576", "deposits": [ { "amount": "1998.95815", @@ -16019,6 +16019,16 @@ } ], "withdrawals": [ + { + "amount": "20676.42232", + "user": "0x93b478148FF792B00076B7EdC89Db1FdE7772079", + "tx": "0x5f6d3898764817a641875455e6506e8e93c5d9228ebccd69cf1452507279010e" + }, + { + "amount": "11613.2396198211438", + "user": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", + "tx": "0xd079047194931c11582a1eee4e8f50f1b7aa7a8c89681f61e649e9d280a2367e" + }, { "amount": "35594.05138", "user": "0x93b478148FF792B00076B7EdC89Db1FdE7772079", @@ -16125,6 +16135,12 @@ } ], "withdrawals": [ + { + "amount": "11613.2396198211438", + "user": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", + "tranche_id": 1, + "tx": "0xd079047194931c11582a1eee4e8f50f1b7aa7a8c89681f61e649e9d280a2367e" + }, { "amount": "19991.6435667249571", "user": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", @@ -16133,8 +16149,8 @@ } ], "total_tokens": "112323.67", - "withdrawn_tokens": "19991.6435667249571", - "remaining_tokens": "92332.0264332750429" + "withdrawn_tokens": "31604.8831865461009", + "remaining_tokens": "80718.7868134538991" }, { "address": "0x3D7944C81794Bc621076958cA0dC0F0b31BDc3e2", @@ -16484,6 +16500,12 @@ } ], "withdrawals": [ + { + "amount": "20676.42232", + "user": "0x93b478148FF792B00076B7EdC89Db1FdE7772079", + "tranche_id": 1, + "tx": "0x5f6d3898764817a641875455e6506e8e93c5d9228ebccd69cf1452507279010e" + }, { "amount": "35594.05138", "user": "0x93b478148FF792B00076B7EdC89Db1FdE7772079", @@ -16492,8 +16514,8 @@ } ], "total_tokens": "200000", - "withdrawn_tokens": "35594.05138", - "remaining_tokens": "164405.94862" + "withdrawn_tokens": "56270.4737", + "remaining_tokens": "143729.5263" }, { "address": "0xB523235B6c7C74DDB26b10E78bFb2d0Cb63Ae289", @@ -16562,8 +16584,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "12911.590444155464175", - "locked_amount": "14737115.2094697464325356335801128575182482", + "total_removed": "62149.178909066145855", + "locked_amount": "14729745.1972705040553023925395558017315491", "deposits": [ { "amount": "16249.93", @@ -17077,6 +17099,31 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x6fe7c383d5b75c3a0fe9169a3d69217e604177711b37c01d2073002c2fd1c0aa" }, + { + "amount": "13356.160448", + "user": "0x29f1856E73262fc4372BBF442EbB550919459308", + "tx": "0x4dc966d71824dc346ead6f88d059cf0d74198ce99bbafb519f4713fce2a83696" + }, + { + "amount": "13362.766964", + "user": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01", + "tx": "0xd91eb691332437c003dfc5ca3d48307fe9bfc7255d8c117db2aa542467560e6f" + }, + { + "amount": "5858.6529132790638", + "user": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", + "tx": "0x589e397cd552542f80df85299023979505989ffbe37617d74c1ce67e5d2bee32" + }, + { + "amount": "13365.398586", + "user": "0x74b521F96c641FD59631Dc6a24c558ed39D64352", + "tx": "0x341f9033e7d5b39bd80eb73c31838d2b81889ef9828847afccde8ec434295dfe" + }, + { + "amount": "3294.60955363161788", + "user": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148", + "tx": "0x43da238e1b1f28aa8063ca322a3c87d534fb03c52acd56af0193014bf301d775" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17630,10 +17677,17 @@ "tx": "0x12bc4fefc73449e06f98facf0020f5bedebbb211bce00c070a6d4fbef9ffc522" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "3294.60955363161788", + "user": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148", + "tranche_id": 2, + "tx": "0x43da238e1b1f28aa8063ca322a3c87d534fb03c52acd56af0193014bf301d775" + } + ], "total_tokens": "49294.676", - "withdrawn_tokens": "0", - "remaining_tokens": "49294.676" + "withdrawn_tokens": "3294.60955363161788", + "remaining_tokens": "46000.06644636838212" }, { "address": "0x4092E429B149b5495265b608FD6Fae69fa5bfBe6", @@ -17660,10 +17714,17 @@ "tx": "0x2f62f0ae1720018d9d429b0d3c83add3dc99dc8f27bdd5f1b54cf47399ed71c5" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "13365.398586", + "user": "0x74b521F96c641FD59631Dc6a24c558ed39D64352", + "tranche_id": 2, + "tx": "0x341f9033e7d5b39bd80eb73c31838d2b81889ef9828847afccde8ec434295dfe" + } + ], "total_tokens": "200000", - "withdrawn_tokens": "0", - "remaining_tokens": "200000" + "withdrawn_tokens": "13365.398586", + "remaining_tokens": "186634.601414" }, { "address": "0x834b777E3aB758C84FeBbfb9d6BB675bc4B16915", @@ -17795,10 +17856,17 @@ "tx": "0x23696a5f86dad7c80a11e3a87f555f79d40c4868e85964454663d7708bc2645d" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "13362.766964", + "user": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01", + "tranche_id": 2, + "tx": "0xd91eb691332437c003dfc5ca3d48307fe9bfc7255d8c117db2aa542467560e6f" + } + ], "total_tokens": "200000", - "withdrawn_tokens": "0", - "remaining_tokens": "200000" + "withdrawn_tokens": "13362.766964", + "remaining_tokens": "186637.233036" }, { "address": "0xA5d8726fFaD226e65D136ef9C2185750863b4850", @@ -17930,10 +17998,17 @@ "tx": "0xfc702de647f91b141bc4a828192c745d0bf84fc505a5f275017d07e362736161" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "5858.6529132790638", + "user": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", + "tranche_id": 2, + "tx": "0x589e397cd552542f80df85299023979505989ffbe37617d74c1ce67e5d2bee32" + } + ], "total_tokens": "87676.33", - "withdrawn_tokens": "0", - "remaining_tokens": "87676.33" + "withdrawn_tokens": "5858.6529132790638", + "remaining_tokens": "81817.6770867209362" }, { "address": "0x9cF9B305601154C85ff86014d10a8762C802db0B", @@ -18140,10 +18215,17 @@ "tx": "0x0be42ac80b2dc5b80024b0d6a441dcd670e6850f93e1d8df341e2bcc8ae4b2e6" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "13356.160448", + "user": "0x29f1856E73262fc4372BBF442EbB550919459308", + "tranche_id": 2, + "tx": "0x4dc966d71824dc346ead6f88d059cf0d74198ce99bbafb519f4713fce2a83696" + } + ], "total_tokens": "200000", - "withdrawn_tokens": "0", - "remaining_tokens": "200000" + "withdrawn_tokens": "13356.160448", + "remaining_tokens": "186643.839552" }, { "address": "0x87D71adAbC11c35aF566eD51421eDA0c82828a3A", @@ -18812,8 +18894,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2166012.841486662889182427", - "locked_amount": "7953778.03458773767706984114364732", + "total_removed": "2200961.013774708284036027", + "locked_amount": "7946939.07317449655904578201451189", "deposits": [ { "amount": "129284.449", @@ -19042,6 +19124,41 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x84bd672f790c5873c15d35e0cc0592ecc2041e1423e8b70a0f63e228c925847f" }, + { + "amount": "3578.334540394068", + "user": "0xCe068b733CDB8D1455E72Ede39705E209251269f", + "tx": "0x5a5e339b1b28edef055de4af68c950621be3a148be529eabf29767c00d559ca9" + }, + { + "amount": "2752.406564582654", + "user": "0x97E5985117F47c8d110Be1c422DdCB9bE9b46e62", + "tx": "0x607657d39483078a5d5b3a48c93138f3753e58978e7b10487c251d8ecce70c5d" + }, + { + "amount": "4678.855033842795", + "user": "0xc01F2E57554Bb392384feCA6a54c8E3A3Ca94E42", + "tx": "0x0e63d6ddac024730c1e6840b0127f60f3e631bcb223a9ca1c508d664caddeec8" + }, + { + "amount": "5780.03710676496", + "user": "0xe2E6F37cb1f1980418012BF69f43910d6Bc73e73", + "tx": "0x5e5297ae7a6951f21cbea97c9871f0f14f8708ad200ffd7d4c801e38b40cda1c" + }, + { + "amount": "3853.3118498576", + "user": "0xd4632B682228Db5f38E2283869AEe8c29ee6Eec8", + "tx": "0xa39e8088492ff0a57c645d3b97393fa3e7cf668ada70506f73f6424f90c4318e" + }, + { + "amount": "4128.34689631801", + "user": "0x83BB032E371D7f18195037d85b3A1d459322C20c", + "tx": "0xe042f84dfed2f96f75d5ee7e2936d661b061f34c5dde77fa1723e35a0a753ee1" + }, + { + "amount": "10176.8802962853078536", + "user": "0x17d93ca9263fCaEADf29088b3aCa8C290d5423FB", + "tx": "0x8e879f16287074e3fb87f4047ad962db3de3f7345aed1cab88a63b6f305045d6" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -22876,6 +22993,12 @@ } ], "withdrawals": [ + { + "amount": "2752.406564582654", + "user": "0x97E5985117F47c8d110Be1c422DdCB9bE9b46e62", + "tranche_id": 3, + "tx": "0x607657d39483078a5d5b3a48c93138f3753e58978e7b10487c251d8ecce70c5d" + }, { "amount": "9236.914528065455", "user": "0x97E5985117F47c8d110Be1c422DdCB9bE9b46e62", @@ -22890,8 +23013,8 @@ } ], "total_tokens": "31784.9", - "withdrawn_tokens": "11721.292988015548", - "remaining_tokens": "20063.607011984452" + "withdrawn_tokens": "14473.699552598202", + "remaining_tokens": "17311.200447401798" }, { "address": "0x17d93ca9263fCaEADf29088b3aCa8C290d5423FB", @@ -22904,6 +23027,12 @@ } ], "withdrawals": [ + { + "amount": "10176.8802962853078536", + "user": "0x17d93ca9263fCaEADf29088b3aCa8C290d5423FB", + "tranche_id": 3, + "tx": "0x8e879f16287074e3fb87f4047ad962db3de3f7345aed1cab88a63b6f305045d6" + }, { "amount": "1809.0490389033853472", "user": "0x17d93ca9263fCaEADf29088b3aCa8C290d5423FB", @@ -22918,8 +23047,8 @@ } ], "total_tokens": "31786.09544", - "withdrawn_tokens": "4298.1923904720520544", - "remaining_tokens": "27487.9030495279479456" + "withdrawn_tokens": "14475.072686757359908", + "remaining_tokens": "17311.022753242640092" }, { "address": "0xbEb7f1B85626Fd9BdA69765d7abb3832C542A62E", @@ -22947,6 +23076,12 @@ } ], "withdrawals": [ + { + "amount": "3853.3118498576", + "user": "0xd4632B682228Db5f38E2283869AEe8c29ee6Eec8", + "tranche_id": 3, + "tx": "0xa39e8088492ff0a57c645d3b97393fa3e7cf668ada70506f73f6424f90c4318e" + }, { "amount": "8440.209063021632", "user": "0xd4632B682228Db5f38E2283869AEe8c29ee6Eec8", @@ -22973,8 +23108,8 @@ } ], "total_tokens": "44499.2", - "withdrawn_tokens": "16410.88640274976", - "remaining_tokens": "28088.31359725024" + "withdrawn_tokens": "20264.19825260736", + "remaining_tokens": "24235.00174739264" }, { "address": "0xe2E6F37cb1f1980418012BF69f43910d6Bc73e73", @@ -22987,6 +23122,12 @@ } ], "withdrawals": [ + { + "amount": "5780.03710676496", + "user": "0xe2E6F37cb1f1980418012BF69f43910d6Bc73e73", + "tranche_id": 3, + "tx": "0x5e5297ae7a6951f21cbea97c9871f0f14f8708ad200ffd7d4c801e38b40cda1c" + }, { "amount": "12661.530439173696", "user": "0xe2E6F37cb1f1980418012BF69f43910d6Bc73e73", @@ -23007,8 +23148,8 @@ } ], "total_tokens": "66748.8", - "withdrawn_tokens": "24615.953230336032", - "remaining_tokens": "42132.846769663968" + "withdrawn_tokens": "30395.990337100992", + "remaining_tokens": "36352.809662899008" }, { "address": "0x83BB032E371D7f18195037d85b3A1d459322C20c", @@ -23021,6 +23162,12 @@ } ], "withdrawals": [ + { + "amount": "4128.34689631801", + "user": "0x83BB032E371D7f18195037d85b3A1d459322C20c", + "tranche_id": 3, + "tx": "0xe042f84dfed2f96f75d5ee7e2936d661b061f34c5dde77fa1723e35a0a753ee1" + }, { "amount": "11068.756947018642", "user": "0x83BB032E371D7f18195037d85b3A1d459322C20c", @@ -23041,8 +23188,8 @@ } ], "total_tokens": "47678.2", - "withdrawn_tokens": "17583.656769925972", - "remaining_tokens": "30094.543230074028" + "withdrawn_tokens": "21712.003666243982", + "remaining_tokens": "25966.196333756018" }, { "address": "0xCe068b733CDB8D1455E72Ede39705E209251269f", @@ -23055,6 +23202,12 @@ } ], "withdrawals": [ + { + "amount": "3578.334540394068", + "user": "0xCe068b733CDB8D1455E72Ede39705E209251269f", + "tranche_id": 3, + "tx": "0x5a5e339b1b28edef055de4af68c950621be3a148be529eabf29767c00d559ca9" + }, { "amount": "12003.2446429164", "user": "0xCe068b733CDB8D1455E72Ede39705E209251269f", @@ -23069,8 +23222,8 @@ } ], "total_tokens": "41320.2", - "withdrawn_tokens": "15237.323014538964", - "remaining_tokens": "26082.876985461036" + "withdrawn_tokens": "18815.657554933032", + "remaining_tokens": "22504.542445066968" }, { "address": "0xc01F2E57554Bb392384feCA6a54c8E3A3Ca94E42", @@ -23083,6 +23236,12 @@ } ], "withdrawals": [ + { + "amount": "4678.855033842795", + "user": "0xc01F2E57554Bb392384feCA6a54c8E3A3Ca94E42", + "tranche_id": 3, + "tx": "0x0e63d6ddac024730c1e6840b0127f60f3e631bcb223a9ca1c508d664caddeec8" + }, { "amount": "10248.998002731345", "user": "0xc01F2E57554Bb392384feCA6a54c8E3A3Ca94E42", @@ -23103,8 +23262,8 @@ } ], "total_tokens": "54034.5", - "withdrawn_tokens": "19926.772773219", - "remaining_tokens": "34107.727226781" + "withdrawn_tokens": "24605.627807061795", + "remaining_tokens": "29428.872192938205" } ] }, @@ -23113,8 +23272,8 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "1539572.873831600560839727", - "locked_amount": "2825682.40197448672662300311737747", + "total_removed": "1543188.041113165491270727", + "locked_amount": "2822980.28695842137071265866487474", "deposits": [ { "amount": "552496.6455", @@ -23263,6 +23422,11 @@ "user": "0x1b4B2372462b391006FAc69f09066Ae8504D75eC", "tx": "0x157dbf1b28465a758596604a1ee5874977d3b527d63e430ba1a4e21bb702f7be" }, + { + "amount": "3615.167281564930431", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tx": "0x9c4cfa505550e13a41c2eb84a767412539ccae45bb280b5235423aadce942f2e" + }, { "amount": "4089.266768653121589", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -24139,6 +24303,12 @@ } ], "withdrawals": [ + { + "amount": "3615.167281564930431", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tranche_id": 4, + "tx": "0x9c4cfa505550e13a41c2eb84a767412539ccae45bb280b5235423aadce942f2e" + }, { "amount": "4089.266768653121589", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -24219,8 +24389,8 @@ } ], "total_tokens": "331498.5873", - "withdrawn_tokens": "165797.579674556372286", - "remaining_tokens": "165701.007625443627714" + "withdrawn_tokens": "169412.746956121302717", + "remaining_tokens": "162085.840343878697283" }, { "address": "0x16da609341ed67750A8BCC5AAa2005471006Cd77", @@ -24302,8 +24472,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "213.463831802", - "locked_amount": "425115.20503130098139637358904112", + "total_removed": "233.531716124", + "locked_amount": "424784.16965720094389367883409436", "deposits": [ { "amount": "3000", @@ -30932,6 +31102,11 @@ "user": "0x0F71cA78EFa7bc202EcB5d2BB10125F41c7a1911", "tx": "0x855e70f6d8fcced11047c4a93eeaf116ba5e67c01c72d56c47306ca0518d1d1a" }, + { + "amount": "20.067884322", + "user": "0x0ab986C2eEe9A631Dfd770250b0BF04A6Dba1B45", + "tx": "0xbe5b2b288555ca7d800cef1d044b229400b806051914c78ccbf2abc04c58fd98" + }, { "amount": "11.163032724", "user": "0xF5037DDA4A660d67560200f45380FF8364e35540", @@ -39106,10 +39281,17 @@ "tx": "0x96a22c369645e8945b4047374a05332f4054b50a492c43092e8bb8e974a006b9" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "20.067884322", + "user": "0x0ab986C2eEe9A631Dfd770250b0BF04A6Dba1B45", + "tranche_id": 5, + "tx": "0xbe5b2b288555ca7d800cef1d044b229400b806051914c78ccbf2abc04c58fd98" + } + ], "total_tokens": "200", - "withdrawn_tokens": "0", - "remaining_tokens": "200" + "withdrawn_tokens": "20.067884322", + "remaining_tokens": "179.932115678" }, { "address": "0x000566B53E028d21e104E4320dE61c2314ef4064", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index baa6a8c8c..0854694c2 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "37.82779363267377", + "locked_amount": "37.75769596651446", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "278.86768455098938", + "locked_amount": "278.09661022323686", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 597a6b1ba..a05c61e2b 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "256.0512376331811580002535160768645358", + "locked_amount": "255.3432512049720260002528151002029426", "deposits": [ { "amount": "1000", From c3edf663fb291b0741d364541e0b25d1269a6d27 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 12 Jul 2022 00:09:31 +0000 Subject: [PATCH 12/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 28 +++++++++---------- apps/static/src/assets/stagnet1-tranches.json | 4 +-- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index d98d3b001..368dea850 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121279.156018808930647995", + "locked_amount": "121220.547098752407341175", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62185.75601295245911797", + "locked_amount": "62128.266122044883249862", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "84997.19254680807659605484256", + "locked_amount": "84918.61379115302691556164168", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26160.473664083417227576", + "locked_amount": "26136.288659775910278554", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8514.980322431576960239", + "locked_amount": "8507.108338215209194628", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13725.05519701086975", + "locked_amount": "13694.84403306159375", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1728611.457461139653171874", + "locked_amount": "1727298.364132896257047384", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12533.284180546332636590396503227", + "locked_amount": "12494.694224270828950913956144794", "deposits": [ { "amount": "2833.333333", @@ -5384,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3458.29551227169011877043759275114155259", + "locked_amount": "3442.24743027016778472043556211948249624", "deposits": [ { "amount": "25", @@ -15850,7 +15850,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "106452.6400159857469", - "locked_amount": "2680775.29625942927217630576", + "locked_amount": "2678757.52898446014816104884", "deposits": [ { "amount": "1998.95815", @@ -16585,7 +16585,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "62149.178909066145855", - "locked_amount": "14729745.1972705040553023925395558017315491", + "locked_amount": "14722626.9546387207456815223057012419775615", "deposits": [ { "amount": "16249.93", @@ -18895,7 +18895,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2200961.013774708284036027", - "locked_amount": "7946939.07317449655904578201451189", + "locked_amount": "7940333.73991686089254940083873767", "deposits": [ { "amount": "129284.449", @@ -23273,7 +23273,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1543188.041113165491270727", - "locked_amount": "2822980.28695842137071265866487474", + "locked_amount": "2820370.47983960638743186470175744", "deposits": [ { "amount": "552496.6455", @@ -24473,7 +24473,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "233.531716124", - "locked_amount": "424784.16965720094389367883409436", + "locked_amount": "424464.44289843257084248172196852", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 0854694c2..f966543c9 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "37.75769596651446", + "locked_amount": "37.69002092846271", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "278.09661022323686", + "locked_amount": "277.35218480466761", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index a05c61e2b..227fe1c91 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "255.3432512049720260002528151002029426", + "locked_amount": "254.6597653475392710002521383815322171", "deposits": [ { "amount": "1000", From d2b3034b5ddf8e09a2d7bf46ab9c7ff7065b2993 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 12 Jul 2022 06:05:03 +0000 Subject: [PATCH 13/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 48 ++++++++++++------- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 368dea850..50b5e9927 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121220.547098752407341175", + "locked_amount": "121161.97661797636262121", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62128.266122044883249862", + "locked_amount": "62070.813936490647121542", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "84918.61379115302691556164168", + "locked_amount": "84840.086572206447404794509", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26136.288659775910278554", + "locked_amount": "26112.119517459420708502", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8507.108338215209194628", + "locked_amount": "8499.241516922998316449", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13694.84403306159375", + "locked_amount": "13664.65268342391525", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1727298.364132896257047384", + "locked_amount": "1725986.132010808612687496", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12494.694224270828950913956144794", + "locked_amount": "12456.1295776265310634262226910358", "deposits": [ { "amount": "2833.333333", @@ -5384,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3442.24743027016778472043556211948249624", + "locked_amount": "3426.20987357305891542043353281963470314", "deposits": [ { "amount": "25", @@ -15850,7 +15850,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "106452.6400159857469", - "locked_amount": "2678757.52898446014816104884", + "locked_amount": "2676741.08508351133825164747", "deposits": [ { "amount": "1998.95815", @@ -16585,7 +16585,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "62149.178909066145855", - "locked_amount": "14722626.9546387207456815223057012419775615", + "locked_amount": "14715513.3805817000126378761223398079115978", "deposits": [ { "amount": "16249.93", @@ -18895,7 +18895,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2200961.013774708284036027", - "locked_amount": "7940333.73991686089254940083873767", + "locked_amount": "7933732.73883694350386266243485045", "deposits": [ { "amount": "129284.449", @@ -23273,7 +23273,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1543188.041113165491270727", - "locked_amount": "2820370.47983960638743186470175744", + "locked_amount": "2817762.38439040926200777627653321", "deposits": [ { "amount": "552496.6455", @@ -24473,7 +24473,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "233.531716124", - "locked_amount": "424464.44289843257084248172196852", + "locked_amount": "424144.9258358424993189810350076", "deposits": [ { "amount": "3000", @@ -50247,7 +50247,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "36080.0423647506377", + "total_removed": "36329.8823647506377", "locked_amount": "0", "deposits": [ { @@ -54507,6 +54507,11 @@ "user": "0x36C1803bddbE4DDF1CaEE6A3Ba7F935F4bC04CFE", "tx": "0x64faa1c40a458e900ee051160b4aace05319a2aba230993a971be489c03489d1" }, + { + "amount": "249.84", + "user": "0x5cce57661D758497446B57592D31667aafd60465", + "tx": "0x8d9b31eaaecaa4f74f05f93d33e61d0691eba3a6f23a9033dbfcaeca1c9a00c4" + }, { "amount": "60.4448387275", "user": "0xEe3183EcE9ee7d73Fb7bA7F4eB262A2dE68C42B0", @@ -68911,10 +68916,17 @@ "tx": "0xb59405747c8088945a412703637a7b422f3639439ec2ee15e180c0a2a0d71ee4" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "249.84", + "user": "0x5cce57661D758497446B57592D31667aafd60465", + "tranche_id": 6, + "tx": "0x8d9b31eaaecaa4f74f05f93d33e61d0691eba3a6f23a9033dbfcaeca1c9a00c4" + } + ], "total_tokens": "249.84", - "withdrawn_tokens": "0", - "remaining_tokens": "249.84" + "withdrawn_tokens": "249.84", + "remaining_tokens": "0" }, { "address": "0x3E0a6071c887155fD43f9e66E48502063405ACf5", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index f966543c9..42746613f 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "37.69002092846271", + "locked_amount": "37.622390284119733", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "277.35218480466761", + "locked_amount": "276.608247716895017", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 227fe1c91..2e93d0a0a 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "254.6597653475392710002521383815322171", + "locked_amount": "253.97666381278542470025146204337899547", "deposits": [ { "amount": "1000", From ed03a5d0c5f9c03d96554935d22d58e32e9f500d Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 12 Jul 2022 12:05:13 +0000 Subject: [PATCH 14/27] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 62 +++++++++++++------ apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 50b5e9927..5eadb059f 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "121161.97661797636262121", + "locked_amount": "121102.64558857969221732", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "62070.813936490647121542", + "locked_amount": "62012.615723587904857212", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "84840.086572206447404794509", + "locked_amount": "84760.53966267068972186302848", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "26112.119517459420708502", + "locked_amount": "26087.636534320613908308", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8499.241516922998316449", + "locked_amount": "8491.27254348856180828", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13664.65268342391525", + "locked_amount": "13634.06929347826125", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1725986.132010808612687496", + "locked_amount": "1724656.86030978686295456", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19065.935569279679372649", - "locked_amount": "12456.1295776265310634262226910358", + "locked_amount": "12417.0641618503900074905033261346", "deposits": [ { "amount": "2833.333333", @@ -5384,7 +5384,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "23709.000000000000000003", "total_removed": "6310.21478833278", - "locked_amount": "3426.20987357305891542043353281963470314", + "locked_amount": "3409.96406621004590316043147716894977172", "deposits": [ { "amount": "25", @@ -15850,7 +15850,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "106452.6400159857469", - "locked_amount": "2676741.08508351133825164747", + "locked_amount": "2674698.36275557641592432839", "deposits": [ { "amount": "1998.95815", @@ -16584,8 +16584,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "62149.178909066145855", - "locked_amount": "14715513.3805817000126378761223398079115978", + "total_removed": "62519.983413609387255", + "locked_amount": "14708307.1019687115735198566060714123263044", "deposits": [ { "amount": "16249.93", @@ -17124,6 +17124,11 @@ "user": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148", "tx": "0x43da238e1b1f28aa8063ca322a3c87d534fb03c52acd56af0193014bf301d775" }, + { + "amount": "370.8045045432414", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x3f16131c69129bfd1a0a0bcd5f474ccf7612fdadc3abf4dc7de85f26fb37c2ae" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17314,6 +17319,12 @@ "tranche_id": 2, "tx": "0x6fe7c383d5b75c3a0fe9169a3d69217e604177711b37c01d2073002c2fd1c0aa" }, + { + "amount": "370.8045045432414", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x3f16131c69129bfd1a0a0bcd5f474ccf7612fdadc3abf4dc7de85f26fb37c2ae" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17454,8 +17465,8 @@ } ], "total_tokens": "194999.1675", - "withdrawn_tokens": "12911.590444155464175", - "remaining_tokens": "182087.577055844535825" + "withdrawn_tokens": "13282.394948698705575", + "remaining_tokens": "181716.772551301294425" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -18894,8 +18905,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2200961.013774708284036027", - "locked_amount": "7933732.73883694350386266243485045", + "total_removed": "2201644.472304849808826277", + "locked_amount": "7927045.71308516233757655619964586", "deposits": [ { "amount": "129284.449", @@ -19159,6 +19170,11 @@ "user": "0x17d93ca9263fCaEADf29088b3aCa8C290d5423FB", "tx": "0x8e879f16287074e3fb87f4047ad962db3de3f7345aed1cab88a63b6f305045d6" }, + { + "amount": "683.45853014152479025", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x44168decc7619b10c602ccf2058513e929aa81b2618d01224f59830e45f6839e" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -20869,6 +20885,12 @@ "tranche_id": 3, "tx": "0x84bd672f790c5873c15d35e0cc0592ecc2041e1423e8b70a0f63e228c925847f" }, + { + "amount": "683.45853014152479025", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x44168decc7619b10c602ccf2058513e929aa81b2618d01224f59830e45f6839e" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -22215,8 +22237,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "163306.63681757040031", - "remaining_tokens": "195816.83275742959969" + "withdrawn_tokens": "163990.09534771192510025", + "remaining_tokens": "195133.37422728807489975" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -23273,7 +23295,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1543188.041113165491270727", - "locked_amount": "2817762.38439040926200777627653321", + "locked_amount": "2815120.300073085598471208078615521", "deposits": [ { "amount": "552496.6455", @@ -24473,7 +24495,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "233.531716124", - "locked_amount": "424144.9258358424993189810350076", + "locked_amount": "423821.24480628260917017647691528", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 42746613f..b11674454 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "37.622390284119733", + "locked_amount": "37.55384322678843", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "276.608247716895017", + "locked_amount": "275.854230086250684", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 2e93d0a0a..61ffa931b 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "253.97666381278542470025146204337899547", + "locked_amount": "253.28433853373926440025077657280568244", "deposits": [ { "amount": "1000", From 74bb4b9bf9ff3fa0440178517c492da01fc49343 Mon Sep 17 00:00:00 2001 From: AndyWhiteVega <106072061+AndyWhiteVega@users.noreply.github.com> Date: Tue, 12 Jul 2022 14:43:04 +0100 Subject: [PATCH 15/27] Test/704 expand tfe flow path coverage around association and staking (#743) * test: refactor functions for cypress commands * test: lint changes * test: setting tweak to prevent race condition * test: lint * test: refactor functions and locators * test: lint * test: tweak on function locations * test: lint --- .../src/integration/flow/staking-flow.cy.js | 233 +++++++++--------- .../flow/token-association-flow.cy.js | 49 +--- .../token-e2e/src/support/common.functions.js | 7 + apps/token-e2e/src/support/index.ts | 6 + .../src/support/staking.functions.js | 113 +++++---- .../src/support/wallet-eth.functions.js | 90 ++++--- .../src/support/wallet-teardown.functions.js | 49 ++-- .../src/support/wallet-vega.functions.js | 32 +-- 8 files changed, 297 insertions(+), 282 deletions(-) create mode 100644 apps/token-e2e/src/support/common.functions.js diff --git a/apps/token-e2e/src/integration/flow/staking-flow.cy.js b/apps/token-e2e/src/integration/flow/staking-flow.cy.js index 3f9cb8915..47e25ca80 100644 --- a/apps/token-e2e/src/integration/flow/staking-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/staking-flow.cy.js @@ -1,31 +1,28 @@ -/// -import navigation from '../../locators/navigation.locators'; -import staking from '../../locators/staking.locators'; -import vegaWallet from '../../locators/wallet-vega.locators'; -import '../../support/staking.functions'; -import '../../support/wallet-vega.functions'; -import '../../support/wallet-eth.functions'; -import '../../support/wallet-teardown.functions'; - +const stakingPageLink = '[href="/staking"]'; +const pageSpinner = 'splash-loader'; +const menuBar = 'nav'; +const validatorList = '[data-testid="node-list-item-name"]'; +const removeStakeRadioButton = '[data-testid="remove-stake-radio"]'; +const tokenAmountInputBox = '[data-testid="token-amount-input"]'; +const tokenSubmitButton = '[data-testid="token-input-submit-button"]'; +const stakeNextEpochValue = '[data-testid="stake-next-epoch"]'; const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort'); +const vegaWalletContainer = '[data-testid="vega-wallet"]'; context('Staking Flow - with eth and vega wallets connected', function () { before('visit staking tab and connect vega wallet', function () { cy.vega_wallet_import(); cy.visit('/'); - cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); + cy.get(menuBar, { timeout: 20000 }).should('be.visible'); cy.vega_wallet_connect(); cy.vega_wallet_set_specified_approval_amount('1000'); cy.reload(); - cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); + cy.get(menuBar, { timeout: 20000 }).should('be.visible'); cy.ethereum_wallet_connect(); - cy.get(navigation.staking).first().click(); - cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist'); - cy.get(staking.validatorNames).first().invoke('text').as('validatorName'); - cy.get(staking.validatorNames) - .last() - .invoke('text') - .as('otherValidatorName'); + cy.get(stakingPageLink).first().click(); + cy.get(pageSpinner, { timeout: 20000 }).should('not.exist'); + cy.get(validatorList).first().invoke('text').as('validatorName'); + cy.get(validatorList).last().invoke('text').as('otherValidatorName'); }); describe('Eth wallet - contains VEGA tokens', function () { @@ -33,7 +30,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { 'teardown wallet & drill into a specific validator', function () { cy.vega_wallet_teardown(); - cy.get(navigation.staking).first().click(); + cy.get(stakingPageLink).first().click(); } ); @@ -47,7 +44,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { ); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); cy.vega_wallet_check_validator_stake_next_epoch_value_is( @@ -67,15 +64,15 @@ context('Staking Flow - with eth and vega wallets connected', function () { cy.staking_page_associate_tokens('5'); cy.vega_wallet_check_unstaked_value_is('5.000000000000000000'); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); cy.vega_wallet_check_validator_staked_value_is( this.validatorName, '2.000000000000000000' ); - cy.get(navigation.staking).first().click(); - cy.get(staking.validatorNames).contains(this.otherValidatorName).click(); + cy.get(stakingPageLink).first().click(); + cy.get(validatorList).contains(this.otherValidatorName).click(); cy.staking_validator_page_add_stake('1'); cy.vega_wallet_check_validator_staked_value_is( this.otherValidatorName, @@ -89,7 +86,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { cy.vega_wallet_check_unstaked_value_is('4.000000000000000000'); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('3'); cy.staking_validator_page_check_stake_next_epoch_value('3.0'); @@ -99,8 +96,8 @@ context('Staking Flow - with eth and vega wallets connected', function () { ); cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); - cy.get(navigation.staking).first().click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(stakingPageLink).first().click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_removeStake('1'); cy.staking_validator_page_check_stake_next_epoch_value('2.0'); @@ -127,7 +124,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('1'); cy.vega_wallet_check_validator_stake_next_epoch_value_is( @@ -136,8 +133,8 @@ context('Staking Flow - with eth and vega wallets connected', function () { ); cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); - cy.get(navigation.staking).first().click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(stakingPageLink).first().click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_removeStake('1'); cy.staking_validator_page_check_stake_next_epoch_value('0.0'); @@ -161,7 +158,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); cy.staking_validator_page_check_stake_next_epoch_value('2.0'); @@ -171,12 +168,12 @@ context('Staking Flow - with eth and vega wallets connected', function () { ); cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); - cy.get(navigation.staking).first().click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); - cy.get(staking.removeStakeRadioButton).click({ force: true }); - cy.get(staking.tokenAmountInput).type('-0.1'); + cy.get(stakingPageLink).first().click(); + cy.get(validatorList).contains(this.validatorName).click(); + cy.get(removeStakeRadioButton).click({ force: true }); + cy.get(tokenAmountInputBox).type('-0.1'); cy.contains('Waiting for next epoch to start', { timeout: 10000 }); - cy.get(staking.tokenInputSubmit) + cy.get(tokenSubmitButton) .should('be.disabled', { timeout: 8000 }) .and('contain', `Remove -0.1 $VEGA tokens at the end of epoch`) .and('be.visible'); @@ -187,7 +184,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); cy.staking_validator_page_check_stake_next_epoch_value('2.0'); @@ -197,12 +194,12 @@ context('Staking Flow - with eth and vega wallets connected', function () { ); cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); - cy.get(navigation.staking).first().click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); - cy.get(staking.removeStakeRadioButton).click({ force: true }); - cy.get(staking.tokenAmountInput).type(4); + cy.get(stakingPageLink).first().click(); + cy.get(validatorList).contains(this.validatorName).click(); + cy.get(removeStakeRadioButton).click({ force: true }); + cy.get(tokenAmountInputBox).type(4); cy.contains('Waiting for next epoch to start', { timeout: 10000 }); - cy.get(staking.tokenInputSubmit) + cy.get(tokenSubmitButton) .should('be.disabled', { timeout: 8000 }) .and('contain', `Remove 4 $VEGA tokens at the end of epoch`) .and('be.visible'); @@ -213,7 +210,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); @@ -221,7 +218,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { this.validatorName, '2.000000000000000000' ); - cy.get(navigation.staking).first().click(); + cy.get(stakingPageLink).first().click(); cy.staking_page_disassociate_all_tokens(); cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing( vegaWalletPublicKeyShort @@ -236,7 +233,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(staking.validatorNames).contains(this.validatorName).click(); + cy.get(validatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); @@ -244,7 +241,7 @@ context('Staking Flow - with eth and vega wallets connected', function () { this.validatorName, '2.000000000000000000' ); - cy.get(navigation.staking).first().click(); + cy.get(stakingPageLink).first().click(); cy.staking_page_disassociate_tokens('1'); cy.ethereum_wallet_check_associated_value_is('2.0'); cy.vega_wallet_check_associated_value_is('2.000000000000000000'); @@ -262,77 +259,89 @@ context('Staking Flow - with eth and vega wallets connected', function () { ); }); - cy.staking_validator_page_check_stake_next_epoch_value = (expectedVal) => { - cy.highlight( - `Checking Staking Page - Validator Stake Next Epoch Value is ${expectedVal}` - ); - cy.get(staking.stakeNextEpochValue, { timeout: 10000 }) - .contains(expectedVal, { timeout: 10000 }) - .should('be.visible'); - }; - - cy.staking_validator_page_check_stake_this_epoch_value = (expectedVal) => { - cy.highlight( - `Checking Staking Page - Validator Stake This Epoch Value is ${expectedVal}` - ); - cy.get(staking.stakeThisEpochValue, { timeout: 10000 }) - .contains(expectedVal, { timeout: 10000 }) - .should('be.visible'); - }; - - cy.vega_wallet_check_validator_stake_next_epoch_value_is = ( - validatorName, - expectedVal - ) => { - cy.highlight( - `Checking vega wallet - Stake Next Epoch Value for ${validatorName} is ${expectedVal}` - ); - cy.get(vegaWallet.walletContainer).within(() => { - cy.contains(`${validatorName} (Next epoch)`, { timeout: 40000 }) - .siblings() - .contains(expectedVal, { timeout: 40000 }) + Cypress.Commands.add( + 'staking_validator_page_check_stake_next_epoch_value', + (expectedVal) => { + cy.highlight( + `Checking Staking Page - Validator Stake Next Epoch Value is ${expectedVal}` + ); + cy.get(stakeNextEpochValue, { timeout: 10000 }) + .contains(expectedVal, { timeout: 10000 }) .should('be.visible'); - }); - }; + } + ); - cy.vega_wallet_check_validator_stake_this_epoch_value_is = ( - validatorName, - expectedVal - ) => { - cy.highlight( - `Checking vega wallet - Stake This Epoch Value for ${validatorName} is ${expectedVal}` - ); - cy.get(vegaWallet.walletContainer).within(() => { - cy.contains(`${validatorName} (This Epoch)`, { timeout: 40000 }) - .siblings() - .contains(expectedVal, { timeout: 40000 }) + Cypress.Commands.add( + 'staking_validator_page_check_stake_this_epoch_value', + (expectedVal) => { + cy.highlight( + `Checking Staking Page - Validator Stake This Epoch Value is ${expectedVal}` + ); + cy.get(stakeNextEpochValue, { timeout: 10000 }) + .contains(expectedVal, { timeout: 10000 }) .should('be.visible'); - }); - }; + } + ); - cy.vega_wallet_check_validator_no_longer_showing = (validatorName) => { - cy.highlight( - `Checking Validator and therefore stake removed for ${validatorName}` - ); - cy.get(vegaWallet.walletContainer).within(() => { - cy.contains(`${validatorName}`, { timeout: 40000 }).should('not.exist', { - timeout: 40000, + Cypress.Commands.add( + 'vega_wallet_check_validator_stake_next_epoch_value_is', + (validatorName, expectedVal) => { + cy.highlight( + `Checking vega wallet - Stake Next Epoch Value for ${validatorName} is ${expectedVal}` + ); + cy.get(vegaWalletContainer).within(() => { + cy.contains(`${validatorName} (Next epoch)`, { timeout: 40000 }) + .siblings() + .contains(expectedVal, { timeout: 40000 }) + .should('be.visible'); }); - }); - }; + } + ); - cy.vega_wallet_check_validator_staked_value_is = ( - validatorName, - expectedVal - ) => { - cy.highlight( - `Checking Validator Stake Value for ${validatorName} is ${expectedVal}` - ); - cy.get(vegaWallet.walletContainer).within(() => { - cy.contains(`${validatorName}`, { timeout: 40000 }) - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); - }; + Cypress.Commands.add( + 'vega_wallet_check_validator_stake_this_epoch_value_is', + (validatorName, expectedVal) => { + cy.highlight( + `Checking vega wallet - Stake This Epoch Value for ${validatorName} is ${expectedVal}` + ); + cy.get(vegaWalletContainer).within(() => { + cy.contains(`${validatorName} (This Epoch)`, { timeout: 40000 }) + .siblings() + .contains(expectedVal, { timeout: 40000 }) + .should('be.visible'); + }); + } + ); + + Cypress.Commands.add( + 'vega_wallet_check_validator_no_longer_showing', + (validatorName) => { + cy.highlight( + `Checking Validator and therefore stake removed for ${validatorName}` + ); + cy.get(vegaWalletContainer).within(() => { + cy.contains(`${validatorName}`, { timeout: 40000 }).should( + 'not.exist', + { + timeout: 40000, + } + ); + }); + } + ); + + Cypress.Commands.add( + 'vega_wallet_check_validator_staked_value_is', + (validatorName, expectedVal) => { + cy.highlight( + `Checking Validator Stake Value for ${validatorName} is ${expectedVal}` + ); + cy.get(vegaWalletContainer).within(() => { + cy.contains(`${validatorName}`, { timeout: 40000 }) + .siblings() + .contains(expectedVal, { timeout: 40000 }) + .should('be.visible'); + }); + } + ); }); diff --git a/apps/token-e2e/src/integration/flow/token-association-flow.cy.js b/apps/token-e2e/src/integration/flow/token-association-flow.cy.js index a4a967be8..a60ceb183 100644 --- a/apps/token-e2e/src/integration/flow/token-association-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/token-association-flow.cy.js @@ -1,12 +1,7 @@ -/// -import navigation from '../../locators/navigation.locators'; -import staking from '../../locators/staking.locators'; -import ethWallet from '../../locators/wallet-eth.locators'; -import '../../support/staking.functions'; -import '../../support/wallet-vega.functions'; -import '../../support/wallet-eth.functions'; -import '../../support/wallet-teardown.functions'; - +const stakingPageLink = '[href="/staking"]'; +const pageSpinner = 'splash-loader'; +const menuBar = 'nav'; +const validatorList = '[data-testid="node-list-item-name"]'; const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort'); context( @@ -15,15 +10,15 @@ context( before('visit staking tab and connect vega wallet', function () { cy.vega_wallet_import(); cy.visit('/'); - cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); + cy.get(menuBar, { timeout: 20000 }).should('be.visible'); cy.vega_wallet_connect(); cy.vega_wallet_set_specified_approval_amount('1000'); cy.reload(); - cy.get(navigation.section, { timeout: 20000 }).should('be.visible'); + cy.get(menuBar, { timeout: 20000 }).should('be.visible'); cy.ethereum_wallet_connect(); - cy.get(navigation.staking).first().click(); - cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist'); - cy.get(staking.validatorNames).first().invoke('text').as('validatorName'); + cy.get(stakingPageLink).first().click(); + cy.get(pageSpinner, { timeout: 20000 }).should('not.exist'); + cy.get(validatorList).first().invoke('text').as('validatorName'); }); describe('Eth wallet - contains VEGA tokens', function () { @@ -31,12 +26,12 @@ context( 'teardown wallet & drill into a specific validator', function () { cy.vega_wallet_teardown(); - cy.get(navigation.staking).first().click(); - cy.get(navigation.spinner, { timeout: 20000 }).should('not.exist'); + cy.get(stakingPageLink).first().click(); + cy.get(pageSpinner, { timeout: 20000 }).should('not.exist'); } ); - it('Able to associate tokens - from staking page', function () { + it('Able to associate tokens', function () { cy.staking_page_associate_tokens('2'); cy.ethereum_wallet_check_associated_vega_key_value_is( vegaWalletPublicKeyShort, @@ -47,7 +42,7 @@ context( cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); }); - it('Able to disassociate tokens - from staking page', function () { + it('Able to disassociate tokens', function () { cy.staking_page_associate_tokens('2'); cy.ethereum_wallet_check_associated_vega_key_value_is( vegaWalletPublicKeyShort, @@ -64,24 +59,6 @@ context( cy.vega_wallet_check_associated_value_is('1.000000000000000000'); }); - it('Able to access associate token form - from eth wallet', function () { - cy.get(ethWallet.walletContainer).within(() => - cy.get(ethWallet.associate).click() - ); - cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).should( - 'be.enabled' - ); - }); - - it('Able to access disassociate token form - from eth wallet', function () { - cy.get(ethWallet.walletContainer).within(() => - cy.get(ethWallet.disassociate).click() - ); - cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).should( - 'be.enabled' - ); - }); - it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () { cy.staking_page_associate_tokens('1001', true); cy.ethereum_wallet_check_associated_vega_key_value_is( diff --git a/apps/token-e2e/src/support/common.functions.js b/apps/token-e2e/src/support/common.functions.js new file mode 100644 index 000000000..ae7d1d705 --- /dev/null +++ b/apps/token-e2e/src/support/common.functions.js @@ -0,0 +1,7 @@ +Cypress.Commands.add( + 'convertTokenValueToNumber', + { prevSubject: true }, + (subject) => { + return parseFloat(subject.replace(/,/g, '')); + } +); diff --git a/apps/token-e2e/src/support/index.ts b/apps/token-e2e/src/support/index.ts index ac0235f29..f5a484c0d 100644 --- a/apps/token-e2e/src/support/index.ts +++ b/apps/token-e2e/src/support/index.ts @@ -1,5 +1,11 @@ import '@vegaprotocol/cypress'; +import './common.functions.js'; +import './staking.functions.js'; +import './wallet-eth.functions.js'; +import './wallet-teardown.functions.js'; +import './wallet-vega.functions.js'; + // Hide fetch/XHR requests - They create a lot of noise in command log const app = window.top; if (!app.document.head.querySelector('[data-hide-command-log-request]')) { diff --git a/apps/token-e2e/src/support/staking.functions.js b/apps/token-e2e/src/support/staking.functions.js index 57eb9e916..42652b3fb 100644 --- a/apps/token-e2e/src/support/staking.functions.js +++ b/apps/token-e2e/src/support/staking.functions.js @@ -1,11 +1,27 @@ -import staking from '../locators/staking.locators'; +const tokenAmountInputBox = '[data-testid="token-amount-input"]'; +const tokenSubmitButton = '[data-testid="token-input-submit-button"]'; +const tokenInputApprove = '[data-testid="token-input-approve-button"]'; +const addStakeRadioButton = '[data-testid="add-stake-radio"]'; +const removeStakeRadioButton = '[data-testid="remove-stake-radio"]'; +const ethWalletAssociateButton = '[href="/staking/associate"]'; +const ethWalletDissociateButton = '[href="/staking/disassociate"]'; +const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]'; +const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]'; -cy.staking_validator_page_add_stake = (stake) => { +Cypress.Commands.add('wait_for_begining_of_epoch', () => { + cy.highlight(`Waiting for next epoch to start`); + cy.contains('Waiting for next epoch to start', { timeout: 10000 }).should( + 'not.exist' + ); + cy.contains('Waiting for next epoch to start', { timeout: 20000 }); +}); + +Cypress.Commands.add('staking_validator_page_add_stake', (stake) => { cy.highlight(`Adding a stake of ${stake}`); - cy.get(staking.addStakeRadioButton).click({ force: true }); - cy.get(staking.tokenAmountInput).type(stake); - cy.contains('Waiting for next epoch to start', { timeout: 10000 }); - cy.get(staking.tokenInputSubmit, { timeout: 8000 }) + cy.get(addStakeRadioButton).click({ force: true }); + cy.get(tokenAmountInputBox).type(stake); + cy.wait_for_begining_of_epoch(); + cy.get(tokenSubmitButton, { timeout: 8000 }) .should('be.enabled') .and('contain', `Add ${stake} $VEGA tokens`) .and('be.visible') @@ -14,14 +30,14 @@ cy.staking_validator_page_add_stake = (stake) => { 'At the beginning of the next epoch your $VEGA will be nominated to the validator', { timeout: 20000 } ).should('be.visible'); -}; +}); -cy.staking_validator_page_removeStake = (stake) => { +Cypress.Commands.add('staking_validator_page_removeStake', (stake) => { cy.highlight(`Removing a stake of ${stake}`); - cy.get(staking.removeStakeRadioButton).click({ force: true }); - cy.get(staking.tokenAmountInput).type(stake); - cy.contains('Waiting for next epoch to start', { timeout: 10000 }); - cy.get(staking.tokenInputSubmit) + cy.get(removeStakeRadioButton).click({ force: true }); + cy.get(tokenAmountInputBox).type(stake); + cy.wait_for_begining_of_epoch(); + cy.get(tokenSubmitButton) .should('be.enabled', { timeout: 8000 }) .and('contain', `Remove ${stake} $VEGA tokens at the end of epoch`) .and('be.visible') @@ -29,53 +45,52 @@ cy.staking_validator_page_removeStake = (stake) => { cy.contains(`${stake} $VEGA has been removed from validator`).should( 'be.visible' ); -}; +}); -cy.staking_page_associate_tokens = (amount, approve = false) => { - cy.highlight(`Associating ${amount} tokens`); - cy.get(staking.associateButton).click(); - cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).click(); - cy.get(staking.tokenAmountInput, { timeout: 10000 }).type(amount); - if (approve) { - cy.get(staking.tokenInputApprove, { timeout: 40000 }) - .should('be.enabled') - .click(); - cy.contains('Approve $VEGA Tokens for staking on Vega').should( - 'be.visible' - ); - cy.contains('Approve $VEGA Tokens for staking on Vega', { - timeout: 40000, - }).should('not.exist'); +Cypress.Commands.add( + 'staking_page_associate_tokens', + (amount, approve = false) => { + cy.highlight(`Associating ${amount} tokens`); + cy.get(ethWalletAssociateButton).first().click(); + cy.get(associateWalletRadioButton, { timeout: 30000 }).click(); + cy.get(tokenAmountInputBox, { timeout: 10000 }).type(amount); + if (approve) { + cy.get(tokenInputApprove, { timeout: 40000 }) + .should('be.enabled') + .click(); + cy.contains('Approve $VEGA Tokens for staking on Vega').should( + 'be.visible' + ); + cy.contains('Approve $VEGA Tokens for staking on Vega', { + timeout: 40000, + }).should('not.exist'); + } + cy.get(tokenSubmitButton, { timeout: 40000 }).should('be.enabled').click(); + cy.contains('can now participate in governance and nominate a validator', { + timeout: 60000, + }).should('be.visible'); } - cy.get(staking.tokenInputSubmit, { timeout: 40000 }) - .should('be.enabled') - .click(); - cy.contains('can now participate in governance and nominate a validator', { - timeout: 60000, - }).should('be.visible'); -}; +); -cy.staking_page_disassociate_tokens = (amount) => { +Cypress.Commands.add('staking_page_disassociate_tokens', (amount) => { cy.highlight(`Disassociating ${amount} tokens via Staking Page`); - cy.get(staking.disassociateButton).click(); - cy.get(staking.stakeAssociateWalletRadio, { timeout: 30000 }).click(); - cy.get(staking.tokenAmountInput, { timeout: 10000 }).type(amount); + cy.get(ethWalletDissociateButton).first().click(); + cy.get(associateWalletRadioButton, { timeout: 30000 }).click(); + cy.get(tokenAmountInputBox, { timeout: 10000 }).type(amount); - cy.get(staking.tokenInputSubmit, { timeout: 40000 }) - .should('be.enabled') - .click(); + cy.get(tokenSubmitButton, { timeout: 40000 }).should('be.enabled').click(); cy.contains(`${amount} $VEGA tokens have been returned to Ethereum wallet`, { timeout: 60000, }).should('be.visible'); -}; +}); -cy.staking_page_disassociate_all_tokens = () => { +Cypress.Commands.add('staking_page_disassociate_all_tokens', () => { cy.highlight(`Disassociating all tokens via Staking Page`); - cy.get(staking.disassociateButton).click(); - cy.get(staking.stakeAssociateWalletRadio, { timeout: 20000 }).click(); - cy.get(staking.stakeMaximumTokens, { timeout: 60000 }).click(); - cy.get(staking.tokenInputSubmit, { timeout: 10000 }).click(); + cy.get(ethWalletDissociateButton).first().click(); + cy.get(associateWalletRadioButton, { timeout: 20000 }).click(); + cy.get(stakeMaximumTokens, { timeout: 60000 }).click(); + cy.get(tokenSubmitButton, { timeout: 10000 }).click(); cy.contains('$VEGA tokens have been returned to Ethereum wallet', { timeout: 60000, }).should('be.visible'); -}; +}); diff --git a/apps/token-e2e/src/support/wallet-eth.functions.js b/apps/token-e2e/src/support/wallet-eth.functions.js index da6fcfb97..1a4bec47d 100644 --- a/apps/token-e2e/src/support/wallet-eth.functions.js +++ b/apps/token-e2e/src/support/wallet-eth.functions.js @@ -1,59 +1,57 @@ -import ethWallet from '../locators/wallet-eth.locators'; +const ethWalletContainer = '[data-testid="ethereum-wallet"]'; +const connectToEthButton = '[data-testid="connect-to-eth-wallet-button"]'; +const capsuleWalletConnectButton = '[data-testid="web3-connector-Unknown"]'; -cy.ethereum_wallet_connect = () => { +Cypress.Commands.add('ethereum_wallet_connect', () => { cy.highlight('Connecting Eth Wallet'); - cy.get(ethWallet.connectToEthButton).within(() => { + cy.get(connectToEthButton).within(() => { cy.contains('Connect Ethereum wallet to associate $VEGA') .should('be.visible') .click(); }); - cy.get(ethWallet.connectorCapsule).click(); - cy.get(ethWallet.connectorCapsule, { timeout: 60000 }).should('not.exist'); - cy.get(ethWallet.walletContainer).within(() => { + cy.get(capsuleWalletConnectButton).click(); + cy.get(capsuleWalletConnectButton, { timeout: 60000 }).should('not.exist'); + cy.get(ethWalletContainer).within(() => { // this check is required since it ensures the wallet is fully (not partially) loaded cy.contains('Locked', { timeout: 15000 }).should('be.visible'); }); -}; - -cy.ethereum_wallet_check_associated_value_is = (expectedVal) => { - cy.highlight(`Checking Eth Wallet - Associated Value is ${expectedVal}`); - cy.get(ethWallet.walletContainer).within(() => { - cy.contains('Associated', { timeout: 20000 }) - .parent() - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); -}; - -cy.ethereum_wallet_check_associated_vega_key_value_is = ( - vegaShortPublicKey, - expectedVal -) => { - cy.highlight( - `Checking Eth Wallet - Vega Key Associated Value is ${expectedVal} for key ${vegaShortPublicKey}` - ); - cy.get(ethWallet.walletContainer).within(() => { - cy.contains(vegaShortPublicKey, { timeout: 20000 }) - .parent() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); -}; - -cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing = ( - vegaShortPublicKey -) => { - cy.highlight('Checking Eth Wallet - Vega Key Associated is not showing'); - cy.get(ethWallet.walletContainer).within(() => { - cy.contains(vegaShortPublicKey, { timeout: 20000 }).should('not.exist'); - }); -}; +}); Cypress.Commands.add( - 'convertTokenValueToNumber', - { prevSubject: true }, - (subject) => { - return parseFloat(subject.replace(/,/g, '')); + 'ethereum_wallet_check_associated_value_is', + (expectedVal) => { + cy.highlight(`Checking Eth Wallet - Associated Value is ${expectedVal}`); + cy.get(ethWalletContainer).within(() => { + cy.contains('Associated', { timeout: 20000 }) + .parent() + .siblings() + .contains(expectedVal, { timeout: 40000 }) + .should('be.visible'); + }); + } +); + +Cypress.Commands.add( + 'ethereum_wallet_check_associated_vega_key_value_is', + (vegaShortPublicKey, expectedVal) => { + cy.highlight( + `Checking Eth Wallet - Vega Key Associated Value is ${expectedVal} for key ${vegaShortPublicKey}` + ); + cy.get(ethWalletContainer).within(() => { + cy.contains(vegaShortPublicKey, { timeout: 20000 }) + .parent() + .contains(expectedVal, { timeout: 40000 }) + .should('be.visible'); + }); + } +); + +Cypress.Commands.add( + 'ethereum_wallet_check_associated_vega_key_is_no_longer_showing', + (vegaShortPublicKey) => { + cy.highlight('Checking Eth Wallet - Vega Key Associated is not showing'); + cy.get(ethWalletContainer).within(() => { + cy.contains(vegaShortPublicKey, { timeout: 20000 }).should('not.exist'); + }); } ); diff --git a/apps/token-e2e/src/support/wallet-teardown.functions.js b/apps/token-e2e/src/support/wallet-teardown.functions.js index aef6805af..5642c07e0 100644 --- a/apps/token-e2e/src/support/wallet-teardown.functions.js +++ b/apps/token-e2e/src/support/wallet-teardown.functions.js @@ -64,27 +64,30 @@ Cypress.Commands.add( } ); -cy.vega_wallet_teardown_staking = (stakingBridgeContract) => { - cy.highlight('Tearing down staking tokens from vega wallet if present'); - cy.wrap( - stakingBridgeContract.stakeBalance(ethWalletPubKey, vegaWalletPubKey), - { - timeout: transactionTimeout, - log: false, - } - ).then((stake_amount) => { - if (String(stake_amount) != '0') { - cy.wrap( - stakingBridgeContract.removeStake(stake_amount, vegaWalletPubKey), - { timeout: transactionTimeout, log: false } - ).then((tx) => { - cy.wait_for_transaction(tx); - }); - } - }); -}; +Cypress.Commands.add( + 'vega_wallet_teardown_staking', + (stakingBridgeContract) => { + cy.highlight('Tearing down staking tokens from vega wallet if present'); + cy.wrap( + stakingBridgeContract.stakeBalance(ethWalletPubKey, vegaWalletPubKey), + { + timeout: transactionTimeout, + log: false, + } + ).then((stake_amount) => { + if (String(stake_amount) != '0') { + cy.wrap( + stakingBridgeContract.removeStake(stake_amount, vegaWalletPubKey), + { timeout: transactionTimeout, log: false } + ).then((tx) => { + cy.wait_for_transaction(tx); + }); + } + }); + } +); -cy.vega_wallet_teardown_vesting = (vestingContract) => { +Cypress.Commands.add('vega_wallet_teardown_vesting', (vestingContract) => { cy.highlight('Tearing down vesting tokens from vega wallet if present'); cy.wrap(vestingContract.stakeBalance(ethWalletPubKey, vegaWalletPubKey), { timeout: transactionTimeout, @@ -99,8 +102,8 @@ cy.vega_wallet_teardown_vesting = (vestingContract) => { }); } }); -}; +}); -cy.wait_for_transaction = (tx) => { +Cypress.Commands.add('wait_for_transaction', (tx) => { cy.wrap(tx.wait(1).catch(cy.log), { timeout: transactionTimeout }); -}; +}); diff --git a/apps/token-e2e/src/support/wallet-vega.functions.js b/apps/token-e2e/src/support/wallet-vega.functions.js index 684df9d66..3ab43139d 100644 --- a/apps/token-e2e/src/support/wallet-vega.functions.js +++ b/apps/token-e2e/src/support/wallet-vega.functions.js @@ -1,10 +1,10 @@ -import vegaWallet from '../locators/wallet-vega.locators'; - +const vegaWalletContainer = '[data-testid="vega-wallet"]'; +const restConnectorForm = '[data-testid="rest-connector-form"]'; const vegaWalletName = Cypress.env('vegaWalletName'); const vegaWalletLocation = Cypress.env('vegaWalletLocation'); const vegaWalletPassphrase = Cypress.env('vegaWalletPassphrase'); -cy.vega_wallet_import = () => { +Cypress.Commands.add('vega_wallet_import', () => { cy.highlight(`Importing Vega Wallet ${vegaWalletName}`); cy.exec(`vegawallet init -f --home ${vegaWalletLocation}`); cy.exec( @@ -14,11 +14,11 @@ cy.vega_wallet_import = () => { cy.exec( `vegawallet service run --network DV --automatic-consent --home ${vegaWalletLocation}` ); -}; +}); -cy.vega_wallet_connect = () => { +Cypress.Commands.add('vega_wallet_connect', () => { cy.highlight('Connecting Vega Wallet'); - cy.get(vegaWallet.walletContainer).within(() => { + cy.get(vegaWalletContainer).within(() => { cy.get('button') .contains('Connect Vega wallet to use associated $VEGA') .should('be.enabled') @@ -26,31 +26,31 @@ cy.vega_wallet_connect = () => { .click({ force: true }); }); cy.get('button').contains('rest provider').click(); - cy.get(vegaWallet.connectRestForm).within(() => { - cy.get(vegaWallet.name).click().type(vegaWalletName); - cy.get(vegaWallet.passphrase).click().type(vegaWalletPassphrase); + cy.get(restConnectorForm).within(() => { + cy.get('#wallet').click().type(vegaWalletName); + cy.get('#passphrase').click().type(vegaWalletPassphrase); cy.get('button').contains('Connect').click(); }); cy.contains(`${vegaWalletName} key`, { timeout: 20000 }).should('be.visible'); -}; +}); -cy.vega_wallet_check_unstaked_value_is = (expectedVal) => { +Cypress.Commands.add('vega_wallet_check_unstaked_value_is', (expectedVal) => { cy.highlight(`Checking vega wallet - Unstaked Value is ${expectedVal}`); - cy.get(vegaWallet.walletContainer).within(() => { + cy.get(vegaWalletContainer).within(() => { cy.contains('Unstaked', { timeout: 40000 }) .siblings() .contains(expectedVal, { timeout: 40000 }) .should('be.visible'); }); -}; +}); -cy.vega_wallet_check_associated_value_is = (expectedVal) => { +Cypress.Commands.add('vega_wallet_check_associated_value_is', (expectedVal) => { cy.highlight(`Checking vega wallet - Associated Value is ${expectedVal}`); - cy.get(vegaWallet.walletContainer).within(() => { + cy.get(vegaWalletContainer).within(() => { cy.contains('Associated', { timeout: 40000 }) .parent() .siblings() .contains(expectedVal, { timeout: 40000 }) .should('be.visible'); }); -}; +}); From c32dae6eb9cd0e162e91004796e9a403cac3196e Mon Sep 17 00:00:00 2001 From: botond <105208209+notbot00@users.noreply.github.com> Date: Tue, 12 Jul 2022 17:34:54 +0100 Subject: [PATCH 16/27] Feat/676 node switcher hosts (#698) * feat: add node swicther * chore: remove hook form from node switcher * feat: generate apollo types and add tests * fix: format * fix: types * fix: remove redundant wrapper * fix: layout styles * fix: add controlled value to radio group * fix: flaky node hook test * feat: hook in node switcher to the explorer & token footer info * fix: cache key handling for env config * fix: env type in tests * fix: format again * fix: use netlify git env vars * fix: remove commented styles * fix: replace clsx with classnames * fix: dialog sizes * fix: fetch config by default * fix: format * fix: dialog close --- libs/environment/.eslintrc.json | 2 +- libs/environment/src/components/index.ts | 2 + .../components/node-switcher-dialog/index.tsx | 1 + .../node-switcher-dialog.tsx | 27 ++ .../__generated__/BlockHeightStats.ts | 23 ++ .../src/components/node-switcher/index.tsx | 1 + .../components/node-switcher/layout-cell.tsx | 26 ++ .../components/node-switcher/layout-row.tsx | 13 + .../node-switcher/node-block-height.tsx | 46 +++ .../components/node-switcher/node-error.tsx | 3 + .../components/node-switcher/node-stats.tsx | 142 ++++++++++ .../node-switcher/node-switcher.tsx | 113 ++++++++ .../src/hooks/__generated__/BlockTime.ts | 23 ++ .../src/hooks/__generated__/Statistics.ts | 27 ++ .../environment/src/hooks/use-config.spec.tsx | 23 +- libs/environment/src/hooks/use-config.tsx | 27 +- .../src/hooks/use-environment.spec.tsx | 41 ++- .../environment/src/hooks/use-environment.tsx | 26 +- libs/environment/src/hooks/use-node.spec.tsx | 267 ++++++++++++++++++ libs/environment/src/hooks/use-node.tsx | 188 ++++++++++++ libs/environment/src/types.ts | 14 + libs/environment/src/utils/apollo-client.tsx | 71 +++++ .../src/utils/validate-environment.ts | 16 +- libs/network-info/src/network-info.tsx | 112 ++++---- .../src/components/dialog/dialog.tsx | 2 +- .../components/radio-group/radio-group.tsx | 31 +- 26 files changed, 1150 insertions(+), 117 deletions(-) create mode 100644 libs/environment/src/components/node-switcher-dialog/index.tsx create mode 100644 libs/environment/src/components/node-switcher-dialog/node-switcher-dialog.tsx create mode 100644 libs/environment/src/components/node-switcher/__generated__/BlockHeightStats.ts create mode 100644 libs/environment/src/components/node-switcher/index.tsx create mode 100644 libs/environment/src/components/node-switcher/layout-cell.tsx create mode 100644 libs/environment/src/components/node-switcher/layout-row.tsx create mode 100644 libs/environment/src/components/node-switcher/node-block-height.tsx create mode 100644 libs/environment/src/components/node-switcher/node-error.tsx create mode 100644 libs/environment/src/components/node-switcher/node-stats.tsx create mode 100644 libs/environment/src/components/node-switcher/node-switcher.tsx create mode 100644 libs/environment/src/hooks/__generated__/BlockTime.ts create mode 100644 libs/environment/src/hooks/__generated__/Statistics.ts create mode 100644 libs/environment/src/hooks/use-node.spec.tsx create mode 100644 libs/environment/src/hooks/use-node.tsx create mode 100644 libs/environment/src/utils/apollo-client.tsx diff --git a/libs/environment/.eslintrc.json b/libs/environment/.eslintrc.json index 734ddacee..db820c5d0 100644 --- a/libs/environment/.eslintrc.json +++ b/libs/environment/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], + "ignorePatterns": ["!**/*", "__generated__"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/environment/src/components/index.ts b/libs/environment/src/components/index.ts index ec29fafd4..34e06b5c6 100644 --- a/libs/environment/src/components/index.ts +++ b/libs/environment/src/components/index.ts @@ -1,3 +1,5 @@ export * from './network-loader'; export * from './network-switcher'; export * from './network-switcher-dialog'; +export * from './node-switcher'; +export * from './node-switcher-dialog'; diff --git a/libs/environment/src/components/node-switcher-dialog/index.tsx b/libs/environment/src/components/node-switcher-dialog/index.tsx new file mode 100644 index 000000000..cc6231794 --- /dev/null +++ b/libs/environment/src/components/node-switcher-dialog/index.tsx @@ -0,0 +1 @@ +export * from './node-switcher-dialog'; diff --git a/libs/environment/src/components/node-switcher-dialog/node-switcher-dialog.tsx b/libs/environment/src/components/node-switcher-dialog/node-switcher-dialog.tsx new file mode 100644 index 000000000..680be87f7 --- /dev/null +++ b/libs/environment/src/components/node-switcher-dialog/node-switcher-dialog.tsx @@ -0,0 +1,27 @@ +import type { ComponentProps } from 'react'; +import { Dialog } from '@vegaprotocol/ui-toolkit'; +import { NodeSwitcher } from '../node-switcher'; + +type NodeSwitcherDialogProps = ComponentProps & { + dialogOpen: boolean; + toggleDialogOpen: (dialogOpen: boolean) => void; +}; + +export const NodeSwitcherDialog = ({ + config, + dialogOpen, + toggleDialogOpen, + onConnect, +}: NodeSwitcherDialogProps) => { + return ( + + { + onConnect(url); + toggleDialogOpen(false); + }} + /> + + ); +}; diff --git a/libs/environment/src/components/node-switcher/__generated__/BlockHeightStats.ts b/libs/environment/src/components/node-switcher/__generated__/BlockHeightStats.ts new file mode 100644 index 000000000..574ae149e --- /dev/null +++ b/libs/environment/src/components/node-switcher/__generated__/BlockHeightStats.ts @@ -0,0 +1,23 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: BlockHeightStats +// ==================================================== + +export interface BlockHeightStats_statistics { + __typename: "Statistics"; + /** + * Current block number + */ + blockHeight: string; +} + +export interface BlockHeightStats { + /** + * get statistics about the vega node + */ + statistics: BlockHeightStats_statistics; +} diff --git a/libs/environment/src/components/node-switcher/index.tsx b/libs/environment/src/components/node-switcher/index.tsx new file mode 100644 index 000000000..b1acd80e3 --- /dev/null +++ b/libs/environment/src/components/node-switcher/index.tsx @@ -0,0 +1 @@ +export * from './node-switcher'; diff --git a/libs/environment/src/components/node-switcher/layout-cell.tsx b/libs/environment/src/components/node-switcher/layout-cell.tsx new file mode 100644 index 000000000..c60063037 --- /dev/null +++ b/libs/environment/src/components/node-switcher/layout-cell.tsx @@ -0,0 +1,26 @@ +import type { ReactNode } from 'react'; +import classnames from 'classnames'; +import { t } from '@vegaprotocol/react-helpers'; + +type LayoutCellProps = { + hasError?: boolean; + isLoading?: boolean; + children?: ReactNode; +}; + +export const LayoutCell = ({ + hasError, + isLoading, + children, +}: LayoutCellProps) => { + return ( +
+ {isLoading ? t('Checking') : children || '-'} +
+ ); +}; diff --git a/libs/environment/src/components/node-switcher/layout-row.tsx b/libs/environment/src/components/node-switcher/layout-row.tsx new file mode 100644 index 000000000..d2b274d8e --- /dev/null +++ b/libs/environment/src/components/node-switcher/layout-row.tsx @@ -0,0 +1,13 @@ +import type { ReactNode } from 'react'; + +type LayoutRowProps = { + children?: ReactNode; +}; + +export const LayoutRow = ({ children }: LayoutRowProps) => { + return ( +
+ {children} +
+ ); +}; diff --git a/libs/environment/src/components/node-switcher/node-block-height.tsx b/libs/environment/src/components/node-switcher/node-block-height.tsx new file mode 100644 index 000000000..6d02cb2a7 --- /dev/null +++ b/libs/environment/src/components/node-switcher/node-block-height.tsx @@ -0,0 +1,46 @@ +import { useEffect } from 'react'; +import { gql, useQuery } from '@apollo/client'; +import type { BlockHeightStats } from './__generated__/BlockHeightStats'; + +type NodeBlockHeightProps = { + value?: number; + setValue: (value: number) => void; +}; + +const POLL_INTERVAL = 3000; + +const BLOCK_HEIGHT_QUERY = gql` + query BlockHeightStats { + statistics { + blockHeight + } + } +`; + +export const NodeBlockHeight = ({ value, setValue }: NodeBlockHeightProps) => { + const { data, startPolling, stopPolling } = useQuery( + BLOCK_HEIGHT_QUERY, + { + pollInterval: POLL_INTERVAL, + } + ); + + useEffect(() => { + const handleStartPoll = () => startPolling(POLL_INTERVAL); + const handleStopPoll = () => stopPolling(); + window.addEventListener('blur', handleStopPoll); + window.addEventListener('focus', handleStartPoll); + return () => { + window.removeEventListener('blur', handleStopPoll); + window.removeEventListener('focus', handleStartPoll); + }; + }, [startPolling, stopPolling]); + + useEffect(() => { + if (data?.statistics?.blockHeight) { + setValue(Number(data.statistics.blockHeight)); + } + }, [setValue, data?.statistics?.blockHeight]); + + return {value ?? '-'}; +}; diff --git a/libs/environment/src/components/node-switcher/node-error.tsx b/libs/environment/src/components/node-switcher/node-error.tsx new file mode 100644 index 000000000..97e316117 --- /dev/null +++ b/libs/environment/src/components/node-switcher/node-error.tsx @@ -0,0 +1,3 @@ +export const NodeError = () => { + return
; +}; diff --git a/libs/environment/src/components/node-switcher/node-stats.tsx b/libs/environment/src/components/node-switcher/node-stats.tsx new file mode 100644 index 000000000..c6e55fcb1 --- /dev/null +++ b/libs/environment/src/components/node-switcher/node-stats.tsx @@ -0,0 +1,142 @@ +import type { ReactNode } from 'react'; +import { useEffect, useState, useCallback } from 'react'; +import { ApolloProvider } from '@apollo/client'; +import { t } from '@vegaprotocol/react-helpers'; +import type { NodeData } from '../../types'; +import { createClient } from '../../utils/apollo-client'; +import { useNode } from '../../hooks/use-node'; +import { LayoutRow } from './layout-row'; +import { LayoutCell } from './layout-cell'; +import { NodeBlockHeight } from './node-block-height'; + +type NodeStatsContentProps = { + data: NodeData; + highestBlock: number; + setBlock: (value: number) => void; + children: ReactNode; +}; + +const getResponseTimeDisplayValue = ( + responseTime: NodeData['responseTime'] +) => { + if (typeof responseTime.value === 'number') { + return `${Number(responseTime.value).toFixed(2)}ms`; + } + if (responseTime.hasError) { + return t('n/a'); + } + return '-'; +}; + +const getBlockDisplayValue = (block: NodeData['block']) => { + if (block.value) { + return ''; + } + if (block.hasError) { + return t('n/a'); + } + return '-'; +}; + +const getSslDisplayValue = (ssl: NodeData['ssl']) => { + if (ssl.value) { + return t('Yes'); + } + if (ssl.hasError) { + return t('No'); + } + return '-'; +}; + +const NodeStatsContent = ({ + data: { url, responseTime, block, ssl }, + highestBlock, + setBlock, + children, +}: NodeStatsContentProps) => { + return ( + + {children} + + {getResponseTimeDisplayValue(responseTime)} + + block.value) + } + > + {url && block.value && ( + + )} + {getBlockDisplayValue(block)} + + + {getSslDisplayValue(ssl)} + + + ); +}; + +type WrapperProps = { + client?: ReturnType; + children: ReactNode; +}; + +const Wrapper = ({ client, children }: WrapperProps) => { + if (client) { + return {children}; + } + // eslint-disable-next-line react/jsx-no-useless-fragment + return <>{children}; +}; + +export type NodeStatsProps = { + url?: string; + highestBlock: number; + setBlock: (value: number) => void; + render: (data: NodeData) => ReactNode; +}; + +export const NodeStats = ({ + url, + highestBlock, + render, + setBlock, +}: NodeStatsProps) => { + const [client, setClient] = useState< + undefined | ReturnType + >(); + const { state, reset, updateBlockState } = useNode(url, client); + + useEffect(() => { + client?.stop(); + reset(); + setClient(url ? createClient(url) : undefined); + return () => client?.stop(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [url]); + + const onHandleBlockChange = useCallback( + (value: number) => { + updateBlockState(value); + setBlock(value); + }, + [updateBlockState, setBlock] + ); + + return ( + + + {render(state)} + + + ); +}; diff --git a/libs/environment/src/components/node-switcher/node-switcher.tsx b/libs/environment/src/components/node-switcher/node-switcher.tsx new file mode 100644 index 000000000..54401f1de --- /dev/null +++ b/libs/environment/src/components/node-switcher/node-switcher.tsx @@ -0,0 +1,113 @@ +import { useState } from 'react'; +import { t } from '@vegaprotocol/react-helpers'; +import { RadioGroup, Button, Radio } from '@vegaprotocol/ui-toolkit'; +import { useEnvironment } from '../../hooks/use-environment'; +import type { Configuration, NodeData, Networks } from '../../types'; +import { LayoutRow } from './layout-row'; +import { LayoutCell } from './layout-cell'; +import { NodeError } from './node-error'; +import { NodeStats } from './node-stats'; + +type NodeSwitcherProps = { + error?: string; + config: Configuration; + onConnect: (url: string) => void; +}; + +const getDefaultNode = (urls: string[], currentUrl?: string) => { + return currentUrl && urls.includes(currentUrl) ? currentUrl : undefined; +}; + +const getIsLoading = ({ chain, responseTime, block, ssl }: NodeData) => { + return ( + chain.isLoading || + responseTime.isLoading || + block.isLoading || + ssl.isLoading + ); +}; + +const getHasMatchingChain = (env: Networks, chain?: string) => { + return chain?.includes(env.toLowerCase()) ?? false; +}; + +const getIsDisabled = (env: Networks, data: NodeData) => { + const { chain, responseTime, block, ssl } = data; + return ( + !getHasMatchingChain(env, data.chain.value) || + getIsLoading(data) || + chain.hasError || + responseTime.hasError || + block.hasError || + ssl.hasError + ); +}; + +export const NodeSwitcher = ({ config, onConnect }: NodeSwitcherProps) => { + const { VEGA_ENV, VEGA_URL } = useEnvironment(); + const [node, setNode] = useState(getDefaultNode(config.hosts, VEGA_URL)); + const [highestBlock, setHighestBlock] = useState(0); + + const onSubmit = (node: ReturnType) => { + if (node) { + onConnect(node); + } + }; + + const isSubmitDisabled = !node; + + return ( +
+ +
onSubmit(node)}> +

+ {t('Select a GraphQL node to connect to:')} +

+
+ +
+ {t('Response time')} + {t('Block')} + {t('SSL')} + + setNode(value)} + > +
+ {config.hosts.map((url, index) => ( + + setHighestBlock(Math.max(block, highestBlock)) + } + render={(data) => ( +
+ +
+ )} + /> + ))} +
+
+
+ + +
+ ); +}; diff --git a/libs/environment/src/hooks/__generated__/BlockTime.ts b/libs/environment/src/hooks/__generated__/BlockTime.ts new file mode 100644 index 000000000..7f6cc2895 --- /dev/null +++ b/libs/environment/src/hooks/__generated__/BlockTime.ts @@ -0,0 +1,23 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL subscription operation: BlockTime +// ==================================================== + +export interface BlockTime_busEvents { + __typename: "BusEvent"; + /** + * the id for this event + */ + eventId: string; +} + +export interface BlockTime { + /** + * Subscribe to event data from the event bus + */ + busEvents: BlockTime_busEvents[] | null; +} diff --git a/libs/environment/src/hooks/__generated__/Statistics.ts b/libs/environment/src/hooks/__generated__/Statistics.ts new file mode 100644 index 000000000..90d1d3ea2 --- /dev/null +++ b/libs/environment/src/hooks/__generated__/Statistics.ts @@ -0,0 +1,27 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: Statistics +// ==================================================== + +export interface Statistics_statistics { + __typename: "Statistics"; + /** + * Current chain id + */ + chainId: string; + /** + * Current block number + */ + blockHeight: string; +} + +export interface Statistics { + /** + * get statistics about the vega node + */ + statistics: Statistics_statistics; +} diff --git a/libs/environment/src/hooks/use-config.spec.tsx b/libs/environment/src/hooks/use-config.spec.tsx index ed9a54d0c..8e88761fe 100644 --- a/libs/environment/src/hooks/use-config.spec.tsx +++ b/libs/environment/src/hooks/use-config.spec.tsx @@ -20,6 +20,10 @@ const mockEnvironment: EnvironmentWithOptionalUrl = { VEGA_NETWORKS: {}, ETHEREUM_PROVIDER_URL: 'https://ethereum.provider', ETHERSCAN_URL: 'https://etherscan.url', + GIT_BRANCH: 'test', + GIT_ORIGIN_URL: 'https://github.com/test/repo', + GIT_COMMIT_HASH: 'abcde01234', + GITHUB_FEEDBACK_URL: 'https://github.com/test/feedback', }; function setupFetch(configUrl: string, hostMap: HostMapping) { @@ -77,18 +81,6 @@ afterAll(() => { }); describe('useConfig hook', () => { - it('has an initial success state when the environment already has a URL', async () => { - const mockEnvWithUrl = { - ...mockEnvironment, - VEGA_URL: 'https://some.url/query', - }; - const { result } = renderHook(() => useConfig(mockEnvWithUrl, mockUpdate)); - - expect(fetch).not.toHaveBeenCalled(); - expect(mockUpdate).not.toHaveBeenCalled(); - expect(result.current.status).toBe('success'); - }); - it('updates the environment with a host url from the network configuration', async () => { const allowedStatuses = [ 'idle', @@ -273,7 +265,10 @@ describe('useConfig hook', () => { }); it('refetches the network configuration and resets the cache when malformed data found in the storage', async () => { - window.localStorage.setItem(LOCAL_STORAGE_NETWORK_KEY, '{not:{valid:{json'); + window.localStorage.setItem( + `${LOCAL_STORAGE_NETWORK_KEY}-${mockEnvironment.VEGA_ENV}`, + '{not:{valid:{json' + ); const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(noop); const run1 = renderHook(() => useConfig(mockEnvironment, mockUpdate)); @@ -291,7 +286,7 @@ describe('useConfig hook', () => { it('refetches the network configuration and resets the cache when invalid data found in the storage', async () => { window.localStorage.setItem( - LOCAL_STORAGE_NETWORK_KEY, + `${LOCAL_STORAGE_NETWORK_KEY}-${mockEnvironment.VEGA_ENV}`, JSON.stringify({ invalid: 'data' }) ); const consoleSpy = jest.spyOn(console, 'warn').mockImplementation(noop); diff --git a/libs/environment/src/hooks/use-config.tsx b/libs/environment/src/hooks/use-config.tsx index 205a882da..9c034b691 100644 --- a/libs/environment/src/hooks/use-config.tsx +++ b/libs/environment/src/hooks/use-config.tsx @@ -1,7 +1,12 @@ import type { Dispatch, SetStateAction } from 'react'; import { useState, useEffect } from 'react'; import { LocalStorage } from '@vegaprotocol/react-helpers'; -import type { Environment, Configuration, ConfigStatus } from '../types'; +import type { + Environment, + Configuration, + ConfigStatus, + Networks, +} from '../types'; import { validateConfiguration } from '../utils/validate-configuration'; import { promiseRaceToSuccess } from '../utils/promise-race-success'; @@ -18,8 +23,11 @@ const requestToNode = async (url: string, index: number): Promise => { return index; }; -const getCachedConfig = () => { - const value = LocalStorage.getItem(LOCAL_STORAGE_NETWORK_KEY); +const getCacheKey = (env: Networks) => `${LOCAL_STORAGE_NETWORK_KEY}-${env}`; + +const getCachedConfig = (env: Networks) => { + const key = getCacheKey(env); + const value = LocalStorage.getItem(key); if (value) { try { @@ -32,7 +40,7 @@ const getCachedConfig = () => { return config; } catch (err) { - LocalStorage.removeItem(LOCAL_STORAGE_NETWORK_KEY); + LocalStorage.removeItem(key); console.warn( 'Malformed data found for network configuration. Removed and continuing...' ); @@ -47,10 +55,10 @@ export const useConfig = ( updateEnvironment: Dispatch> ) => { const [config, setConfig] = useState( - getCachedConfig() + getCachedConfig(environment.VEGA_ENV) ); const [status, setStatus] = useState( - !environment.VEGA_URL ? 'idle' : 'success' + environment.VEGA_CONFIG_URL ? 'idle' : 'success' ); useEffect(() => { @@ -68,7 +76,7 @@ export const useConfig = ( setConfig({ hosts: configData.hosts }); LocalStorage.setItem( - LOCAL_STORAGE_NETWORK_KEY, + getCacheKey(environment.VEGA_ENV), JSON.stringify({ hosts: configData.hosts }) ); } catch (err) { @@ -93,7 +101,7 @@ export const useConfig = ( setStatus('success'); updateEnvironment((prevEnvironment) => ({ ...prevEnvironment, - VEGA_URL: config.hosts[0], + VEGA_URL: prevEnvironment.VEGA_URL || config.hosts[0], })); return; } @@ -105,7 +113,7 @@ export const useConfig = ( setStatus('success'); updateEnvironment((prevEnvironment) => ({ ...prevEnvironment, - VEGA_URL: config.hosts[index], + VEGA_URL: prevEnvironment.VEGA_URL || config.hosts[index], })); } catch (err) { setStatus('error-loading-node'); @@ -118,5 +126,6 @@ export const useConfig = ( return { status, + config, }; }; diff --git a/libs/environment/src/hooks/use-environment.spec.tsx b/libs/environment/src/hooks/use-environment.spec.tsx index 78ce13216..da54029f0 100644 --- a/libs/environment/src/hooks/use-environment.spec.tsx +++ b/libs/environment/src/hooks/use-environment.spec.tsx @@ -44,6 +44,7 @@ const mockEnvironmentState: EnvironmentState = { GIT_ORIGIN_URL: 'https://github.com/test/repo', GIT_COMMIT_HASH: 'abcde01234', GITHUB_FEEDBACK_URL: 'https://github.com/test/feedback', + setNodeSwitcherOpen: noop, }; beforeEach(() => { @@ -81,18 +82,26 @@ afterAll(() => { delete process.env['NX_ETHEREUM_PROVIDER_URL']; delete process.env['NX_ETHERSCAN_URL']; delete process.env['NX_VEGA_NETWORKS']; + delete process.env['NX_GIT_BRANCH']; + delete process.env['NX_GIT_ORIGIN_URL']; + delete process.env['NX_GIT_COMMIT_HASH']; + delete process.env['NX_GITHUB_FEEDBACK_URL']; }); describe('useEnvironment hook', () => { - it('transforms and exposes values from the environment', () => { - const { result } = renderHook(() => useEnvironment(), { + it('transforms and exposes values from the environment', async () => { + const { result, waitForNextUpdate } = renderHook(() => useEnvironment(), { wrapper: MockWrapper, }); + await waitForNextUpdate(); expect(result.error).toBe(undefined); - expect(result.current).toEqual(mockEnvironmentState); + expect(result.current).toEqual({ + ...mockEnvironmentState, + setNodeSwitcherOpen: result.current.setNodeSwitcherOpen, + }); }); - it('allows for the VEGA_CONFIG_URL to be missing when there is a VEGA_URL present', () => { + it('allows for the VEGA_CONFIG_URL to be missing when there is a VEGA_URL present', async () => { delete process.env['NX_VEGA_CONFIG_URL']; const { result } = renderHook(() => useEnvironment(), { wrapper: MockWrapper, @@ -101,6 +110,7 @@ describe('useEnvironment hook', () => { expect(result.current).toEqual({ ...mockEnvironmentState, VEGA_CONFIG_URL: undefined, + setNodeSwitcherOpen: result.current.setNodeSwitcherOpen, }); }); @@ -115,18 +125,21 @@ describe('useEnvironment hook', () => { expect(result.current).toEqual({ ...mockEnvironmentState, VEGA_URL: MOCK_HOST, + setNodeSwitcherOpen: result.current.setNodeSwitcherOpen, }); }); - it('allows for the VEGA_NETWORKS to be missing from the environment', () => { + it('allows for the VEGA_NETWORKS to be missing from the environment', async () => { delete process.env['NX_VEGA_NETWORKS']; - const { result } = renderHook(() => useEnvironment(), { + const { result, waitForNextUpdate } = renderHook(() => useEnvironment(), { wrapper: MockWrapper, }); + await waitForNextUpdate(); expect(result.error).toBe(undefined); expect(result.current).toEqual({ ...mockEnvironmentState, VEGA_NETWORKS: {}, + setNodeSwitcherOpen: result.current.setNodeSwitcherOpen, }); }); @@ -140,7 +153,7 @@ describe('useEnvironment hook', () => { ); }); - it('throws a validation error when VEGA_ENV is not a valid network', () => { + it('throws a validation error when VEGA_ENV is not a valid network', async () => { process.env['NX_VEGA_ENV'] = 'SOMETHING'; const { result } = renderHook(() => useEnvironment(), { wrapper: MockWrapper, @@ -150,23 +163,25 @@ describe('useEnvironment hook', () => { ); }); - it('when VEGA_NETWORKS is not a valid json, prints a warning and continues without using the value from it', () => { + it('when VEGA_NETWORKS is not a valid json, prints a warning and continues without using the value from it', async () => { const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(noop); process.env['NX_VEGA_NETWORKS'] = '{not:{valid:json'; - const { result } = renderHook(() => useEnvironment(), { + const { result, waitForNextUpdate } = renderHook(() => useEnvironment(), { wrapper: MockWrapper, }); + await waitForNextUpdate(); expect(result.error).toBe(undefined); expect(result.current).toEqual({ ...mockEnvironmentState, VEGA_NETWORKS: {}, + setNodeSwitcherOpen: result.current.setNodeSwitcherOpen, }); expect(consoleWarnSpy).toHaveBeenCalled(); consoleWarnSpy.mockRestore(); }); - it('throws a validation error when VEGA_NETWORKS is has an invalid network as a key', () => { + it('throws a validation error when VEGA_NETWORKS is has an invalid network as a key', async () => { process.env['NX_VEGA_NETWORKS'] = JSON.stringify({ NOT_A_NETWORK: 'https://somewhere.url', }); @@ -178,7 +193,7 @@ describe('useEnvironment hook', () => { ); }); - it('throws a validation error when both VEGA_URL and VEGA_CONFIG_URL are missing in the environment', () => { + it('throws a validation error when both VEGA_URL and VEGA_CONFIG_URL are missing in the environment', async () => { delete process.env['NX_VEGA_URL']; delete process.env['NX_VEGA_CONFIG_URL']; const { result } = renderHook(() => useEnvironment(), { @@ -202,15 +217,17 @@ describe('useEnvironment hook', () => { process.env['NX_VEGA_ENV'] = env; delete process.env['NX_ETHEREUM_PROVIDER_URL']; delete process.env['NX_ETHERSCAN_URL']; - const { result } = renderHook(() => useEnvironment(), { + const { result, waitForNextUpdate } = renderHook(() => useEnvironment(), { wrapper: MockWrapper, }); + await waitForNextUpdate(); expect(result.error).toBe(undefined); expect(result.current).toEqual({ ...mockEnvironmentState, VEGA_ENV: env, ETHEREUM_PROVIDER_URL: providerUrl, ETHERSCAN_URL: etherscanUrl, + setNodeSwitcherOpen: result.current.setNodeSwitcherOpen, }); } ); diff --git a/libs/environment/src/hooks/use-environment.tsx b/libs/environment/src/hooks/use-environment.tsx index c9a6d7f4d..c324e6949 100644 --- a/libs/environment/src/hooks/use-environment.tsx +++ b/libs/environment/src/hooks/use-environment.tsx @@ -1,6 +1,7 @@ import type { ReactNode } from 'react'; import { useState, createContext, useContext } from 'react'; +import { NodeSwitcherDialog } from '../components/node-switcher-dialog'; import { useConfig } from './use-config'; import { compileEnvironment } from '../utils/compile-environment'; import { validateEnvironment } from '../utils/validate-environment'; @@ -13,6 +14,7 @@ type EnvironmentProviderProps = { export type EnvironmentState = Environment & { configStatus: ConfigStatus; + setNodeSwitcherOpen: () => void; }; const EnvironmentContext = createContext({} as EnvironmentState); @@ -21,10 +23,14 @@ export const EnvironmentProvider = ({ definitions, children, }: EnvironmentProviderProps) => { + const [isNodeSwitcherOpen, setNodeSwitcherOpen] = useState(false); const [environment, updateEnvironment] = useState( compileEnvironment(definitions) ); - const { status: configStatus } = useConfig(environment, updateEnvironment); + const { status: configStatus, config } = useConfig( + environment, + updateEnvironment + ); const errorMessage = validateEnvironment(environment); @@ -33,7 +39,23 @@ export const EnvironmentProvider = ({ } return ( - + setNodeSwitcherOpen(true), + }} + > + {config && ( + + updateEnvironment((env) => ({ ...env, VEGA_URL: url })) + } + /> + )} {children} ); diff --git a/libs/environment/src/hooks/use-node.spec.tsx b/libs/environment/src/hooks/use-node.spec.tsx new file mode 100644 index 000000000..4b255316e --- /dev/null +++ b/libs/environment/src/hooks/use-node.spec.tsx @@ -0,0 +1,267 @@ +import { renderHook, act } from '@testing-library/react-hooks'; +import { MockedProvider } from '@apollo/client/testing'; + +import { useNode, STATS_QUERY, TIME_UPDATE_SUBSCRIPTION } from './use-node'; + +const MOCK_DURATION = 1073; + +const MOCK_STATISTICS_QUERY_RESULT = { + blockHeight: '11', + chainId: 'testnet_01234', +}; + +const initialState = { + url: '', + responseTime: { + isLoading: false, + hasError: false, + value: undefined, + }, + block: { + isLoading: false, + hasError: false, + value: undefined, + }, + ssl: { + isLoading: false, + hasError: false, + value: undefined, + }, + chain: { + isLoading: false, + hasError: false, + value: undefined, + }, +}; + +const createMockClient = ({ + failStats = false, + failSubscription = false, +}: { failStats?: boolean; failSubscription?: boolean } = {}) => { + const provider = new MockedProvider({ + mocks: [ + { + request: { + query: STATS_QUERY, + }, + result: failStats + ? undefined + : { + data: { + statistics: { + __typename: 'Statistics', + ...MOCK_STATISTICS_QUERY_RESULT, + }, + }, + }, + }, + { + request: { + query: TIME_UPDATE_SUBSCRIPTION, + }, + result: failSubscription + ? undefined + : { + data: { + busEvents: { + eventId: 'time-0', + }, + }, + }, + }, + ], + }); + + return provider.state.client; +}; + +window.performance.getEntriesByName = jest + .fn() + .mockImplementation((url: string) => [ + { + entryType: 'resource', + name: url, + startTime: 0, + toJSON: () => ({}), + duration: MOCK_DURATION, + }, + ]); + +afterAll(() => { + // @ts-ignore allow deleting the spy function after we're done with the tests + delete window.performance.getEntriesByName; +}); + +describe('useNode hook', () => { + it('returns the default state when no arguments provided', () => { + const { result } = renderHook(() => useNode()); + expect(result.current.state).toEqual(initialState); + }); + + it('returns the default state when no url provided', () => { + const client = createMockClient(); + const { result } = renderHook(() => useNode(undefined, client)); + expect(result.current.state).toEqual(initialState); + }); + + it('returns the default state when no client provided', () => { + const url = 'https://some.url'; + const { result } = renderHook(() => useNode(url, undefined)); + expect(result.current.state).toEqual({ ...initialState, url }); + }); + + it('sets loading state while waiting for the results', async () => { + const url = 'https://some.url'; + const client = createMockClient(); + const { result, waitForNextUpdate } = renderHook(() => + useNode(url, client) + ); + + expect(result.current.state).toEqual({ + url, + responseTime: { + isLoading: true, + hasError: false, + value: undefined, + }, + block: { + isLoading: true, + hasError: false, + value: undefined, + }, + ssl: { + isLoading: true, + hasError: false, + value: undefined, + }, + chain: { + isLoading: true, + hasError: false, + value: undefined, + }, + }); + + await waitForNextUpdate(); + }); + + it('sets statistics results', async () => { + const url = 'https://some.url'; + const client = createMockClient(); + const { result, waitFor } = renderHook(() => useNode(url, client)); + + await waitFor(() => { + expect(result.current.state.block).toEqual({ + isLoading: false, + hasError: false, + value: Number(MOCK_STATISTICS_QUERY_RESULT.blockHeight), + }); + + expect(result.current.state.chain).toEqual({ + isLoading: false, + hasError: false, + value: MOCK_STATISTICS_QUERY_RESULT.chainId, + }); + + expect(result.current.state.responseTime).toEqual({ + isLoading: false, + hasError: false, + value: MOCK_DURATION, + }); + }); + }); + + it('sets subscription result', async () => { + const url = 'https://some.url'; + const client = createMockClient(); + const { result, waitFor } = renderHook(() => useNode(url, client)); + + await waitFor(() => { + expect(result.current.state.ssl).toEqual({ + isLoading: false, + hasError: false, + value: true, + }); + }); + }); + + it('sets error when statistics request fails', async () => { + const url = 'https://some.url'; + const client = createMockClient({ failStats: true }); + const { result, waitFor } = renderHook(() => useNode(url, client)); + + await waitFor(() => { + expect(result.current.state.block).toEqual({ + isLoading: false, + hasError: true, + value: undefined, + }); + + expect(result.current.state.chain).toEqual({ + isLoading: false, + hasError: true, + value: undefined, + }); + + expect(result.current.state.responseTime).toEqual({ + isLoading: false, + hasError: true, + value: undefined, + }); + }); + }); + + it('sets error when subscription request fails', async () => { + const url = 'https://some.url'; + const client = createMockClient({ failSubscription: true }); + const { result, waitFor } = renderHook(() => useNode(url, client)); + + await waitFor(() => { + expect(result.current.state.ssl).toEqual({ + isLoading: false, + hasError: true, + value: undefined, + }); + }); + }); + + it('allows updating block values', async () => { + const url = 'https://some.url'; + const client = createMockClient({ failSubscription: true }); + const { result, waitFor } = renderHook(() => useNode(url, client)); + + await waitFor(() => { + expect(result.current.state.block.value).toEqual(11); + }); + + act(() => { + result.current.updateBlockState(12); + }); + + await waitFor(() => { + expect(result.current.state.block.value).toEqual(12); + }); + }); + + it('allows resetting the state to defaults', async () => { + const url = 'https://some.url'; + const client = createMockClient(); + const { result, waitFor } = renderHook(() => useNode(url, client)); + + await waitFor(() => { + expect(result.current.state.block.value).toBe( + Number(MOCK_STATISTICS_QUERY_RESULT.blockHeight) + ); + expect(result.current.state.chain.value).toBe( + MOCK_STATISTICS_QUERY_RESULT.chainId + ); + expect(result.current.state.responseTime.value).toBe(MOCK_DURATION); + expect(result.current.state.ssl.value).toBe(true); + }); + + act(() => { + result.current.reset(); + }); + + expect(result.current.state).toEqual({ ...initialState, url }); + }); +}); diff --git a/libs/environment/src/hooks/use-node.tsx b/libs/environment/src/hooks/use-node.tsx new file mode 100644 index 000000000..74e59ad02 --- /dev/null +++ b/libs/environment/src/hooks/use-node.tsx @@ -0,0 +1,188 @@ +import { useEffect, useReducer } from 'react'; +import { produce } from 'immer'; +import { gql } from '@apollo/client'; +import type { createClient } from '../utils/apollo-client'; +import type { NodeData } from '../types'; +import type { Statistics } from './__generated__/Statistics'; + +type StatisticsPayload = { + block: NodeData['block']['value']; + chain: NodeData['chain']['value']; + responseTime: NodeData['responseTime']['value']; +}; + +export const STATS_QUERY = gql` + query Statistics { + statistics { + chainId + blockHeight + } + } +`; + +export const TIME_UPDATE_SUBSCRIPTION = gql` + subscription BlockTime { + busEvents(types: TimeUpdate, batchSize: 1) { + eventId + } + } +`; + +enum ACTION { + GET_STATISTICS, + GET_STATISTICS_SUCCESS, + GET_STATISTICS_FAILURE, + CHECK_SUBSCRIPTION, + CHECK_SUBSCRIPTION_SUCCESS, + CHECK_SUBSCRIPTION_FAILURE, + UPDATE_BLOCK, + RESET_STATE, +} + +function withData(value?: T) { + return { + isLoading: false, + hasError: false, + value, + }; +} + +function withError(value?: T) { + return { + isLoading: false, + hasError: true, + value, + }; +} + +const getInitialState = (url?: string): NodeData => ({ + url: url ?? '', + responseTime: withData(), + block: withData(), + ssl: withData(), + chain: withData(), +}); + +const getResponseTime = (url: string) => { + const requests = window.performance.getEntriesByName(url); + const { duration } = (requests.length && requests[requests.length - 1]) || {}; + return duration; +}; + +type ActionType = { + type: T; + payload?: P; +}; + +type Action = + | ActionType + | ActionType + | ActionType + | ActionType + | ActionType + | ActionType + | ActionType + | ActionType; + +const reducer = (state: NodeData, action: Action) => { + switch (action.type) { + case ACTION.GET_STATISTICS: + return produce(state, (state) => { + state.block.isLoading = true; + state.chain.isLoading = true; + state.responseTime.isLoading = true; + }); + case ACTION.GET_STATISTICS_SUCCESS: + return produce(state, (state) => { + state.block = withData(action.payload?.block); + state.chain = withData(action.payload?.chain); + state.responseTime = withData(action.payload?.responseTime); + }); + case ACTION.GET_STATISTICS_FAILURE: + return produce(state, (state) => { + state.block = withError(); + state.chain = withError(); + state.responseTime = withError(); + }); + case ACTION.CHECK_SUBSCRIPTION: + return produce(state, (state) => { + state.ssl.isLoading = true; + }); + case ACTION.CHECK_SUBSCRIPTION_SUCCESS: + return produce(state, (state) => { + state.ssl = withData(true); + }); + case ACTION.CHECK_SUBSCRIPTION_FAILURE: + return produce(state, (state) => { + state.ssl = withError(); + }); + case ACTION.UPDATE_BLOCK: + return produce(state, (state) => { + state.block.value = action.payload; + }); + case ACTION.RESET_STATE: + return produce(state, (state) => { + state.responseTime = withData(); + state.block = withData(); + state.ssl = withData(); + state.chain = withData(); + }); + default: + return state; + } +}; + +export const useNode = ( + url?: string, + client?: ReturnType +) => { + const [state, dispatch] = useReducer(reducer, getInitialState(url)); + + useEffect(() => { + if (client && url) { + dispatch({ type: ACTION.GET_STATISTICS }); + dispatch({ type: ACTION.CHECK_SUBSCRIPTION }); + + client + .query({ + query: STATS_QUERY, + }) + .then((res) => { + dispatch({ + type: ACTION.GET_STATISTICS_SUCCESS, + payload: { + chain: res.data.statistics.chainId, + block: Number(res.data.statistics.blockHeight), + responseTime: getResponseTime(url), + }, + }); + }) + .catch(() => { + dispatch({ type: ACTION.GET_STATISTICS_FAILURE }); + }); + + const subscription = client + .subscribe({ + query: TIME_UPDATE_SUBSCRIPTION, + errorPolicy: 'all', + }) + .subscribe({ + next() { + dispatch({ type: ACTION.CHECK_SUBSCRIPTION_SUCCESS }); + subscription.unsubscribe(); + }, + error() { + dispatch({ type: ACTION.CHECK_SUBSCRIPTION_FAILURE }); + subscription.unsubscribe(); + }, + }); + } + }, [client, url, dispatch]); + + return { + state, + updateBlockState: (value: number) => + dispatch({ type: ACTION.UPDATE_BLOCK, payload: value }), + reset: () => dispatch({ type: ACTION.RESET_STATE }), + }; +}; diff --git a/libs/environment/src/types.ts b/libs/environment/src/types.ts index 58a29a3db..08b3c9b69 100644 --- a/libs/environment/src/types.ts +++ b/libs/environment/src/types.ts @@ -25,3 +25,17 @@ export type ConfigStatus = | 'error-loading-config' | 'error-validating-config' | 'error-loading-node'; + +type NodeCheck = { + isLoading: boolean; + hasError: boolean; + value?: T; +}; + +export type NodeData = { + url: string; + ssl: NodeCheck; + block: NodeCheck; + responseTime: NodeCheck; + chain: NodeCheck; +}; diff --git a/libs/environment/src/utils/apollo-client.tsx b/libs/environment/src/utils/apollo-client.tsx new file mode 100644 index 000000000..e593c912a --- /dev/null +++ b/libs/environment/src/utils/apollo-client.tsx @@ -0,0 +1,71 @@ +import { + ApolloClient, + from, + split, + ApolloLink, + HttpLink, + InMemoryCache, +} from '@apollo/client'; +import { GraphQLWsLink } from '@apollo/client/link/subscriptions'; +import { getMainDefinition } from '@apollo/client/utilities'; +import { createClient as createWSClient } from 'graphql-ws'; +import { onError } from '@apollo/client/link/error'; +import { RetryLink } from '@apollo/client/link/retry'; + +const isBrowser = typeof window !== 'undefined'; + +export function createClient(base?: string) { + if (!base) { + throw new Error('Base must be passed into createClient!'); + } + const gqlPath = 'query'; + const urlHTTP = new URL(gqlPath, base); + const urlWS = new URL(gqlPath, base); + // Replace http with ws, preserving if its a secure connection eg. https => wss + urlWS.protocol = urlWS.protocol.replace('http', 'ws'); + + const retryLink = new RetryLink({ + delay: { + initial: 300, + max: 10000, + jitter: true, + }, + }); + + const httpLink = new HttpLink({ + uri: urlHTTP.href, + credentials: 'same-origin', + }); + + const wsLink = isBrowser + ? new GraphQLWsLink( + createWSClient({ + url: urlWS.href, + }) + ) + : new ApolloLink((operation, forward) => forward(operation)); + + const splitLink = isBrowser + ? split( + ({ query }) => { + const definition = getMainDefinition(query); + return ( + definition.kind === 'OperationDefinition' && + definition.operation === 'subscription' + ); + }, + wsLink, + httpLink + ) + : httpLink; + + const errorLink = onError(({ graphQLErrors, networkError }) => { + if (graphQLErrors) console.log(graphQLErrors); + if (networkError) console.log(networkError); + }); + + return new ApolloClient({ + link: from([errorLink, retryLink, splitLink]), + cache: new InMemoryCache(), + }); +} diff --git a/libs/environment/src/utils/validate-environment.ts b/libs/environment/src/utils/validate-environment.ts index 58c25434b..2289ab6a2 100644 --- a/libs/environment/src/utils/validate-environment.ts +++ b/libs/environment/src/utils/validate-environment.ts @@ -14,20 +14,13 @@ export enum Networks { const schemaObject = { VEGA_URL: z.optional(z.string()), - VEGA_EXPLORER_URL: z.optional(z.string()), VEGA_CONFIG_URL: z.optional(z.string()), - ETHEREUM_PROVIDER_URL: z.string().url({ - message: - 'The NX_ETHEREUM_PROVIDER_URL environment variable must be a valid url', - }), - ETHERSCAN_URL: z.string().url({ - message: 'The NX_ETHERSCAN_URL environment variable must be a valid url', - }), GIT_BRANCH: z.optional(z.string()), GIT_COMMIT_HASH: z.optional(z.string()), GIT_ORIGIN_URL: z.optional(z.string()), GITHUB_FEEDBACK_URL: z.optional(z.string()), VEGA_ENV: z.nativeEnum(Networks), + VEGA_EXPLORER_URL: z.optional(z.string()), VEGA_NETWORKS: z .object( Object.keys(Networks).reduce( @@ -43,6 +36,13 @@ const schemaObject = { Networks ).join(' | ')}`, }), + ETHEREUM_PROVIDER_URL: z.string().url({ + message: + 'The NX_ETHEREUM_PROVIDER_URL environment variable must be a valid url', + }), + ETHERSCAN_URL: z.string().url({ + message: 'The NX_ETHERSCAN_URL environment variable must be a valid url', + }), }; export const ENV_KEYS = Object.keys(schemaObject) as Array< diff --git a/libs/network-info/src/network-info.tsx b/libs/network-info/src/network-info.tsx index b20577358..5403aecc4 100644 --- a/libs/network-info/src/network-info.tsx +++ b/libs/network-info/src/network-info.tsx @@ -1,10 +1,6 @@ -import { useState } from 'react'; import { t } from '@vegaprotocol/react-helpers'; import { Link, Lozenge } from '@vegaprotocol/ui-toolkit'; -import { - useEnvironment, - NetworkSwitcherDialog, -} from '@vegaprotocol/environment'; +import { useEnvironment } from '@vegaprotocol/environment'; const getFeedbackLinks = (gitOriginUrl?: string) => [ @@ -15,77 +11,65 @@ const getFeedbackLinks = (gitOriginUrl?: string) => ].filter((link) => !!link.url); export const NetworkInfo = () => { - const [isNetworkConfigOpen, setNetworkConfigOpen] = useState(false); const { VEGA_URL, - VEGA_NETWORKS, GIT_COMMIT_HASH, GIT_ORIGIN_URL, GITHUB_FEEDBACK_URL, ETHEREUM_PROVIDER_URL, + setNodeSwitcherOpen, } = useEnvironment(); const feedbackLinks = getFeedbackLinks(GITHUB_FEEDBACK_URL); return ( - <> -
+
+

+ {t('Reading network data from')}{' '} + + {VEGA_URL} + + . setNodeSwitcherOpen()}>{t('Edit')} +

+

+ {t('Reading Ethereum data from')}{' '} + + {ETHEREUM_PROVIDER_URL} + + .{' '} +

+ {GIT_COMMIT_HASH && (

- {t('Reading network data from')}{' '} - - {VEGA_URL} - - . setNetworkConfigOpen(true)}>{t('Edit')} + {t('Version/commit hash')}:{' '} + + {GIT_COMMIT_HASH} +

-

- {t('Reading Ethereum data from')}{' '} - - {ETHEREUM_PROVIDER_URL} - - .{' '} + )} + {feedbackLinks.length > 0 && ( +

+ {t('Known issues and feedback on')}{' '} + {feedbackLinks.map(({ name, url }, index) => ( + <> + + {name} + + {feedbackLinks.length > 1 && + index < feedbackLinks.length - 2 && + ','} + {feedbackLinks.length > 1 && + index === feedbackLinks.length - 1 && + `, ${t('and')} `} + + ))}

- {GIT_COMMIT_HASH && ( -

- {t('Version/commit hash')}:{' '} - - {GIT_COMMIT_HASH} - -

- )} - {feedbackLinks.length > 0 && ( -

- {t('Known issues and feedback on')}{' '} - {feedbackLinks.map(({ name, url }, index) => ( - <> - - {name} - - {feedbackLinks.length > 1 && - index < feedbackLinks.length - 2 && - ','} - {feedbackLinks.length > 1 && - index === feedbackLinks.length - 1 && - `, ${t('and')} `} - - ))} -

- )} -
- { - if (VEGA_NETWORKS[network]) { - window.location.href = VEGA_NETWORKS[network] as string; - } - }} - /> - + )} +
); }; diff --git a/libs/ui-toolkit/src/components/dialog/dialog.tsx b/libs/ui-toolkit/src/components/dialog/dialog.tsx index 09f15aa88..3c29fdc2f 100644 --- a/libs/ui-toolkit/src/components/dialog/dialog.tsx +++ b/libs/ui-toolkit/src/components/dialog/dialog.tsx @@ -26,7 +26,7 @@ export function Dialog({ }: DialogProps) { const contentClasses = classNames( // Positions the modal in the center of screen - 'z-20 fixed w-full md:w-[520px] px-28 py-24 top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]', + 'z-20 fixed w-full md:w-[520px] lg:w-[1000px] px-28 py-24 top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]', // Need to apply background and text colors again as content is rendered in a portal 'dark:bg-black dark:text-white-95 bg-white text-black-95', getIntentShadow(intent), diff --git a/libs/ui-toolkit/src/components/radio-group/radio-group.tsx b/libs/ui-toolkit/src/components/radio-group/radio-group.tsx index 20348c07f..bf9f70321 100644 --- a/libs/ui-toolkit/src/components/radio-group/radio-group.tsx +++ b/libs/ui-toolkit/src/components/radio-group/radio-group.tsx @@ -5,17 +5,25 @@ import type { ReactNode } from 'react'; interface RadioGroupProps { name?: string; children: ReactNode; + className?: string; defaultValue?: string; value?: string; onChange?: (value: string) => void; } -export const RadioGroup = ({ children, onChange, name }: RadioGroupProps) => { +export const RadioGroup = ({ + children, + name, + value, + className, + onChange, +}: RadioGroupProps) => { return ( {children} @@ -26,12 +34,20 @@ interface RadioProps { id: string; value: string; label: string; + labelClassName?: string; disabled?: boolean; hasError?: boolean; } -export const Radio = ({ id, value, label, disabled, hasError }: RadioProps) => { - const wrapperClasses = classNames('flex flex-row gap-8 items-center', { +export const Radio = ({ + id, + value, + label, + labelClassName, + disabled, + hasError, +}: RadioProps) => { + const wrapperClasses = classNames('relative pl-[25px]', { 'opacity-50': disabled, }); const itemClasses = classNames( @@ -40,6 +56,7 @@ export const Radio = ({ id, value, label, disabled, hasError }: RadioProps) => { 'focus:outline-none focus-visible:outline-none', 'focus-visible:shadow-vega-pink dark:focus-visible:shadow-vega-yellow', 'dark:bg-white-25', + labelClassName, { 'border-black-60 dark:border-white-60': !hasError, 'border-danger dark:border-danger': hasError, @@ -49,12 +66,14 @@ export const Radio = ({ id, value, label, disabled, hasError }: RadioProps) => {
- +
+ +