npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@omni-kit/omni-deployer

v0.2.3

Published

Deploy smart contracts across multiple chains using SuperchainFactory

Readme

OmniKit User Flow

This guide walks you through how to use omni-deployer to deploy your smart contracts across multiple chains using the SuperchainFactory. The package supports two main commands:

  • deploy: Deploys the same contract on multiple chains at the same address.
  • deploy-hs: Deploys hub-and-spoke contracts (with potentially different bytecodes) on the same address across multiple chains.

What is the Hub and Spoke Contract Architecture

  • Central Hub: One main contract on Chain-A that stores all data and handles all write operations.
  • Multiple Spokes: Contracts on separate chains (B, C, D) that only make cross-chain calls to the Hub Contract.
  • Data Management: All storage variables and state changes happen only in the Hub, creating a single source of truth.
  • Frontend Access: Frontend reads data from the Hub only but can interact with either Hub or Spoke depending on which chain the user is connected to.

Prerequisites

Note: If you are using Windows OS, you must run these commands inside WSL (Windows Subsystem for Linux) to ensure compatibility with Foundry and other tools.

Before starting:

  • Ensure Node.js (16.x+) and npm are installed.
  • Install Foundry globally (forge command available). Instructions.
  • Install Supersim by following Instructions. (Optional if you're deploying on Superchain Devnets)
  • Have a private key for the deployment account ready (set as an environment variable).

Step-by-Step User Flow

1. Initialize Foundry Project

Before deploying, initialize a Foundry project:

forge init my-foundry-project
cd my-foundry-project

2. Install Omni-Deployer

Install the Omni-Deployer library:

npm i @omni-kit/omni-deployer

3. Run Supersim Anvil (Optional For Superchain Devnet Users)

Note: If you are deploying contracts on Superchain Devnets as per the Optimism Console, you don’t need to follow this step or install Supersim.

Start the Supersim Anvil to simulate the Superchain environment. You can specify the chains you want the contracts to deploy on:

supersim fork --network=sepolia --chains=op,base,mode --interop.autorelay

4. Create Your Smart Contracts

Example for deploy (Single Contract)

// src/TestToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";

contract TestToken is ERC20 {
    constructor(string memory name, string memory symbol) ERC20(name, symbol) {
        _mint(msg.sender, 1_000_000 * 10 ** decimals());
    }
}

Example for deploy-hs (Hub-and-Spoke Contracts)

// src/HubContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract HubContract {
    address public admin;

    constructor(address _admin) {
        admin = _admin;
    }

    function doHubAction() external {
        // Hub-specific logic
    }
}
// src/SpokeContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SpokeContract {
    address public adminAddress;

    constructor(address _adminAddress) {
        adminAddress = _adminAddress;
    }

    function doSpokeAction() external {
        // Spoke-specific logic
    }
}

5. Set Up Your Config File (Optional)

For deploy (Single Contract)

Create a file named superchain.json in your project root:

{
  "chains": [420120000, 420120001],
  "factoryContract": "0x5a0632d24ddae5B4CB511aBB134561b9396473b4",
  "contractName": "TestToken",
  "constructorArgs": ["MyToken", "MTK"],
  "rpcUrl": "https://interop-alpha-0.optimism.io",
  "salt": "mysalt"
}

For deploy-hs (Hub-and-Spoke Contracts)

Create a file named hubAndSpokeConfig.json in your project root:

{
  "chains": [420120000, 420120001],
  "factoryContract": "0x5a0632d24ddae5B4CB511aBB134561b9396473b4",
  "hubContract": "HubContract",
  "spokeContract": "SpokeContract",
  "hubConstructorArgs": ["0xYourAdminAddress"],
  "spokeConstructorArgs": ["0xYourAdminAddress"],
  "salt": "deployHS",
  "rpcUrl": "https://interop-alpha-0.optimism.io"
}

6. Set Your Private Key

Export your private key securely:

export PRIVATE_KEY=0xYourPrivateKey

7. Run Omni-Deployer

With a Config File

For deploy (Single Contract):

npx omni-deployer deploy superchain.json

For deploy-hs (Hub-and-Spoke Contracts):

npx omni-deployer deploy-hs hubAndSpokeConfig.json

Without a Config File (Interactive Mode)

For deploy:

npx omni-deployer deploy

For deploy-hs:

npx omni-deployer deploy-hs

You’ll be asked to provide:

  • Chain IDs: Comma-separated list (e.g., 420120000,420120001).
  • Factory Contract Address: use 0x5a0632d24ddae5B4CB511aBB134561b9396473b4 address (currently deployed on OP-BASE-MODE sepolia, Superchain Devnets 0 & 1).
  • Contract Name(s): For deploy, enter the contract name; for deploy-hs, enter hub and spoke contract names.
  • Constructor Arguments: Enter as a JSON array (e.g., {"0xYourAdminAddress"}) or comma-separated list.
  • Salt: Enter a salt string (e.g., deployHS).
  • RPC URL: Enter the RPC endpoint (e.g., https://interop-alpha-0.optimism.io).

8. What Happens

  • Compiles your contracts with forge build.
  • For deploy: Deploys the contract to the chain at rpcUrl and sends cross-chain messages to deploy it on other chains at the same address.
  • For deploy-hs: Deploys the hub contract on the chain at rpcUrl and sends cross-chain messages to deploy spoke contracts on the chains listed in chains at the same address.
  • Outputs the transaction hash and deployed addresses.
  • checkout Omnikit to working of the Contract underhood.

9. Verify Output

Example for deploy

Compiling contract with forge build...
Deploying contract across chains: [420120000, 420120001]
Transaction hash: 0x...
Deployed contract address on local chain: 0x...
Computed CREATE2 address (for all chains): 0x...
Contract has been deployed across all specified chains.

Example for deploy-hs

Compiling contracts with forge build...
Deploying hub and spoke contracts...
Transaction hash: 0x...
Deployed hub contract address on local chain: 0x...
Computed CREATE3 address (for all chains): 0x...
Hub and spoke contracts have been deployed across specified chains.

Conclusion

With omni-deployer, you can easily deploy contracts across multiple chains using either a configuration file or interactive prompts. The deploy command is ideal for deploying identical contracts, while deploy-hs supports hub-and-spoke architectures with different bytecodes at the same address.

For further assistance, refer to the official documentation or open an issue in the repository. Happy deploying! 🚀