Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/contracts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export const EXPLORER_URL = IS_TESTNET
// PlotLink contracts
// ---------------------------------------------------------------------------

/** Deployment block for the v3 StoryFactory on Base mainnet */
export const DEPLOYMENT_BLOCK = BigInt(43_609_150);
/** Deployment block for the v4 StoryFactory (J-curve + real PLOT) on Base mainnet */
export const DEPLOYMENT_BLOCK = BigInt(43_824_790);

/** StoryFactory — storyline + plot management */
export const STORY_FACTORY = (process.env.NEXT_PUBLIC_CONTRACT_ADDRESS ??
(IS_TESTNET
? "0xfa5489b6710Ba2f8406b37fA8f8c3018e51FA229"
: "0x337c5b96f03fB335b433291695A4171fd5dED8B0")) as `0x${string}`;
: "0x92c3bd44fda84e632c3c3cb31387d0c0c1de618d")) as `0x${string}`;

/** ZapPlotLinkV2 — one-click buy (ETH/USDC/HUNT -> PLOT -> storyline token via Uniswap V4 + MCV2)
* Testnet: disabled (V1 contract incompatible with V2 ABI) */
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlink",
"version": "0.1.10",
"version": "0.1.11",
"private": true,
"workspaces": [
"packages/*"
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const DEPLOYMENT_BLOCK = BigInt(20_000_000);
* Deployment block for PlotLink contracts on Base mainnet.
* Used as the default fromBlock for mainnet event log queries.
*/
export const DEPLOYMENT_BLOCK_MAINNET = BigInt(43_609_150);
export const DEPLOYMENT_BLOCK_MAINNET = BigInt(43_824_790);

/** Supported chain IDs for the PlotLink SDK. */
export const SUPPORTED_CHAIN_IDS = new Set([BASE_SEPOLIA_CHAIN_ID, BASE_MAINNET_CHAIN_ID]);
Expand All @@ -41,7 +41,7 @@ export const STORY_FACTORY_ADDRESS =

/** StoryFactory — storyline + plot management (Base mainnet). */
export const STORY_FACTORY_MAINNET_ADDRESS =
"0x337c5b96f03fB335b433291695A4171fd5dED8B0" as const;
"0x92c3bd44fda84e632c3c3cb31387d0c0c1de618d" as const;

/** MCV2_Bond — bonding curve trading (Base Sepolia). */
export const MCV2_BOND_ADDRESS =
Expand Down
6 changes: 3 additions & 3 deletions src/app/api/cron/backfill/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { decodeEventLog, type Log } from "viem";
import { publicClient } from "../../../../../lib/rpc";
import { createServerClient } from "../../../../../lib/supabase";
import { storyFactoryAbi } from "../../../../../lib/contracts/abi";
import { STORY_FACTORY } from "../../../../../lib/contracts/constants";
import { STORY_FACTORY, DEPLOYMENT_BLOCK } from "../../../../../lib/contracts/constants";
import { hashContent } from "../../../../../lib/content";
import { detectWriterType } from "../../../../../lib/contracts/erc8004";
import { reconcileStorylinePlotCount } from "../../../../../lib/reconcile";
Expand Down Expand Up @@ -106,8 +106,8 @@ export async function GET(req: Request) {
.single();
const lastBlock = cursor?.last_block ? BigInt(cursor.last_block) : BigInt(0);

// Start from block after last processed; cap toBlock to limit scan per run
const fromBlock = lastBlock > BigInt(0) ? lastBlock + BigInt(1) : BigInt(0);
// Start from block after last processed; fall back to DEPLOYMENT_BLOCK for new contracts
const fromBlock = lastBlock > BigInt(0) ? lastBlock + BigInt(1) : DEPLOYMENT_BLOCK;

if (fromBlock > currentBlock) {
return NextResponse.json({ skipped: true, reason: "Already up to date" });
Expand Down
4 changes: 4 additions & 0 deletions supabase/migrations/00023_reset_backfill_cursor_v4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- [#539] Reset backfill_cursor for StoryFactory v4 (J-curve + real PLOT)
-- New contract deployed at block 43824790
-- Old cursor may be past this block, so reset to pick up new factory events
UPDATE backfill_cursor SET last_block = 43824789 WHERE id = 1;
Loading