From 4663881c469fb3b436203128a429bdf98a2ab01b Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Tue, 31 Mar 2026 09:10:58 +0100 Subject: [PATCH] [#660] Fix create command by passing creationFee as msg.value MCV2_Bond.createToken requires a creation fee (currently 0.0007 ETH on Base mainnet) as msg.value. The SDK's createStoryline() was not reading or passing this fee, causing all create transactions to revert with MCV2_Bond__InvalidCreationFee. Fix: read creationFee() from the Bond contract before the simulateContract call and pass it as the transaction value. Fixes realproject7/plotlink#660 Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/cli/src/sdk/abi.ts | 7 +++++++ packages/cli/src/sdk/client.ts | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/packages/cli/src/sdk/abi.ts b/packages/cli/src/sdk/abi.ts index cfb092d3..54e534f4 100644 --- a/packages/cli/src/sdk/abi.ts +++ b/packages/cli/src/sdk/abi.ts @@ -158,6 +158,13 @@ export const erc8004Abi = [ // --------------------------------------------------------------------------- export const mcv2BondAbi = [ + { + type: "function", + name: "creationFee", + stateMutability: "view", + inputs: [], + outputs: [{ name: "", type: "uint256" }], + }, { type: "function", name: "getRoyaltyInfo", diff --git a/packages/cli/src/sdk/client.ts b/packages/cli/src/sdk/client.ts index 3ba0550d..64b59b0c 100644 --- a/packages/cli/src/sdk/client.ts +++ b/packages/cli/src/sdk/client.ts @@ -230,12 +230,20 @@ export class PlotLink { const contentCid = await uploadWithRetry(metadata, key, this.filebase!); const contentHash = hashContent(content); + // MCV2_Bond requires a creation fee as msg.value when minting a new token + const creationFee = await this.publicClient.readContract({ + address: this.mcv2Bond, + abi: mcv2BondAbi, + functionName: "creationFee", + }) as bigint; + const { request } = await this.publicClient.simulateContract({ account: this.walletClient.account!, address: this.storyFactory, abi: storyFactoryAbi, functionName: "createStoryline", args: [title, contentCid, contentHash, hasDeadline], + value: creationFee, }); const txHash = await this.walletClient.writeContract(request);