))
@@ -390,9 +395,14 @@ export function StakeForm({ defaultMode = 'stake' }: StakeFormProps) {
setSelectedToken(null);
}}
>
-
-
{pool.symbol}
-
{pool.name}
+
+
+ {pool.symbol}
+ {pool.name}
+
+ {pool.price && (
+
{pool.price}
+ )}
))
diff --git a/src/hooks/usePartyPlanner.ts b/src/hooks/usePartyPlanner.ts
index 5fe9740..5d4d322 100644
--- a/src/hooks/usePartyPlanner.ts
+++ b/src/hooks/usePartyPlanner.ts
@@ -333,6 +333,7 @@ export interface PoolDetails {
name: string;
symbol: string;
tokens: readonly `0x${string}`[];
+ price?: string; // Formatted price string
}
export function useGetAllPools(offset: number = 0, limit: number = 100) {
@@ -413,11 +414,41 @@ export function useGetAllPools(offset: number = 0, limit: number = 100) {
// Only add pool if it's working
if (isWorking) {
+ // Fetch pool price (use first token as quote, index 0)
+ let priceStr: string | undefined;
+ try {
+ const priceRaw = await publicClient.readContract({
+ address: partyInfoAddress as `0x${string}`,
+ abi: IPartyInfoABI,
+ functionName: 'poolPrice',
+ args: [poolAddress, BigInt(0)],
+ });
+
+ const price = BigInt(priceRaw as bigint | number);
+
+ if (price === 0n) {
+ priceStr = undefined;
+ } else {
+ // Convert Q64 format to decimal (price = priceValue / 2^64)
+ const Q64 = 2n ** 64n;
+ const isNegative = price < 0n;
+ const absPrice = isNegative ? -price : price;
+ const priceFloat = Number(absPrice) / Number(Q64);
+ const finalPrice = isNegative ? -priceFloat : priceFloat;
+
+ priceStr = `$${finalPrice.toFixed(4)}`;
+ }
+ } catch (err) {
+ console.error(`Error fetching pool price for ${poolAddress}:`, err);
+ priceStr = undefined;
+ }
+
details.push({
address: poolAddress,
name: name as string,
symbol: symbol as string,
tokens: tokens as readonly `0x${string}`[],
+ price: priceStr,
});
}
} catch (err) {