InverterTransparentUpgradeableProxy_v1.sol
Inherits: ERC1967Proxy
Author: Inverter Network
An alternative variant of the {TransparentUpgradeableProxy} of OpenZeppelin that allows for upgrading the linked implementation of the proxy to the implementation provided by a linked beacon.
*This contract is a fork of the {TransparentUpgradeableProxy} from openzeppelin. We adapted the callable functions of the admin account to only be able to upgrade the implementation to the newest implementation of the linked {InverterBeacon_v1}. !!! IMPORTANT !!!
If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches the {IInverterTransparentUpgradeableProxy_v1-upgradeToNewestVersion} function exposed by the proxy itself.
If the admin calls the proxy, it can call the
upgradeToNewestVersion
function but any other call won't be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating the proxy admin cannot fallback to the target implementation. These properties mean that the admin account can only be used for upgrading the proxy, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. For this reason, the proxy deploys an instance of {ProxyAdmin} and allows upgrades only if they come through it. You should think of theProxyAdmin
instance as the administrative interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.*
State Variables
_admin
The address of the admin that can update the implementation address of this proxy.
_beacon
The address of the beacon that is used to fetch the implementation address.
majorVersion
The major version of the implementation.
minorVersion
The minor version of the implementation.
patchVersion
The patch version of the implementation.
Functions
constructor
version
Returns the version of the linked implementation.
This overrides the possible use of a "version" function in the modules that are called via the Proxy Beacon structure.
Returns
<none>
uint256
The major version.
<none>
uint256
The minor version.
<none>
uint256
The patch version.
receive
Fallback function to delegate calls to the implementation contract even if the call data is empty but msg.value > 0.
upgradeToNewestVersion
Upgrades the implementation to the newest version listed in the beacon.
_fallback
If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.
Errors
InverterTransparentUpgradeableProxy__InvalidBeacon
The provided beacon address doesn't support the interface {IInverterBeacon_v1}.
InverterTransparentUpgradeableProxy__ProxyDeniedAdminAccess
If the proxy caller is the current admin then it can only call the admin functions.
Last updated