diff --git a/lib/contracts/constants.ts b/lib/contracts/constants.ts index 92b6be0f..d15c7cf9 100644 --- a/lib/contracts/constants.ts +++ b/lib/contracts/constants.ts @@ -47,6 +47,9 @@ export const PLOT_TOKEN = (IS_TESTNET /** Human-readable label for the reserve token */ export const RESERVE_LABEL = "PLOT"; +/** PLOT max supply (bonding curve cap) — used for FDV calculation */ +export const PLOT_MAX_SUPPLY = 1_000_000; + // --------------------------------------------------------------------------- // Supported Zap input tokens (Base) // --------------------------------------------------------------------------- diff --git a/package.json b/package.json index b3a5cfb9..67bd4b56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plotlink", - "version": "0.1.34", + "version": "0.1.35", "private": true, "workspaces": [ "packages/*" diff --git a/src/app/api/airdrop/status/route.ts b/src/app/api/airdrop/status/route.ts index d89a14e8..b2bcb994 100644 --- a/src/app/api/airdrop/status/route.ts +++ b/src/app/api/airdrop/status/route.ts @@ -41,28 +41,28 @@ export async function GET() { } const totalParticipants = uniqueAddresses.size; - // Milestone status - const currentMcap = latestPrice?.mcap_usd ?? 0; + // Milestone status — mcap_usd column now stores FDV (price × max supply) + const currentFdv = latestPrice?.mcap_usd ?? 0; const milestones = { bronze: { mcap: AIRDROP_CONFIG.MILESTONES.BRONZE.mcap, pct: AIRDROP_CONFIG.MILESTONES.BRONZE.pct, - reached: currentMcap >= AIRDROP_CONFIG.MILESTONES.BRONZE.mcap, + reached: currentFdv >= AIRDROP_CONFIG.MILESTONES.BRONZE.mcap, }, silver: { mcap: AIRDROP_CONFIG.MILESTONES.SILVER.mcap, pct: AIRDROP_CONFIG.MILESTONES.SILVER.pct, - reached: currentMcap >= AIRDROP_CONFIG.MILESTONES.SILVER.mcap, + reached: currentFdv >= AIRDROP_CONFIG.MILESTONES.SILVER.mcap, }, gold: { mcap: AIRDROP_CONFIG.MILESTONES.GOLD.mcap, pct: AIRDROP_CONFIG.MILESTONES.GOLD.pct, - reached: currentMcap >= AIRDROP_CONFIG.MILESTONES.GOLD.mcap, + reached: currentFdv >= AIRDROP_CONFIG.MILESTONES.GOLD.mcap, }, diamond: { mcap: AIRDROP_CONFIG.MILESTONES.DIAMOND.mcap, pct: AIRDROP_CONFIG.MILESTONES.DIAMOND.pct, - reached: currentMcap >= AIRDROP_CONFIG.MILESTONES.DIAMOND.mcap, + reached: currentFdv >= AIRDROP_CONFIG.MILESTONES.DIAMOND.mcap, }, }; @@ -72,7 +72,7 @@ export async function GET() { timeRemainingDays: Math.ceil(remainingMs / (1000 * 60 * 60 * 24)), timeElapsedPercent: totalMs > 0 ? Math.min(100, Math.round((elapsedMs / totalMs) * 100)) : 0, poolAmount: AIRDROP_CONFIG.POOL_AMOUNT, - currentMcap, + currentFdv, latestPriceUsd: latestPrice?.price_usd ?? null, milestones, totalPointsEarned, diff --git a/src/app/api/cron/airdrop-price/route.ts b/src/app/api/cron/airdrop-price/route.ts index c7b2b746..1c3f34af 100644 --- a/src/app/api/cron/airdrop-price/route.ts +++ b/src/app/api/cron/airdrop-price/route.ts @@ -10,7 +10,7 @@ import { formatUnits } from "viem"; import { createServerClient } from "../../../../../lib/supabase"; import { getPlotUsdPrice } from "../../../../../lib/usd-price"; import { publicClient } from "../../../../../lib/rpc"; -import { PLOT_TOKEN } from "../../../../../lib/contracts/constants"; +import { PLOT_TOKEN, PLOT_MAX_SUPPLY } from "../../../../../lib/contracts/constants"; import { erc20Abi } from "../../../../../lib/price"; function verifyCron(req: Request): boolean { @@ -67,13 +67,14 @@ export async function GET(req: Request) { return NextResponse.json({ skipped: true, reason: "Supply fetch failed" }, { status: 200 }); } - const mcapUsd = priceUsd * supplyFormatted; + // Store FDV (price × max supply) instead of MCap for milestone tracking + const fdvUsd = priceUsd * PLOT_MAX_SUPPLY; const { error } = await supabase.from("pl_daily_prices").insert({ recorded_at: todayUtc, price_usd: priceUsd, supply: supplyFormatted, - mcap_usd: mcapUsd, + mcap_usd: fdvUsd, // column stores FDV (price × max supply) }); if (error) { @@ -81,6 +82,6 @@ export async function GET(req: Request) { return NextResponse.json({ error: "Insert failed" }, { status: 500 }); } - console.info(`[airdrop-price] Snapshot recorded: date=${todayUtc} price=${priceUsd} supply=${supplyFormatted} mcap=${mcapUsd}`); - return NextResponse.json({ recorded: true, date: todayUtc, priceUsd, supply: supplyFormatted, mcapUsd }); + console.info(`[airdrop-price] Snapshot recorded: date=${todayUtc} price=${priceUsd} supply=${supplyFormatted} fdv=${fdvUsd}`); + return NextResponse.json({ recorded: true, date: todayUtc, priceUsd, supply: supplyFormatted, fdvUsd }); } diff --git a/src/app/token/page.tsx b/src/app/token/page.tsx index 1a40ed06..fbd2a036 100644 --- a/src/app/token/page.tsx +++ b/src/app/token/page.tsx @@ -119,7 +119,7 @@ export default function TokenPage() {