Skip to content

feat: SDK upgrade with the ModularEtherspotWalletFactory contracts (on all chains) with latest IHook #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 28, 2025

Conversation

kanthgithub
Copy link
Contributor

@kanthgithub kanthgithub commented May 23, 2025

Description

SmartContract Change Details

  • Updated ModularEtherspotWalletFactory contract to allow for pointing to different ModularEtherspotWallet implementation contract for easier upgrade (w/ access controls).
  • Redeployed ModularEtherspotWalletFactory, ModularEtherspotWallet and Bootstrap contracts on all chains.

SDK updates

  1. Updated contract addresses for all chains

    • walletFactory
    • bootstrap
    • multipleOwnerECDSAValidator
  2. release version of sdk upgraded from 6.0.1 to 7.0.0

  3. contract Address updates

    • Changed contract address for Wallet Factory from 0x2A40091f044e48DEB5C0FCbc442E443F3341B451 to
      0x38CC0EDdD3a944CA17981e0A19470d2298B8d43a
    • Changed contract address for Bootstrap from 0x0D5154d7751b6e2fDaa06F0cC9B400549394C8AA to 0xCF2808eA7d131d96E5C73Eb0eCD8Dc84D33905C7
    • Changed contract address for Multiple Owner ECDSA Validator from 0x0740Ed7c11b9da33d9C80Bd76b826e4E90CC1906 to 0x0eA25BF9F313344d422B513e1af679484338518E
    • Added support for HookMultiPlexer at address 0xDcA918dd23456d321282DF9507F6C09A50522136.
    • Results in a change of precomputed modular account address.
  4. enhance getInitCode function to include the HookMultiplexer address set as default Hook

    • context: previous version for initiCode sets ZeroAddress as defaultHook which means no default hook is initialised

Types of changes

  • Refactoring (no functional changes, no api changes)

cryptonoyaiba and others added 3 commits May 22, 2025 11:06
- Updated factory, bootstrap and MOECDSA validator contract addresses.
- Updated CHANGLOG.md with changes.
- Bumped version from 5.1.2 to 6.0.0.
Copy link

coderabbitai bot commented May 23, 2025

Walkthrough

This update introduces breaking changes by updating the contract addresses for Wallet Factory, Bootstrap, and Multiple Owner ECDSA Validator across the SDK, examples, and constants. The package version is incremented to 6.0.0, and minor formatting improvements are applied throughout the affected files.

Changes

File(s) Change Summary
CHANGELOG.md, package.json Added 6.0.0 release with breaking changes; updated package version to 6.0.0.
src/sdk/network/constants.ts Updated contract addresses for walletFactory, bootstrap, and multipleOwnerECDSAValidator; formatting.
examples/basics/custom-chain.ts Updated contract addresses, improved formatting, and refactored SDK instantiation.
examples/basics/transfer-erc20.ts Replaced ERC20 token address from env variable to hardcoded value.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ModularSdk
    participant NetworkConstants

    User->>ModularSdk: Initialize with network/chain info
    ModularSdk->>NetworkConstants: Retrieve contract addresses
    NetworkConstants-->>ModularSdk: Return updated addresses (walletFactory, bootstrap, validator)
    ModularSdk-->>User: SDK ready with new contract addresses
Loading

Possibly related PRs

  • Custom_Chain #63: Adds support for custom chain and custom contract addresses, which is directly related to this PR’s update of default contract addresses in the SDK.

Suggested reviewers

  • ch4r10t33r
  • nikhilkumar1612

Poem

A hop, a skip, new addresses in tow,
Version six arrives, onward we go!
Factories and validators, all shiny and bright,
With constants aligned, the SDK feels right.
🐇✨ Here’s to breaking changes done neat—
The modular journey skips on with nimble feet!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

examples/basics/transfer-erc20.ts

Oops! Something went wrong! :(

ESLint: 8.28.0

ReferenceError: Cannot read config file: /.eslintrc.js
Error: module is not defined
at file:///.eslintrc.js:1:1
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:479:35)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:435:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1565:24)
at Module._compile (node:internal/modules/cjs/loader:1716:5)
at Object..js (node:internal/modules/cjs/loader:1899:10)
at Module.load (node:internal/modules/cjs/loader:1469:32)
at Module._load (node:internal/modules/cjs/loader:1286:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)

examples/basics/custom-chain.ts

Oops! Something went wrong! :(

ESLint: 8.28.0

ReferenceError: Cannot read config file: /.eslintrc.js
Error: module is not defined
at file:///.eslintrc.js:1:1
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:479:35)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:435:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1565:24)
at Module._compile (node:internal/modules/cjs/loader:1716:5)
at Object..js (node:internal/modules/cjs/loader:1899:10)
at Module.load (node:internal/modules/cjs/loader:1469:32)
at Module._load (node:internal/modules/cjs/loader:1286:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)

src/sdk/network/constants.ts

Oops! Something went wrong! :(

ESLint: 8.28.0

ReferenceError: Cannot read config file: /.eslintrc.js
Error: module is not defined
at file:///.eslintrc.js:1:1
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:479:35)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:435:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1565:24)
at Module._compile (node:internal/modules/cjs/loader:1716:5)
at Object..js (node:internal/modules/cjs/loader:1899:10)
at Module.load (node:internal/modules/cjs/loader:1469:32)
at Module._load (node:internal/modules/cjs/loader:1286:12)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kanthgithub kanthgithub changed the title Pro3264 new contract deployments feat: SDK upgrade with the ModularEtherspotWalletFactory contracts (on all chains) with latest IHook May 28, 2025
@kanthgithub kanthgithub requested a review from cryptonoyaiba May 28, 2025 06:50
@kanthgithub kanthgithub self-assigned this May 28, 2025
@kanthgithub kanthgithub added the enhancement New feature or request label May 28, 2025
@kanthgithub kanthgithub marked this pull request as ready for review May 28, 2025 06:51
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd151d9 and 5ab62f2.

📒 Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • examples/basics/custom-chain.ts (2 hunks)
  • examples/basics/transfer-erc20.ts (1 hunks)
  • package.json (1 hunks)
  • src/sdk/network/constants.ts (37 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/sdk/network/constants.ts (1)
src/sdk/network/interfaces.ts (1)
  • NetworkConfig (9-20)
🔇 Additional comments (8)
src/sdk/network/constants.ts (2)

45-48: Approve formatting improvements.

The conversion to multiline format with trailing commas improves readability and maintainability.


544-545: Verify consistency of default exported constants.

The default constants have been updated to match the new addresses. Ensure these align with the addresses used in the Networks object.

package.json (1)

3-3: Appropriate major version bump for breaking changes.

The version increment from 5.1.2 to 6.0.0 correctly follows semantic versioning for breaking changes, as the contract address updates will affect precomputed modular account addresses.

CHANGELOG.md (1)

2-8: Comprehensive breaking changes documentation.

The changelog properly documents the breaking changes with clear before/after contract addresses and explains the impact on precomputed modular account addresses. This will help users understand the migration requirements.

examples/basics/custom-chain.ts (4)

15-17: Contract addresses updated correctly.

The contract addresses have been properly updated to match the new deployed contracts:

  • Wallet Factory: 0x38CC0EDdD3a944CA17981e0A19470d2298B8d43a
  • Bootstrap: 0xCF2808eA7d131d96E5C73Eb0eCD8Dc84D33905C7
  • Multiple Owner ECDSA Validator: 0x0eA25BF9F313344d422B513e1af679484338518E

These align with the breaking changes documented in the PR objectives.


24-35: Good formatting improvements.

The consistent use of single quotes, trailing commas, and proper formatting enhances code readability and maintainability.


37-47: Excellent refactoring to options object pattern.

The refactoring from multi-line constructor arguments to a single options object significantly improves readability while maintaining all the same parameters and functionality. This follows modern JavaScript/TypeScript best practices.


77-77: Minor improvement to while loop condition.

Removing the redundant parentheses simplifies the condition without changing its logic. Good cleanup.

Comment on lines +100 to +102
walletFactory: '0x38CC0EDdD3a944CA17981e0A19470d2298B8d43a',
bootstrap: '0xCF2808eA7d131d96E5C73Eb0eCD8Dc84D33905C7',
multipleOwnerECDSAValidator: '0x0eA25BF9F313344d422B513e1af679484338518E',
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify new contract addresses are deployed and functional.

The contract addresses for walletFactory, bootstrap, and multipleOwnerECDSAValidator have been systematically updated across all networks. Ensure these new addresses correspond to deployed and functional contracts.

Also applies to: 112-114, 125-127, 137-139, 149-151, 161-163


🏁 Script executed:

#!/bin/bash
# Description: Verify that the new contract addresses are deployed on multiple chains
# Expected: Contract code should exist at these addresses

# Check a few key networks for contract deployment
declare -A networks=(
  ["1"]="https://eth-mainnet.g.alchemy.com/v2/demo"
  ["10"]="https://opt-mainnet.g.alchemy.com/v2/demo" 
  ["137"]="https://polygon-mainnet.g.alchemy.com/v2/demo"
  ["42161"]="https://arb-mainnet.g.alchemy.com/v2/demo"
)

addresses=(
  "0x38CC0EDdD3a944CA17981e0A19470d2298B8d43a"  # walletFactory
  "0xCF2808eA7d131d96E5C73Eb0eCD8Dc84D33905C7"   # bootstrap  
  "0x0eA25BF9F313344d422B513e1af679484338518E"   # multipleOwnerECDSAValidator
)

for chain_id in "${!networks[@]}"; do
  rpc_url="${networks[$chain_id]}"
  echo "Checking chain $chain_id..."
  
  for address in "${addresses[@]}"; do
    echo "  Checking address $address"
    response=$(curl -s -X POST \
      -H "Content-Type: application/json" \
      -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"$address\",\"latest\"],\"id\":1}" \
      "$rpc_url")
    
    code=$(echo "$response" | jq -r '.result')
    if [ "$code" = "0x" ] || [ "$code" = "null" ]; then
      echo "    ❌ No contract code found at $address on chain $chain_id"
    else
      echo "    ✅ Contract deployed at $address on chain $chain_id"
    fi
  done
done

Length of output: 9786


Improve verification script and validate contract deployments

The current script treats RPC errors (e.g. “error code: 1015”) as successful deployments because an empty result doesn’t equal “0x” or “null”. Please update your checks and verify each new address truly hosts bytecode:

• Handle JSON-RPC errors: fail when the response contains an "error" field.
• Ensure eth_getCode returns non-empty bytecode (length > 2, not just prefix “0x”).
• Use valid provider API keys (avoid demo/rate-limited endpoints).
• Manually confirm on block explorers (Etherscan, Polygonscan, Arbiscan, Optimism Explorer).

Example snippet update:

-   code=$(echo "$response" | jq -r '.result')
-   if [ "$code" = "0x" ] || [ "$code" = "null" ]; then
+   if echo "$response" | jq -e 'has("error") or .result == "0x" or .result == "null"' >/dev/null; then
       echo "    ❌ No contract code found at $address on chain $chain_id"
     else
       echo "    ✅ Contract deployed at $address on chain $chain_id"

Apply these fixes to lines 100–102, 112–114, 125–127, 137–139, 149–151, and 161–163.

🤖 Prompt for AI Agents
In src/sdk/network/constants.ts around lines 100 to 102 and also at lines
112-114, 125-127, 137-139, 149-151, and 161-163, the verification script for
contract addresses does not properly handle JSON-RPC errors and may incorrectly
treat error responses as successful deployments. Update the script to check if
the JSON response contains an "error" field and fail if it does. Also, ensure
that the returned bytecode from eth_getCode is longer than just the "0x" prefix
(length > 2) to confirm actual contract deployment. Replace demo API keys with
valid provider keys to avoid rate limits and manually verify addresses on block
explorers for completeness.

@@ -13,7 +13,7 @@ dotenv.config();
// add/change these values
const recipient = '0x80a1874E1046B1cc5deFdf4D3153838B72fF94Ac'; // recipient wallet address
const value = '0.1'; // transfer value
const tokenAddress = process.env.TOKEN_ADDRESS as string; // token address
const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider reverting to environment variable for token address.

Hardcoding the token address reduces flexibility and may cause issues if this address is not valid across all supported chains or becomes outdated. The previous approach using process.env.TOKEN_ADDRESS was more flexible for users.

-const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
+const tokenAddress = process.env.TOKEN_ADDRESS || '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address

This provides the hardcoded address as a fallback while maintaining the flexibility of environment variable configuration.

📝 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
const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
- const tokenAddress = '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
+ const tokenAddress = process.env.TOKEN_ADDRESS || '0xf7e6a76F138817c39dC0b5fCb409f642490CcEdD'; // token address
🤖 Prompt for AI Agents
In examples/basics/transfer-erc20.ts at line 16, replace the hardcoded token
address with a reference to an environment variable, such as
process.env.TOKEN_ADDRESS, to improve flexibility. Keep the current hardcoded
address as a fallback default in case the environment variable is not set,
ensuring the code works across different environments and chains without manual
changes.

Copy link
Contributor

@vignesha22 vignesha22 left a comment

Choose a reason for hiding this comment

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

LGTM

@kanthgithub kanthgithub merged commit b8ac81f into master May 28, 2025
5 checks passed
@kanthgithub kanthgithub deleted the PRO3264-new-contract-deployments branch May 28, 2025 07:35
@kanthgithub kanthgithub restored the PRO3264-new-contract-deployments branch May 28, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

4 participants