Make non-view functions virtual (#2468)

This commit is contained in:
Hadrien Croubois
2021-01-13 22:25:39 +01:00
committed by GitHub
parent 65b7e515a2
commit faec973e09
12 changed files with 62 additions and 63 deletions

View File

@ -13,9 +13,9 @@ contract ProxyAdmin is Ownable {
/**
* @dev Returns the current implementation of `proxy`.
*
*
* Requirements:
*
*
* - This contract must be the admin of `proxy`.
*/
function getProxyImplementation(TransparentUpgradeableProxy proxy) public view returns (address) {
@ -28,9 +28,9 @@ contract ProxyAdmin is Ownable {
/**
* @dev Returns the current admin of `proxy`.
*
*
* Requirements:
*
*
* - This contract must be the admin of `proxy`.
*/
function getProxyAdmin(TransparentUpgradeableProxy proxy) public view returns (address) {
@ -43,35 +43,35 @@ contract ProxyAdmin is Ownable {
/**
* @dev Changes the admin of `proxy` to `newAdmin`.
*
*
* Requirements:
*
*
* - This contract must be the current admin of `proxy`.
*/
function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public onlyOwner {
function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {
proxy.changeAdmin(newAdmin);
}
/**
* @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.
*
*
* Requirements:
*
*
* - This contract must be the admin of `proxy`.
*/
function upgrade(TransparentUpgradeableProxy proxy, address implementation) public onlyOwner {
function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {
proxy.upgradeTo(implementation);
}
/**
* @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See
* {TransparentUpgradeableProxy-upgradeToAndCall}.
*
*
* Requirements:
*
*
* - This contract must be the admin of `proxy`.
*/
function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable onlyOwner {
function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable virtual onlyOwner {
proxy.upgradeToAndCall{value: msg.value}(implementation, data);
}
}