Skip to content

Commit

Permalink
build: adds correct vault doc links and tooltip (#1275)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-garrett authored Nov 21, 2024
1 parent b553112 commit ab68337
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
27 changes: 27 additions & 0 deletions packages/core-entities/src/config/whitelisted-vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,30 @@ export function getVaultType(
return 'SingleSidedLP_AutoReinvest';
}
}

export function getVaultDocsLink(
vaultAddress?: string,
network?: Network
): string {
if (
vaultAddress &&
network &&
PendlePTVaults[network].includes(vaultAddress.toLowerCase())
) {
return 'https://docs.notional.finance/notional-v3/product-guides/leveraged-pendle-pts';
} else if (
vaultAddress &&
network &&
SingleSidedLP_DirectClaim[network].includes(vaultAddress.toLowerCase())
) {
return 'https://docs.notional.finance/notional-v3/product-guides/leveraged-yield-farming';
} else if (
vaultAddress &&
network &&
Object.keys(PointsMultipliers[network]).includes(vaultAddress.toLowerCase())
) {
return 'https://docs.notional.finance/notional-v3/product-guides/leveraged-points-farming';
} else {
return 'https://docs.notional.finance/notional-v3/product-guides/leveraged-yield-farming';
}
}
8 changes: 5 additions & 3 deletions packages/features/vault/src/hooks/use-vault-faq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box } from '@mui/material';
import { Body } from '@notional-finance/mui';
import { RiskFaq } from '../components';
import { HowItWorksFaq, HowItWorksFaqPendle } from '../components';
import { VaultType } from '@notional-finance/core-entities';
import { getVaultDocsLink, VaultType } from '@notional-finance/core-entities';
import {
getEtherscanAddressLink,
Network,
Expand All @@ -22,11 +22,13 @@ export const useVaultFaq = (
selectedNetwork: Network | undefined,
tokenSymbol: string | undefined,
points: Record<string, number> | undefined,
currentVaultType?: VaultType | undefined
currentVaultType?: VaultType | undefined,
vaultAddress?: string
) => {
const docsLink = getVaultDocsLink(vaultAddress, selectedNetwork);
const faqHeaderLinks = [
{
href: 'https://docs.notional.finance/notional-v3/product-guides/leveraged-vaults',
href: docsLink,
text: (
<FormattedMessage defaultMessage={'Leveraged Vault Documentation'} />
),
Expand Down
8 changes: 5 additions & 3 deletions packages/features/vault/src/hooks/use-vault-strategy-data.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useContext } from 'react';
import { VaultActionContext } from '../vault';
import { getVaultDocsLink } from '@notional-finance/core-entities';

export interface VaultsDataProps {
vaultName: string;
Expand All @@ -12,15 +13,16 @@ export interface VaultsDataProps {

export const useVaultStrategyData = () => {
const { state } = useContext(VaultActionContext);
const { vaultConfig, deposit } = state;
const { vaultConfig, deposit, selectedNetwork, vaultAddress } = state;
const docsLink = getVaultDocsLink(vaultAddress, selectedNetwork);

if (!vaultConfig) return undefined;

return {
baseProtocol: vaultConfig.baseProtocol,
boosterProtocol: vaultConfig.boosterProtocol,
primaryBorrowCurrency: deposit?.symbol,
poolName: vaultConfig.poolName,
docsLink:
'https://docs.notional.finance/notional-v3/product-guides/leveraged-vaults',
docsLink,
};
};
3 changes: 2 additions & 1 deletion packages/features/vault/src/vault-view/vault-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const VaultSummary = () => {
selectedNetwork,
deposit?.symbol,
points,
vaultType
vaultType,
vaultAddress
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,10 @@ export function useTradeSummary(state: VaultTradeState | TradeState) {
content: defineMessage({
defaultMessage: 'Difference from Oracle Price',
}),
toolTipContent: defineMessage({
defaultMessage:
'The difference between the position value at oracle prices vs. traded market prices.',
}),
},
},
value: {
Expand Down

0 comments on commit ab68337

Please sign in to comment.