I have noticed that the UUPSUpgradeable.sol
contract which every UUPS implementation contract is supposed to inherit from may have a number of functions that may not be used at all. Not only that, it seems like all proxy contracts inherit from ERC1967Proxy
and they may all inherit the same set of functions. Would this end up bloating the gas costs needed to deploy the proxy and implementation contracts?
For example, there are a bunch of functions meant for updating of beacon and setting admin. Most of them are internal functions. I will still have to create functions to wrap them to use them. Would this further bloat the size of the contracts? If I were only using UUPS, I don't think I will ever be touching the beacon functions even though the functions are included and will be deployed, would I?
And for the setting admin related functions, should I be using the ones that come included or using onlyOwner
from OwnableUpgradeable
?
Also, the ERC1967Proxy
which will be used to point to the UUPS implementation seems to have similar functions in both the proxy and implementation contract in it. For eg, ERC1967Upgrade.sol
at here and ERC1967UpgradeUpgradeable.sol
at here.
Why doesn't the proxy contract only do a delegatecall (may even cost less to deploy?) but included very similar looking set of upgrade/admin functions as the implementation contract in it? Which one should be used then?