|
@@ -55,7 +55,8 @@ contract TransparentUpgradeableProxy is ERC1967Proxy {
|
|
|
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
|
|
|
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
|
|
|
*/
|
|
|
- function admin() external ifAdmin returns (address admin_) {
|
|
|
+ function admin() external payable ifAdmin returns (address admin_) {
|
|
|
+ _requireZeroValue();
|
|
|
admin_ = _getAdmin();
|
|
|
}
|
|
|
|
|
@@ -68,7 +69,8 @@ contract TransparentUpgradeableProxy is ERC1967Proxy {
|
|
|
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
|
|
|
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
|
|
|
*/
|
|
|
- function implementation() external ifAdmin returns (address implementation_) {
|
|
|
+ function implementation() external payable ifAdmin returns (address implementation_) {
|
|
|
+ _requireZeroValue();
|
|
|
implementation_ = _implementation();
|
|
|
}
|
|
|
|
|
@@ -79,7 +81,8 @@ contract TransparentUpgradeableProxy is ERC1967Proxy {
|
|
|
*
|
|
|
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
|
|
|
*/
|
|
|
- function changeAdmin(address newAdmin) external virtual ifAdmin {
|
|
|
+ function changeAdmin(address newAdmin) external payable virtual ifAdmin {
|
|
|
+ _requireZeroValue();
|
|
|
_changeAdmin(newAdmin);
|
|
|
}
|
|
|
|
|
@@ -88,7 +91,8 @@ contract TransparentUpgradeableProxy is ERC1967Proxy {
|
|
|
*
|
|
|
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
|
|
|
*/
|
|
|
- function upgradeTo(address newImplementation) external ifAdmin {
|
|
|
+ function upgradeTo(address newImplementation) external payable ifAdmin {
|
|
|
+ _requireZeroValue();
|
|
|
_upgradeToAndCall(newImplementation, bytes(""), false);
|
|
|
}
|
|
|
|
|
@@ -117,4 +121,12 @@ contract TransparentUpgradeableProxy is ERC1967Proxy {
|
|
|
require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
|
|
|
super._beforeFallback();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @dev To keep this contract fully transparent, all `ifAdmin` functions must be payable. This helper is here to
|
|
|
+ * emulate some proxy functions being non-payable while still allowing value to pass through.
|
|
|
+ */
|
|
|
+ function _requireZeroValue() private {
|
|
|
+ require(msg.value == 0);
|
|
|
+ }
|
|
|
}
|