Skip to content

Commit

Permalink
v7.2.4
Browse files Browse the repository at this point in the history
v7.2.4
  • Loading branch information
platschi authored Jun 12, 2023
2 parents 73c31c0 + f496c45 commit 82ec0fa
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const getStep = (maxValue: number) => {
if (maxValue < 10) return 0.01;
if (maxValue < 100) return 1;
if (maxValue < 10000) return 10;
return 100;
return Math.pow(10, Math.floor(Math.log10(maxValue)) - 3);
};

const styledMarkLabel = css`
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": "7.2.2",
"version": "7.2.4",
"scripts": {
"dev": "next",
"build": "next build",
Expand Down
2 changes: 1 addition & 1 deletion sdk/constants/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const KWENTA_TRACKING_CODE = formatBytes32String('KWENTA');
export const DEFAULT_NUMBER_OF_TRADES = 32;

export const DEFAULT_PRICE_IMPACT_DELTA_PERCENT = {
MARKET: '4',
MARKET: '1',
STOP: '4',
LIMIT: '4',
STOP_LOSS: '5',
Expand Down
4 changes: 2 additions & 2 deletions sdk/utils/futures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,14 @@ export const formatPotentialTrade = (
const notionalValue = wei(size).mul(wei(basePrice));
const leverage = margin.gt(0) ? notionalValue.div(wei(margin)) : ZERO_WEI;

const priceImpact = wei(price).sub(basePrice).div(basePrice);
const priceImpact = wei(price).sub(basePrice).div(basePrice).abs();
const slippageDirection = nativeSizeDelta.gt(0)
? priceImpact.gt(0)
? -1
: nativeSizeDelta.lt(0)
? priceImpact.lt(0)
: -1
: 1;

return {
fee: wei(fee),
liqPrice: wei(liqPrice),
Expand Down Expand Up @@ -434,6 +433,7 @@ export const mapConditionalOrderFromContract = (
const asset = MarketAssetByKey[marketKey];
const sizeDelta = wei(orderDetails.sizeDelta);
const size = sizeDelta.abs();

return {
id: orderDetails.id,
subgraphId: `CM-${account}-${orderDetails.id}`,
Expand Down
2 changes: 0 additions & 2 deletions sections/futures/MarketInfo/MarketHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import Head from 'next/head';
import { FC } from 'react';
import { useTranslation } from 'react-i18next';

import { DEFAULT_CRYPTO_DECIMALS } from 'constants/defaults';
import { getDisplayAsset } from 'sdk/utils/futures';
import { formatCurrency } from 'sdk/utils/number';
import { selectMarketAsset, selectSkewAdjustedPrice } from 'state/futures/selectors';
import { useAppSelector } from 'state/hooks';
import { isDecimalFour } from 'utils/futures';

const MarketHead: FC = () => {
const { t } = useTranslation();
Expand Down
4 changes: 0 additions & 4 deletions sections/futures/Trade/ShowPercentage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ const ShowPercentage: React.FC<ShowPercentageProps> = ({
leverageWei,
}) => {
const calculatePercentage = useMemo(() => {
// eslint-disable-next-line no-console
console.log(
`targetPrice: ${targetPrice}, currentPrice: ${currentPrice}, leverageSide: ${leverageSide}`
);
if (!targetPrice || !currentPrice || !leverageSide) return '';
const priceWei = wei(targetPrice);
const diff =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default function TradeConfirmationModal({
value: formatDollars(orderPrice, { suggestDecimals: true }),
}
: {
label: 'fill price',
label: 'Est. fill price',
value: formatDollars(positionDetails?.price ?? ZERO_WEI, { suggestDecimals: true }),
},

Expand Down
9 changes: 5 additions & 4 deletions sections/futures/TradingHistory/TradesHistoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import styled, { css } from 'styled-components';
import Table, { TableHeader } from 'components/Table';
import { Body } from 'components/Text';
import { NO_VALUE } from 'constants/placeholder';
import { blockExplorer } from 'containers/Connector/Connector';
import useGetFuturesTrades from 'queries/futures/useGetFuturesTrades';
import { formatNumber } from 'sdk/utils/number';
import { selectMarketKey } from 'state/futures/selectors';
Expand Down Expand Up @@ -44,6 +45,7 @@ const TradesHistoryTable: FC<TradesHistoryTableProps> = ({ mobile }) => {
time: Number(trade?.timestamp),
id: trade?.txnHash,
orderType: trade?.orderType,
account: trade?.account,
};
})
: [];
Expand Down Expand Up @@ -103,10 +105,9 @@ const TradesHistoryTable: FC<TradesHistoryTableProps> = ({ mobile }) => {
lastRef={lastElementRef}
$mobile={mobile}
onTableRowClick={(_row) => {
// TODO: Open tx to creator not executor
// row.original.id !== NO_VALUE
// ? window.open(`${blockExplorer.txLink(row.original.id)}`)
// : undefined
return _row.original.id !== NO_VALUE
? window.open(`${blockExplorer.addressLink(_row.original.account)}`)
: undefined;
}}
highlightRowsOnHover
columns={[
Expand Down
5 changes: 3 additions & 2 deletions sections/futures/UserInfo/PositionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const PositionsTable: FC<FuturesPositionTableProps> = () => {
const markPrice = markPrices[market?.marketKey!] ?? ZERO_WEI;
return {
market: market!,
remainingMargin: position.remainingMargin,
position: position.position!,
avgEntryPrice: thisPositionHistory?.avgEntryPrice,
stopLoss: position.stopLoss?.targetPrice,
Expand Down Expand Up @@ -205,7 +206,7 @@ const PositionsTable: FC<FuturesPositionTableProps> = () => {
<PositionCell>
<FlexDivCol>
<FlexDivRow justifyContent="flex-start" columnGap="5px">
<NumericValue value={row.position.initialMargin} />
<NumericValue value={row.remainingMargin} />
{accountType === 'cross_margin' && (
<EditPositionButton
modalType={'futures_edit_position_margin'}
Expand Down Expand Up @@ -303,7 +304,7 @@ const TableContainer = styled.div`

const PositionRowDesktop = styled.div`
display: grid;
grid-template-columns: 75px 60px 110px 1fr 1fr 1.3fr 1fr 1fr 1fr 64px;
grid-template-columns: 75px 60px minmax(130px, 1fr) 1fr 1fr 1.3fr 1fr 1fr 1fr 64px;
grid-gap: 10px;
height: 100%;
height: 54px;
Expand Down
2 changes: 1 addition & 1 deletion translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@
"margin-change": "Margin",
"liquidation": "Liquidation",
"price-impact": "Price Impact",
"fill-price": "Fill Price",
"fill-price": "Est. Fill Price",
"submit-size": "Submit size change",
"submit-margin-withdraw": "Withdraw Margin",
"submit-margin-deposit": "Deposit Margin",
Expand Down

1 comment on commit 82ec0fa

@vercel
Copy link

@vercel vercel bot commented on 82ec0fa Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kwenta – ./

kwenta.io
kwenta-git-main-kwenta.vercel.app
kwenta-kwenta.vercel.app

Please sign in to comment.