AdminUpgradeableImpl : This contract will manage who can upgrade a contract,
allowing roles to be separated between the owner of the contract and the administrator
of the upgradeability features. Unlike Solidity and the Proxy Pattern, where the storage
layouts of the proxy and the implementation are defined separately (even though the
storage itself is the same), using set_code_hash directly changes the code of a
contract at a given address, meaning both the storage layout and storage are shared and
defined in the implementation contract. By implementing an AdminUpgradeableImpl
contract, it becomes possible to easily separate the roles of the contract owner and the
administrator of upgradeability.
An upgradeAndCall function: This permissioned function allows the caller to both
upgrade the code of the contract and call a function and/or the constructor to initialize
new variables introduced in the newest implementation in the same transaction.
An Initialize contract: This contract sets the initializing function mentioned above
to be callable only once.
AdminUpgradeableImpl
: This contract will manage who can upgrade a contract, allowing roles to be separated between the owner of the contract and the administrator of the upgradeability features. Unlike Solidity and the Proxy Pattern, where the storage layouts of the proxy and the implementation are defined separately (even though the storage itself is the same), using set_code_hash directly changes the code of a contract at a given address, meaning both the storage layout and storage are shared and defined in the implementation contract. By implementing an AdminUpgradeableImpl contract, it becomes possible to easily separate the roles of the contract owner and the administrator of upgradeability.upgradeAndCall
function: This permissioned function allows the caller to both upgrade the code of the contract and call a function and/or the constructor to initialize new variables introduced in the newest implementation in the same transaction.Initialize
contract: This contract sets the initializing function mentioned above to be callable only once.