From 9a226eac38d94ffbb2994c27c3589d4f33aa7373 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Fri, 20 Mar 2026 11:05:24 +0000 Subject: [PATCH 1/2] [#380] Update StoryFactory address and ABI for v2 deployment Update mainnet address to 0x27B4FCf333f29a3865b3B76ea00C955D7b64BD0F, add hasSunset, updateCurve, owner, CurveUpdated to ABI, fix createStoryline stateMutability to payable, and update SDK deployment block. Fixes #380 Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/contracts/abi.ts | 39 ++++++++++++++++++++++++++++++++++- lib/contracts/constants.ts | 2 +- packages/sdk/src/abi.ts | 31 +++++++++++++++++++++++++++- packages/sdk/src/constants.ts | 4 ++-- 4 files changed, 71 insertions(+), 5 deletions(-) diff --git a/lib/contracts/abi.ts b/lib/contracts/abi.ts index a67be308..956b8970 100644 --- a/lib/contracts/abi.ts +++ b/lib/contracts/abi.ts @@ -53,7 +53,7 @@ export const donationEvent = { export const createStorylineFunction = { type: "function", name: "createStoryline", - stateMutability: "nonpayable", + stateMutability: "payable", inputs: [ { name: "title", type: "string" }, { name: "openingCID", type: "string" }, @@ -152,11 +152,48 @@ export const tokenBondFunction = { // Combined ABI (for viem contract instances) // --------------------------------------------------------------------------- +export const curveUpdatedEvent = { + type: "event", + name: "CurveUpdated", + inputs: [{ name: "newStepCount", type: "uint256", indexed: false }], +} as const; + +export const hasSunsetFunction = { + type: "function", + name: "hasSunset", + stateMutability: "view", + inputs: [{ name: "storylineId", type: "uint256" }], + outputs: [{ name: "", type: "bool" }], +} as const; + +export const updateCurveFunction = { + type: "function", + name: "updateCurve", + stateMutability: "nonpayable", + inputs: [ + { name: "newRanges", type: "uint128[]" }, + { name: "newPrices", type: "uint128[]" }, + ], + outputs: [], +} as const; + +export const ownerFunction = { + type: "function", + name: "owner", + stateMutability: "view", + inputs: [], + outputs: [{ name: "", type: "address" }], +} as const; + export const storyFactoryAbi = [ plotChainedEvent, storylineCreatedEvent, donationEvent, + curveUpdatedEvent, createStorylineFunction, chainPlotFunction, donateFunction, + hasSunsetFunction, + updateCurveFunction, + ownerFunction, ] as const; diff --git a/lib/contracts/constants.ts b/lib/contracts/constants.ts index eacdfb19..6a3742ce 100644 --- a/lib/contracts/constants.ts +++ b/lib/contracts/constants.ts @@ -28,7 +28,7 @@ export const EXPLORER_URL = IS_TESTNET export const STORY_FACTORY = (process.env.NEXT_PUBLIC_CONTRACT_ADDRESS ?? (IS_TESTNET ? "0xfa5489b6710Ba2f8406b37fA8f8c3018e51FA229" - : "0xc278F4099298118efA8dF30DF0F4876632571948")) as `0x${string}`; + : "0x27B4FCf333f29a3865b3B76ea00C955D7b64BD0F")) as `0x${string}`; /** ZapPlotLinkMCV2 — one-click buy (ETH/USDC/HUNT -> storyline token) */ export const ZAP_PLOTLINK = "0x0000000000000000000000000000000000000000" as const; diff --git a/packages/sdk/src/abi.ts b/packages/sdk/src/abi.ts index 9a2a8248..cfb092d3 100644 --- a/packages/sdk/src/abi.ts +++ b/packages/sdk/src/abi.ts @@ -45,11 +45,16 @@ export const storyFactoryAbi = [ { name: "amount", type: "uint256", indexed: false }, ], }, + { + type: "event", + name: "CurveUpdated", + inputs: [{ name: "newStepCount", type: "uint256", indexed: false }], + }, // Functions { type: "function", name: "createStoryline", - stateMutability: "nonpayable", + stateMutability: "payable", inputs: [ { name: "title", type: "string" }, { name: "openingCID", type: "string" }, @@ -80,6 +85,30 @@ export const storyFactoryAbi = [ ], outputs: [], }, + { + type: "function", + name: "hasSunset", + stateMutability: "view", + inputs: [{ name: "storylineId", type: "uint256" }], + outputs: [{ name: "", type: "bool" }], + }, + { + type: "function", + name: "updateCurve", + stateMutability: "nonpayable", + inputs: [ + { name: "newRanges", type: "uint128[]" }, + { name: "newPrices", type: "uint128[]" }, + ], + outputs: [], + }, + { + type: "function", + name: "owner", + stateMutability: "view", + inputs: [], + outputs: [{ name: "", type: "address" }], + }, ] as const; // --------------------------------------------------------------------------- diff --git a/packages/sdk/src/constants.ts b/packages/sdk/src/constants.ts index 0724406b..def3e383 100644 --- a/packages/sdk/src/constants.ts +++ b/packages/sdk/src/constants.ts @@ -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_561_137); +export const DEPLOYMENT_BLOCK_MAINNET = BigInt(43_606_398); /** Supported chain IDs for the PlotLink SDK. */ export const SUPPORTED_CHAIN_IDS = new Set([BASE_SEPOLIA_CHAIN_ID, BASE_MAINNET_CHAIN_ID]); @@ -41,7 +41,7 @@ export const STORY_FACTORY_ADDRESS = /** StoryFactory — storyline + plot management (Base mainnet). */ export const STORY_FACTORY_MAINNET_ADDRESS = - "0xc278F4099298118efA8dF30DF0F4876632571948" as const; + "0x27B4FCf333f29a3865b3B76ea00C955D7b64BD0F" as const; /** MCV2_Bond — bonding curve trading (Base Sepolia). */ export const MCV2_BOND_ADDRESS = From 27787316fd9eee1a37eecc95c1d48b1cf7cee03b Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Fri, 20 Mar 2026 11:07:47 +0000 Subject: [PATCH 2/2] [#380] Add DEPLOYMENT_BLOCK to web app constants Adds mainnet deployment block (43_606_398) to lib/contracts/constants.ts to match the SDK, per reviewer feedback. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/contracts/constants.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/contracts/constants.ts b/lib/contracts/constants.ts index 6a3742ce..89ea36cf 100644 --- a/lib/contracts/constants.ts +++ b/lib/contracts/constants.ts @@ -24,6 +24,9 @@ export const EXPLORER_URL = IS_TESTNET // PlotLink contracts // --------------------------------------------------------------------------- +/** Deployment block for the v2 StoryFactory on Base mainnet */ +export const DEPLOYMENT_BLOCK = BigInt(43_606_398); + /** StoryFactory — storyline + plot management */ export const STORY_FACTORY = (process.env.NEXT_PUBLIC_CONTRACT_ADDRESS ?? (IS_TESTNET