diff --git a/components/modals/PerpMarketDetailsModal.tsx b/components/modals/PerpMarketDetailsModal.tsx index d68b3227..6c51c3c8 100644 --- a/components/modals/PerpMarketDetailsModal.tsx +++ b/components/modals/PerpMarketDetailsModal.tsx @@ -3,6 +3,8 @@ import Modal from '../shared/Modal' import { useTranslation } from 'next-i18next' import { PerpMarket } from '@blockworks-foundation/mango-v4' import Button from '@components/shared/Button' +import useOracleProvider from 'hooks/useOracleProvider' +import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid' // import Tooltip from '@components/shared/Tooltip' interface PerpMarketDetailsModalProps { @@ -17,6 +19,9 @@ const PerpMarketDetailsModal = ({ market, }: ModalCombinedProps) => { const { t } = useTranslation(['common', 'trade']) + const { oracleProvider, oracleLinkPath } = useOracleProvider() + + console.log(oracleProvider, oracleLinkPath) return market ? ( @@ -62,6 +67,22 @@ const PerpMarketDetailsModal = ({ {(100 * market.maxFunding.toNumber()).toFixed(2)}%

+
+

{t('trade:oracle')}

+ {oracleLinkPath ? ( + + {oracleProvider} + + + ) : ( +

{oracleProvider}

+ )} +
{/* Uncomment when insurance fund is ready */} {/*
{ const { t } = useTranslation(['common', 'trade']) const { serumOrPerpMarket } = useSelectedMarket() + const { oracleProvider, oracleLinkPath } = useOracleProvider() // const { group } = useMangoGroup() // const [baseBank, quoteBank] = useMemo(() => { @@ -61,6 +64,22 @@ const SpotMarketDetailsModal = ({

{t('trade:max-leverage')}

5x

+
+

{t('trade:oracle')}

+ {oracleLinkPath ? ( + + {oracleProvider} + + + ) : ( +

{oracleProvider}

+ )} +
{/* {baseMintInfo ? (
string title?: string + tooltipContent?: string xKey: string yDecimals?: number yKey: string @@ -78,6 +80,7 @@ const DetailedAreaChart: FunctionComponent = ({ suffix = '', tickFormat, title, + tooltipContent, xKey, yDecimals, yKey, @@ -135,6 +138,8 @@ const DetailedAreaChart: FunctionComponent = ({ return 0 } + const titleClasses = `${small ? 'text-sm' : 'mb-0.5 text-base'} text-th-fgd-3` + return ( @@ -160,13 +165,18 @@ const DetailedAreaChart: FunctionComponent = ({ ) : null}
-

- {title} -

+ {tooltipContent ? ( + +

+ {title} +

+
+ ) : ( +

{title}

+ )} {mouseData ? (
= ({ onMouseMove={handleMouseMove} onMouseLeave={handleMouseLeave} > - { const { t } = useTranslation(['common', 'trade']) @@ -28,6 +32,7 @@ const PerpMarketSettingsTable = () => { {t('trade:max-leverage')} {t('fees')} {t('trade:funding-limits')} + {t('trade:oracle')} {/* Uncomment when insurance fund is ready */} {/* { publicKey, } = market + const [oracleProvider, oracleLinkPath] = getOracleProvider(market) + return ( @@ -100,6 +107,23 @@ const PerpMarketSettingsTable = () => { {(100 * maxFunding.toNumber()).toFixed(2)}%

+ + {oracleLinkPath ? ( + + + {oracleProvider} + + + + ) : ( +

{oracleProvider}

+ )} + {/*

{groupInsuranceFund ? t('yes') : t('no')} @@ -112,7 +136,7 @@ const PerpMarketSettingsTable = () => { ) : (

- {perpMarkets.map((market) => { + {perpMarkets.map((market, i) => { const { name, minOrderSize, @@ -126,12 +150,15 @@ const PerpMarketSettingsTable = () => { maxFunding, publicKey, } = market + const [oracleProvider, oracleLinkPath] = getOracleProvider(market) return ( {({ open }) => ( <>
@@ -220,6 +247,26 @@ const PerpMarketSettingsTable = () => { {(100 * maxFunding.toNumber()).toFixed(2)}%

+
+

{t('trade:oracle')}

+ {oracleLinkPath ? ( + + + {oracleProvider} + + + + ) : ( +

+ {oracleProvider} +

+ )} +
{/*
{ const tabsWithCount: [string, number][] = useMemo(() => { return TABS.map((t) => [t, 0]) }, []) - return market ? ( - - ) : token ? ( - - ) : ( + return (
-
- setActiveTab(v)} - showBorders - values={tabsWithCount} - /> -
- + {market ? ( + + ) : token ? ( + + ) : ( + <> +
+ setActiveTab(v)} + showBorders + values={tabsWithCount} + /> +
+ + + )}
) } diff --git a/components/stats/TokenSettingsTable.tsx b/components/stats/TokenSettingsTable.tsx index 6df98ec7..f604b896 100644 --- a/components/stats/TokenSettingsTable.tsx +++ b/components/stats/TokenSettingsTable.tsx @@ -1,5 +1,6 @@ import { Disclosure, Transition } from '@headlessui/react' import { + ArrowTopRightOnSquareIcon, ChevronDownIcon, QuestionMarkCircleIcon, } from '@heroicons/react/20/solid' @@ -14,9 +15,10 @@ import useJupiterMints from 'hooks/useJupiterMints' import { Table, Td, Th, TrBody, TrHead } from '@components/shared/TableElements' import useMangoGroup from 'hooks/useMangoGroup' import useBanksWithBalances from 'hooks/useBanksWithBalances' +import { getOracleProvider } from 'hooks/useOracleProvider' const TokenSettingsTable = () => { - const { t } = useTranslation(['common', 'activity', 'token']) + const { t } = useTranslation(['common', 'activity', 'token', 'trade']) const { group } = useMangoGroup() const { mangoTokens } = useJupiterMints() const { width } = useViewport() @@ -42,6 +44,7 @@ const TokenSettingsTable = () => { {t('borrow-fee')} {t('activity:liquidation-fee')} + {t('trade:oracle')} {/* Uncomment when insurance fund is ready */} {/* { )?.logoURI } + const [oracleProvider, oracleLinkPath] = getOracleProvider(bank) + // const mintInfo = group.mintInfosMapByMint.get( // bank.mint.toString() // ) @@ -108,6 +113,23 @@ const TokenSettingsTable = () => { {(bank.liquidationFee.toNumber() * 100).toFixed(2)}%

+ + {oracleLinkPath ? ( + + + {oracleProvider} + + + + ) : ( +

{oracleProvider}

+ )} + {/*

{mintInfo?.groupInsuranceFund ? t('yes') : t('no')} @@ -129,6 +151,7 @@ const TokenSettingsTable = () => { (t) => t.address === bank.mint.toString() )?.logoURI } + const [oracleProvider, oracleLinkPath] = getOracleProvider(bank) // const mintInfo = group.mintInfosMapByMint.get( // bank.mint.toString() // ) @@ -207,6 +230,26 @@ const TokenSettingsTable = () => { %

+
+

{t('trade:oracle')}

+ {oracleLinkPath ? ( + + + {oracleProvider} + + + + ) : ( +

+ {oracleProvider} +

+ )} +
diff --git a/components/stats/TokenStatsCharts.tsx b/components/stats/TokenStatsCharts.tsx index 046dcb4a..e45bf752 100644 --- a/components/stats/TokenStatsCharts.tsx +++ b/components/stats/TokenStatsCharts.tsx @@ -154,6 +154,7 @@ const TokenStatsCharts = () => { prefix="$" tickFormat={(x) => `$${formatYAxis(x)}`} title={t('token:token-fees-collected')} + tooltipContent={t('token:tooltip-token-fees-collected')} xKey="date" yKey={'feesCollected'} /> diff --git a/components/token/CoingeckoStats.tsx b/components/token/CoingeckoStats.tsx index 250b99ec..ec696a37 100644 --- a/components/token/CoingeckoStats.tsx +++ b/components/token/CoingeckoStats.tsx @@ -165,7 +165,7 @@ const CoingeckoStats = ({

{bank.name} Stats

-
+

{t('token:market-cap')}

diff --git a/components/token/TokenParams.tsx b/components/token/TokenParams.tsx index bede5385..65420d17 100644 --- a/components/token/TokenParams.tsx +++ b/components/token/TokenParams.tsx @@ -1,42 +1,29 @@ import { Bank, I80F48, - OracleProvider, toUiDecimals, toUiDecimalsForQuote, } from '@blockworks-foundation/mango-v4' import Tooltip from '@components/shared/Tooltip' import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid' +import { BN } from '@project-serum/anchor' +import { getOracleProvider } from 'hooks/useOracleProvider' import { useTranslation } from 'next-i18next' import { useMemo } from 'react' -import { formatCurrencyValue, formatNumericValue } from 'utils/numbers' +import { formatCurrencyValue } from 'utils/numbers' const TokenParams = ({ bank }: { bank: Bank }) => { const { t } = useTranslation(['common', 'activity', 'token']) const [oracleProvider, oracleLinkPath] = useMemo(() => { - switch (bank.oracleProvider) { - case OracleProvider.Pyth: - return [ - 'Pyth', - `https://pyth.network/price-feeds/crypto-${bank.name.toLowerCase()}-usd`, - ] - case OracleProvider.Switchboard: - return [ - 'Switchboard', - `https://switchboard.xyz/explorer/3/${bank.oracle.toString()}`, - ] - case OracleProvider.Stub: - return ['Stub', ''] - default: - return ['Unknown', ''] - } + if (!bank) return ['Unavaliable', ''] + return getOracleProvider(bank) }, [bank]) return (

-

{bank.name} Paramaters

+

{`${bank.name} ${t('token:parameters')}`}

@@ -76,8 +63,8 @@ const TokenParams = ({ bank }: { bank: Bank }) => {

- -

{t('token:borrow-upkeep-fee')}

+ +

{t('token:borrow-upkeep-rate')}

{(100 * bank.loanFeeRate.toNumber()).toFixed(2)}% @@ -116,14 +103,25 @@ const TokenParams = ({ bank }: { bank: Bank }) => {

+ +

{t('token:net-borrow-period')}

+
+

+ {bank.netBorrowLimitWindowSizeTs.div(new BN(3600)).toNumber()}hrs +

+
+

{t('token:net-borrows-in-period')}

- {formatNumericValue( - toUiDecimalsForQuote(I80F48.fromI64(bank.netBorrowsInWindow)) + {formatCurrencyValue( + toUiDecimalsForQuote( + I80F48.fromI64(bank.netBorrowsInWindow).toNumber() * + bank.uiPrice + ) )}

@@ -134,7 +132,7 @@ const TokenParams = ({ bank }: { bank: Bank }) => {

- {formatNumericValue( + {formatCurrencyValue( toUiDecimals(bank.netBorrowLimitPerWindowQuote, 6) )}

@@ -147,7 +145,7 @@ const TokenParams = ({ bank }: { bank: Bank }) => { target="_blank" rel="noopener noreferrer" > -

{oracleProvider}

+ {oracleProvider}
@@ -172,14 +170,6 @@ const TokenParams = ({ bank }: { bank: Bank }) => { Slots

-
- -

- {t('token:insurance-rate-curve')} -

-
-

?

-
) diff --git a/components/trade/OraclePrice.tsx b/components/trade/OraclePrice.tsx index 2cc9c532..95666547 100644 --- a/components/trade/OraclePrice.tsx +++ b/components/trade/OraclePrice.tsx @@ -7,11 +7,7 @@ import Tooltip from '@components/shared/Tooltip' import { useTranslation } from 'next-i18next' import mangoStore from '@store/mangoStore' import { useEffect, useState } from 'react' -import { - PerpMarket, - Bank, - OracleProvider, -} from '@blockworks-foundation/mango-v4' +import { PerpMarket, Bank } from '@blockworks-foundation/mango-v4' import { BorshAccountsCoder } from '@coral-xyz/anchor' import { floorToDecimal, @@ -21,6 +17,8 @@ import { import dayjs from 'dayjs' import duration from 'dayjs/plugin/duration' import relativeTime from 'dayjs/plugin/relativeTime' +import useOracleProvider from 'hooks/useOracleProvider' +import { ArrowTopRightOnSquareIcon } from '@heroicons/react/20/solid' const OraclePrice = ({ setChangePrice, @@ -38,10 +36,10 @@ const OraclePrice = ({ const connection = mangoStore((s) => s.connection) const [price, setPrice] = useState(stalePrice) - const [oracleProviderName, setOracleProviderName] = useState('Unknown') const [oracleLastUpdatedSlot, setOracleLastUpdatedSlot] = useState(0) const [highestSlot, setHighestSlot] = useState(0) const [isStale, setIsStale] = useState(false) + const { oracleProvider, oracleLinkPath } = useOracleProvider() const { t } = useTranslation(['common', 'trade']) @@ -64,20 +62,6 @@ const OraclePrice = ({ decimals = group.getMintDecimals(baseBank.mint) } - switch (marketOrBank.oracleProvider) { - case OracleProvider.Pyth: - setOracleProviderName('Pyth') - break - case OracleProvider.Switchboard: - setOracleProviderName('Switchboard') - break - case OracleProvider.Stub: - setOracleProviderName('Stub') - break - default: - setOracleProviderName('Unknown') - } - const coder = new BorshAccountsCoder(client.program.idl) const subId = connection.onAccountChange( marketOrBank.oracle, @@ -147,8 +131,21 @@ const OraclePrice = ({ placement="bottom" content={ <> -
- {t('trade:price-provided-by')} {oracleProviderName}. +
+ {t('trade:price-provided-by')} + {oracleLinkPath ? ( + + {oracleProvider} + + + ) : ( + {oracleProvider} + )}
{t('trade:last-updated')}{' '} diff --git a/hooks/useOracleProvider.ts b/hooks/useOracleProvider.ts new file mode 100644 index 00000000..4a5b2e53 --- /dev/null +++ b/hooks/useOracleProvider.ts @@ -0,0 +1,62 @@ +import { + Bank, + OracleProvider, + PerpMarket, + Serum3Market, +} from '@blockworks-foundation/mango-v4' +import mangoStore from '@store/mangoStore' +import { useMemo } from 'react' +import { formatTokenSymbol } from 'utils/tokens' +import useSelectedMarket from './useSelectedMarket' + +export const getOracleProvider = ( + marketOrBank: PerpMarket | Serum3Market | Bank +) => { + let marketOrBase: PerpMarket | Bank + let name: string + if (marketOrBank instanceof Bank) { + marketOrBase = marketOrBank + name = formatTokenSymbol(marketOrBank.name) + } else if (marketOrBank instanceof PerpMarket) { + marketOrBase = marketOrBank + name = marketOrBank.name.split('-')[0] + } else { + const group = mangoStore.getState().group + if (!group) return ['Unavailable', ''] + const baseBank = group.getFirstBankByTokenIndex(marketOrBank.baseTokenIndex) + marketOrBase = baseBank + name = formatTokenSymbol(baseBank.name) + } + + if (name === 'USDC') return ['N/A', ''] + + switch (marketOrBase.oracleProvider) { + case OracleProvider.Pyth: + return [ + 'Pyth', + `https://pyth.network/price-feeds/crypto-${name.toLowerCase()}-usd`, + ] + case OracleProvider.Switchboard: + return [ + 'Switchboard', + `https://switchboard.xyz/explorer/3/${marketOrBase.oracle.toString()}`, + ] + case OracleProvider.Stub: + return ['Stub', ''] + default: + return ['Unknown', ''] + } +} + +const useOracleProvider = () => { + const { selectedMarket } = useSelectedMarket() + + const [oracleProvider, oracleLinkPath] = useMemo(() => { + if (!selectedMarket) return ['', ''] + return getOracleProvider(selectedMarket) + }, [selectedMarket]) + + return { oracleProvider, oracleLinkPath } +} + +export default useOracleProvider diff --git a/public/locales/en/token.json b/public/locales/en/token.json index 16ffc463..ecca3c5c 100644 --- a/public/locales/en/token.json +++ b/public/locales/en/token.json @@ -4,7 +4,7 @@ "borrowing": "Borrowing", "borrows": "Borrows", "borrow-rates": "Borrow Rates", - "borrow-upkeep-fee": "Borrow Upkeep Fee", + "borrow-upkeep-rate": "Borrow Upkeep Rate", "chart-unavailable": "Chart Unavailable", "circulating-supply": "Circulating Supply", "deposit-borrow-scaling-start": "Deposit/Borrow Scaling Start", @@ -20,26 +20,30 @@ "market-cap": "Market Cap", "max-supply": "Max Supply", "net-borrow-limit-in-period": "Net Borrow Limit in Period", + "net-borrow-period": "Net Borrow Period", "net-borrows-in-period": "Net Borrows in Period", "no-borrowers": "No Borrowers...", "no-depositors": "No Depositors...", "oracle": "Oracle", "oracle-confidence": "Oracle Confidence", "oracle-staleness": "Oracle Staleness", + "parameters": "Parameters", "token-details": "Token Details", - "token-fees-collected": "Token Fees Collected (M2M)", + "token-fees-collected": "Token Fees Collected", "token-not-found": "Token Not Found", "token-not-found-desc": "'{{token}}' is either not listed or we're having issues loading the data.", - "tooltip-borrow-upkeep-fee": "", - "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for opening new positions is scaled down. For borrows, the liability weight for opening new positions is scaled up.", - "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight increases health and liability weight reduces it. Initial health affects your ability to withdraw and open new positions and is reflected by the amount of free collateral in your account.", - "tooltip-insurance-rate-curve": "", + "tooltip-borrow-upkeep-rate": "The yearly rate paid to the DAO on open borrows. This is included in the displayed borrow interest rate.", + "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for deposits is scaled down. For borrows, the liability weight for borrows is scaled up.", + "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Initial health controls your ability to withdraw and open new positions and is shown as an account's free collateral.", + "tooltip-insurance-rate-curve": "Interest rates are dependent on token utilization. The more tokens that are lent out the higher the rate. The curve scales up and down with long term trends in utilization.", "tooltip-liquidation-fee": "The fee paid to liqudators when {{symbol}} is liquidated.", - "tooltip-maint-asset-liability-weight": "The contribution a token has to your account health. Asset weight increases health and liability weight reduces it. Maintance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", - "tooltip-net-borrow-limit-in-period": "", - "tooltip-net-borrows-in-period": "", - "tooltip-oracle-confidence": "How much variation from the true price is tolerated.", - "tooltip-oracle-staleness": "Price is considered valid when it is last udpated within {{slots}} slots.", + "tooltip-maint-asset-liability-weight": "The contribution a token has to your maintenance account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Maintenance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", + "tooltip-net-borrow-period": "As a safety feature, the amount of new borrows is limited. The limit resets at regular periods. This is the amount of time between resets.", + "tooltip-net-borrow-limit-in-period": "Value of allowed net borrows. Once this value is reached, new borrows will be forbidden until the end of the period.", + "tooltip-net-borrows-in-period": "Current value of net borrows in this period.", + "tooltip-oracle-confidence": "Oracles work by aggregating multiple price sources. If these sources disagree too much, confidence will be low. If it's below this threshold, the price is considered invalid.", + "tooltip-oracle-staleness": "Price is considered valid when it is last updated within {{slots}} slots.", + "tooltip-token-fees-collected": "These fees accrue in every native token listed on Mango. The values in this chart are derived from the current market value.", "top-borrowers": "Top {{symbol}} Borrowers", "top-depositors": "Top {{symbol}} Depositors", "total-supply": "Total Supply", diff --git a/public/locales/en/trade.json b/public/locales/en/trade.json index ec1a1293..66d4492c 100644 --- a/public/locales/en/trade.json +++ b/public/locales/en/trade.json @@ -41,6 +41,7 @@ "notional": "Notional", "notional-volume": "Notional Volume ($)", "open-interest": "Open Interest", + "oracle": "Oracle", "oracle-not-updated": "This oracle has not updated recently.", "oracle-not-updated-warning": "Actions will fail for accounts with a position in this token.", "oracle-price": "Oracle Price", @@ -54,7 +55,7 @@ "post": "Post", "preview-sound": "Preview Sound", "price-expect": "The price you receive may be worse than you expect and full execution is not guaranteed. Max slippage is 2.5% for your safety. The part of your position with slippage beyond 2.5% will not be closed.", - "price-provided-by": "This price is provided by", + "price-provided-by": "Oracle by", "quote": "Quote", "reduce-only": "Reduce Only", "sells": "Sells", diff --git a/public/locales/es/token.json b/public/locales/es/token.json index 16ffc463..ecca3c5c 100644 --- a/public/locales/es/token.json +++ b/public/locales/es/token.json @@ -4,7 +4,7 @@ "borrowing": "Borrowing", "borrows": "Borrows", "borrow-rates": "Borrow Rates", - "borrow-upkeep-fee": "Borrow Upkeep Fee", + "borrow-upkeep-rate": "Borrow Upkeep Rate", "chart-unavailable": "Chart Unavailable", "circulating-supply": "Circulating Supply", "deposit-borrow-scaling-start": "Deposit/Borrow Scaling Start", @@ -20,26 +20,30 @@ "market-cap": "Market Cap", "max-supply": "Max Supply", "net-borrow-limit-in-period": "Net Borrow Limit in Period", + "net-borrow-period": "Net Borrow Period", "net-borrows-in-period": "Net Borrows in Period", "no-borrowers": "No Borrowers...", "no-depositors": "No Depositors...", "oracle": "Oracle", "oracle-confidence": "Oracle Confidence", "oracle-staleness": "Oracle Staleness", + "parameters": "Parameters", "token-details": "Token Details", - "token-fees-collected": "Token Fees Collected (M2M)", + "token-fees-collected": "Token Fees Collected", "token-not-found": "Token Not Found", "token-not-found-desc": "'{{token}}' is either not listed or we're having issues loading the data.", - "tooltip-borrow-upkeep-fee": "", - "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for opening new positions is scaled down. For borrows, the liability weight for opening new positions is scaled up.", - "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight increases health and liability weight reduces it. Initial health affects your ability to withdraw and open new positions and is reflected by the amount of free collateral in your account.", - "tooltip-insurance-rate-curve": "", + "tooltip-borrow-upkeep-rate": "The yearly rate paid to the DAO on open borrows. This is included in the displayed borrow interest rate.", + "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for deposits is scaled down. For borrows, the liability weight for borrows is scaled up.", + "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Initial health controls your ability to withdraw and open new positions and is shown as an account's free collateral.", + "tooltip-insurance-rate-curve": "Interest rates are dependent on token utilization. The more tokens that are lent out the higher the rate. The curve scales up and down with long term trends in utilization.", "tooltip-liquidation-fee": "The fee paid to liqudators when {{symbol}} is liquidated.", - "tooltip-maint-asset-liability-weight": "The contribution a token has to your account health. Asset weight increases health and liability weight reduces it. Maintance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", - "tooltip-net-borrow-limit-in-period": "", - "tooltip-net-borrows-in-period": "", - "tooltip-oracle-confidence": "How much variation from the true price is tolerated.", - "tooltip-oracle-staleness": "Price is considered valid when it is last udpated within {{slots}} slots.", + "tooltip-maint-asset-liability-weight": "The contribution a token has to your maintenance account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Maintenance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", + "tooltip-net-borrow-period": "As a safety feature, the amount of new borrows is limited. The limit resets at regular periods. This is the amount of time between resets.", + "tooltip-net-borrow-limit-in-period": "Value of allowed net borrows. Once this value is reached, new borrows will be forbidden until the end of the period.", + "tooltip-net-borrows-in-period": "Current value of net borrows in this period.", + "tooltip-oracle-confidence": "Oracles work by aggregating multiple price sources. If these sources disagree too much, confidence will be low. If it's below this threshold, the price is considered invalid.", + "tooltip-oracle-staleness": "Price is considered valid when it is last updated within {{slots}} slots.", + "tooltip-token-fees-collected": "These fees accrue in every native token listed on Mango. The values in this chart are derived from the current market value.", "top-borrowers": "Top {{symbol}} Borrowers", "top-depositors": "Top {{symbol}} Depositors", "total-supply": "Total Supply", diff --git a/public/locales/es/trade.json b/public/locales/es/trade.json index ec1a1293..66d4492c 100644 --- a/public/locales/es/trade.json +++ b/public/locales/es/trade.json @@ -41,6 +41,7 @@ "notional": "Notional", "notional-volume": "Notional Volume ($)", "open-interest": "Open Interest", + "oracle": "Oracle", "oracle-not-updated": "This oracle has not updated recently.", "oracle-not-updated-warning": "Actions will fail for accounts with a position in this token.", "oracle-price": "Oracle Price", @@ -54,7 +55,7 @@ "post": "Post", "preview-sound": "Preview Sound", "price-expect": "The price you receive may be worse than you expect and full execution is not guaranteed. Max slippage is 2.5% for your safety. The part of your position with slippage beyond 2.5% will not be closed.", - "price-provided-by": "This price is provided by", + "price-provided-by": "Oracle by", "quote": "Quote", "reduce-only": "Reduce Only", "sells": "Sells", diff --git a/public/locales/ru/token.json b/public/locales/ru/token.json index 16ffc463..ecca3c5c 100644 --- a/public/locales/ru/token.json +++ b/public/locales/ru/token.json @@ -4,7 +4,7 @@ "borrowing": "Borrowing", "borrows": "Borrows", "borrow-rates": "Borrow Rates", - "borrow-upkeep-fee": "Borrow Upkeep Fee", + "borrow-upkeep-rate": "Borrow Upkeep Rate", "chart-unavailable": "Chart Unavailable", "circulating-supply": "Circulating Supply", "deposit-borrow-scaling-start": "Deposit/Borrow Scaling Start", @@ -20,26 +20,30 @@ "market-cap": "Market Cap", "max-supply": "Max Supply", "net-borrow-limit-in-period": "Net Borrow Limit in Period", + "net-borrow-period": "Net Borrow Period", "net-borrows-in-period": "Net Borrows in Period", "no-borrowers": "No Borrowers...", "no-depositors": "No Depositors...", "oracle": "Oracle", "oracle-confidence": "Oracle Confidence", "oracle-staleness": "Oracle Staleness", + "parameters": "Parameters", "token-details": "Token Details", - "token-fees-collected": "Token Fees Collected (M2M)", + "token-fees-collected": "Token Fees Collected", "token-not-found": "Token Not Found", "token-not-found-desc": "'{{token}}' is either not listed or we're having issues loading the data.", - "tooltip-borrow-upkeep-fee": "", - "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for opening new positions is scaled down. For borrows, the liability weight for opening new positions is scaled up.", - "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight increases health and liability weight reduces it. Initial health affects your ability to withdraw and open new positions and is reflected by the amount of free collateral in your account.", - "tooltip-insurance-rate-curve": "", + "tooltip-borrow-upkeep-rate": "The yearly rate paid to the DAO on open borrows. This is included in the displayed borrow interest rate.", + "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for deposits is scaled down. For borrows, the liability weight for borrows is scaled up.", + "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Initial health controls your ability to withdraw and open new positions and is shown as an account's free collateral.", + "tooltip-insurance-rate-curve": "Interest rates are dependent on token utilization. The more tokens that are lent out the higher the rate. The curve scales up and down with long term trends in utilization.", "tooltip-liquidation-fee": "The fee paid to liqudators when {{symbol}} is liquidated.", - "tooltip-maint-asset-liability-weight": "The contribution a token has to your account health. Asset weight increases health and liability weight reduces it. Maintance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", - "tooltip-net-borrow-limit-in-period": "", - "tooltip-net-borrows-in-period": "", - "tooltip-oracle-confidence": "How much variation from the true price is tolerated.", - "tooltip-oracle-staleness": "Price is considered valid when it is last udpated within {{slots}} slots.", + "tooltip-maint-asset-liability-weight": "The contribution a token has to your maintenance account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Maintenance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", + "tooltip-net-borrow-period": "As a safety feature, the amount of new borrows is limited. The limit resets at regular periods. This is the amount of time between resets.", + "tooltip-net-borrow-limit-in-period": "Value of allowed net borrows. Once this value is reached, new borrows will be forbidden until the end of the period.", + "tooltip-net-borrows-in-period": "Current value of net borrows in this period.", + "tooltip-oracle-confidence": "Oracles work by aggregating multiple price sources. If these sources disagree too much, confidence will be low. If it's below this threshold, the price is considered invalid.", + "tooltip-oracle-staleness": "Price is considered valid when it is last updated within {{slots}} slots.", + "tooltip-token-fees-collected": "These fees accrue in every native token listed on Mango. The values in this chart are derived from the current market value.", "top-borrowers": "Top {{symbol}} Borrowers", "top-depositors": "Top {{symbol}} Depositors", "total-supply": "Total Supply", diff --git a/public/locales/ru/trade.json b/public/locales/ru/trade.json index ec1a1293..66d4492c 100644 --- a/public/locales/ru/trade.json +++ b/public/locales/ru/trade.json @@ -41,6 +41,7 @@ "notional": "Notional", "notional-volume": "Notional Volume ($)", "open-interest": "Open Interest", + "oracle": "Oracle", "oracle-not-updated": "This oracle has not updated recently.", "oracle-not-updated-warning": "Actions will fail for accounts with a position in this token.", "oracle-price": "Oracle Price", @@ -54,7 +55,7 @@ "post": "Post", "preview-sound": "Preview Sound", "price-expect": "The price you receive may be worse than you expect and full execution is not guaranteed. Max slippage is 2.5% for your safety. The part of your position with slippage beyond 2.5% will not be closed.", - "price-provided-by": "This price is provided by", + "price-provided-by": "Oracle by", "quote": "Quote", "reduce-only": "Reduce Only", "sells": "Sells", diff --git a/public/locales/zh/token.json b/public/locales/zh/token.json index 16ffc463..ecca3c5c 100644 --- a/public/locales/zh/token.json +++ b/public/locales/zh/token.json @@ -4,7 +4,7 @@ "borrowing": "Borrowing", "borrows": "Borrows", "borrow-rates": "Borrow Rates", - "borrow-upkeep-fee": "Borrow Upkeep Fee", + "borrow-upkeep-rate": "Borrow Upkeep Rate", "chart-unavailable": "Chart Unavailable", "circulating-supply": "Circulating Supply", "deposit-borrow-scaling-start": "Deposit/Borrow Scaling Start", @@ -20,26 +20,30 @@ "market-cap": "Market Cap", "max-supply": "Max Supply", "net-borrow-limit-in-period": "Net Borrow Limit in Period", + "net-borrow-period": "Net Borrow Period", "net-borrows-in-period": "Net Borrows in Period", "no-borrowers": "No Borrowers...", "no-depositors": "No Depositors...", "oracle": "Oracle", "oracle-confidence": "Oracle Confidence", "oracle-staleness": "Oracle Staleness", + "parameters": "Parameters", "token-details": "Token Details", - "token-fees-collected": "Token Fees Collected (M2M)", + "token-fees-collected": "Token Fees Collected", "token-not-found": "Token Not Found", "token-not-found-desc": "'{{token}}' is either not listed or we're having issues loading the data.", - "tooltip-borrow-upkeep-fee": "", - "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for opening new positions is scaled down. For borrows, the liability weight for opening new positions is scaled up.", - "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight increases health and liability weight reduces it. Initial health affects your ability to withdraw and open new positions and is reflected by the amount of free collateral in your account.", - "tooltip-insurance-rate-curve": "", + "tooltip-borrow-upkeep-rate": "The yearly rate paid to the DAO on open borrows. This is included in the displayed borrow interest rate.", + "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for deposits is scaled down. For borrows, the liability weight for borrows is scaled up.", + "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Initial health controls your ability to withdraw and open new positions and is shown as an account's free collateral.", + "tooltip-insurance-rate-curve": "Interest rates are dependent on token utilization. The more tokens that are lent out the higher the rate. The curve scales up and down with long term trends in utilization.", "tooltip-liquidation-fee": "The fee paid to liqudators when {{symbol}} is liquidated.", - "tooltip-maint-asset-liability-weight": "The contribution a token has to your account health. Asset weight increases health and liability weight reduces it. Maintance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", - "tooltip-net-borrow-limit-in-period": "", - "tooltip-net-borrows-in-period": "", - "tooltip-oracle-confidence": "How much variation from the true price is tolerated.", - "tooltip-oracle-staleness": "Price is considered valid when it is last udpated within {{slots}} slots.", + "tooltip-maint-asset-liability-weight": "The contribution a token has to your maintenance account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Maintenance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", + "tooltip-net-borrow-period": "As a safety feature, the amount of new borrows is limited. The limit resets at regular periods. This is the amount of time between resets.", + "tooltip-net-borrow-limit-in-period": "Value of allowed net borrows. Once this value is reached, new borrows will be forbidden until the end of the period.", + "tooltip-net-borrows-in-period": "Current value of net borrows in this period.", + "tooltip-oracle-confidence": "Oracles work by aggregating multiple price sources. If these sources disagree too much, confidence will be low. If it's below this threshold, the price is considered invalid.", + "tooltip-oracle-staleness": "Price is considered valid when it is last updated within {{slots}} slots.", + "tooltip-token-fees-collected": "These fees accrue in every native token listed on Mango. The values in this chart are derived from the current market value.", "top-borrowers": "Top {{symbol}} Borrowers", "top-depositors": "Top {{symbol}} Depositors", "total-supply": "Total Supply", diff --git a/public/locales/zh/trade.json b/public/locales/zh/trade.json index ec1a1293..66d4492c 100644 --- a/public/locales/zh/trade.json +++ b/public/locales/zh/trade.json @@ -41,6 +41,7 @@ "notional": "Notional", "notional-volume": "Notional Volume ($)", "open-interest": "Open Interest", + "oracle": "Oracle", "oracle-not-updated": "This oracle has not updated recently.", "oracle-not-updated-warning": "Actions will fail for accounts with a position in this token.", "oracle-price": "Oracle Price", @@ -54,7 +55,7 @@ "post": "Post", "preview-sound": "Preview Sound", "price-expect": "The price you receive may be worse than you expect and full execution is not guaranteed. Max slippage is 2.5% for your safety. The part of your position with slippage beyond 2.5% will not be closed.", - "price-provided-by": "This price is provided by", + "price-provided-by": "Oracle by", "quote": "Quote", "reduce-only": "Reduce Only", "sells": "Sells", diff --git a/public/locales/zh_tw/token.json b/public/locales/zh_tw/token.json index 4071dade..5de1df05 100644 --- a/public/locales/zh_tw/token.json +++ b/public/locales/zh_tw/token.json @@ -2,7 +2,7 @@ "all-time-high": "歷史高價", "all-time-low": "歷史低價", "borrow-rates": "借貸利率", - "borrow-upkeep-fee": "Borrow Upkeep Fee", + "borrow-upkeep-rate": "Borrow Upkeep Fee", "borrowing": "借入", "borrows": "借貸", "chart-unavailable": "無法顯示圖表", @@ -20,26 +20,30 @@ "market-cap": "總市值", "max-supply": "最大供應量", "net-borrow-limit-in-period": "Net Borrow Limit in Period", + "net-borrow-period": "Net Borrow Period", "net-borrows-in-period": "Net Borrows in Period", "no-borrowers": "無借貸者...", "no-depositors": "無存款者...", "oracle": "Oracle", "oracle-confidence": "Oracle Confidence", "oracle-staleness": "Oracle Staleness", + "parameters": "Parameters", "token-details": "幣種細節", - "token-fees-collected": "Token Fees Collected (M2M)", + "token-fees-collected": "Token Fees Collected", "token-not-found": "查不到幣種", "token-not-found-desc": "'{{token}}'未列入或我們在加載數據時出錯。", - "tooltip-borrow-upkeep-fee": "", - "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for opening new positions is scaled down. For borrows, the liability weight for opening new positions is scaled up.", - "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight increases health and liability weight reduces it. Initial health affects your ability to withdraw and open new positions and is reflected by the amount of free collateral in your account.", - "tooltip-insurance-rate-curve": "", + "tooltip-borrow-upkeep-rate": "The yearly rate paid to the DAO on open borrows. This is included in the displayed borrow interest rate.", + "tooltip-deposit-borrow-scaling-start": "This acts as a soft limit for deposits and borrows. For deposits, if this value is exceeded the asset weight for deposits is scaled down. For borrows, the liability weight for borrows is scaled up.", + "tooltip-init-asset-liability-weight": "The contribution a token has to your initial account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Initial health controls your ability to withdraw and open new positions and is shown as an account's free collateral.", + "tooltip-insurance-rate-curve": "Interest rates are dependent on token utilization. The more tokens that are lent out the higher the rate. The curve scales up and down with long term trends in utilization.", "tooltip-liquidation-fee": "The fee paid to liqudators when {{symbol}} is liquidated.", - "tooltip-maint-asset-liability-weight": "The contribution a token has to your account health. Asset weight increases health and liability weight reduces it. Maintance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", - "tooltip-net-borrow-limit-in-period": "", - "tooltip-net-borrows-in-period": "", - "tooltip-oracle-confidence": "How much variation from the true price is tolerated.", - "tooltip-oracle-staleness": "Price is considered valid when it is last udpated within {{slots}} slots.", + "tooltip-maint-asset-liability-weight": "The contribution a token has to your maintenance account health. Asset weight is applied to deposits that increase health and liability weight is applied to borrows that reduce it. Maintenance health is what's displayed on your account page. If this value reaches zero your account will be liquidated.", + "tooltip-net-borrow-period": "As a safety feature, the amount of new borrows is limited. The limit resets at regular periods. This is the amount of time between resets.", + "tooltip-net-borrow-limit-in-period": "Value of allowed net borrows. Once this value is reached, new borrows will be forbidden until the end of the period.", + "tooltip-net-borrows-in-period": "Current value of net borrows in this period.", + "tooltip-oracle-confidence": "Oracles work by aggregating multiple price sources. If these sources disagree too much, confidence will be low. If it's below this threshold, the price is considered invalid.", + "tooltip-oracle-staleness": "Price is considered valid when it is last updated within {{slots}} slots.", + "tooltip-token-fees-collected": "These fees accrue in every native token listed on Mango. The values in this chart are derived from the current market value.", "top-borrowers": "頂級{{symbol}}借貸者", "top-depositors": "頂級{{symbol}}存款者", "total-supply": "總供應量", diff --git a/public/locales/zh_tw/trade.json b/public/locales/zh_tw/trade.json index aecebea8..0df4a908 100644 --- a/public/locales/zh_tw/trade.json +++ b/public/locales/zh_tw/trade.json @@ -41,6 +41,7 @@ "notional": "合約面值", "notional-volume": "面值交易量($)", "open-interest": "持倉量", + "oracle": "Oracle", "oracle-not-updated": "This oracle has not updated recently.", "oracle-not-updated-warning": "Actions will fail for accounts with a position in this token.", "oracle-price": "預言機價格", @@ -54,7 +55,7 @@ "post": "Post", "preview-sound": "聲音預覽", "price-expect": "您收到的價格可能與您預期有差異,並且無法保證完全執行。為了您的安全,最大滑點保持為 2.5%。超過 2.5%滑點的部分不會被平倉。", - "price-provided-by": "This price is provided by", + "price-provided-by": "Oracle by", "quote": "計價", "reduce-only": "限減少", "sells": "賣單", diff --git a/utils/tokens.ts b/utils/tokens.ts index 4a9ef5a7..cd07dee9 100644 --- a/utils/tokens.ts +++ b/utils/tokens.ts @@ -142,8 +142,8 @@ export async function getNFTsByOwner(owner: PublicKey, connection: Connection) { export const formatTokenSymbol = (symbol: string) => { if (symbol.toLowerCase().includes('portal')) { - const truncSymbol = symbol.split(' ')[0] - return truncSymbol === 'WBTC' ? 'wBTC' : truncSymbol + const truncSymbol = symbol.split(' ')[0].toUpperCase() + return truncSymbol === 'WBTC' ? 'BTC' : truncSymbol } return symbol === 'MSOL' ? 'mSOL' : symbol }