mirror of openzeppelin-contracts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
import "../ERC1967/ERC1967Upgrade.sol";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Base contract for building openzeppelin-upgrades compatible implementations for the {ERC1967Proxy}. It includes
|
|
|
|
* publicly available upgrade functions that are called by the plugin and by the secure upgrade mechanism to verify
|
|
|
|
* continuation of the upgradability.
|
|
|
|
*
|
|
|
|
* The {_authorizeUpgrade} function MUST be overridden to include access restriction to the upgrade mechanism.
|
|
|
|
*
|
|
|
|
* _Available since v4.1._
|
|
|
|
*/
|
|
|
|
abstract contract UUPSUpgradeable is ERC1967Upgrade {
|
|
|
|
function upgradeTo(address newImplementation) external virtual {
|
|
|
|
_authorizeUpgrade(newImplementation);
|
|
|
|
_upgradeToAndCallSecure(newImplementation, bytes(""), false);
|
|
|
|
}
|
|
|
|
|
|
|
|
function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual {
|
|
|
|
_authorizeUpgrade(newImplementation);
|
|
|
|
_upgradeToAndCallSecure(newImplementation, data, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function _authorizeUpgrade(address newImplementation) internal virtual;
|
|
|
|
}
|