Skip to content

Commit 3b96fe4

Browse files
committed
refactor: add favoriteKey to llamma market
1 parent 6422a1e commit 3b96fe4

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

apps/main/src/llamalend/features/market-list/LlamaMarketExpandedPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const LlamaMarketExpandedPanel: ExpandedPanel<LlamaMarket> = ({ row: { or
6565
const { data: deposited, error: depositedError } = useUserMarketStats(market, LlamaMarketColumnId.UserDeposited)
6666
const {
6767
controllerAddress,
68+
favoriteKey,
6869
assets,
6970
leverage,
7071
liquidityUsd,
@@ -98,7 +99,7 @@ export const LlamaMarketExpandedPanel: ExpandedPanel<LlamaMarket> = ({ row: { or
9899
confirmationText={t`Market address copied`}
99100
data-testid={`copy-market-address-${controllerAddress}`}
100101
/>
101-
<FavoriteMarketButton address={controllerAddress} />
102+
<FavoriteMarketButton address={favoriteKey} />
102103
</Stack>
103104
</Stack>
104105
}

apps/main/src/llamalend/features/market-list/cells/MarketTitleCell/MarketBadges.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const poolTypeTooltips: Record<LlamaMarketType, () => string> = {
2525

2626
/** Displays badges for a pool, such as the chain icon and the pool type. */
2727
export const MarketBadges = ({ market, isMobile }: { market: LlamaMarket; isMobile: boolean }) => {
28-
const { controllerAddress, type, leverage, deprecatedMessage } = market
28+
const { favoriteKey, type, leverage, deprecatedMessage } = market
2929
const isSmall = useMediaQuery('(max-width:1250px)')
3030
const { isCollateralEroded } = useUserMarketStats(market)?.data ?? {}
3131
return (
@@ -68,7 +68,7 @@ export const MarketBadges = ({ market, isMobile }: { market: LlamaMarket; isMobi
6868
</Tooltip>
6969
)}
7070

71-
<FavoriteMarketButton address={controllerAddress} desktopOnly />
71+
<FavoriteMarketButton address={favoriteKey} desktopOnly />
7272
</Stack>
7373
)
7474
}

apps/main/src/llamalend/queries/market-list/llama-markets.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export type LlamaMarket = {
6969
deprecatedMessage: string | null
7070
userHasPositions: Record<MarketRateType, boolean> | null // null means no positions in either market and makes easy to filter
7171
createdAt: number
72+
favoriteKey: Address // this differs per market type; for lend markets the vault address, for mint markets the amm address
7273
}
7374

7475
export type LlamaMarketsResult = {
@@ -242,6 +243,7 @@ const convertLendingVault = (
242243
}
243244
: null,
244245
createdAt: new Date(createdAt).getTime(),
246+
favoriteKey: vault,
245247
}
246248
}
247249

@@ -327,6 +329,7 @@ const convertMintMarket = (
327329
leverage,
328330
userHasPositions: hasBorrow ? { [MarketRateType.Borrow]: hasBorrow, [MarketRateType.Supply]: false } : null,
329331
createdAt: new Date(createdAt).getTime(),
332+
favoriteKey: llamma,
330333
}
331334
}
332335

0 commit comments

Comments
 (0)