Skip to content

Commit

Permalink
v6.2.2
Browse files Browse the repository at this point in the history
v6.2.2
  • Loading branch information
platschi authored Mar 9, 2023
2 parents 0d9f9f0 + bab5455 commit 16aaf7e
Show file tree
Hide file tree
Showing 26 changed files with 183 additions and 316 deletions.
2 changes: 1 addition & 1 deletion assets/svg/app/link-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions constants/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export const EXTERNAL_LINKS = {
},
Options: {
Portfolio: 'https://options.kwenta.eth.limo/#/portfolio',
Trade: 'https://options.kwenta.eth.limo/#/trade',
Vaults: 'https://options.kwenta.eth.limo/#/vaults',
Rewards: 'https://options.kwenta.eth.limo/#/rewards',
},
Synthetix: {
Home: 'https://www.synthetix.io',
Expand Down
29 changes: 21 additions & 8 deletions hooks/useStatsData.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
import { useMemo } from 'react';
import { UseQueryResult } from 'react-query';

import { useGetFuturesTradersStats } from 'queries/futures/useGetFuturesTradersStats';
import { useGetStatsVolumes } from 'queries/futures/useGetStatsVolumes';
import useGetFile from 'queries/files/useGetFile';
import { selectMarkPrices, selectMarkets } from 'state/futures/selectors';
import { useAppSelector } from 'state/hooks';
import { selectMinTimestamp } from 'state/stats/selectors';

export type StatsTimeframe = '1M' | '1Y' | 'MAX';

export type DailyStat = {
timestamp: number;
volume: number;
trades: number;
feesSynthetix: number;
feesKwenta: number;
cumulativeTrades: number;
uniqueTraders: number;
cumulativeTraders: number;
};

const useStatsData = () => {
const futuresMarkets = useAppSelector(selectMarkets);
const prices = useAppSelector(selectMarkPrices);
const minTimestamp = useAppSelector(selectMinTimestamp);

const { data: volumeData, isLoading: volumeIsLoading } = useGetStatsVolumes();
const { data: tradersData, isLoading: tradersIsLoading } = useGetFuturesTradersStats();
const {
data: dailyStatsData,
isLoading: dailyStatsIsLoading,
}: UseQueryResult<DailyStat[]> = useGetFile('stats/daily_stats.json');

const openInterestData = useMemo(() => {
return futuresMarkets.map(({ marketKey, asset, marketSize }) => {
Expand All @@ -24,10 +39,8 @@ const useStatsData = () => {
}, [futuresMarkets, prices]);

return {
volumeData,
volumeIsLoading,
tradersData,
tradersIsLoading,
dailyStatsData: dailyStatsData?.filter(({ timestamp }) => timestamp > minTimestamp) ?? [],
dailyStatsIsLoading,
openInterestData,
};
};
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kwenta",
"version": "6.1.1",
"version": "6.2.2",
"scripts": {
"dev": "next",
"build": "next build",
Expand Down
12 changes: 6 additions & 6 deletions pages/dashboard/earn.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Head from 'next/head';
import { FC, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';

import Button from 'components/Button';
Expand All @@ -17,6 +18,8 @@ import media from 'styles/media';
type EarnPageProps = FC & { getLayout: (page: HTMLElement) => JSX.Element };

const EarnPage: EarnPageProps = () => {
const { t } = useTranslation();

const dispatch = useAppDispatch();
const walletAddress = useAppSelector(({ wallet }) => wallet.walletAddress);

Expand All @@ -39,16 +42,13 @@ const EarnPage: EarnPageProps = () => {
return (
<>
<Head>
<title>Earn | Kwenta</title>
<title>{t('dashboard.earn.title')}</title>
</Head>
<PageContent>
<FullHeightContainer>
<EarnContent>
<Heading>Kwenta Liquidity Mining</Heading>
<StyledBody>
The ETH/KWENTA program rewards liquidity providers on the Uniswap v3 pool via Arrakis
Finance. Liquidity providers can stake their pool tokens to earn KWENTA.
</StyledBody>
<Heading>{t('dashboard.earn.heading')}</Heading>
<StyledBody>{t('dashboard.earn.copy')}</StyledBody>
<StepOne />
<StepTwo />
<GitHashID />
Expand Down
84 changes: 0 additions & 84 deletions queries/futures/useGetFuturesTradersStats.ts

This file was deleted.

72 changes: 0 additions & 72 deletions queries/futures/useGetStatsVolumes.ts

This file was deleted.

2 changes: 1 addition & 1 deletion sdk/utils/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export const POTENTIAL_TRADE_STATUS_TO_MESSAGE: { [key: string]: string } = {
PRICE_OUT_OF_BOUNDS: 'Price out of acceptable range',
CAN_LIQUIDATE: 'Position can be liquidated',
CANNOT_LIQUIDATE: 'Position cannot be liquidated',
MAX_MARKET_SIZE_EXCEEDED: 'Max market size exceeded',
MAX_MARKET_SIZE_EXCEEDED: 'Open interest limit exceeded',
MAX_LEVERAGE_EXCEEDED: 'Max leverage exceeded',
INSUFFICIENT_MARGIN: 'Insufficient margin',
NOT_PERMITTED: 'Not permitted by this address',
Expand Down
60 changes: 34 additions & 26 deletions sections/dashboard/FuturesPositionsTable/FuturesPositionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import MobilePositionRow from './MobilePositionRow';
type FuturesPositionTableProps = {
accountType: FuturesAccountType;
showCurrentMarket?: boolean;
showEmptyTable?: boolean;
};

const LegacyLink = () => {
Expand All @@ -63,6 +64,7 @@ const LegacyLink = () => {
const FuturesPositionsTable: FC<FuturesPositionTableProps> = ({
accountType,
showCurrentMarket = true,
showEmptyTable = true,
}) => {
const { t } = useTranslation();
const { synthsMap } = Connector.useContainer();
Expand Down Expand Up @@ -294,32 +296,38 @@ const FuturesPositionsTable: FC<FuturesPositionTableProps> = ({
</DesktopOnlyView>
<MobileOrTabletView>
<LegacyLink />
<OpenPositionsHeader>
<div>{t('dashboard.overview.futures-positions-table.mobile.market')}</div>
<OpenPositionsRightHeader>
<div>{t('dashboard.overview.futures-positions-table.mobile.price')}</div>
<div>{t('dashboard.overview.futures-positions-table.mobile.pnl')}</div>
</OpenPositionsRightHeader>
</OpenPositionsHeader>
<div style={{ margin: '0 15px' }}>
{data.length === 0 ? (
<NoPositionsText>
<Link href={ROUTES.Markets.Home(accountType)}>
<div>{t('common.perp-cta')}</div>
</Link>
</NoPositionsText>
) : (
data.map((row) => (
<MobilePositionRow
onClick={() =>
router.push(ROUTES.Markets.MarketPair(row.market?.asset ?? 'sETH', accountType))
}
key={row.market?.asset}
row={row}
/>
))
)}
</div>
{(showEmptyTable || data.length) && (
<>
<OpenPositionsHeader>
<div>{t('dashboard.overview.futures-positions-table.mobile.market')}</div>
<OpenPositionsRightHeader>
<div>{t('dashboard.overview.futures-positions-table.mobile.price')}</div>
<div>{t('dashboard.overview.futures-positions-table.mobile.pnl')}</div>
</OpenPositionsRightHeader>
</OpenPositionsHeader>
<div style={{ margin: '0 15px' }}>
{data.length === 0 ? (
<NoPositionsText>
<Link href={ROUTES.Markets.Home(accountType)}>
<div>{t('common.perp-cta')}</div>
</Link>
</NoPositionsText>
) : (
data.map((row) => (
<MobilePositionRow
onClick={() =>
router.push(
ROUTES.Markets.MarketPair(row.market?.asset ?? 'sETH', accountType)
)
}
key={row.market?.asset}
row={row}
/>
))
)}
</div>
</>
)}
</MobileOrTabletView>
</>
);
Expand Down
Loading

0 comments on commit 16aaf7e

Please sign in to comment.