wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.17k stars 283 forks source link

Add ImmutableCreate2Factory supprt #532

Open ifelsedeveloper opened 2 months ago

ifelsedeveloper commented 2 months ago

Support for Another Factory Type in Create2 Deployment

I have added support for another factory type for create2 deployment. You need to specify this in the root hardhat config as follows:

deterministicDeployment: {
    '137': {
        factory: '0xCAcc283126Cc22204f6538dA7751E1eEb29f4C48'
    }
}
const deployResult: DeployResult = await deploy("TestDeployContract", {
        from: deployer,
        log: true,
        args: [100, 200], // Unlock timestamp in seconds
        waitConfirmations: 1,
        deterministicDeployment: "0x11111",
    });

I have tested deploying contracts with and without proxy


const deployResult: DeployResult = await deploy('UpgradeableTestDeploy', {
    from: deployer,
    log: true,
    waitConfirmations: 1,
    deterministicDeployment: "0x0a0a0a",
    proxy: {
      execute: {
        init: {
          methodName: "initialize",
          args: [100, 200],
        },
      },
      proxyContract: "OpenZeppelinTransparentProxy",
    },
  });
ifelsedeveloper commented 2 months ago

I have also published the package hardhat-deploy-immutable-proxy@0.13.0 The same contract is used by opensea https://polygonscan.com/address/0x0000000000ffe8b47b3e2130213b802212439497#code

ifelsedeveloper commented 2 months ago

@wighawag Hi Can you find some time to check pull request?

wighawag commented 2 months ago

Hi @ifelsedeveloper can you explain the rationale behind this PR ? What it do that current factory deployment setup could not do ?