Skip to content

Conversation

@salgozino
Copy link
Contributor

@salgozino salgozino commented Oct 5, 2025

Support to deploy at base sepolia

Summary by CodeRabbit

  • New Features

    • Added Base Sepolia testnet support, including explorer integration.
    • Enhanced deployment tooling with multi-chain parameterization.
    • Introduced a new streamlined deployment flow (v2) for core contracts.
  • Refactor

    • Simplified deployments with conditional components and smarter defaults.
    • Improved verification steps aligned with the new deployment paths.
  • Chores

    • Set the project package manager to Yarn 1.x.
    • Replaced deprecated Kovan deployment script with a Base Sepolia alternative.

@coderabbitai
Copy link

coderabbitai bot commented Oct 5, 2025

Walkthrough

Adds Base Sepolia network support and Basescan config; updates Etherscan keys. Replaces Kovan deploy script with Base Sepolia. Parameterizes deploy-market-view by chain. Introduces a new deploy-v2 script deploying and verifying multiple contracts. Modifies main deploy script with chain 84532 params and conditional CurateProxy/arbitrator handling and verification tweaks.

Changes

Cohort / File(s) Summary
Hardhat config & explorers
hardhat.config.js
Imports basescanApiKey; adds base-sepolia network; conditional Hardhat forking config; normalizes optimizer settings; adds Basescan customChains; maps base-sepolia -> basescanApiKey.
Package scripts
package.json
Adds packageManager: "yarn@1.22.19"; replaces deploy:kovan with deploy:baseSepolia targeting --network 'base-sepolia'.
MarketView deployment params
scripts/deploy-market-view.js
Introduces per-chain params for ids 100 and 84532; replaces hardcoded constructor args with params[chainId] for deploy and verify.
New v2 deployment
scripts/deploy-v2.js
New script: selects per-chain params; deploys LiquidityPool, LiquidityFactory, KeyValue, MarketFactoryV2; verifies all with constructor args.
Main deploy flow updates
scripts/deploy.js
Adds chainId 84532 params; makes CurateProxy optional based on params[chainId].curate; passes AddressZero when arbitrator absent; adjusts constructor args and verification targets; conditional logging and verification for CurateProxy.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant HH as Hardhat Script (scripts/deploy.js)
  participant Net as Network (RPC)
  participant Cur as CurateProxy
  participant Desc as BetNFTDescriptor
  participant Fac as MarketFactory

  Dev->>HH: run --network base-sepolia
  HH->>Net: get chainId
  alt curate configured
    HH->>Net: deploy CurateProxy
    activate Cur
    Cur-->>HH: address
    deactivate Cur
  else curate not configured
    Note over HH: Skip CurateProxy
  end
  HH->>Net: deploy BetNFTDescriptor (curate ? Cur.address : AddressZero)
  activate Desc
  Desc-->>HH: address
  deactivate Desc
  HH->>Net: deploy MarketFactory (arbitrator || AddressZero, governor, treasury,…)
  activate Fac
  Fac-->>HH: address
  deactivate Fac
  par verify contracts
    HH->>Net: verify BetNFTDescriptor (args per curate presence)
    HH->>Net: verify MarketFactory (arbitrator may be AddressZero)
    opt curate configured
      HH->>Net: verify CurateProxy
    end
  end
Loading
sequenceDiagram
  autonumber
  actor Dev as Developer
  participant HH as Hardhat Script (scripts/deploy-v2.js)
  participant Net as Network (RPC)
  participant LP as LiquidityPool
  participant LF as LiquidityFactory
  participant KV as KeyValue
  participant MF2 as MarketFactoryV2

  Dev->>HH: run deploy-v2
  HH->>Net: get chainId & params (realityRegistry, marketFactory, governor)
  HH->>Net: deploy LiquidityPool
  LP-->>HH: address
  HH->>Net: deploy LiquidityFactory (marketFactory, LP, governor)
  LF-->>HH: address
  HH->>Net: deploy KeyValue
  KV-->>HH: address
  HH->>Net: deploy MarketFactoryV2 (realityRegistry, KV, marketFactory, LF)
  MF2-->>HH: address
  par verify
    HH->>Net: verify LiquidityPool
    HH->>Net: verify KeyValue
    HH->>Net: verify LiquidityFactory (ctor args)
    HH->>Net: verify MarketFactoryV2 (ctor args)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I twitch my ears at Base’s glow,
New scripts hop in, old ones go.
Param paths where hardcodes were,
Fork or not, we now confer.
Verify trails like clover lines—
Deploy, deploy, the ledger shines.
Thump-thump! On Sepolia, it binds. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly indicates adding deployment support for the Base Sepolia network, directly reflecting the pull request’s main change and enabling reviewers to understand the core purpose at a glance.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/deploy-base

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/deploy.js (1)

38-124: Fix the curateProxy shadowing bug

Within Lines 39-43 const curateProxy = … shadows the outer let, so the outer variable never gets assigned. The script then crashes when it tries to read curateProxy.address, and BetNFTDescriptor is always initialised with AddressZero. Assign to the outer variable instead.

-  let curateProxy;
+  let curateProxy;
   if (params[chainId].curate) {
     const CurateProxy = await ethers.getContractFactory("CurateProxy");
-    const curateProxy = await CurateProxy.deploy(params[chainId].curate);
-    await curateProxy.deployed();
+    curateProxy = await CurateProxy.deploy(params[chainId].curate);
+    await curateProxy.deployed();
   }
🧹 Nitpick comments (2)
scripts/deploy-market-view.js (1)

4-32: Validate the chain configuration before using it

params[chainId] is used immediately, so an unsupported network will trigger a Cannot read properties of undefined later on. Add an explicit guard near Line 19 to bail out with a clear message.

   const chainId = hre.network.config.chainId;
+  if (!params[chainId]) {
+    throw new Error(`Unsupported chainId ${chainId} for MarketView deployment`);
+  }
scripts/deploy-v2.js (1)

5-101: Guard against missing params entries

Line 19 reads params[chainId] without checking for existence. On an unsupported network this script will crash deep into deployment. Add the same fail-fast guard used elsewhere so users get a clear error.

   const chainId = hre.network.config.chainId;
+  if (!params[chainId]) {
+    throw new Error(`Unsupported chainId ${chainId} for deploy-v2`);
+  }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 967fd0f and 690d939.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • hardhat.config.js (3 hunks)
  • package.json (1 hunks)
  • scripts/deploy-market-view.js (4 hunks)
  • scripts/deploy-v2.js (1 hunks)
  • scripts/deploy.js (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/deploy.js (1)
test/factory.js (5)
  • curateProxy (87-87)
  • CurateProxy (86-86)
  • ethers (3-3)
  • BetNFTDescriptor (90-90)
  • betNFTDescriptor (36-36)

Comment on lines +103 to +110
network: "base-sepolia",
chainId: 84532,
urls: {
// 3) Select to what explorer verify the contracts
// BaseScan
apiURL: "https://api.etherscan.io/v2/api?chainid=84532",
browserURL: "https://sepolia.basescan.org/",
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Point the Base Sepolia explorer config at BaseScan

Line 108 uses https://api.etherscan.io/v2/api?chainid=84532, which is not the Base Sepolia explorer endpoint. Hardhat verification will fail against that URL. Use the BaseScan API instead.

-          apiURL: "https://api.etherscan.io/v2/api?chainid=84532",
+          apiURL: "https://api-sepolia.basescan.org/api",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
network: "base-sepolia",
chainId: 84532,
urls: {
// 3) Select to what explorer verify the contracts
// BaseScan
apiURL: "https://api.etherscan.io/v2/api?chainid=84532",
browserURL: "https://sepolia.basescan.org/",
},
network: "base-sepolia",
chainId: 84532,
urls: {
// 3) Select to what explorer verify the contracts
// BaseScan
apiURL: "https://api-sepolia.basescan.org/api",
browserURL: "https://sepolia.basescan.org/",
},
🤖 Prompt for AI Agents
In hardhat.config.js around lines 103 to 110, the explorer apiURL is incorrectly
set to Etherscan (https://api.etherscan.io/...) which will fail for Base
Sepolia; update the apiURL to BaseScan's endpoint (e.g.
https://api.basescan.org/api?chainid=84532) and ensure the project uses the
correct explorer API key variable (e.g. BASESCAN_API_KEY) in the
hardhat-etherscan configuration; verify browserURL stays pointing at the Base
Sepolia explorer and that the chainId matches the network.

"scripts": {
"prettier": "prettier --write 'contracts/**/*.sol'",
"deploy:kovan": "npx hardhat run --network kovan scripts/deploy.js",
"deploy:baseSepolia": "npx hardhat run --network 'base-sepolia' scripts/deploy.js",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Drop the single quotes from the network name

On Line 9 the script passes 'base-sepolia'. When run on Windows the quotes are preserved, so Hardhat looks for a network called 'base-sepolia' and the deployment fails. Please remove the quotes so the command works cross-platform.

-    "deploy:baseSepolia": "npx hardhat run --network 'base-sepolia' scripts/deploy.js",
+    "deploy:baseSepolia": "npx hardhat run --network base-sepolia scripts/deploy.js",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"deploy:baseSepolia": "npx hardhat run --network 'base-sepolia' scripts/deploy.js",
"deploy:baseSepolia": "npx hardhat run --network base-sepolia scripts/deploy.js",
🤖 Prompt for AI Agents
In package.json around line 9, the npm script "deploy:baseSepolia" uses quoted
network name 'base-sepolia' which on Windows is passed verbatim to Hardhat;
remove the single quotes so the script reads the network name without quotes
(i.e., use base-sepolia) to ensure cross-platform correctness when running npx
hardhat --network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants