From 9fc6b255c813de836793c35ccb10a52f24f58336 Mon Sep 17 00:00:00 2001
From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com>
Date: Wed, 12 Apr 2023 11:19:15 -0400
Subject: [PATCH 1/5] fix(orders): update order toast intent and title (#3424)
---
.../use-vega-transaction-toasts.spec.tsx | 30 +++-
.../lib/hooks/use-vega-transaction-toasts.tsx | 46 ++++---
libs/orders/src/lib/utils.spec.ts | 129 ++++++++++++++++++
libs/orders/src/lib/utils.ts | 2 +-
4 files changed, 186 insertions(+), 21 deletions(-)
create mode 100644 libs/orders/src/lib/utils.spec.ts
diff --git a/apps/trading/lib/hooks/use-vega-transaction-toasts.spec.tsx b/apps/trading/lib/hooks/use-vega-transaction-toasts.spec.tsx
index 3fb7d229f..10cd72f40 100644
--- a/apps/trading/lib/hooks/use-vega-transaction-toasts.spec.tsx
+++ b/apps/trading/lib/hooks/use-vega-transaction-toasts.spec.tsx
@@ -7,7 +7,11 @@ import {
} from '@vegaprotocol/types';
import type { VegaStoredTxState } from '@vegaprotocol/wallet';
import { VegaTxStatus } from '@vegaprotocol/wallet';
-import { VegaTransactionDetails } from './use-vega-transaction-toasts';
+import {
+ VegaTransactionDetails,
+ getVegaTransactionContentIntent,
+} from './use-vega-transaction-toasts';
+import { Intent } from '@vegaprotocol/ui-toolkit';
jest.mock('@vegaprotocol/assets', () => {
const A1 = {
@@ -278,3 +282,27 @@ describe('VegaTransactionDetails', () => {
expect(queryByTestId('toast-panel')?.textContent).toEqual(details);
});
});
+
+describe('getVegaTransactionContentIntent', () => {
+ it('returns the correct intent for a transaction', () => {
+ expect(getVegaTransactionContentIntent(withdraw).intent).toBe(
+ Intent.Primary
+ );
+ expect(getVegaTransactionContentIntent(submitOrder).intent).toBe(
+ Intent.Success
+ );
+ expect(getVegaTransactionContentIntent(editOrder).intent).toBe(
+ Intent.Success
+ );
+ expect(getVegaTransactionContentIntent(cancelOrder).intent).toBe(
+ Intent.Primary
+ );
+ expect(getVegaTransactionContentIntent(cancelAll).intent).toBe(
+ Intent.Primary
+ );
+ expect(getVegaTransactionContentIntent(closePosition).intent).toBe(
+ Intent.Primary
+ );
+ expect(getVegaTransactionContentIntent(batch).intent).toBe(Intent.Primary);
+ });
+});
diff --git a/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx b/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx
index c0591a94e..86a70d6c6 100644
--- a/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx
+++ b/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx
@@ -547,7 +547,11 @@ const VegaTxCompleteToastsContent = ({ tx }: VegaTxToastContentProps) => {
return (
<>
- {t('Confirmed')}
+
+ {tx.order?.status
+ ? getOrderToastTitle(tx.order.status)
+ : t('Confirmed')}
+
{t('Your transaction has been confirmed ')}
{tx.txHash && (
@@ -634,25 +638,8 @@ export const useVegaTransactionToasts = () => {
);
const fromVegaTransaction = (tx: VegaStoredTxState): Toast => {
- let content: ToastContent;
const closeAfter = isFinal(tx) ? CLOSE_AFTER : undefined;
- if (tx.status === VegaTxStatus.Requested) {
- content = ;
- }
- if (tx.status === VegaTxStatus.Pending) {
- content = ;
- }
- if (tx.status === VegaTxStatus.Complete) {
- content = ;
- }
- if (tx.status === VegaTxStatus.Error) {
- content = ;
- }
-
- // Transaction can be successful but the order can be rejected by the network
- const intent =
- (tx.order && getOrderToastIntent(tx.order.status)) ||
- intentMap[tx.status];
+ const { intent, content } = getVegaTransactionContentIntent(tx);
return {
id: `vega-${tx.id}`,
@@ -676,3 +663,24 @@ export const useVegaTransactionToasts = () => {
}
);
};
+
+export const getVegaTransactionContentIntent = (tx: VegaStoredTxState) => {
+ let content: ToastContent;
+ if (tx.status === VegaTxStatus.Requested) {
+ content = ;
+ }
+ if (tx.status === VegaTxStatus.Pending) {
+ content = ;
+ }
+ if (tx.status === VegaTxStatus.Complete) {
+ content = ;
+ }
+ if (tx.status === VegaTxStatus.Error) {
+ content = ;
+ }
+
+ // Transaction can be successful but the order can be rejected by the network
+ const intent =
+ (tx.order && getOrderToastIntent(tx.order.status)) || intentMap[tx.status];
+ return { intent, content };
+};
diff --git a/libs/orders/src/lib/utils.spec.ts b/libs/orders/src/lib/utils.spec.ts
new file mode 100644
index 000000000..ac7c8937d
--- /dev/null
+++ b/libs/orders/src/lib/utils.spec.ts
@@ -0,0 +1,129 @@
+import { Intent } from '@vegaprotocol/ui-toolkit';
+import {
+ getOrderToastIntent,
+ getOrderToastTitle,
+ getRejectionReason,
+ timeInForceLabel,
+} from './utils';
+import * as Types from '@vegaprotocol/types';
+
+describe('getOrderToastTitle', () => {
+ it('should return the correct title', () => {
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_ACTIVE)).toBe(
+ 'Order submitted'
+ );
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_FILLED)).toBe(
+ 'Order filled'
+ );
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_PARTIALLY_FILLED)).toBe(
+ 'Order partially filled'
+ );
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_PARKED)).toBe(
+ 'Order parked'
+ );
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_STOPPED)).toBe(
+ 'Order stopped'
+ );
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_CANCELLED)).toBe(
+ 'Order cancelled'
+ );
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_EXPIRED)).toBe(
+ 'Order expired'
+ );
+ expect(getOrderToastTitle(Types.OrderStatus.STATUS_REJECTED)).toBe(
+ 'Order rejected'
+ );
+ expect(getOrderToastTitle(undefined)).toBe(undefined);
+ });
+});
+
+describe('getOrderToastIntent', () => {
+ it('should return the correct intent', () => {
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_PARKED)).toBe(
+ Intent.Warning
+ );
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_EXPIRED)).toBe(
+ Intent.Warning
+ );
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_PARTIALLY_FILLED)).toBe(
+ Intent.Warning
+ );
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_REJECTED)).toBe(
+ Intent.Danger
+ );
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_STOPPED)).toBe(
+ Intent.Danger
+ );
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_FILLED)).toBe(
+ Intent.Success
+ );
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_ACTIVE)).toBe(
+ Intent.Success
+ );
+ expect(getOrderToastIntent(Types.OrderStatus.STATUS_CANCELLED)).toBe(
+ Intent.Success
+ );
+ expect(getOrderToastIntent(undefined)).toBe(undefined);
+ });
+});
+
+describe('getRejectionReason', () => {
+ it('should return the correct rejection reason for insufficient asset balance', () => {
+ expect(
+ getRejectionReason({
+ rejectionReason:
+ Types.OrderRejectionReason.ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE,
+ status: Types.OrderStatus.STATUS_REJECTED,
+ id: '',
+ createdAt: undefined,
+ size: '',
+ price: '',
+ timeInForce: Types.OrderTimeInForce.TIME_IN_FORCE_FOK,
+ side: Types.Side.SIDE_BUY,
+ marketId: '',
+ })
+ ).toBe('Insufficient asset balance');
+ });
+
+ it('should return the correct rejection reason when order is stopped', () => {
+ expect(
+ getRejectionReason({
+ rejectionReason: null,
+ status: Types.OrderStatus.STATUS_STOPPED,
+ id: '',
+ createdAt: undefined,
+ size: '',
+ price: '',
+ timeInForce: Types.OrderTimeInForce.TIME_IN_FORCE_FOK,
+ side: Types.Side.SIDE_BUY,
+ marketId: '',
+ })
+ ).toBe(
+ 'Your Fill or Kill (FOK) order was not filled and it has been stopped'
+ );
+ });
+});
+
+describe('timeInForceLabel', () => {
+ it('should return the correct label for time in force', () => {
+ expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_FOK)).toBe(
+ `Fill or Kill (FOK)`
+ );
+ expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GTC)).toBe(
+ `Good 'til Cancelled (GTC)`
+ );
+ expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_IOC)).toBe(
+ `Immediate or Cancel (IOC)`
+ );
+ expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GTT)).toBe(
+ `Good 'til Time (GTT)`
+ );
+ expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GFA)).toBe(
+ `Good for Auction (GFA)`
+ );
+ expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GFN)).toBe(
+ `Good for Normal (GFN)`
+ );
+ expect(timeInForceLabel('')).toBe('');
+ });
+});
diff --git a/libs/orders/src/lib/utils.ts b/libs/orders/src/lib/utils.ts
index 2acac6fcb..e71ebaf59 100644
--- a/libs/orders/src/lib/utils.ts
+++ b/libs/orders/src/lib/utils.ts
@@ -82,10 +82,10 @@ export const getOrderToastIntent = (
return Intent.Warning;
case Schema.OrderStatus.STATUS_REJECTED:
case Schema.OrderStatus.STATUS_STOPPED:
- case Schema.OrderStatus.STATUS_CANCELLED:
return Intent.Danger;
case Schema.OrderStatus.STATUS_FILLED:
case Schema.OrderStatus.STATUS_ACTIVE:
+ case Schema.OrderStatus.STATUS_CANCELLED:
return Intent.Success;
default:
return;
From ab2666726506637d40a774a3d201e7e87b324b68 Mon Sep 17 00:00:00 2001
From: dexturr
Date: Wed, 12 Apr 2023 18:08:22 +0000
Subject: [PATCH 2/5] chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
---
apps/static/src/assets/mainnet-tranches.json | 50 ++++++++++++--------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json
index 82667e100..90372540e 100644
--- a/apps/static/src/assets/mainnet-tranches.json
+++ b/apps/static/src/assets/mainnet-tranches.json
@@ -582,7 +582,7 @@
"tranche_end": "2023-05-06T00:00:00.000Z",
"total_added": "8865",
"total_removed": "57.68717013147",
- "locked_amount": "6942.2971006944436455",
+ "locked_amount": "6868.661510416666995",
"deposits": [
{
"amount": "33",
@@ -4245,7 +4245,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
- "locked_amount": "56153.4424125955394179021",
+ "locked_amount": "56094.2743071157747326133",
"deposits": [
{
"amount": "86666.297",
@@ -4311,7 +4311,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
- "locked_amount": "679.8542747761499",
+ "locked_amount": "676.43133775946275",
"deposits": [
{
"amount": "2500",
@@ -4432,7 +4432,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
- "locked_amount": "13457.251880787036",
+ "locked_amount": "13433.551762530193",
"deposits": [
{
"amount": "12500",
@@ -4699,7 +4699,7 @@
"tranche_end": "2023-08-01T00:00:00.000Z",
"total_added": "37500",
"total_removed": "12151.298246325",
- "locked_amount": "22892.27718308778",
+ "locked_amount": "22840.6494590239425",
"deposits": [
{
"amount": "7500",
@@ -5052,7 +5052,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
- "locked_amount": "56102.2094618910983594025",
+ "locked_amount": "56043.0953398627516531515",
"deposits": [
{
"amount": "129999.45",
@@ -5085,7 +5085,7 @@
"tranche_end": "2024-04-01T00:00:00.000Z",
"total_added": "54144.7663",
"total_removed": "0",
- "locked_amount": "52442.51863830331283731817",
+ "locked_amount": "52405.65436429378528995867",
"deposits": [
{
"amount": "54144.7663",
@@ -5118,7 +5118,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
- "locked_amount": "24610.099422881789042",
+ "locked_amount": "24567.36166286148736",
"deposits": [
{
"amount": "10000",
@@ -5311,7 +5311,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
- "locked_amount": "2157.44371511922885",
+ "locked_amount": "2154.0301560121765",
"deposits": [
{
"amount": "5000",
@@ -5852,7 +5852,7 @@
"tranche_end": "2023-05-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "6727.9921539",
- "locked_amount": "2298.90222145488015",
+ "locked_amount": "2267.92558701657495",
"deposits": [
{
"amount": "7500",
@@ -6325,7 +6325,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "928642.9598472029154",
- "locked_amount": "268365.924927416892687982",
+ "locked_amount": "267041.5128897012885036948",
"deposits": [
{
"amount": "1852091.69",
@@ -40141,7 +40141,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "715655.108029600523393",
- "locked_amount": "436886.316251527897819535653",
+ "locked_amount": "434851.156060855261707673057",
"deposits": [
{
"amount": "1998.95815",
@@ -41534,7 +41534,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "832085.86755480045340352",
- "locked_amount": "6848858.41228621146423137625497604821843745",
+ "locked_amount": "6841641.86491985915194408259857427627899427",
"deposits": [
{
"amount": "16249.93",
@@ -47914,7 +47914,7 @@
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "5825428.980241267385732886",
- "locked_amount": "601377.1295584657774180930334501436",
+ "locked_amount": "594714.859107939716417948219056443",
"deposits": [
{
"amount": "129284.449",
@@ -57738,7 +57738,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "42362.8219648421949",
- "locked_amount": "69227.13415870679476685853018774",
+ "locked_amount": "68904.65139302313265571425875192",
"deposits": [
{
"amount": "3000",
@@ -87367,7 +87367,7 @@
"tranche_start": "2021-12-05T00:00:00.000Z",
"tranche_end": "2022-06-05T00:00:00.000Z",
"total_added": "171288.42",
- "total_removed": "69140.5995794947989",
+ "total_removed": "69390.5995794947989",
"locked_amount": "0",
"deposits": [
{
@@ -91602,6 +91602,11 @@
"user": "0xC1991C8BDA29507991EEB230FF2063C2eA74a34C",
"tx": "0x71a163020ce928ca230a50c099b8baaf60af6191d6cbc46edc004239d3ff9901"
},
+ {
+ "amount": "250",
+ "user": "0x0715B8bA27dB75F7601A9D8E22c15dcA1487FB70",
+ "tx": "0x11c685c41ff0c2d5f1d7fe3b08dc84a7ddb9160764a45bc61b8f39df94729634"
+ },
{
"amount": "1250",
"user": "0x9405F540EcC1204801De5C4444D06386BD6693F0",
@@ -100423,10 +100428,17 @@
"tx": "0x057f65938b1360b6d2c4ebf5e789c67897cf60cb6a13f947004def03891afbd8"
}
],
- "withdrawals": [],
+ "withdrawals": [
+ {
+ "amount": "250",
+ "user": "0x0715B8bA27dB75F7601A9D8E22c15dcA1487FB70",
+ "tranche_id": 6,
+ "tx": "0x11c685c41ff0c2d5f1d7fe3b08dc84a7ddb9160764a45bc61b8f39df94729634"
+ }
+ ],
"total_tokens": "250",
- "withdrawn_tokens": "0",
- "remaining_tokens": "250"
+ "withdrawn_tokens": "250",
+ "remaining_tokens": "0"
},
{
"address": "0x027306C886Da27fa29Ce9B4DB489C6E44d2ECc55",
From 3df9270b579850966c4a7cc55f90517ca6f731e8 Mon Sep 17 00:00:00 2001
From: dexturr
Date: Thu, 13 Apr 2023 00:13:51 +0000
Subject: [PATCH 3/5] chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
---
apps/static/src/assets/mainnet-tranches.json | 54 ++++++++++++++------
1 file changed, 37 insertions(+), 17 deletions(-)
diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json
index 90372540e..5bd4f0e70 100644
--- a/apps/static/src/assets/mainnet-tranches.json
+++ b/apps/static/src/assets/mainnet-tranches.json
@@ -3,9 +3,9 @@
"tranche_id": 56,
"tranche_start": "2023-04-20T00:00:00.000Z",
"tranche_end": "2023-05-20T00:00:00.000Z",
- "total_added": "15607.625",
+ "total_added": "15711.125",
"total_removed": "0",
- "locked_amount": "15607.625",
+ "locked_amount": "15711.125",
"deposits": [
{
"amount": "241.5",
@@ -82,6 +82,11 @@
"user": "0x268070d5EEd5b24E34a5F4C17B5482178b18089D",
"tx": "0x7543f201673298844d68e4dd15222ab85bdd2796b5b95c739d1a1d5c198806e8"
},
+ {
+ "amount": "103.5",
+ "user": "0x697cEF6741F519621fE14c72041e4B8B1f7e2c8A",
+ "tx": "0xc7483de16af39896b3ae052dd8a6e01fb3dc3794ceb9d2a76d81436992af320e"
+ },
{
"amount": "50",
"user": "0x15024E62134A8BFFCce11f5ce58CeCDe853038D7",
@@ -356,6 +361,21 @@
"withdrawn_tokens": "0",
"remaining_tokens": "138"
},
+ {
+ "address": "0x697cEF6741F519621fE14c72041e4B8B1f7e2c8A",
+ "deposits": [
+ {
+ "amount": "103.5",
+ "user": "0x697cEF6741F519621fE14c72041e4B8B1f7e2c8A",
+ "tranche_id": 56,
+ "tx": "0xc7483de16af39896b3ae052dd8a6e01fb3dc3794ceb9d2a76d81436992af320e"
+ }
+ ],
+ "withdrawals": [],
+ "total_tokens": "103.5",
+ "withdrawn_tokens": "0",
+ "remaining_tokens": "103.5"
+ },
{
"address": "0x15024E62134A8BFFCce11f5ce58CeCDe853038D7",
"deposits": [
@@ -582,7 +602,7 @@
"tranche_end": "2023-05-06T00:00:00.000Z",
"total_added": "8865",
"total_removed": "57.68717013147",
- "locked_amount": "6868.661510416666995",
+ "locked_amount": "6793.6612847222217735",
"deposits": [
{
"amount": "33",
@@ -4245,7 +4265,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
- "locked_amount": "56094.2743071157747326133",
+ "locked_amount": "56034.0096817063039022493",
"deposits": [
{
"amount": "86666.297",
@@ -4311,7 +4331,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
- "locked_amount": "676.43133775946275",
+ "locked_amount": "672.944965913716",
"deposits": [
{
"amount": "2500",
@@ -4432,7 +4452,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
- "locked_amount": "13433.551762530193",
+ "locked_amount": "13409.41242703301225",
"deposits": [
{
"amount": "12500",
@@ -4699,7 +4719,7 @@
"tranche_end": "2023-08-01T00:00:00.000Z",
"total_added": "37500",
"total_removed": "12151.298246325",
- "locked_amount": "22840.6494590239425",
+ "locked_amount": "22788.06495549416625",
"deposits": [
{
"amount": "7500",
@@ -5052,7 +5072,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
- "locked_amount": "56043.0953398627516531515",
+ "locked_amount": "55982.88569834118901974",
"deposits": [
{
"amount": "129999.45",
@@ -5085,7 +5105,7 @@
"tranche_end": "2024-04-01T00:00:00.000Z",
"total_added": "54144.7663",
"total_removed": "0",
- "locked_amount": "52405.65436429378528995867",
+ "locked_amount": "52368.10691121644550910354",
"deposits": [
{
"amount": "54144.7663",
@@ -5118,7 +5138,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
- "locked_amount": "24567.36166286148736",
+ "locked_amount": "24523.83187468289929",
"deposits": [
{
"amount": "10000",
@@ -5311,7 +5331,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
- "locked_amount": "2154.0301560121765",
+ "locked_amount": "2150.55333587011675",
"deposits": [
{
"amount": "5000",
@@ -5852,7 +5872,7 @@
"tranche_end": "2023-05-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "6727.9921539",
- "locked_amount": "2267.92558701657495",
+ "locked_amount": "2236.374884898711675",
"deposits": [
{
"amount": "7500",
@@ -6325,7 +6345,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "928642.9598472029154",
- "locked_amount": "267041.5128897012885036948",
+ "locked_amount": "265692.55647655380096827",
"deposits": [
{
"amount": "1852091.69",
@@ -40141,7 +40161,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "715655.108029600523393",
- "locked_amount": "434851.156060855261707673057",
+ "locked_amount": "432778.279710587885660311453",
"deposits": [
{
"amount": "1998.95815",
@@ -41534,7 +41554,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "832085.86755480045340352",
- "locked_amount": "6841641.86491985915194408259857427627899427",
+ "locked_amount": "6834291.5784731942883416584385774442308732",
"deposits": [
{
"amount": "16249.93",
@@ -47914,7 +47934,7 @@
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "5825428.980241267385732886",
- "locked_amount": "594714.859107939716417948219056443",
+ "locked_amount": "587929.1215923998205872131428215364",
"deposits": [
{
"amount": "129284.449",
@@ -57738,7 +57758,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "42362.8219648421949",
- "locked_amount": "68904.65139302313265571425875192",
+ "locked_amount": "68576.192286256899229088470116708",
"deposits": [
{
"amount": "3000",
From e8fdb63323417d538241994ed72d402142ce1aaa Mon Sep 17 00:00:00 2001
From: dexturr
Date: Thu, 13 Apr 2023 06:09:41 +0000
Subject: [PATCH 4/5] chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
---
apps/static/src/assets/mainnet-tranches.json | 64 +++++++++++++-------
1 file changed, 43 insertions(+), 21 deletions(-)
diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json
index 5bd4f0e70..3d31fde74 100644
--- a/apps/static/src/assets/mainnet-tranches.json
+++ b/apps/static/src/assets/mainnet-tranches.json
@@ -601,8 +601,8 @@
"tranche_start": "2023-04-06T00:00:00.000Z",
"tranche_end": "2023-05-06T00:00:00.000Z",
"total_added": "8865",
- "total_removed": "57.68717013147",
- "locked_amount": "6793.6612847222217735",
+ "total_removed": "212.71903124703",
+ "locked_amount": "6720.641319444444729",
"deposits": [
{
"amount": "33",
@@ -746,6 +746,11 @@
"user": "0x92A1e98C6f09970e45645Cbe57c6DcaF4547c8FE",
"tx": "0xb9b9b6b0882ad6e197e540e034c39e785f8b77372ac03f93d2f8960e8cde658b"
},
+ {
+ "amount": "155.03186111556",
+ "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
+ "tx": "0x7da34162df1b167ed5a3de6d98759af7100bcd51ec4e4c55abce2d145c98ba15"
+ },
{
"amount": "52.2185023074",
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
@@ -959,6 +964,12 @@
}
],
"withdrawals": [
+ {
+ "amount": "155.03186111556",
+ "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
+ "tranche_id": 54,
+ "tx": "0x7da34162df1b167ed5a3de6d98759af7100bcd51ec4e4c55abce2d145c98ba15"
+ },
{
"amount": "52.2185023074",
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
@@ -967,8 +978,8 @@
}
],
"total_tokens": "858",
- "withdrawn_tokens": "52.2185023074",
- "remaining_tokens": "805.7814976926"
+ "withdrawn_tokens": "207.25036342296",
+ "remaining_tokens": "650.74963657704"
},
{
"address": "0x0bBf7580e036eA5D69ABe679CC90117EeC2e3dc1",
@@ -4265,7 +4276,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
- "locked_amount": "56034.0096817063039022493",
+ "locked_amount": "55975.3362468715096583895",
"deposits": [
{
"amount": "86666.297",
@@ -4331,7 +4342,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
- "locked_amount": "672.944965913716",
+ "locked_amount": "669.55064611314625",
"deposits": [
{
"amount": "2500",
@@ -4452,7 +4463,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
- "locked_amount": "13409.41242703301225",
+ "locked_amount": "13385.91045189210925",
"deposits": [
{
"amount": "12500",
@@ -4719,7 +4730,7 @@
"tranche_end": "2023-08-01T00:00:00.000Z",
"total_added": "37500",
"total_removed": "12151.298246325",
- "locked_amount": "22788.06495549416625",
+ "locked_amount": "22736.8688612645775",
"deposits": [
{
"amount": "7500",
@@ -5072,7 +5083,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
- "locked_amount": "55982.88569834118901974",
+ "locked_amount": "55924.265795633105973795",
"deposits": [
{
"amount": "129999.45",
@@ -5105,7 +5116,7 @@
"tranche_end": "2024-04-01T00:00:00.000Z",
"total_added": "54144.7663",
"total_removed": "0",
- "locked_amount": "52368.10691121644550910354",
+ "locked_amount": "52331.55083829013672190566",
"deposits": [
{
"amount": "54144.7663",
@@ -5138,7 +5149,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
- "locked_amount": "24523.83187468289929",
+ "locked_amount": "24481.45142059868271",
"deposits": [
{
"amount": "10000",
@@ -5331,7 +5342,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
- "locked_amount": "2150.55333587011675",
+ "locked_amount": "2147.16831557584975",
"deposits": [
{
"amount": "5000",
@@ -5872,7 +5883,7 @@
"tranche_end": "2023-05-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "6727.9921539",
- "locked_amount": "2236.374884898711675",
+ "locked_amount": "2205.657228360958425",
"deposits": [
{
"amount": "7500",
@@ -6345,7 +6356,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "928642.9598472029154",
- "locked_amount": "265692.55647655380096827",
+ "locked_amount": "264379.2170894088612502104",
"deposits": [
{
"amount": "1852091.69",
@@ -40161,7 +40172,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "715655.108029600523393",
- "locked_amount": "432778.279710587885660311453",
+ "locked_amount": "430760.134328755393533225946",
"deposits": [
{
"amount": "1998.95815",
@@ -41554,7 +41565,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "832085.86755480045340352",
- "locked_amount": "6834291.5784731942883416584385774442308732",
+ "locked_amount": "6827135.3645265337866511762819105499945931",
"deposits": [
{
"amount": "16249.93",
@@ -47934,7 +47945,7 @@
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "5825428.980241267385732886",
- "locked_amount": "587929.1215923998205872131428215364",
+ "locked_amount": "581322.550569700658722837432388667",
"deposits": [
{
"amount": "129284.449",
@@ -57757,8 +57768,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
- "total_removed": "42362.8219648421949",
- "locked_amount": "68576.192286256899229088470116708",
+ "total_removed": "42408.3252372941949",
+ "locked_amount": "68256.405614294737212900293658024",
"deposits": [
{
"amount": "3000",
@@ -64387,6 +64398,11 @@
"user": "0xa9a677b0a3Be231C0654CabB0Eaa0A72E91B3E8d",
"tx": "0xc0db5f216679203b937bf90415f24231997ea35bc1d418af30913aa313be498d"
},
+ {
+ "amount": "45.503272452",
+ "user": "0x9347177014d3fEA775b5B29fFC96bF6B911686F9",
+ "tx": "0xd1d4724eae5566e3162c1b210a19d73f5a2e4b9b3d52d9d1e77c4b9cb9bdc2e1"
+ },
{
"amount": "19.918569252",
"user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1",
@@ -81503,6 +81519,12 @@
}
],
"withdrawals": [
+ {
+ "amount": "45.503272452",
+ "user": "0x9347177014d3fEA775b5B29fFC96bF6B911686F9",
+ "tranche_id": 5,
+ "tx": "0xd1d4724eae5566e3162c1b210a19d73f5a2e4b9b3d52d9d1e77c4b9cb9bdc2e1"
+ },
{
"amount": "47.970776254",
"user": "0x9347177014d3fEA775b5B29fFC96bF6B911686F9",
@@ -81517,8 +81539,8 @@
}
],
"total_tokens": "200",
- "withdrawn_tokens": "125.533250886",
- "remaining_tokens": "74.466749114"
+ "withdrawn_tokens": "171.036523338",
+ "remaining_tokens": "28.963476662"
},
{
"address": "0x1a268a88b586B475FF4bD86882bF2f9D79875964",
From ee2aafb99c67a241e4c51c260bb414dbb2ab5136 Mon Sep 17 00:00:00 2001
From: Joe Tsang <30622993+jtsang586@users.noreply.github.com>
Date: Thu, 13 Apr 2023 10:46:01 +0100
Subject: [PATCH 5/5] fix(governance): failing nightly tests (#3351)
---
.../integration/flow/proposal-details.cy.ts | 4 ++-
.../integration/flow/proposal-enacted.cy.ts | 7 +---
.../src/integration/flow/proposal-flow.cy.ts | 4 +--
.../src/integration/flow/proposal-forms.cy.ts | 4 +--
.../flow/token-association-flow.cy.ts | 34 +++++++++----------
.../src/support/governance.functions.ts | 1 +
.../src/support/wallet-teardown.functions.ts | 33 ++++++++++++------
7 files changed, 48 insertions(+), 39 deletions(-)
diff --git a/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts
index e0223ab64..5e9de85ec 100644
--- a/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts
+++ b/apps/governance-e2e/src/integration/flow/proposal-details.cy.ts
@@ -44,7 +44,8 @@ describe(
function () {
before('connect wallets and set approval limit', function () {
cy.visit('/');
- vegaWalletSetSpecifiedApprovalAmount('1000');
+ ethereumWalletConnect();
+ cy.associateTokensToVegaWallet('1');
});
beforeEach('visit proposals tab', function () {
@@ -213,6 +214,7 @@ describe(
// 3001-VOTE-042, 3001-VOTE-057, 3001-VOTE-058, 3001-VOTE-059, 3001-VOTE-060
it('Newly created proposal details - ability to increase associated tokens - by voting again after association', function () {
+ vegaWalletSetSpecifiedApprovalAmount('1000');
createRawProposal();
cy.get('@rawProposal').then((rawProposal) => {
getSubmittedProposalFromProposalList(rawProposal.rationale.title)
diff --git a/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts
index ee0f5863b..5f1fa01d9 100644
--- a/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts
+++ b/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.ts
@@ -13,7 +13,6 @@ import {
createUpdateNetworkProposalTxBody,
createFreeFormProposalTxBody,
} from '../../support/proposal.functions';
-import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../support/staking.functions';
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
@@ -33,10 +32,6 @@ context(
before('Connect wallets and set approval', function () {
cy.visit('/');
vegaWalletSetSpecifiedApprovalAmount('1000');
- cy.connectVegaWallet();
- ethereumWalletConnect();
- ensureSpecifiedUnstakedTokensAreAssociated('1');
- cy.clearLocalStorage();
});
beforeEach('visit proposals', function () {
@@ -114,7 +109,7 @@ context(
navigateTo(navigation.proposals);
cy.reload();
waitForSpinner();
- cy.get(openProposals).within(() => {
+ cy.get(openProposals, { timeout: 6000 }).within(() => {
cy.contains(proposalTitle)
.parentsUntil('[data-testid="proposals-list-item"]')
.within(() => cy.get(viewProposalButton).click());
diff --git a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts
index 0785b8249..da5278d03 100644
--- a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts
+++ b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts
@@ -232,7 +232,7 @@ context(
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
const errorMsg =
- 'Invalid params: the transaction does not use a valid Vega command: unknown field unexpected" in vega.commands.v1.ProposalSubmission';
+ 'Invalid params: the transaction does not use a valid Vega command: unknown field "unexpected" in vega.commands.v1.ProposalSubmission';
// 3001-VOTE-038 3002-PROP-013 3002-PROP-014
goToMakeNewProposal(governanceProposalType.RAW);
@@ -313,7 +313,7 @@ context(
it('Unable to vote on a proposal - when vega wallet disconnected - option to connect from within', function () {
createRawProposal();
- cy.get('[data-testid="manage-vega-wallet"]').click();
+ cy.get('[data-testid="manage-vega-wallet"]:visible').click();
cy.get('[data-testid="disconnect"]').click();
cy.get('@rawProposal').then((rawProposal) => {
getSubmittedProposalFromProposalList(
diff --git a/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts
index dd7209a56..8edb77c66 100644
--- a/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts
+++ b/apps/governance-e2e/src/integration/flow/proposal-forms.cy.ts
@@ -218,7 +218,7 @@ context(
it('Unable to submit new market proposal with missing/invalid fields', function () {
const errorMsg =
- 'Invalid params: the transaction is not a valid Vega command: unknown field "filters" in vega.DataSourceDefinition';
+ 'Invalid params: the transaction does not use a valid Vega command: unknown field "invalid" in vega.NewMarket';
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
cy.get(newProposalSubmitButton).should('be.visible').click();
@@ -436,7 +436,7 @@ context(
});
});
- it.only('Able to submit update asset proposal using max deadline', function () {
+ it('Able to submit update asset proposal using max deadline', function () {
goToMakeNewProposal(governanceProposalType.UPDATE_ASSET);
enterUpdateAssetProposalDetails();
cy.get(maxVoteDeadline).click();
diff --git a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts
index 330e9a4d3..9bb79171a 100644
--- a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts
+++ b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts
@@ -25,11 +25,11 @@ const vegaWalletUnstakedBalance =
'[data-testid="vega-wallet-balance-unstaked"]';
const txTimeout = Cypress.env('txTimeout');
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
-const ethWalletAssociateButton = '[data-testid="associate-btn"]';
+const ethWalletAssociateButton = '[data-testid="associate-btn"]:visible';
const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]';
const tokenAmountInputBox = '[data-testid="token-amount-input"]';
const tokenSubmitButton = '[data-testid="token-input-submit-button"]';
-const ethWalletDissociateButton = '[href="/token/disassociate"]';
+const ethWalletDissociateButton = '[href="/token/disassociate"]:visible';
const vestingContractSection = '[data-testid="vega-in-vesting-contract"]';
const vegaInWalletSection = '[data-testid="vega-in-wallet"]';
const connectedVegaKey = '[data-testid="connected-vega-key"]';
@@ -78,12 +78,12 @@ context(
cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
- 3
+ 6
);
validateWalletCurrency('Associated', '0.00');
validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '2.00');
- cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
+ cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
// 0005-ETXN-002
verifyEthWalletAssociatedBalance('2.0');
@@ -111,12 +111,12 @@ context(
stakingPageDisassociateTokens('2');
cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
- 3
+ 6
);
validateWalletCurrency('Associated', '2.00');
validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '0.00');
- cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
+ cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
cy.getByTestId('eth-wallet-associated-balances', txTimeout).should(
'not.exist'
);
@@ -192,12 +192,12 @@ context(
cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
- 3
+ 6
);
validateWalletCurrency('Associated', '0.00');
validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '2.00');
- cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
+ cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
verifyEthWalletAssociatedBalance('2.0');
verifyEthWalletTotalAssociatedBalance('2.0');
cy.get(vegaWallet).within(() => {
@@ -210,12 +210,12 @@ context(
});
cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
- 3
+ 6
);
validateWalletCurrency('Associated', '2.00');
validateWalletCurrency('Pending association', '1.00');
validateWalletCurrency('Total associated after pending', '1.00');
- cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
+ cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
verifyEthWalletAssociatedBalance('1.0');
verifyEthWalletTotalAssociatedBalance('1.0');
});
@@ -266,7 +266,7 @@ context(
// 1004-ASSO-008
// 1004-ASSO-010
// No warning visible as described in AC, but the button is disabled
- cy.get(ethWalletAssociateButton).first().click();
+ cy.get(ethWalletAssociateButton).click();
cy.get(associateWalletRadioButton, { timeout: 30000 }).click();
cy.get(tokenSubmitButton, txTimeout).should('be.disabled'); // button disabled with no input
cy.get(tokenAmountInputBox, { timeout: 10000 }).type('6500000');
@@ -278,12 +278,12 @@ context(
vegaWalletAssociate('2');
cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
- 3
+ 6
);
validateWalletCurrency('Associated', '0.00');
validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '2.00');
- cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
+ cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
validateWalletCurrency('Associated', '2.00');
});
@@ -294,24 +294,24 @@ context(
});
cy.getByTestId('currency-title', txTimeout).should(
'have.length.above',
- 3
+ 6
);
validateWalletCurrency('Associated', '2.00');
validateWalletCurrency('Pending association', '2.00');
validateWalletCurrency('Total associated after pending', '0.00');
- cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
+ cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
validateWalletCurrency('Associated', '0.00');
});
it('Able to associate tokens to different public key of connected vega wallet', function () {
- cy.get(ethWalletAssociateButton).first().click();
+ cy.get(ethWalletAssociateButton).click();
cy.get(associateWalletRadioButton).click();
cy.get(connectedVegaKey).should(
'have.text',
Cypress.env('vegaWalletPublicKey')
);
- cy.get('[data-testid="manage-vega-wallet"]').click();
+ cy.get('[data-testid="manage-vega-wallet"]:visible').click();
cy.get('[data-testid="select-keypair-button"]').eq(0).click();
cy.get(connectedVegaKey).should(
'have.text',
diff --git a/apps/governance-e2e/src/support/governance.functions.ts b/apps/governance-e2e/src/support/governance.functions.ts
index c77e394ff..066ab1847 100644
--- a/apps/governance-e2e/src/support/governance.functions.ts
+++ b/apps/governance-e2e/src/support/governance.functions.ts
@@ -166,6 +166,7 @@ export function goToMakeNewProposal(proposalType: string) {
navigateTo(navigation.proposals);
cy.get(newProposalButton).should('be.visible').click();
cy.url().should('include', '/proposals/propose');
+ cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist');
cy.get('li').should('contain.text', proposalType).and('be.visible');
cy.get('li').contains(proposalType).click();
}
diff --git a/apps/governance-e2e/src/support/wallet-teardown.functions.ts b/apps/governance-e2e/src/support/wallet-teardown.functions.ts
index 4d81c43ea..ba7baa60f 100644
--- a/apps/governance-e2e/src/support/wallet-teardown.functions.ts
+++ b/apps/governance-e2e/src/support/wallet-teardown.functions.ts
@@ -8,6 +8,7 @@ import {
} from '@vegaprotocol/smart-contracts';
import { ethers, Wallet } from 'ethers';
+const associatedAmountInWallet = '[data-testid="associated-amount"]:visible';
const vegaWalletContainer = 'aside [data-testid="vega-wallet"]';
const vegaWalletMnemonic = Cypress.env('vegaWalletMnemonic');
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
@@ -59,7 +60,7 @@ export async function faucetAsset(assetEthAddress: string) {
}
export async function vegaWalletTeardown() {
- cy.get('[data-testid="associated-amount"]')
+ cy.get(associatedAmountInWallet)
.should('be.visible')
.invoke('text')
.then((associatedAmount) => {
@@ -68,12 +69,12 @@ export async function vegaWalletTeardown() {
$body.find('[data-testid="eth-wallet-associated-balances"]').length ||
associatedAmount != '0.00'
) {
- vegaWalletTeardownVesting(vestingContract);
vegaWalletTeardownStaking(stakingBridgeContract);
+ vegaWalletTeardownVesting(vestingContract);
}
});
cy.get(vegaWalletContainer).within(() => {
- cy.getByTestId('associated-amount', {
+ cy.get(associatedAmountInWallet, {
timeout: transactionTimeout,
}).contains('0.00', {
timeout: transactionTimeout,
@@ -90,7 +91,7 @@ export async function vegaWalletSetSpecifiedApprovalAmount(
await promiseWithTimeout(
token.approve(
ethStakingBridgeContractAddress,
- resetAmount.concat('000000000000000000')
+ resetAmount + '0'.repeat(18)
),
10 * 60 * 1000,
'set approval amount'
@@ -104,12 +105,23 @@ async function vegaWalletTeardownStaking(stakingBridgeContract: StakingBridge) {
{ timeout: transactionTimeout, log: false }
).then((stakeBalance) => {
if (Number(stakeBalance) != 0) {
- cy.wrap(
- stakingBridgeContract.remove_stake(
- String(stakeBalance),
- vegaWalletPubKey
- ),
- { timeout: transactionTimeout, log: false }
+ cy.get('[data-testid="vega-wallet-balance-unstaked"]:visible').within(
+ () => {
+ cy.get(associatedAmountInWallet)
+ .invoke('text')
+ .then(($walletAmount) => {
+ cy.wrap(
+ stakingBridgeContract.remove_stake(
+ String(stakeBalance),
+ vegaWalletPubKey
+ ),
+ { timeout: transactionTimeout, log: false }
+ );
+ cy.get(associatedAmountInWallet, {
+ timeout: transactionTimeout,
+ }).should('not.have.text', $walletAmount);
+ });
+ }
);
}
});
@@ -124,7 +136,6 @@ async function vegaWalletTeardownVesting(vestingContract: TokenVesting) {
if (Number(vestingAmount) != 0) {
// Wait needed to allow time for ganache to process tx for stakingBridgeContract.remove_stake
// eslint-disable-next-line cypress/no-unnecessary-waiting
- cy.wait(1000);
cy.wrap(
vestingContract.remove_stake(String(vestingAmount), vegaWalletPubKey),
{ timeout: transactionTimeout, log: false }