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 v4 StoryFactory (J-curve + real PLOT) on Base mainnet */
export const DEPLOYMENT_BLOCK = BigInt(43_824_790);
/** Deployment block for the v4b StoryFactory (symbol-collision fix) on Base mainnet */
export const DEPLOYMENT_BLOCK = BigInt(43_840_298);

/** StoryFactory — storyline + plot management */
export const STORY_FACTORY = (process.env.NEXT_PUBLIC_CONTRACT_ADDRESS ??
(IS_TESTNET
? "0xfa5489b6710Ba2f8406b37fA8f8c3018e51FA229"
: "0x92c3bd44fda84e632c3c3cb31387d0c0c1de618d")) as `0x${string}`;
: "0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf")) 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
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_824_790);
export const DEPLOYMENT_BLOCK_MAINNET = BigInt(43_840_298);

/** 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 =
"0x92c3bd44fda84e632c3c3cb31387d0c0c1de618d" as const;
"0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf" as const;

/** MCV2_Bond — bonding curve trading (Base Sepolia). */
export const MCV2_BOND_ADDRESS =
Expand Down
57 changes: 57 additions & 0 deletions supabase/migrations/00025_cleanup_orphan_storylines.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
-- [#549] Clean up orphan storylines 25-33 from first E2E attempt
-- and reset backfill cursor for the v4b factory redeployment.
--
-- Storylines 25-33 were created on the v4b factory
-- (0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf) during the first E2E
-- attempt with wrong content hashes. They need to be removed so the
-- backfill can re-index clean data from the same factory.

-- Scope all deletes to the v4b factory to avoid touching data from
-- any other contract.

-- 1. Delete plots for orphan storylines on v4b factory
DELETE FROM plots
WHERE storyline_id BETWEEN 25 AND 33
AND lower(contract_address) = lower('0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf');

-- 2. Delete donations for orphan storylines on v4b factory
DELETE FROM donations
WHERE storyline_id BETWEEN 25 AND 33
AND lower(contract_address) = lower('0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf');

-- 3. Delete ratings for orphan storylines on v4b factory
DELETE FROM ratings
WHERE storyline_id BETWEEN 25 AND 33
AND lower(contract_address) = lower('0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf');

-- 4. Delete comments for orphan storylines on v4b factory
DELETE FROM comments
WHERE storyline_id BETWEEN 25 AND 33
AND lower(contract_address) = lower('0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf');

-- 5. Delete page views for orphan storylines on v4b factory
DELETE FROM page_views
WHERE storyline_id BETWEEN 25 AND 33
AND lower(contract_address) = lower('0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf');

-- 6. Delete trade history for orphan storylines
DELETE FROM trade_history WHERE storyline_id BETWEEN 25 AND 33;

-- 7. Delete the orphan storylines on v4b factory (last, after FK-dependent deletes)
DELETE FROM storylines
WHERE storyline_id BETWEEN 25 AND 33
AND lower(contract_address) = lower('0x9D2AE1E99D0A6300bfcCF41A82260374e38744Cf');

-- 8. Clean up backfill_failures for orphan storylines
DELETE FROM backfill_failures WHERE storyline_id BETWEEN 25 AND 33;

-- 9. Clean up notification_queue for orphan storylines (skip if table doesn't exist)
DO $$ BEGIN
DELETE FROM notification_queue WHERE storyline_id BETWEEN 25 AND 33;
EXCEPTION WHEN undefined_table THEN NULL;
END $$;

-- 10. Reset backfill cursor to just before the v4b factory deployment block
-- so the backfill picks up events from the new factory (deployed at 43840298)
UPDATE backfill_cursor SET last_block = 43840297 WHERE id = 1;
UPDATE backfill_cursor SET last_block = 43840297 WHERE id = 2;
Loading