Open jaypaik opened 3 years ago
Will this avoid having to set _ADMIN_SLOT? UUPS generally isn't supposed to use _ADMIN_SLOT.
I guess you refers to this comment : https://github.com/wighawag/hardhat-deploy/issues/146#issuecomment-1244674006
UUPS idea is that proxy upgrade are handled in the implementation. so setting proxyContract: 'UUPS',
will not change that and you can handle admin check the way you want.
As I mentioned here, you do not need to use the proxied
modifier (that use _ADMIN_SLOTS)
This is exactly right. And the contract is not using the proxied
modifier.
For UUPSUpgradeable
, the plugin code should not assume that the upgrades are controlled by _ADMIN_SLOT
, owner()
, or any other fixed logic. If needed, the plugin could perhaps invoke _authorizeUpgrade()
and see if it succeeds.
But the point is that the following check in the plugin should be skipped for UUPS: https://github.com/wighawag/hardhat-deploy/blob/ee7e872fc8f8fa5ed63a00deaf25c6c7cd464a18/src/helpers.ts#L1543
There are several other comments above that all attempt to describe this same problem: #1, #2, #3, #4, #5, #6. They all seem correct to me, so I'm curious to understand what exactly is the disconnect here :-)
Ha yes, sorry, my bad, did not consider that the plugin would fails there.
I will indeed need to add an option to skip that condition checkk. The plugin cannot call _authorizeUpgrade
though as this is an internal function.
I'll wait for that condition fix :) Thanks
fix in 0.11.22
Let me know if there are any issues
@wighawag
Thank you so much!
It is finally working!!!!!!!!!
@0xTimepunk Just added the UUPS option in v0.11.21
you just do the following :
await deploy('MyContract', { from: deployer, proxy: { proxyContract: 'UUPS', } });
or if you need some initialization:
await deploy('MyContract', { from: deployer, proxy: { proxyContract: 'UUPS', execute: { init: { methodName: 'init', args: ['hello'], }, }, }, });
Thanks for this update! I had an issue with init function which is not being executed. I had to change the proxy options:
proxy: { proxyContract: 'UUPS', execute: { methodName: 'init', args: ['hello'], }, },
also, it is not clear how do i upgrade the implementation . can you share a snippet ?
@omryozgrappa did you find a snippet for upgrading?
yes... @Sotatek-HaiTrieu2
await deploy('ProxyContractName', {
from: deployerAddress,
args: constructorArgs,
libraries: libraries,
proxy:{
proxyContract: 'UUPS',
upgradeIndex: 1,
execute: {
methodName: 'anReinitializerMethod',
args: theMethodArgs,
},
implementationName: 'TheNameOfTheNewImplementationContract',
},,
contract: 'TheNameOfTheNewImplementationContract',
})
@0xTimepunk Just added the UUPS option in v0.11.21 you just do the following :
await deploy('MyContract', { from: deployer, proxy: { proxyContract: 'UUPS', } });
or if you need some initialization:
await deploy('MyContract', { from: deployer, proxy: { proxyContract: 'UUPS', execute: { init: { methodName: 'init', args: ['hello'], }, }, }, });
Thanks for this update! I had an issue with init function which is not being executed. I had to change the proxy options:
proxy: { proxyContract: 'UUPS', execute: { methodName: 'init', args: ['hello'], }, },
also, it is not clear how do i upgrade the implementation . can you share a snippet ?
Its not called "init" in UUPS but "initialize" so you need to have it like this
execute: {
init: {
methodName: 'initialize',
args: args,
},
},
I see that
OpenZeppelinTransparentProxy
is supported. Are there any plans to add UUPS proxy support in the near future?