Skip to content
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

Force write the deployment information to disk #809

Conversation

SebastienGllmt
Copy link
Contributor

This PR is to help with #791

Notably, with this code change, you can now force writing the deployment information to disk (even when using the hardhat network) by overriding the deploy task like this

function forceToDisk() {
  scope('ignition').task(
    'deploy',
    async (taskArguments: IgnitionDeployParameters, hre, runSuper) => {
      const network = hre.hardhatArguments.network ?? hre.config.defaultNetwork ?? 'hardhat';
      // see https://github.com/NomicFoundation/hardhat-ignition/issues/791
      if (taskArguments.deploymentId == null && network === 'hardhat') {
        taskArguments.deploymentId = taskArguments.deploymentId ?? 'chain-31337';
      }
      const result = await runSuper(taskArguments);
      return result;
    }
  );
}

@kanej kanej requested a review from zoeyTM September 23, 2024 09:21
Copy link
Contributor

@zoeyTM zoeyTM left a comment

Choose a reason for hiding this comment

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

I think this is a bit unclear and overcomplicated for a solution. I think a much simpler solution would be to just add a flag instead, something like this:

// hardhat-plugin/src/type-extensions.ts
export interface HardhatUserConfig {
    ignition?: Partial<DeployConfig> & {
      strategyConfig?: Partial<StrategyConfig>;
      writeLocalhostDeployment?: boolean;
    };
  }

  export interface HardhatConfig {
    ignition: Partial<DeployConfig> & {
      strategyConfig?: Partial<StrategyConfig>;
      writeLocalhostDeployment?: boolean;
    };
  }

@alcuadrado
Copy link
Member

Maybe .addFlag() in the task itself instead?

@zoeyTM
Copy link
Contributor

zoeyTM commented Sep 24, 2024

Closing in favor of #816

@zoeyTM zoeyTM closed this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants