A hardhat plugin that allows developers to deploy contracts to exact same addresses and verify them on multiple networks (Layer 2 or any EVM compatible network) with few commands.
Introducing Omnichain Deployer, a hardhat plugin simplifying the deployment of contracts across multiple networks, including Layer 2 and any EVM-compatible network, with just a few commands.
To facilitate cross-chain dApp development, Omnichain Deployer ensures contracts are deployed to the exact same addresses on each network, reducing confusion for both developers and users. Here's how it works:
By following this approach, developers can write their deployment script once and deploy it across multiple networks effortlessly. Omnichain Deployer makes deploying dApps across multiple chains as straightforward as deploying on a single network.
Deployed Contract on Morph: 0x3B0E082BC8913B28EAd0c84670ddCa7014FF8Fc6
Deployed Contract on Arbitrum: 0x3B0E082BC8913B28EAd0c84670ddCa7014FF8Fc6
Deployed Contract on Gnosis: 0x3B0E082BC8913B28EAd0c84670ddCa7014FF8Fc6
Deployed Contract on NeonEVM: 0x3B0E082BC8913B28EAd0c84670ddCa7014FF8Fc6
This project utilizes the Hardhat Runtime Environment for deploying and verifying smart contracts, along with the ethers library for various tasks such as estimating deployment gas, sending funds, checking balances, generating accounts, and encrypting/decrypting them. It's a command-line tool and relies on 'chalk' and 'prompt-sync' for user interaction, such as asking for passwords, logging, and displaying error messages.
Changing the network on the Hardhat Runtime Environment during runtime posed some challenges. While sending funds didn't involve HRE directly, deployment and verification tasks required constant network changes. Directly manipulating hre.network didn't work, so an alternative approach was taken using hre.hardhatArguments to change the network for deployment and running terminal commands with 'child_process' for verifying.
To calculate deployment costs, several pieces of information were needed: the gas required for the transaction and the gas price. This was achieved by using the ethers library. Contract and constructor arguments were taken as inputs, a deployment transaction was generated, and the gas estimation was extracted from this data. The gas price was obtained from the provider of the network to be deployed to, using fee data. To ensure successful deployment transactions, 1.5 times the deployment cost was declared to be sent from the developer's funder account to the deployer account.