- Tip the author directly with {reserveLabel}
+ Tip the author directly with {RESERVE_LABEL}
{balance !== undefined && (
- Balance: {formatUnits(balance, 18)} {reserveLabel}
+ Balance: {formatUnits(balance, 18)} {RESERVE_LABEL}
)}
{insufficientBalance && (
@@ -167,7 +166,7 @@ export function DonateWidget({ storylineId, writerAddress }: DonateWidgetProps)
Donating{" "}
- {formatUnits(parsedAmount, 18)} {reserveLabel}
+ {formatUnits(parsedAmount, 18)} {RESERVE_LABEL}
{" "}
to {writerAddress ? : `story #${storylineId}`}
diff --git a/src/components/PriceChart.tsx b/src/components/PriceChart.tsx
index a94a3bf2..ba4013c7 100644
--- a/src/components/PriceChart.tsx
+++ b/src/components/PriceChart.tsx
@@ -3,7 +3,7 @@
import { useQuery } from "@tanstack/react-query";
import { type Address, formatUnits } from "viem";
import { supabase } from "../../lib/supabase";
-import { IS_TESTNET } from "../../lib/contracts/constants";
+import { RESERVE_LABEL } from "../../lib/contracts/constants";
const CHART_W = 320;
const CHART_H = 140;
@@ -36,7 +36,6 @@ function formatPrice(v: number): string {
}
export function PriceChart({ tokenAddress, currentPriceRaw }: PriceChartProps) {
- const reserveLabel = IS_TESTNET ? "WETH" : "$PLOT";
const currentPrice = Number(formatUnits(currentPriceRaw, 18));
const { data: tradePoints } = useQuery({
@@ -81,7 +80,7 @@ export function PriceChart({ tokenAddress, currentPriceRaw }: PriceChartProps) {
No trading activity yet
{currentPrice > 0 && (
- {formatPrice(currentPrice)} {reserveLabel}
+ {formatPrice(currentPrice)} {RESERVE_LABEL}
)}
@@ -202,9 +201,9 @@ export function PriceChart({ tokenAddress, currentPriceRaw }: PriceChartProps) {
- Price per token ({reserveLabel})
+ Price per token ({RESERVE_LABEL})
- {" "}· latest: {formatPrice(points[lastIdx].price)} {reserveLabel}
+ {" "}· latest: {formatPrice(points[lastIdx].price)} {RESERVE_LABEL}
diff --git a/src/components/ReaderPortfolio.tsx b/src/components/ReaderPortfolio.tsx
index 003a7d46..f287f698 100644
--- a/src/components/ReaderPortfolio.tsx
+++ b/src/components/ReaderPortfolio.tsx
@@ -5,7 +5,7 @@ import { useQuery } from "@tanstack/react-query";
import { formatUnits, type Address } from "viem";
import { publicClient } from "../../lib/rpc";
import { erc20Abi, mcv2BondAbi, get24hPriceChange, getTokenTVL } from "../../lib/price";
-import { MCV2_BOND, IS_TESTNET, STORY_FACTORY } from "../../lib/contracts/constants";
+import { MCV2_BOND, RESERVE_LABEL, STORY_FACTORY } from "../../lib/contracts/constants";
import { supabase, type Storyline } from "../../lib/supabase";
import Link from "next/link";
@@ -20,8 +20,6 @@ interface Holding {
export function ReaderPortfolio() {
const { address, isConnected } = useAccount();
- const reserveLabel = IS_TESTNET ? "WETH" : "$PLOT";
-
const { data: holdings, isLoading } = useQuery({
queryKey: ["reader-portfolio", address],
queryFn: async (): Promise
=> {
@@ -127,7 +125,7 @@ export function ReaderPortfolio() {
Total Value
- {formatUnits(totalValue, reserveDecimals)} {reserveLabel}
+ {formatUnits(totalValue, reserveDecimals)} {RESERVE_LABEL}
{bestPick && bestPick.priceChange !== null && (
@@ -166,7 +164,7 @@ export function ReaderPortfolio() {
- {formatUnits(h.value, h.reserveDecimals)} {reserveLabel}
+ {formatUnits(h.value, h.reserveDecimals)} {RESERVE_LABEL}
{h.priceChange !== null && (
- Price: {price} {reserveLabel}
- TVL: {tvl} {reserveLabel}
+ Price: {price} {RESERVE_LABEL}
+ TVL: {tvl} {RESERVE_LABEL}
);
}
@@ -60,6 +58,6 @@ export function StoryCardTVL({ tokenAddress }: { tokenAddress: string }) {
const tvl = tvlData ? formatCompact(tvlData.tvl) : "—";
return (
-
TVL: {tvl} {reserveLabel}
+
TVL: {tvl} {RESERVE_LABEL}
);
}
diff --git a/src/components/TradingWidget.tsx b/src/components/TradingWidget.tsx
index 917608db..5b59eed2 100644
--- a/src/components/TradingWidget.tsx
+++ b/src/components/TradingWidget.tsx
@@ -6,7 +6,7 @@ import { useQuery } from "@tanstack/react-query";
import { parseUnits, formatUnits, type Address } from "viem";
import { publicClient } from "../../lib/rpc";
import { mcv2BondAbi, erc20Abi } from "../../lib/price";
-import { MCV2_BOND, PLOT_TOKEN, IS_TESTNET, EXPLORER_URL } from "../../lib/contracts/constants";
+import { MCV2_BOND, PLOT_TOKEN, RESERVE_LABEL, EXPLORER_URL } from "../../lib/contracts/constants";
type Tab = "buy" | "sell";
type TxState = "idle" | "approving" | "confirming" | "pending" | "done" | "error";
@@ -32,7 +32,6 @@ export function TradingWidget({ tokenAddress }: { tokenAddress: Address }) {
const { writeContractAsync } = useWriteContract();
- const reserveLabel = IS_TESTNET ? "WETH" : "$PLOT";
const parsedAmount =
amount && !isNaN(Number(amount)) && Number(amount) > 0
? parseUnits(amount, 18)
@@ -242,7 +241,7 @@ export function TradingWidget({ tokenAddress }: { tokenAddress: Address }) {
{balance !== undefined && (
- Balance: {formatUnits(balance, 18)} {tab === "buy" ? reserveLabel : "tokens"}
+ Balance: {formatUnits(balance, 18)} {tab === "buy" ? RESERVE_LABEL : "tokens"}
)}
{insufficientBalance && (
@@ -255,7 +254,7 @@ export function TradingWidget({ tokenAddress }: { tokenAddress: Address }) {
{tab === "buy" ? "Estimated cost" : "Estimated return"}:{" "}
- {formatUnits(estimate, 18)} {reserveLabel}
+ {formatUnits(estimate, 18)} {RESERVE_LABEL}
(3% slippage tolerance)
diff --git a/src/components/WriterTradingStats.tsx b/src/components/WriterTradingStats.tsx
index b87ba34e..369cb6e7 100644
--- a/src/components/WriterTradingStats.tsx
+++ b/src/components/WriterTradingStats.tsx
@@ -4,7 +4,7 @@ import { useQuery } from "@tanstack/react-query";
import { formatUnits, type Address } from "viem";
import { publicClient } from "../../lib/rpc";
import { mcv2BondAbi, getTokenTVL } from "../../lib/price";
-import { MCV2_BOND, IS_TESTNET } from "../../lib/contracts/constants";
+import { MCV2_BOND, RESERVE_LABEL } from "../../lib/contracts/constants";
import type { Storyline } from "../../lib/supabase";
interface WriterTradingStatsProps {
@@ -13,8 +13,6 @@ interface WriterTradingStatsProps {
export function WriterTradingStats({ storyline }: WriterTradingStatsProps) {
const tokenAddress = storyline.token_address as Address;
- const reserveLabel = IS_TESTNET ? "WETH" : "$PLOT";
-
// Fetch token price
const { data: price } = useQuery({
queryKey: ["writer-price", tokenAddress],
@@ -46,7 +44,7 @@ export function WriterTradingStats({ storyline }: WriterTradingStatsProps) {
Token Price
@@ -54,7 +52,7 @@ export function WriterTradingStats({ storyline }: WriterTradingStatsProps) {
TVL
- {tvlData ? `${tvlData.tvl} ${reserveLabel}` : "—"}
+ {tvlData ? `${tvlData.tvl} ${RESERVE_LABEL}` : "—"}