Skip to content

Instantly share code, notes, and snippets.

@owenThurm
Last active January 6, 2024 17:37
Show Gist options
  • Save owenThurm/b047b4f253b210fbe2c76422d39ac495 to your computer and use it in GitHub Desktop.
Save owenThurm/b047b4f253b210fbe2c76422d39ac495 to your computer and use it in GitHub Desktop.
UUPS Implementation
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