Last active
January 6, 2024 17:37
-
-
Save owenThurm/b047b4f253b210fbe2c76422d39ac495 to your computer and use it in GitHub Desktop.
UUPS Implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.8.19; | |
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | |
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; | |
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; | |
contract UUPSImpl is Initializable, OwnableUpgradeable, UUPSUpgradeable { | |
constructor() { | |
_disableInitializers(); | |
} | |
function initialize() public initializer { | |
__Ownable_init(); | |
__UUPSUpgradeable_init(); | |
} | |
function upgradeTo(address newImplementation) public override onlyOwner onlyProxy { | |
_upgradeToAndCallUUPS(newImplementation, new bytes(0), false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment