Using Ignition upgradable contract case in Hardhat 3 does not work
Version of Hardhat
[email protected] | @nomicfoundation/[email protected]
What happened?
According to the official website's use case, I imported a special module called Proxies.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
Then after running, the following error was obtained:
Error HHE1000: Artifact for contract "TransparentUpgradeableProxy" not found.
Minimal reproduction steps
According to the description on the official website: https://hardhat.org/ignition/docs/guides/upgradeable-proxies
Here is a reproducible warehouse: https://github.com/hairyf/hardhat-3-ignition-upgradeable
After installation, run the following command for testing:
pnpm hardhat ignition deploy ignition/modules/Demo.ts
Search terms
No response
Thanks for the info. I was able to reproduce based on the steps above:
WARNING: You are using Node.js 20.19.0 which is not supported by Hardhat.
Please upgrade to 22.10.0 or a later version.
Downloading solc 0.8.28
Downloading solc 0.8.28 (WASM build)
Error HHE1000: Artifact for contract "TransparentUpgradeableProxy" not found.
My apologies @hairyf, this issue slipped through the cracks.
There is a feature dependenciesToCompile that will compile import contracts like TransparentUpgradeableProxy.
If you add dependenciesToCompile to your hardhat.config.ts under solidity, you should be able to deploy:
// ...
solidity: {
// ...
dependenciesToCompile: ["@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol", "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"],
// ...
}
npx hardhat ignition deploy ignition/modules/Demo.ts
You are running Hardhat Ignition against an in-process instance of Hardhat Network.
This will execute the deployment, but the results will be lost.
You can use --network <network-name> to deploy to a different network.
Hardhat Ignition 🚀
Deploying [ DemoModule ]
Batch #1
Executed ProxyModule#Demo
Batch #2
Executed ProxyModule#TransparentUpgradeableProxy
Batch #3
Executed ProxyModule#TransparentUpgradeableProxy.AdminChanged.newAdmin.0
Batch #4
Executed ProxyModule#ProxyAdmin
Batch #5
Executed DemoModule#Demo
[ DemoModule ] successfully deployed 🚀
Deployed Addresses
ProxyModule#Demo - 0x5FbDB2315678afecb367f032d93F642f64180aa3
ProxyModule#TransparentUpgradeableProxy - 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
ProxyModule#ProxyAdmin - 0xCafac3dD18aC6c6e92c921884f9E4176737C052c
DemoModule#Demo - 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512