Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3eb41aec13 | ||
|
|
78e33f08c4 | ||
|
|
c9304ce2b4 | ||
|
|
062146920d | ||
|
|
6a02792d8b |
@@ -11,7 +11,7 @@ export const EthConnectPrompt = () => {
|
||||
const { appDispatch } = useAppState();
|
||||
return (
|
||||
<Button
|
||||
variant="default"
|
||||
variant="primary"
|
||||
onClick={() =>
|
||||
appDispatch({
|
||||
type: AppStateActionType.SET_ETH_WALLET_OVERLAY,
|
||||
|
||||
@@ -336,7 +336,6 @@
|
||||
"withdrawLpNoneDeposited": "You have no SLP tokens deposited or rewards accumulated",
|
||||
"withdrawAllLpSuccessCalloutTitle": "Your SLP tokens and rewards have been sent to your Ethereum address",
|
||||
"Dissociate VEGA tokens": "Disassociate $VEGA tokens",
|
||||
"DisassociateVegaTokensFromWallet": "Disassociate $VEGA tokens from your Vega wallet",
|
||||
"Early Investors": "Early Investors",
|
||||
"Team": "Team",
|
||||
"Community": "Community",
|
||||
@@ -483,7 +482,6 @@
|
||||
"withdrawFormSubmitButtonIdle": "Withdraw {{amount}} {{symbol}} tokens",
|
||||
"withdrawFormSubmitButtonPending": "Preparing",
|
||||
"withdrawalsTitle": "Withdrawals",
|
||||
"withdrawalsSubtitle": "Connect your Vega wallet to complete a withdrawal. These withdrawals will be completed with an Ethereum transaction.",
|
||||
"withdrawalsText": "These withdrawals need to be completed with an Ethereum transaction.",
|
||||
"withdrawalsNone": "You don't have any pending withdrawals.",
|
||||
"withdrawalsCompleteButton": "Finish withdrawal",
|
||||
@@ -554,6 +552,9 @@
|
||||
"resourceNotFound": "Resource Not Found",
|
||||
"Or": "Or",
|
||||
"addTokenToWallet": "Show this token in your Ethereum wallet",
|
||||
"chartBelow": "*Certain activities, for example community incentive tokens, do not have specific dates to be credited and so an approximation has been used. ",
|
||||
"chartTitle": "Token unlocking schedule",
|
||||
"chartAbove": "This chart shows the approximate* schedule for how tokens will unlock from vesting tranches over time.",
|
||||
"date": "Date",
|
||||
"noEthereumProviderError": "No Ethereum browser extension detected, install MetaMask on desktop or visit from a dApp browser on mobile",
|
||||
"unsupportedChainIdError": "You're connected to an unsupported network",
|
||||
|
||||
@@ -15,12 +15,7 @@ export const DisassociateContainer = () => {
|
||||
<>
|
||||
<Heading title={t('pageTitleDisassociate')} />
|
||||
{!account ? (
|
||||
<>
|
||||
<p className="mb-8">{t('DisassociateVegaTokensFromWallet')}</p>
|
||||
<div className="max-w-[400px]">
|
||||
<EthConnectPrompt />
|
||||
</div>
|
||||
</>
|
||||
<EthConnectPrompt />
|
||||
) : (
|
||||
<DisassociatePage address={account} vegaKey={pubKey ?? ''} />
|
||||
)}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { useWeb3React } from '@web3-react/core';
|
||||
import { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||
import { useEthereumConfig } from '@vegaprotocol/web3';
|
||||
|
||||
import { SubHeading } from '../../components/heading';
|
||||
import { TrancheItem } from '../redemption/tranche-item';
|
||||
import { TrancheLabel } from './tranche-label';
|
||||
import { useTranches } from '../../lib/tranches/tranches-store';
|
||||
import { VestingChart } from './vesting-chart';
|
||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||
import { useEthereumConfig } from '@vegaprotocol/web3';
|
||||
import type { Tranche } from '../../lib/tranches/tranches-store';
|
||||
import { useTranches } from '../../lib/tranches/tranches-store';
|
||||
|
||||
const trancheMinimum = 10;
|
||||
|
||||
@@ -15,7 +18,7 @@ const shouldShowTranche = (t: Tranche) =>
|
||||
|
||||
export const Tranches = () => {
|
||||
const tranches = useTranches((state) => state.tranches);
|
||||
const [showAll, setShowAll] = useState<boolean>(false);
|
||||
const [showAll, setShowAll] = React.useState<boolean>(false);
|
||||
const { t } = useTranslation();
|
||||
const { chainId } = useWeb3React();
|
||||
const { config } = useEthereumConfig();
|
||||
@@ -27,6 +30,10 @@ export const Tranches = () => {
|
||||
|
||||
return (
|
||||
<section>
|
||||
<SubHeading title={t('chartTitle')} />
|
||||
<p>{t('chartAbove')}</p>
|
||||
<VestingChart />
|
||||
<p>{t('chartBelow')}</p>
|
||||
{tranches?.length ? (
|
||||
<ul role="list">
|
||||
{(showAll ? tranches : filteredTranches).map((tranche) => {
|
||||
@@ -48,7 +55,6 @@ export const Tranches = () => {
|
||||
) : (
|
||||
<p>{t('No tranches')}</p>
|
||||
)}
|
||||
|
||||
<section className="text-center mt-4">
|
||||
<ButtonLink onClick={() => setShowAll(!showAll)}>
|
||||
{showAll
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
import { format, startOfMonth } from 'date-fns';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Area,
|
||||
AreaChart,
|
||||
Label,
|
||||
Legend,
|
||||
ReferenceLine,
|
||||
ResponsiveContainer,
|
||||
Tooltip,
|
||||
XAxis,
|
||||
YAxis,
|
||||
} from 'recharts';
|
||||
import colors from 'tailwindcss/colors';
|
||||
|
||||
import { DATE_FORMAT_LONG } from '../../lib/date-formats';
|
||||
import data from './data.json';
|
||||
|
||||
import { theme } from '@vegaprotocol/tailwindcss-config';
|
||||
const Colors = theme.colors;
|
||||
|
||||
const ORDER = ['community', 'publicSale', 'earlyInvestors', 'team'];
|
||||
|
||||
export const VestingChart = () => {
|
||||
const { t } = useTranslation();
|
||||
const currentDate = React.useMemo(
|
||||
() => format(startOfMonth(new Date()), DATE_FORMAT_LONG),
|
||||
[]
|
||||
);
|
||||
return (
|
||||
<div style={{ marginBottom: 25 }}>
|
||||
<ResponsiveContainer height={400} width="100%">
|
||||
<AreaChart data={data}>
|
||||
<defs>
|
||||
{[
|
||||
['pink', Colors.vega.pink.DEFAULT],
|
||||
['green', Colors.vega.green.DEFAULT],
|
||||
['orange', Colors.warning],
|
||||
['yellow', Colors.vega.yellow.DEFAULT],
|
||||
].map(([key, color]) => (
|
||||
<linearGradient key={key} id={key} x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stopColor={color} stopOpacity={0.85} />
|
||||
<stop offset="100%" stopColor={color} stopOpacity={0} />
|
||||
</linearGradient>
|
||||
))}
|
||||
</defs>
|
||||
<Tooltip
|
||||
contentStyle={{ backgroundColor: colors.black }}
|
||||
separator=":"
|
||||
// @ts-ignore formatter doesnt seem to allow returning JSX but nonetheless it works
|
||||
formatter={(value: number) => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
textAlign: 'right',
|
||||
}}
|
||||
>
|
||||
{Intl.NumberFormat().format(value)}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
itemSorter={(label: any) => {
|
||||
return ORDER.indexOf(label.dataKey) + 1;
|
||||
}}
|
||||
/>
|
||||
<YAxis type="number" width={100}>
|
||||
<Label
|
||||
angle={270}
|
||||
value={t('VEGA').toString()}
|
||||
position="left"
|
||||
offset={-5}
|
||||
fill={colors.white}
|
||||
/>
|
||||
</YAxis>
|
||||
<XAxis dataKey="date">
|
||||
<Label
|
||||
value={t('date').toString()}
|
||||
position="bottom"
|
||||
offset={5}
|
||||
fill={colors.white}
|
||||
/>
|
||||
</XAxis>
|
||||
<ReferenceLine
|
||||
x={currentDate}
|
||||
stroke={colors.white}
|
||||
strokeWidth={2}
|
||||
label={{
|
||||
position: 'left',
|
||||
value: currentDate,
|
||||
fill: colors.white,
|
||||
}}
|
||||
/>
|
||||
<Area
|
||||
dot={false}
|
||||
type="linear"
|
||||
dataKey="team"
|
||||
stroke={Colors.vega.pink.DEFAULT}
|
||||
fill="url(#pink)"
|
||||
yAxisId={0}
|
||||
strokeWidth={2}
|
||||
fillOpacity={0.85}
|
||||
stackId="1"
|
||||
name={t('Team')}
|
||||
/>
|
||||
<Area
|
||||
dot={false}
|
||||
type="monotone"
|
||||
dataKey="earlyInvestors"
|
||||
stroke={Colors.vega.green.DEFAULT}
|
||||
fill="url(#green)"
|
||||
yAxisId={0}
|
||||
strokeWidth={2}
|
||||
fillOpacity={0.85}
|
||||
stackId="1"
|
||||
name={t('Early Investors')}
|
||||
/>
|
||||
<Area
|
||||
dot={false}
|
||||
type="monotone"
|
||||
dataKey="publicSale"
|
||||
stroke={Colors.vega.yellow.DEFAULT}
|
||||
fill="url(#yellow)"
|
||||
yAxisId={0}
|
||||
strokeWidth={2}
|
||||
stackId="1"
|
||||
fillOpacity={0.85}
|
||||
name={t('Public Sale')}
|
||||
/>
|
||||
<Area
|
||||
dot={false}
|
||||
type="monotone"
|
||||
dataKey="community"
|
||||
stroke={Colors.warning}
|
||||
fill="url(#orange)"
|
||||
yAxisId={0}
|
||||
strokeWidth={2}
|
||||
fillOpacity={0.85}
|
||||
stackId="1"
|
||||
name={t('Community')}
|
||||
/>
|
||||
<Legend wrapperStyle={{ position: 'relative' }} />
|
||||
</AreaChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -17,14 +17,12 @@ import type { RouteChildProps } from '../index';
|
||||
const Withdrawals = ({ name }: RouteChildProps) => {
|
||||
useDocumentTitle(name);
|
||||
const { t } = useTranslation();
|
||||
const { pubKey } = useVegaWallet();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Heading title={t('withdrawalsTitle')} />
|
||||
{!pubKey && <p className="mb-8">{t('withdrawalsSubtitle')}</p>}
|
||||
<VegaWalletContainer>
|
||||
{() => <WithdrawPendingContainer />}
|
||||
{(currVegaKey) => <WithdrawPendingContainer />}
|
||||
</VegaWalletContainer>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -2761,7 +2761,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "86666.297",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "65752.1635199045224671036",
|
||||
"locked_amount": "65888.8190337497085175298",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "86666.297",
|
||||
@@ -2827,7 +2827,7 @@
|
||||
"tranche_end": "2023-06-01T00:00:00.000Z",
|
||||
"total_added": "2500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "1235.1503675722425",
|
||||
"locked_amount": "1243.0560325091575",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "2500",
|
||||
@@ -2948,7 +2948,7 @@
|
||||
"tranche_end": "2023-09-01T00:00:00.000Z",
|
||||
"total_added": "17500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "17302.07374069041875",
|
||||
"locked_amount": "17356.8118772644925",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "12500",
|
||||
@@ -3214,8 +3214,8 @@
|
||||
"tranche_start": "2023-02-01T00:00:00.000Z",
|
||||
"tranche_end": "2023-08-01T00:00:00.000Z",
|
||||
"total_added": "37500",
|
||||
"total_removed": "3500.377436025",
|
||||
"locked_amount": "31267.73758824432375",
|
||||
"total_removed": "3451.5629793",
|
||||
"locked_amount": "31386.97772790055125",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -3244,11 +3244,6 @@
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x7d9d6e2a37fbe030faf08b7b1b0fc5b09f1f4295c4d7f4e28e0bdac1bdd294ac"
|
||||
},
|
||||
{
|
||||
"amount": "48.814456725",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x9e42c457fa017043dbbcb189fb3a574719ce66ce348eee850db3bd809014b1fd"
|
||||
},
|
||||
{
|
||||
"amount": "142.173112275",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -3315,12 +3310,6 @@
|
||||
"tranche_id": 34,
|
||||
"tx": "0x7d9d6e2a37fbe030faf08b7b1b0fc5b09f1f4295c4d7f4e28e0bdac1bdd294ac"
|
||||
},
|
||||
{
|
||||
"amount": "48.814456725",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 34,
|
||||
"tx": "0x9e42c457fa017043dbbcb189fb3a574719ce66ce348eee850db3bd809014b1fd"
|
||||
},
|
||||
{
|
||||
"amount": "142.173112275",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -3359,8 +3348,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "7500",
|
||||
"withdrawn_tokens": "1225.264253325",
|
||||
"remaining_tokens": "6274.735746675"
|
||||
"withdrawn_tokens": "1176.4497966",
|
||||
"remaining_tokens": "6323.5502034"
|
||||
},
|
||||
{
|
||||
"address": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600",
|
||||
@@ -3392,7 +3381,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "129999.45",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "65692.1729439470503785",
|
||||
"locked_amount": "65828.703776830530732315",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129999.45",
|
||||
@@ -3458,7 +3447,7 @@
|
||||
"tranche_end": "2023-09-03T00:00:00.000Z",
|
||||
"total_added": "62600",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "31543.35908802638962",
|
||||
"locked_amount": "31642.06683789954558",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10000",
|
||||
@@ -3651,7 +3640,7 @@
|
||||
"tranche_end": "2023-09-17T00:00:00.000Z",
|
||||
"total_added": "5000",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "2711.2184487569765",
|
||||
"locked_amount": "2719.1024543378995",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "5000",
|
||||
@@ -3862,7 +3851,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "97499.58",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "7660.1037782103571237062",
|
||||
"locked_amount": "7794.0278068466617184238",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "97499.58",
|
||||
@@ -3895,7 +3884,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "135173.4239508",
|
||||
"total_removed": "98230.390980249184455396",
|
||||
"locked_amount": "10470.039403066276125235594836",
|
||||
"locked_amount": "10653.090429193107744542476008",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "135173.4239508",
|
||||
@@ -3941,7 +3930,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "32499.86",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "3222.4733765764461183784",
|
||||
"locked_amount": "3278.8129026794692276046",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "32499.86",
|
||||
@@ -3974,7 +3963,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "10833.29",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "1048.8838139341641135251",
|
||||
"locked_amount": "1067.221782974876983662",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10833.29",
|
||||
@@ -4007,7 +3996,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "22749.93",
|
||||
"total_removed": "4720.860935375",
|
||||
"locked_amount": "3920.9619604548439563678",
|
||||
"locked_amount": "3989.5133844404452945716",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "6500",
|
||||
@@ -4158,8 +4147,8 @@
|
||||
"tranche_start": "2022-11-01T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-01T00:00:00.000Z",
|
||||
"total_added": "22500",
|
||||
"total_removed": "5037.424704525",
|
||||
"locked_amount": "7324.17846454880325",
|
||||
"total_removed": "4988.60449275",
|
||||
"locked_amount": "7395.722548342542",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -4188,11 +4177,6 @@
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x27d0868963dc1e725d9b4da891a4df20b48107f1b0c803dd3f752362aa1d4335"
|
||||
},
|
||||
{
|
||||
"amount": "48.820211775",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x1690b7e9232984baf6a441b517de44cb2c9c547f100e9e8acc8d7e144e01b2b8"
|
||||
},
|
||||
{
|
||||
"amount": "142.17311235",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -4314,12 +4298,6 @@
|
||||
"tranche_id": 33,
|
||||
"tx": "0x27d0868963dc1e725d9b4da891a4df20b48107f1b0c803dd3f752362aa1d4335"
|
||||
},
|
||||
{
|
||||
"amount": "48.820211775",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 33,
|
||||
"tx": "0x1690b7e9232984baf6a441b517de44cb2c9c547f100e9e8acc8d7e144e01b2b8"
|
||||
},
|
||||
{
|
||||
"amount": "142.17311235",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -4430,8 +4408,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "7500",
|
||||
"withdrawn_tokens": "5037.424704525",
|
||||
"remaining_tokens": "2462.575295475"
|
||||
"withdrawn_tokens": "4988.60449275",
|
||||
"remaining_tokens": "2511.39550725"
|
||||
},
|
||||
{
|
||||
"address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1",
|
||||
@@ -4456,7 +4434,7 @@
|
||||
"tranche_end": "2023-06-02T00:00:00.000Z",
|
||||
"total_added": "1939928.38",
|
||||
"total_removed": "928642.9598472029154",
|
||||
"locked_amount": "483222.589309578295592792",
|
||||
"locked_amount": "486281.47054448047845174",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1852091.69",
|
||||
@@ -36836,7 +36814,7 @@
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "3732368.4671",
|
||||
"total_removed": "618385.665327542135993",
|
||||
"locked_amount": "767046.204261494651069018807",
|
||||
"locked_amount": "771746.63973020695967996929",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1998.95815",
|
||||
@@ -38195,8 +38173,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "15870102.715470999700000001",
|
||||
"total_removed": "587055.52353142020335452",
|
||||
"locked_amount": "8019584.17687863003095029918098754518113",
|
||||
"total_removed": "586757.93761874998960452",
|
||||
"locked_amount": "8036251.6192538834556613842019307768004867",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "16249.93",
|
||||
@@ -38760,11 +38738,6 @@
|
||||
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
|
||||
"tx": "0x132a15c0b5f8c6016ac1a90437b9dca119ebc2479cde9c702327653fa3c11750"
|
||||
},
|
||||
{
|
||||
"amount": "297.58591267021375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x7fa0448cd21e20e3a40743d0f294b6d83618e5167b83809c1c91a82afaba57a5"
|
||||
},
|
||||
{
|
||||
"amount": "535.4042378778335",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -40564,12 +40537,6 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0xdbd9367c0d60c1bd9165752d8fab223aa43c7c2e85568a4e98e86ad0e0c97a01"
|
||||
},
|
||||
{
|
||||
"amount": "297.58591267021375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0x7fa0448cd21e20e3a40743d0f294b6d83618e5167b83809c1c91a82afaba57a5"
|
||||
},
|
||||
{
|
||||
"amount": "535.4042378778335",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -41784,8 +41751,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "259998.8875",
|
||||
"withdrawn_tokens": "128372.00706198100925",
|
||||
"remaining_tokens": "131626.88043801899075"
|
||||
"withdrawn_tokens": "128074.4211493107955",
|
||||
"remaining_tokens": "131924.4663506892045"
|
||||
},
|
||||
{
|
||||
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
|
||||
@@ -44058,8 +44025,8 @@
|
||||
"tranche_start": "2021-11-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-05T00:00:00.000Z",
|
||||
"total_added": "14597706.0446472999",
|
||||
"total_removed": "5578506.105997036447643656",
|
||||
"locked_amount": "1682183.680275606109201953939978039",
|
||||
"total_removed": "5578092.828988683569444906",
|
||||
"locked_amount": "1697570.95665381351801300648336951",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129284.449",
|
||||
@@ -44298,11 +44265,6 @@
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xbecb2d5ad72cdfe972b450c388f111d9262c39896c71acceecb5f672e50c3ce9"
|
||||
},
|
||||
{
|
||||
"amount": "413.27700835287819875",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xa266ac6aa7627d396b9d1c668f80e26d95de431e9ed861922df4472e9158204b"
|
||||
},
|
||||
{
|
||||
"amount": "800.792718381487871",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -47294,12 +47256,6 @@
|
||||
"tranche_id": 3,
|
||||
"tx": "0xbecb2d5ad72cdfe972b450c388f111d9262c39896c71acceecb5f672e50c3ce9"
|
||||
},
|
||||
{
|
||||
"amount": "413.27700835287819875",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0xa266ac6aa7627d396b9d1c668f80e26d95de431e9ed861922df4472e9158204b"
|
||||
},
|
||||
{
|
||||
"amount": "800.792718381487871",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -49816,8 +49772,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "359123.469575",
|
||||
"withdrawn_tokens": "317403.12966652957263025",
|
||||
"remaining_tokens": "41720.33990847042736975"
|
||||
"withdrawn_tokens": "316989.8526581766944315",
|
||||
"remaining_tokens": "42133.6169168233055685"
|
||||
},
|
||||
{
|
||||
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
|
||||
@@ -51161,7 +51117,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "5778205.3912159303",
|
||||
"total_removed": "3077573.36197477479025324",
|
||||
"locked_amount": "347737.542298906744323236374749015",
|
||||
"locked_amount": "353817.1482574094718858681604364422",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "552496.6455",
|
||||
@@ -53232,8 +53188,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "472355.6199999996",
|
||||
"total_removed": "35033.4420916090685",
|
||||
"locked_amount": "121542.855688265356170957439167948",
|
||||
"total_removed": "34992.4553336210685",
|
||||
"locked_amount": "122287.66655711750460814439269404",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "3000",
|
||||
@@ -59887,11 +59843,6 @@
|
||||
"user": "0x454D87e666a106F3545B7cde91F32aE8B9616a72",
|
||||
"tx": "0xcefe8932dc5a8ef8bbbb4f4ac1ec86c2de0e064cab91c381e222411c4661d34a"
|
||||
},
|
||||
{
|
||||
"amount": "40.986757988",
|
||||
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
|
||||
"tx": "0x2f4a8c1de411b2a4c858e06633748bd342c23e0ad30910fc30d562f59c86de36"
|
||||
},
|
||||
{
|
||||
"amount": "57.900076104",
|
||||
"user": "0x96d882E908C06cD697Ea07266Fb8D14ae129A50b",
|
||||
@@ -78483,12 +78434,6 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "40.986757988",
|
||||
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
|
||||
"tranche_id": 5,
|
||||
"tx": "0x2f4a8c1de411b2a4c858e06633748bd342c23e0ad30910fc30d562f59c86de36"
|
||||
},
|
||||
{
|
||||
"amount": "108.551141552",
|
||||
"user": "0xf751033D4e6864a88Be93E36258246F26AEf577c",
|
||||
@@ -78503,8 +78448,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "400",
|
||||
"withdrawn_tokens": "296.884766612",
|
||||
"remaining_tokens": "103.115233388"
|
||||
"withdrawn_tokens": "255.898008624",
|
||||
"remaining_tokens": "144.101991376"
|
||||
},
|
||||
{
|
||||
"address": "0x667ee9816155807e4120dba069CC42aED064399b",
|
||||
|
||||
@@ -104,6 +104,7 @@ export const AccountTable = forwardRef<AgGridReact, AccountTableProps>(
|
||||
/>
|
||||
<AgGridColumn
|
||||
headerName={t('Total')}
|
||||
type="rightAligned"
|
||||
field="deposited"
|
||||
headerTooltip={t(
|
||||
'This is the total amount of collateral used plus the amount available in your general account.'
|
||||
@@ -121,6 +122,7 @@ export const AccountTable = forwardRef<AgGridReact, AccountTableProps>(
|
||||
/>
|
||||
<AgGridColumn
|
||||
headerName={t('Used')}
|
||||
type="rightAligned"
|
||||
field="used"
|
||||
headerTooltip={t(
|
||||
'This is the amount of collateral used from your general account.'
|
||||
@@ -139,6 +141,7 @@ export const AccountTable = forwardRef<AgGridReact, AccountTableProps>(
|
||||
<AgGridColumn
|
||||
headerName={t('Available')}
|
||||
field="available"
|
||||
type="rightAligned"
|
||||
headerTooltip={t(
|
||||
'This is the amount of collateral available in your general account.'
|
||||
)}
|
||||
|
||||
@@ -27,7 +27,6 @@ export const RowData = ({
|
||||
highestBlock,
|
||||
onBlockHeight,
|
||||
}: RowDataProps) => {
|
||||
const [subFailed, setSubFailed] = useState(false);
|
||||
const [time, setTime] = useState<number>();
|
||||
// no use of data here as we need the data nodes reference to block height
|
||||
const { data, error, loading, startPolling, stopPolling } =
|
||||
@@ -47,18 +46,9 @@ export const RowData = ({
|
||||
} = useBlockTimeSubscription();
|
||||
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
if (!subData) {
|
||||
setSubFailed(true);
|
||||
}
|
||||
}, 3000);
|
||||
// stop polling if row has errored
|
||||
}, [error, stopPolling]);
|
||||
|
||||
return () => {
|
||||
clearTimeout(timeout);
|
||||
};
|
||||
}, [subData]);
|
||||
|
||||
// handle polling
|
||||
useEffect(() => {
|
||||
const handleStartPoll = () => startPolling(POLL_INTERVAL);
|
||||
const handleStopPoll = () => stopPolling();
|
||||
@@ -78,7 +68,6 @@ export const RowData = ({
|
||||
};
|
||||
}, [startPolling, stopPolling, error]);
|
||||
|
||||
// measure response time
|
||||
useEffect(() => {
|
||||
if (!isValidUrl(url)) return;
|
||||
// every time we get data measure response speed
|
||||
@@ -142,15 +131,6 @@ export const RowData = ({
|
||||
return false;
|
||||
};
|
||||
|
||||
const getSubFailed = (
|
||||
subError: ApolloError | undefined,
|
||||
subFailed: boolean
|
||||
) => {
|
||||
if (subError) return true;
|
||||
if (subFailed) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{id !== CUSTOM_NODE_KEY && (
|
||||
@@ -181,11 +161,11 @@ export const RowData = ({
|
||||
</LayoutCell>
|
||||
<LayoutCell
|
||||
label={t('Subscription')}
|
||||
isLoading={subFailed ? false : subLoading}
|
||||
hasError={getSubFailed(subError, subFailed)}
|
||||
isLoading={subLoading}
|
||||
hasError={Boolean(subError)}
|
||||
dataTestId="subscription-cell"
|
||||
>
|
||||
{getSubscriptionDisplayValue(subFailed, subData?.busEvents, subError)}
|
||||
{getSubscriptionDisplayValue(subData?.busEvents, subError)}
|
||||
</LayoutCell>
|
||||
</>
|
||||
);
|
||||
@@ -215,11 +195,10 @@ const getBlockDisplayValue = (block?: number, error?: ApolloError) => {
|
||||
};
|
||||
|
||||
const getSubscriptionDisplayValue = (
|
||||
subFailed: boolean,
|
||||
events?: { id: string }[] | null,
|
||||
error?: ApolloError
|
||||
) => {
|
||||
if (subFailed || error) {
|
||||
if (error) {
|
||||
return t('No');
|
||||
}
|
||||
if (events?.length) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import * as Schema from '@vegaprotocol/types';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type { Trade } from './fills-data-provider';
|
||||
|
||||
import { FillsTable } from './fills-table';
|
||||
import { FillsTable, getFeesBreakdown } from './fills-table';
|
||||
import { generateFill } from './test-helpers';
|
||||
|
||||
describe('FillsTable', () => {
|
||||
@@ -75,7 +75,7 @@ describe('FillsTable', () => {
|
||||
'1.00 BTC',
|
||||
'3.00 BTC',
|
||||
'Maker',
|
||||
'0.06 BTC',
|
||||
'2.00 BTC',
|
||||
getDateTimeFormat().format(new Date(buyerFill.createdAt)),
|
||||
];
|
||||
cells.forEach((cell, i) => {
|
||||
@@ -176,4 +176,36 @@ describe('FillsTable', () => {
|
||||
await screen.findByTestId('fee-breakdown-tooltip')
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('getFeesBreakdown', () => {
|
||||
it('should return correct fees breakdown for a taker', () => {
|
||||
const fees = {
|
||||
makerFee: '1000',
|
||||
infrastructureFee: '2000',
|
||||
liquidityFee: '3000',
|
||||
};
|
||||
const expectedBreakdown = {
|
||||
infrastructureFee: '2000',
|
||||
liquidityFee: '3000',
|
||||
makerFee: '1000',
|
||||
totalFee: '6000',
|
||||
};
|
||||
expect(getFeesBreakdown('TAKER', fees)).toEqual(expectedBreakdown);
|
||||
});
|
||||
|
||||
it('should return correct fees breakdown for a maker', () => {
|
||||
const fees = {
|
||||
makerFee: '1000',
|
||||
infrastructureFee: '2000',
|
||||
liquidityFee: '3000',
|
||||
};
|
||||
const expectedBreakdown = {
|
||||
infrastructureFee: '2000',
|
||||
liquidityFee: '3000',
|
||||
makerFee: '-1000',
|
||||
totalFee: '4000',
|
||||
};
|
||||
expect(getFeesBreakdown('MAKER', fees)).toEqual(expectedBreakdown);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,6 +27,10 @@ import type {
|
||||
import { forwardRef } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import type { Trade } from './fills-data-provider';
|
||||
import type { FillFieldsFragment } from './__generated__/Fills';
|
||||
|
||||
const TAKER = 'TAKER';
|
||||
const MAKER = 'MAKER';
|
||||
|
||||
export type Props = (AgGridReactProps | AgReactUiProps) & {
|
||||
partyId: string;
|
||||
@@ -228,66 +232,132 @@ const formatFee = (partyId: string) => {
|
||||
return '-';
|
||||
}
|
||||
const asset = value.settlementAsset;
|
||||
let feesObj;
|
||||
if (data?.buyer.id === partyId) {
|
||||
feesObj = data?.buyerFee;
|
||||
} else if (data?.seller.id === partyId) {
|
||||
feesObj = data?.sellerFee;
|
||||
} else {
|
||||
return '-';
|
||||
}
|
||||
const { fees: feesObj, role } = getRoleAndFees({ data, partyId });
|
||||
if (!feesObj) return '-';
|
||||
|
||||
const fee = new BigNumber(feesObj.makerFee)
|
||||
.plus(feesObj.infrastructureFee)
|
||||
.plus(feesObj.liquidityFee);
|
||||
const totalFees = addDecimalsFormatNumber(fee.toString(), asset.decimals);
|
||||
const { totalFee } = getFeesBreakdown(role, feesObj);
|
||||
const totalFees = addDecimalsFormatNumber(totalFee, asset.decimals);
|
||||
return `${totalFees} ${asset.symbol}`;
|
||||
};
|
||||
};
|
||||
|
||||
export const getRoleAndFees = ({
|
||||
data,
|
||||
partyId,
|
||||
}: {
|
||||
data: Pick<
|
||||
FillFieldsFragment,
|
||||
'buyerFee' | 'sellerFee' | 'buyer' | 'seller' | 'aggressor'
|
||||
>;
|
||||
partyId?: string;
|
||||
}) => {
|
||||
let role;
|
||||
let feesObj;
|
||||
if (data?.buyer.id === partyId) {
|
||||
role = data.aggressor === Schema.Side.SIDE_BUY ? TAKER : MAKER;
|
||||
feesObj = role === TAKER ? data?.buyerFee : data.sellerFee;
|
||||
} else if (data?.seller.id === partyId) {
|
||||
role = data.aggressor === Schema.Side.SIDE_SELL ? TAKER : MAKER;
|
||||
feesObj = role === TAKER ? data?.sellerFee : data.buyerFee;
|
||||
} else {
|
||||
return { role: '-', feesObj: '-' };
|
||||
}
|
||||
return { role, fees: feesObj };
|
||||
};
|
||||
|
||||
const FeesBreakdownTooltip = ({
|
||||
data,
|
||||
value,
|
||||
valueFormatted,
|
||||
partyId,
|
||||
}: ITooltipParams & { partyId?: string }) => {
|
||||
if (!value?.settlementAsset || !data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const asset = value.settlementAsset;
|
||||
let feesObj;
|
||||
if (data?.buyer.id === partyId) {
|
||||
feesObj = data?.buyerFee;
|
||||
} else if (data?.seller.id === partyId) {
|
||||
feesObj = data?.sellerFee;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { role, fees: feesObj } = getRoleAndFees({ data, partyId }) ?? {};
|
||||
if (!feesObj) return null;
|
||||
const { infrastructureFee, liquidityFee, makerFee, totalFee } =
|
||||
getFeesBreakdown(role, feesObj);
|
||||
|
||||
return (
|
||||
<div
|
||||
data-testid="fee-breakdown-tooltip"
|
||||
className="max-w-sm border border-neutral-600 bg-neutral-100 dark:bg-neutral-800 px-4 py-2 z-20 rounded text-sm break-word text-black dark:text-white"
|
||||
>
|
||||
<dl className="grid grid-cols-3 gap-x-1">
|
||||
{role === MAKER && (
|
||||
<>
|
||||
<p className="mb-1">{t('The maker will receive the maker fee.')}</p>
|
||||
<p className="mb-1">
|
||||
{t(
|
||||
'If the market is in monitoring auction the maker will pay half of the infrastructure and liquidity fees.'
|
||||
)}
|
||||
</p>
|
||||
<p className="mb-1">
|
||||
{t(
|
||||
'If the market is active the maker will pay zero infrastructure and liquidity fees.'
|
||||
)}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{role === TAKER && (
|
||||
<>
|
||||
<p className="mb-1">{t('Fees to be paid by the taker.')}</p>
|
||||
<p className="mb-1">
|
||||
{t(
|
||||
'If the market is in monitoring auction the taker will pay half of the infrastructure and liquidity fees.'
|
||||
)}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
<dl className="grid grid-cols-2 gap-x-1">
|
||||
<dt className="col-span-1">{t('Infrastructure fee')}</dt>
|
||||
<dd className="text-right col-span-2">
|
||||
{addDecimalsFormatNumber(feesObj.infrastructureFee, asset.decimals)}{' '}
|
||||
<dd className="text-right col-span-1">
|
||||
{addDecimalsFormatNumber(infrastructureFee, asset.decimals)}{' '}
|
||||
{asset.symbol}
|
||||
</dd>
|
||||
<dt className="col-span-1">{t('Liquidity fee')}</dt>
|
||||
<dd className="text-right col-span-2">
|
||||
{addDecimalsFormatNumber(feesObj.liquidityFee, asset.decimals)}{' '}
|
||||
{asset.symbol}
|
||||
<dd className="text-right col-span-1">
|
||||
{addDecimalsFormatNumber(liquidityFee, asset.decimals)} {asset.symbol}
|
||||
</dd>
|
||||
<dt className="col-span-1">{t('Maker fee')}</dt>
|
||||
<dd className="text-right col-span-2">
|
||||
{addDecimalsFormatNumber(feesObj.makerFee, asset.decimals)}{' '}
|
||||
{asset.symbol}
|
||||
<dd className="text-right col-span-1">
|
||||
{addDecimalsFormatNumber(makerFee, asset.decimals)} {asset.symbol}
|
||||
</dd>
|
||||
<dt className="col-span-1">{t('Total fees')}</dt>
|
||||
<dd className="text-right col-span-2">{valueFormatted}</dd>
|
||||
<dd className="text-right col-span-1">
|
||||
{addDecimalsFormatNumber(totalFee, asset.decimals)} {asset.symbol}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const getFeesBreakdown = (
|
||||
role: string,
|
||||
feesObj: {
|
||||
__typename?: 'TradeFee' | undefined;
|
||||
makerFee: string;
|
||||
infrastructureFee: string;
|
||||
liquidityFee: string;
|
||||
}
|
||||
) => {
|
||||
const makerFee =
|
||||
role === MAKER
|
||||
? new BigNumber(feesObj.makerFee).times(-1).toString()
|
||||
: feesObj.makerFee;
|
||||
const infrastructureFee = feesObj.infrastructureFee;
|
||||
const liquidityFee = feesObj.liquidityFee;
|
||||
|
||||
const totalFee = new BigNumber(infrastructureFee)
|
||||
.plus(makerFee)
|
||||
.plus(liquidityFee)
|
||||
.toString();
|
||||
return {
|
||||
infrastructureFee,
|
||||
liquidityFee,
|
||||
makerFee,
|
||||
totalFee,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user