I am trying to deploy the same smart contract multiple times using Hardhat’s Ignition plugin, but with different constructor arguments.
It seems like Ignition performs a reconciliation check and prevents redeployment if the constructor arguments change. I would like to disable this check and deploy the same contract multiple times with different constructor arguments.
Here’s what my current deployment script looks like:
// ignition deployment module
export const RouterModule = buildModule("RouterModule", (m) => {
const selector = m.getParameter("selector");
const routerContract = m.contract("Router", [
selector,
]);
return { routerContract };
});
Deployment script with the specific selector value looks like this
import { RouterModule } from "../ignition/modules/RouterContracts";
const { routerContract } = await hre.ignition.deploy(RouterModule, {
parameters: {
RouterModule: {
selector: 1001n,
},
},
});
const routerAddress = await routerContract.getAddress();
When I attempt to redeploy the contract with different selector value, I encounter the following error:
HardhatPluginError: The deployment wasn't run because of the following reconciliation errors:
* RouterModule#Router: Argument at index 0 has been changed
What I want to achieve:
- Deploy the same contract (RouterModule) multiple times, each time with different constructor arguments (selector).
- Avoid reconciliation checks or force the deployment of a new contract instance even when the constructor arguments change.
I tried the the deploy method with differnt deploymentId
, but did not help