-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Sometimes I want to deploy a contract behind a proxy in a unit test, outside of deployment scripts. One example of such a contract is L2TBTC. A common parent contract for all L2s and sidechains. Each chain-specific implementation will inherit from that contract and specify the token name and symbol. To not repeat the same tests over and over again, I want to test the parent L2TBTC contract. Since this contract is upgradeable and all L2 tokens are expected to be deployed behind a proxy, I want to test this contract as deployed behind a proxy. At the same time, I do not want to add it to the deployment scripts because it is deployed by a separate project, specific to the given chain.
When I call await helpers.upgrades.deployProxy for the second time (call yarn test twice), the second run fails with * was already deployed error here because the artifact for the contract is stored in deployments/hardhat.
I think this behavior is different from hre.deployments.deploy. From the docs:
This is why the hre.deployments.deploy function will by default only deploy if the contract code has changed, making it easier to write idempotent script.`
If detecting code changes is hard, I would suggest to add a flag allowing to force deployment, even if the contract was already deployed.