-
Notifications
You must be signed in to change notification settings - Fork 32
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
Ignition guide for creating UUPS upgradeable module #788
Comments
Does hardhat-ignition currently support deploying UUPS contracts? I can’t find any documentation, is there any plan to support this feature? |
There is no explicit feature supporting UUPS, the API allows you to express contract deployments and calls. |
you just need to use the generic import { buildModule } from '@nomicfoundation/hardhat-ignition/modules';
const ProxyModule = buildModule('ProxyModule', (builder) => {
// Deploy the implementation contract
const implementation = builder.contract('MyContract');
// Encode the initialize function call for the contract.
const initialize = builder.encodeFunctionCall(implementation, 'initialize', [
'param1',
'param2',
]);
// Deploy the ERC1967 Proxy, pointing to the implementation
const proxy = builder.contract('ERC1967Proxy', [implementation, initialize]);
return { proxy };
});
export const MyContractModule = buildModule('MyContractModule', (builder) => {
// Get the proxy from the previous module.
const { proxy } = builder.useModule(ProxyModule);
// Create a contract instance using the deployed proxy's address.
const instance = builder.contractAt('MyContract', proxy);
return { instance, proxy };
});
export default MyContractModule; |
Thank you for providing the solution. If my contract is inherited from |
how would you approach an upgrade module based on this example? |
The current upgrade-able contract docs guide is based around the TransparentUpgradeableProxy pattern:
https://hardhat.org/ignition/docs/guides/upgradeable-proxies
We should add a guide for the Universal Upgradeable Proxy Standard pattern.
See the Open Zeppelin docs for a description of the difference: https://docs.openzeppelin.com/contracts/4.x/api/proxy#transparent-vs-uups
The text was updated successfully, but these errors were encountered: