adding redeem only function for killed pools)
This commit is contained in:
@@ -379,6 +379,7 @@ export interface PoolDetails {
|
||||
tokens: readonly `0x${string}`[];
|
||||
price?: string; // Formatted price string
|
||||
tvl?: string; // Formatted TVL string (e.g., "$1.2M")
|
||||
isKilled: boolean; // Whether the pool has been killed
|
||||
}
|
||||
|
||||
export function useGetAllPools(offset: number = 0, limit: number = 100) {
|
||||
@@ -457,10 +458,12 @@ export function useGetAllPools(offset: number = 0, limit: number = 100) {
|
||||
}).catch(() => false),
|
||||
]);
|
||||
|
||||
// Only add pool if it's working
|
||||
// Fetch pool price and TVL (only for working pools)
|
||||
let priceStr: string | undefined;
|
||||
let tvlStr: string | undefined;
|
||||
|
||||
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}`,
|
||||
@@ -489,7 +492,6 @@ export function useGetAllPools(offset: number = 0, limit: number = 100) {
|
||||
}
|
||||
|
||||
// Calculate TVL (approximate by getting first token balance and doubling it)
|
||||
let tvlStr: string | undefined;
|
||||
try {
|
||||
if (tokens && tokens.length > 0) {
|
||||
const firstTokenAddress = tokens[0];
|
||||
@@ -519,16 +521,18 @@ export function useGetAllPools(offset: number = 0, limit: number = 100) {
|
||||
console.error(`Error fetching TVL for ${poolAddress}:`, err);
|
||||
tvlStr = undefined;
|
||||
}
|
||||
|
||||
details.push({
|
||||
address: poolAddress,
|
||||
name: name as string,
|
||||
symbol: symbol as string,
|
||||
tokens: tokens as readonly `0x${string}`[],
|
||||
price: priceStr,
|
||||
tvl: tvlStr,
|
||||
});
|
||||
}
|
||||
|
||||
// Add all pools (both working and killed)
|
||||
details.push({
|
||||
address: poolAddress,
|
||||
name: name as string,
|
||||
symbol: symbol as string,
|
||||
tokens: tokens as readonly `0x${string}`[],
|
||||
price: priceStr,
|
||||
tvl: tvlStr,
|
||||
isKilled: !isWorking,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error fetching pool details for', poolAddress, err);
|
||||
// Skip pools that fail to load
|
||||
|
||||
Reference in New Issue
Block a user