Skip to content

Commit

Permalink
Merge pull request #1189 from gmx-io/collateral-and-liquidation-tooltips
Browse files Browse the repository at this point in the history
Edit collateral and liquidation tooltips
  • Loading branch information
midas-myth authored Aug 23, 2024
2 parents 954cfac + 5ba0282 commit a370b6c
Show file tree
Hide file tree
Showing 11 changed files with 340 additions and 179 deletions.
4 changes: 2 additions & 2 deletions src/components/Exchange/PositionsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export default function PositionsList(props) {

{!hideActions && (
<span>
<Trans>Use the Edit Collateral icon to deposit or withdraw collateral.</Trans>
<Trans>Use the edit collateral icon to deposit or withdraw collateral.</Trans>
</span>
)}
</>
Expand Down Expand Up @@ -685,7 +685,7 @@ export default function PositionsList(props) {
{!hideActions && (
<>
<br />
<Trans>Use the Edit Collateral icon to deposit or withdraw collateral.</Trans>
<Trans>Use the edit collateral icon to deposit or withdraw collateral.</Trans>
</>
)}
</>
Expand Down
47 changes: 32 additions & 15 deletions src/components/Synthetics/PositionItem/PositionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,16 @@ export function PositionItem(p: Props) {
textClassName={getPositiveOrNegativeClass(fundingFeeRateUsd)}
/>
<br />
<Trans>Use the Edit Collateral icon to deposit or withdraw collateral.</Trans>
<Trans>Use the edit collateral icon to deposit or withdraw collateral.</Trans>
<br />
<br />
<Trans>
Negative Funding Fees are settled against the collateral automatically and will influence the
liquidation price. Positive Funding Fees can be claimed under Claimable Funding after realizing any
action on the position.
Negative funding fees and borrow fees are settled against the collateral automatically and will
influence the time to liquidation, as shown under the liquidation price tooltip.
</Trans>
<br />
<br />
<Trans>Positive funding fees can be claimed under the claims tab.</Trans>
</>
);
}}
Expand Down Expand Up @@ -275,13 +277,17 @@ export function PositionItem(p: Props) {

if (p.position.liquidationPrice === undefined) {
if (!p.position.isLong && p.position.collateralAmount >= p.position.sizeInTokens) {
liqPriceWarning = t`Since your position's Collateral is ${p.position.collateralToken.symbol} with a value larger than the Position Size, the Collateral value will increase to cover any negative PnL.`;
const symbol = p.position.collateralToken.symbol;
const indexName = getMarketIndexName(p.position.marketInfo);
liqPriceWarning = t`Since your position's collateral is in ${symbol}, with an initial value higher than the ${indexName} short position size, the collateral value will increase to cover any negative PnL, so there is no liquidation price.`;
} else if (
p.position.isLong &&
p.position.collateralToken.isStable &&
p.position.collateralUsd >= p.position.sizeInUsd
) {
liqPriceWarning = t`Since your position's Collateral is ${p.position.collateralToken.symbol} with a value larger than the Position Size, the Collateral value will cover any negative PnL.`;
const symbol = p.position.collateralToken.symbol;
const indexName = getMarketIndexName(p.position.marketInfo);
liqPriceWarning = t`Since your position's collateral is in ${symbol}, with an initial value higher than the ${indexName} long position size, the collateral value will cover any negative PnL, so there is no liquidation price.`;
}
}

Expand All @@ -290,20 +296,31 @@ export function PositionItem(p: Props) {
{liqPriceWarning && <div>{liqPriceWarning}</div>}
{estimatedLiquidationHours ? (
<div>
<div>
{!liqPriceWarning && "Liquidation Price is influenced by Fees, Collateral value, and Price Impact."}
</div>
{!liqPriceWarning && (
<>
<Trans>Liquidation price is influenced by fees and collateral value.</Trans>
<br />
</>
)}
<br />
{liqPriceWarning ? (
<Trans>
This position could still be liquidated, excluding any price movement, due to funding and borrowing fee
rates reducing the position's collateral over time.
</Trans>
) : (
<Trans>
This position could be liquidated, excluding any price movement, due to funding and borrowing fee rates
reducing the position's collateral over time.
</Trans>
)}
<br />
<br />
<StatsTooltipRow
label={"Estimated time to Liquidation"}
label={"Estimated Time to Liquidation"}
value={formatEstimatedLiquidationTime(estimatedLiquidationHours)}
showDollar={false}
/>
<br />
<div>
Estimation based on current Borrow and Funding Fees rates reducing position's Collateral over time,
excluding any price movement.
</div>
</div>
) : (
""
Expand Down
52 changes: 34 additions & 18 deletions src/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ msgstr "Markt-Tausch"
msgid "Trade History"
msgstr "Handelshistorie"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's collateral is in {symbol}, with an initial value higher than the {indexName} short position size, the collateral value will increase to cover any negative PnL, so there is no liquidation price."
msgstr ""

#: src/pages/CompleteAccountTransfer/CompleteAccountTransfer.jsx
msgid "You will need to be on this page to accept the transfer, <0>click here</0> to copy the link to this page if needed."
msgstr "Du musst auf dieser Seite sein, um den Transfer zu akzeptieren. <0>Klicke hier</0>, um den Link zu dieser Seite zu kopieren, falls nötig."
Expand Down Expand Up @@ -970,6 +974,10 @@ msgstr "GLP verkaufen"
msgid "Stake submitted! <0>View status.</0>"
msgstr "Staken übermittelt! <0>Status anzeigen.</0>"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's collateral is in {symbol}, with an initial value higher than the {indexName} long position size, the collateral value will cover any negative PnL, so there is no liquidation price."
msgstr ""

#: src/components/Synthetics/PoolSelector2/PoolSelector2.tsx
#: src/components/Synthetics/PoolSelector2/PoolSelector2.tsx
msgid "Short Liq."
Expand Down Expand Up @@ -1101,10 +1109,6 @@ msgstr "Gehe Long..."
msgid "Total Rebates"
msgstr "Rabatte insgesamt"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Negative Funding Fees are settled against the collateral automatically and will influence the liquidation price. Positive Funding Fees can be claimed under Claimable Funding after realizing any action on the position."
msgstr ""

#: src/domain/synthetics/trade/utils/validation.ts
msgid "Min order: {0}"
msgstr ""
Expand Down Expand Up @@ -1840,10 +1844,6 @@ msgstr ""
msgid "STIP.b trading incentives"
msgstr ""

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's Collateral is {0} with a value larger than the Position Size, the Collateral value will cover any negative PnL."
msgstr ""

#: src/components/Exchange/ConfirmationBox.jsx
msgid "You can edit the default Allowed Slippage in the settings menu on the top right of the page.<0/><1/>Note that a low allowed slippage, e.g. less than {0}, may result in failed orders if prices are volatile."
msgstr ""
Expand Down Expand Up @@ -1878,6 +1878,10 @@ msgstr "Genehmigung von {0}..."
msgid "Deposited {0} into {positionText}"
msgstr ""

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Positive funding fees can be claimed under the claims tab."
msgstr ""

#: src/components/Glp/GlpSwap.jsx
msgid "{nativeTokenSymbol} ({wrappedTokenSymbol}) APR"
msgstr "{nativeTokenSymbol} ({wrappedTokenSymbol}) APR"
Expand Down Expand Up @@ -5098,6 +5102,12 @@ msgstr ""
msgid "Limit Increase"
msgstr ""

#: src/components/Exchange/PositionsList.jsx
#: src/components/Exchange/PositionsList.jsx
#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Use the edit collateral icon to deposit or withdraw collateral."
msgstr "Verwende das Kollateral-Bearbeiten-Symbol, um Kollateral einzuzahlen oder abzuheben."

#: src/pages/BuyGMX/BuyGMX.tsx
msgid "Buy GMX using any token from any network:"
msgstr ""
Expand Down Expand Up @@ -5189,10 +5199,6 @@ msgstr ""
msgid "Couldn't find a swap path with enough liquidity"
msgstr ""

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's Collateral is {0} with a value larger than the Position Size, the Collateral value will increase to cover any negative PnL."
msgstr ""

#: src/pages/Stake/StakeV2.tsx
#: src/pages/Stake/StakeV2.tsx
msgid "Withdrawn!"
Expand Down Expand Up @@ -5436,6 +5442,10 @@ msgstr "Ökosystem"
msgid "High USDG Slippage, Long Anyway"
msgstr "Hohe USDG-Abweichung, trotzdem Long"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Negative funding fees and borrow fees are settled against the collateral automatically and will influence the time to liquidation, as shown under the liquidation price tooltip."
msgstr ""

#: src/components/GmTokensBalanceInfo/GmTokensBalanceInfo.tsx
msgid "Wallet total"
msgstr ""
Expand Down Expand Up @@ -5990,6 +6000,10 @@ msgstr "Restliches Kollateral ohne Auswirkung"
msgid "Edit {0} {1}"
msgstr ""

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "This position could still be liquidated, excluding any price movement, due to funding and borrowing fee rates reducing the position's collateral over time."
msgstr ""

#: src/pages/BuyGMX/BuyGMX.tsx
msgid "Transfer {nativeTokenSymbol}"
msgstr ""
Expand Down Expand Up @@ -6321,12 +6335,6 @@ msgstr ""
msgid "Failed Withdraw"
msgstr "Abhebung fehlgeschlagen"

#: src/components/Exchange/PositionsList.jsx
#: src/components/Exchange/PositionsList.jsx
#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Use the Edit Collateral icon to deposit or withdraw collateral."
msgstr "Verwende das Symbol Kollateral bearbeiten, um Kollateral zu hinterlegen oder zurückzuziehen."

#: src/pages/Referrals/Referrals.tsx
msgid "Get fee discounts and earn rebates through the GMX referral program.<0/>For more information, please read the <1>referral program details</1>."
msgstr ""
Expand Down Expand Up @@ -7082,6 +7090,10 @@ msgstr ""
msgid "Accrued"
msgstr ""

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Liquidation price is influenced by fees and collateral value."
msgstr ""

#: src/pages/AccountDashboard/DailyAndCumulativePnL.tsx
msgid "No data available"
msgstr ""
Expand Down Expand Up @@ -7556,6 +7568,10 @@ msgstr ""
msgid "Price is above Mark Price"
msgstr "Preis ist über Mark Preis"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "This position could be liquidated, excluding any price movement, due to funding and borrowing fee rates reducing the position's collateral over time."
msgstr ""

#: src/components/Synthetics/TradeHistory/TradeHistoryRow/utils/position.ts
#: src/components/Synthetics/TradeHistory/TradeHistoryRow/utils/position.ts
#: src/components/Synthetics/TradeHistory/TradeHistoryRow/utils/position.ts
Expand Down
52 changes: 34 additions & 18 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ msgstr "Market Swap"
msgid "Trade History"
msgstr "Trade History"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's collateral is in {symbol}, with an initial value higher than the {indexName} short position size, the collateral value will increase to cover any negative PnL, so there is no liquidation price."
msgstr "Since your position's collateral is in {symbol}, with an initial value higher than the {indexName} short position size, the collateral value will increase to cover any negative PnL, so there is no liquidation price."

#: src/pages/CompleteAccountTransfer/CompleteAccountTransfer.jsx
msgid "You will need to be on this page to accept the transfer, <0>click here</0> to copy the link to this page if needed."
msgstr "You will need to be on this page to accept the transfer, <0>click here</0> to copy the link to this page if needed."
Expand Down Expand Up @@ -970,6 +974,10 @@ msgstr "Sell GLP"
msgid "Stake submitted! <0>View status.</0>"
msgstr "Stake submitted! <0>View status.</0>"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's collateral is in {symbol}, with an initial value higher than the {indexName} long position size, the collateral value will cover any negative PnL, so there is no liquidation price."
msgstr "Since your position's collateral is in {symbol}, with an initial value higher than the {indexName} long position size, the collateral value will cover any negative PnL, so there is no liquidation price."

#: src/components/Synthetics/PoolSelector2/PoolSelector2.tsx
#: src/components/Synthetics/PoolSelector2/PoolSelector2.tsx
msgid "Short Liq."
Expand Down Expand Up @@ -1101,10 +1109,6 @@ msgstr "Longing..."
msgid "Total Rebates"
msgstr "Total Rebates"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Negative Funding Fees are settled against the collateral automatically and will influence the liquidation price. Positive Funding Fees can be claimed under Claimable Funding after realizing any action on the position."
msgstr "Negative Funding Fees are settled against the collateral automatically and will influence the liquidation price. Positive Funding Fees can be claimed under Claimable Funding after realizing any action on the position."

#: src/domain/synthetics/trade/utils/validation.ts
msgid "Min order: {0}"
msgstr "Min order: {0}"
Expand Down Expand Up @@ -1840,10 +1844,6 @@ msgstr "Enter and exit positions with minimal spread and low price impact. Get t
msgid "STIP.b trading incentives"
msgstr "STIP.b trading incentives"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's Collateral is {0} with a value larger than the Position Size, the Collateral value will cover any negative PnL."
msgstr "Since your position's Collateral is {0} with a value larger than the Position Size, the Collateral value will cover any negative PnL."

#: src/components/Exchange/ConfirmationBox.jsx
msgid "You can edit the default Allowed Slippage in the settings menu on the top right of the page.<0/><1/>Note that a low allowed slippage, e.g. less than {0}, may result in failed orders if prices are volatile."
msgstr "You can edit the default Allowed Slippage in the settings menu on the top right of the page.<0/><1/>Note that a low allowed slippage, e.g. less than {0}, may result in failed orders if prices are volatile."
Expand Down Expand Up @@ -1878,6 +1878,10 @@ msgstr "Approving {0}..."
msgid "Deposited {0} into {positionText}"
msgstr "Deposited {0} into {positionText}"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Positive funding fees can be claimed under the claims tab."
msgstr "Positive funding fees can be claimed under the claims tab."

#: src/components/Glp/GlpSwap.jsx
msgid "{nativeTokenSymbol} ({wrappedTokenSymbol}) APR"
msgstr "{nativeTokenSymbol} ({wrappedTokenSymbol}) APR"
Expand Down Expand Up @@ -5101,6 +5105,12 @@ msgstr "Price above lowest Limit Price."
msgid "Limit Increase"
msgstr "Limit Increase"

#: src/components/Exchange/PositionsList.jsx
#: src/components/Exchange/PositionsList.jsx
#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Use the edit collateral icon to deposit or withdraw collateral."
msgstr "Use the edit collateral icon to deposit or withdraw collateral."

#: src/pages/BuyGMX/BuyGMX.tsx
msgid "Buy GMX using any token from any network:"
msgstr "Buy GMX using any token from any network:"
Expand Down Expand Up @@ -5192,10 +5202,6 @@ msgstr "Increase Size (Market)"
msgid "Couldn't find a swap path with enough liquidity"
msgstr "Couldn't find a swap path with enough liquidity"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Since your position's Collateral is {0} with a value larger than the Position Size, the Collateral value will increase to cover any negative PnL."
msgstr "Since your position's Collateral is {0} with a value larger than the Position Size, the Collateral value will increase to cover any negative PnL."

#: src/pages/Stake/StakeV2.tsx
#: src/pages/Stake/StakeV2.tsx
msgid "Withdrawn!"
Expand Down Expand Up @@ -5439,6 +5445,10 @@ msgstr "Ecosystem"
msgid "High USDG Slippage, Long Anyway"
msgstr "High USDG Slippage, Long Anyway"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Negative funding fees and borrow fees are settled against the collateral automatically and will influence the time to liquidation, as shown under the liquidation price tooltip."
msgstr "Negative funding fees and borrow fees are settled against the collateral automatically and will influence the time to liquidation, as shown under the liquidation price tooltip."

#: src/components/GmTokensBalanceInfo/GmTokensBalanceInfo.tsx
msgid "Wallet total"
msgstr "Wallet total"
Expand Down Expand Up @@ -5996,6 +6006,10 @@ msgstr "Leftover Collateral Excluding Impact"
msgid "Edit {0} {1}"
msgstr "Edit {0} {1}"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "This position could still be liquidated, excluding any price movement, due to funding and borrowing fee rates reducing the position's collateral over time."
msgstr "This position could still be liquidated, excluding any price movement, due to funding and borrowing fee rates reducing the position's collateral over time."

#: src/pages/BuyGMX/BuyGMX.tsx
msgid "Transfer {nativeTokenSymbol}"
msgstr "Transfer {nativeTokenSymbol}"
Expand Down Expand Up @@ -6327,12 +6341,6 @@ msgstr "Leaderboard for traders on GMX V2."
msgid "Failed Withdraw"
msgstr "Failed Withdraw"

#: src/components/Exchange/PositionsList.jsx
#: src/components/Exchange/PositionsList.jsx
#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Use the Edit Collateral icon to deposit or withdraw collateral."
msgstr "Use the Edit Collateral icon to deposit or withdraw collateral."

#: src/pages/Referrals/Referrals.tsx
msgid "Get fee discounts and earn rebates through the GMX referral program.<0/>For more information, please read the <1>referral program details</1>."
msgstr "Get fee discounts and earn rebates through the GMX referral program.<0/>For more information, please read the <1>referral program details</1>."
Expand Down Expand Up @@ -7088,6 +7096,10 @@ msgstr "The PnL ($) compared to the capital used.<0/><1/>The capital used is cal
msgid "Accrued"
msgstr "Accrued"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "Liquidation price is influenced by fees and collateral value."
msgstr "Liquidation price is influenced by fees and collateral value."

#: src/pages/AccountDashboard/DailyAndCumulativePnL.tsx
msgid "No data available"
msgstr "No data available"
Expand Down Expand Up @@ -7562,6 +7574,10 @@ msgstr "Max. Leverage exceeded"
msgid "Price is above Mark Price"
msgstr "Price is above Mark Price"

#: src/components/Synthetics/PositionItem/PositionItem.tsx
msgid "This position could be liquidated, excluding any price movement, due to funding and borrowing fee rates reducing the position's collateral over time."
msgstr "This position could be liquidated, excluding any price movement, due to funding and borrowing fee rates reducing the position's collateral over time."

#: src/components/Synthetics/TradeHistory/TradeHistoryRow/utils/position.ts
#: src/components/Synthetics/TradeHistory/TradeHistoryRow/utils/position.ts
#: src/components/Synthetics/TradeHistory/TradeHistoryRow/utils/position.ts
Expand Down
Loading

0 comments on commit a370b6c

Please sign in to comment.