Skip to content

Commit

Permalink
add oracle links (#47)
Browse files Browse the repository at this point in the history
* add pyth logo, oracle url

* tokenlogo refactor

* explorer urls

* bw

* add price id
  • Loading branch information
0xshiba1 authored May 10, 2024
1 parent a13c46e commit ce96ea4
Show file tree
Hide file tree
Showing 30 changed files with 270 additions and 151 deletions.
Binary file added frontend/public/assets/pyth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/assets/wormhole.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions frontend/src/components/admin/CoinPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ChevronsUpDown } from "lucide-react";

import Button from "@/components/shared/Button";
import Popover from "@/components/shared/Popover";
import TokenIcon from "@/components/shared/TokenIcon";
import TokenLogo from "@/components/shared/TokenLogo";
import { TLabel, TLabelSans } from "@/components/shared/Typography";
import { Command, CommandGroup, CommandItem } from "@/components/ui/command";
import { ParsedCoinBalance } from "@/lib/coinBalance";
Expand Down Expand Up @@ -68,11 +68,11 @@ export default function CoinPopover({
className="flex cursor-pointer flex-row items-center text-foreground aria-selected:text-foreground"
>
<div className="mr-2">
<TokenIcon
<TokenLogo
className="h-4 w-4"
coinType={cb.coinType}
symbol={cb.symbol}
url={cb.iconUrl}
src={cb.iconUrl}
/>
</div>

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/admin/ReserveConfigDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ export default function ReserveConfigDialog({
<TBody>{reserve.symbol}</TBody>
<Value
value={reserve.id}
url={explorer.buildObjectUrl(reserve.id)}
isId
url={explorer.buildObjectUrl(reserve.id)}
isExplorerUrl
/>
</div>
}
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/components/admin/ReservePropertiesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export default function ReservePropertiesDialog({
<TBody>{reserve.symbol}</TBody>
<Value
value={reserve.id}
url={explorer.buildObjectUrl(reserve.id)}
isId
url={explorer.buildObjectUrl(reserve.id)}
isExplorerUrl
/>
</div>
}
Expand All @@ -50,14 +51,16 @@ export default function ReservePropertiesDialog({
<LabelWithValue
label="id"
value={reserve.id}
url={explorer.buildObjectUrl(reserve.id)}
isId
url={explorer.buildObjectUrl(reserve.id)}
isExplorerUrl
/>
<LabelWithValue
label="coinType"
value={reserve.coinType}
url={explorer.buildCoinUrl(reserve.coinType)}
isType
url={explorer.buildCoinUrl(reserve.coinType)}
isExplorerUrl
/>
<LabelWithValue label="mintDecimals" value={reserve.mintDecimals} />
<LabelWithValue
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/admin/ReserveRewardsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ export default function ReserveRewardsDialog({
<TBody>{reserve.symbol}</TBody>
<Value
value={reserve.id}
url={explorer.buildObjectUrl(reserve.id)}
isId
url={explorer.buildObjectUrl(reserve.id)}
isExplorerUrl
/>
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/dashboard/AccountAssetTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DataTable, {
decimalSortingFn,
tableHeader,
} from "@/components/dashboard/DataTable";
import TokenIcon from "@/components/shared/TokenIcon";
import TokenLogo from "@/components/shared/TokenLogo";
import { TBody, TLabel } from "@/components/shared/Typography";
import { formatPrice, formatToken, formatUsd } from "@/lib/format";
import { reserveSort } from "@/lib/utils";
Expand Down Expand Up @@ -51,7 +51,7 @@ export default function AccountAssetTable({

return (
<div className="flex flex-row items-center gap-3">
<TokenIcon coinType={coinType} symbol={symbol} url={iconUrl} />
<TokenLogo coinType={coinType} symbol={symbol} src={iconUrl} />

<div className="flex flex-col gap-1">
<TBody>{symbol}</TBody>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/dashboard/AprWithRewardsBreakdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ParsedReserve } from "@suilend/sdk/parsers/reserve";
import { Side } from "@suilend/sdk/types";

import RewardChip from "@/components/shared/RewardChip";
import TokenIcon from "@/components/shared/TokenIcon";
import TokenLogo from "@/components/shared/TokenLogo";
import Tooltip from "@/components/shared/Tooltip";
import {
TBody,
Expand Down Expand Up @@ -125,11 +125,11 @@ function AprRewardRow({
/>

<div className="flex flex-row items-center gap-1.5">
<TokenIcon
<TokenLogo
className="h-4 w-4"
coinType={reward.stats.rewardCoinType}
symbol={reward.stats.rewardSymbol}
url={reward.stats.iconUrl}
src={reward.stats.iconUrl}
/>
<TBody className="text-primary-foreground">
{formatApr(
Expand Down Expand Up @@ -168,11 +168,11 @@ function DailyRewardRow({

<div className="flex flex-col items-end gap-0.5">
<div className="flex flex-row items-center gap-1.5">
<TokenIcon
<TokenLogo
className="h-4 w-4"
coinType={reward.stats.rewardCoinType}
symbol={reward.stats.rewardSymbol}
url={reward.stats.iconUrl}
src={reward.stats.iconUrl}
/>
<TBody className="text-primary-foreground">
{(isSuilendPoints(reward.stats.rewardCoinType)
Expand Down Expand Up @@ -396,12 +396,12 @@ export default function AprWithRewardsBreakdown({
{[...pointsDailyRewards, ...aprRewards, ...nonPointsDailyRewards].map(
(reward, index) => {
return (
<TokenIcon
<TokenLogo
key={index}
className="h-4 w-4"
coinType={reward.stats.rewardCoinType}
symbol={reward.stats.rewardSymbol}
url={reward.stats.iconUrl}
src={reward.stats.iconUrl}
/>
);
},
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/dashboard/MarketCardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ReservesRowData } from "@/components/dashboard/MarketTable";
import Button from "@/components/shared/Button";
import LabelWithTooltip from "@/components/shared/LabelWithTooltip";
import Select from "@/components/shared/Select";
import TokenIcon from "@/components/shared/TokenIcon";
import TokenLogo from "@/components/shared/TokenLogo";
import { TBody, TLabel, TLabelSans } from "@/components/shared/Typography";
import { SelectTrigger } from "@/components/ui/select";
import { Separator } from "@/components/ui/separator";
Expand All @@ -42,10 +42,10 @@ function MarketCard({ rowData, onClick }: MarketCardProps) {
<div className="flex w-full flex-col items-center gap-4 p-4">
<div className="flex w-full flex-col items-center gap-2">
<div className="flex flex-row items-center gap-2">
<TokenIcon
<TokenLogo
coinType={rowData.coinType}
symbol={rowData.symbol}
url={rowData.iconUrl}
src={rowData.iconUrl}
/>
<TBody>{rowData.symbol}</TBody>
</div>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/dashboard/ProtocolRewardsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PointsRank from "@/components/points/PointsRank";
import Button from "@/components/shared/Button";
import Spinner from "@/components/shared/Spinner";
import TextLink from "@/components/shared/TextLink";
import TokenIcon from "@/components/shared/TokenIcon";
import TokenLogo from "@/components/shared/TokenLogo";
import Tooltip from "@/components/shared/Tooltip";
import {
TBody,
Expand Down Expand Up @@ -42,11 +42,11 @@ function PendingRewards({ totalSuiRewards, isCentered }: PendingRewardsProps) {
<div className={cn("flex flex-col gap-1", isCentered && "items-center")}>
<TLabel className="uppercase">Pending rewards</TLabel>
<div className="flex flex-row items-center gap-1.5">
<TokenIcon
<TokenLogo
className="h-4 w-4"
coinType={NORMALIZED_SUI_COINTYPE}
symbol="SUI"
url={LOGO_MAP[NORMALIZED_SUI_COINTYPE]}
src={LOGO_MAP[NORMALIZED_SUI_COINTYPE]}
/>
<Tooltip title={formatToken(totalSuiRewards, { dp: 9 })}>
<TBody>{formatToken(totalSuiRewards)}</TBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Dialog from "@/components/dashboard/Dialog";
import ObligationSwitcherPopover from "@/components/dashboard/ObligationSwitcherPopover";
import Button from "@/components/shared/Button";
import Tabs from "@/components/shared/Tabs";
import TokenIcon from "@/components/shared/TokenIcon";
import TokenLogo from "@/components/shared/TokenLogo";
import Tooltip from "@/components/shared/Tooltip";
import { TBody } from "@/components/shared/Typography";
import { Separator } from "@/components/ui/separator";
Expand Down Expand Up @@ -55,24 +55,24 @@ interface TokenAmountProps {
amount?: BigNumber;
coinType: string;
symbol: string;
iconUrl?: string | null;
src?: string | null;
decimals: number;
}

export function TokenAmount({
amount,
coinType,
symbol,
iconUrl,
src,
decimals,
}: TokenAmountProps) {
return (
<div className="flex w-max flex-row items-center gap-2">
<TokenIcon
<TokenLogo
className="h-4 w-4"
coinType={coinType}
symbol={symbol}
url={iconUrl}
src={src}
/>

<Tooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
getCtokenExchangeRate,
} from "@/components/dashboard/account-details/AccountDetailsDialog";
import DataTable, { tableHeader } from "@/components/dashboard/DataTable";
import TokenIcon from "@/components/shared/TokenIcon";
import TokenLogo from "@/components/shared/TokenLogo";
import Tooltip from "@/components/shared/Tooltip";
import { TBody, TLabelSans, TTitle } from "@/components/shared/Typography";
import { Skeleton } from "@/components/ui/skeleton";
Expand Down Expand Up @@ -322,11 +322,11 @@ export default function EarningsTabContent({

return (
<div className="flex w-max flex-row items-center gap-2">
<TokenIcon
<TokenLogo
className="h-4 w-4"
coinType={coinType}
symbol={coinMetadata.symbol}
url={coinMetadata.iconUrl}
src={coinMetadata.iconUrl}
/>

<TBody className="w-max">{coinMetadata.symbol}</TBody>
Expand Down Expand Up @@ -373,7 +373,7 @@ export default function EarningsTabContent({
amount={earned}
coinType={coinType}
symbol={coinMetadata.symbol}
iconUrl={coinMetadata.iconUrl}
src={coinMetadata.iconUrl}
decimals={coinMetadata.decimals}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default function HistoryTabContent({
amount={amount}
coinType={depositEvent.coinType}
symbol={coinMetadata.symbol}
iconUrl={coinMetadata.iconUrl}
src={coinMetadata.iconUrl}
decimals={coinMetadata.decimals}
/>
);
Expand All @@ -151,7 +151,7 @@ export default function HistoryTabContent({
amount={amount}
coinType={borrowEvent.coinType}
symbol={coinMetadata.symbol}
iconUrl={coinMetadata.iconUrl}
src={coinMetadata.iconUrl}
decimals={coinMetadata.decimals}
/>

Expand Down Expand Up @@ -181,7 +181,7 @@ export default function HistoryTabContent({
amount={amount}
coinType={withdrawEvent.coinType}
symbol={coinMetadata.symbol}
iconUrl={coinMetadata.iconUrl}
src={coinMetadata.iconUrl}
decimals={coinMetadata.decimals}
/>
);
Expand All @@ -198,7 +198,7 @@ export default function HistoryTabContent({
amount={amount}
coinType={repayEvent.coinType}
symbol={coinMetadata.symbol}
iconUrl={coinMetadata.iconUrl}
src={coinMetadata.iconUrl}
decimals={coinMetadata.decimals}
/>
);
Expand Down Expand Up @@ -272,7 +272,7 @@ export default function HistoryTabContent({
amount={withdrawAmount}
coinType={withdrawReserve.coinType}
symbol={withdrawReserve.symbol}
iconUrl={withdrawReserve.iconUrl}
src={withdrawReserve.iconUrl}
decimals={withdrawReserve.mintDecimals}
/>
</div>
Expand All @@ -282,7 +282,7 @@ export default function HistoryTabContent({
amount={repayAmount}
coinType={repayReserve.coinType}
symbol={repayReserve.symbol}
iconUrl={repayReserve.iconUrl}
src={repayReserve.iconUrl}
decimals={repayReserve.mintDecimals}
/>
</div>
Expand All @@ -302,7 +302,7 @@ export default function HistoryTabContent({
amount={claimedAmount}
coinType={claimRewardEvent.coinType}
symbol={coinMetadata.symbol}
iconUrl={coinMetadata.iconUrl}
src={coinMetadata.iconUrl}
decimals={coinMetadata.decimals}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ export default function AccountBreakdown() {
},
{ title: "×" },
{
title: "Weight",
title: "BW",
titleTooltip: "Borrow weight",
data: sortedBorrows.map((b) =>
(b.reserve.config.borrowWeightBps / 10000).toString(),
),
Expand Down
Loading

0 comments on commit ce96ea4

Please sign in to comment.