Skip to main content

InitializeGovernedUpgradeabilityProxy

InitializeGovernedUpgradeabilityProxy​

This contract combines an upgradeability proxy with our governor system. It is based on an older version of OpenZeppelins BaseUpgradeabilityProxy with Solidity ^0.8.0.

Upgraded​

event Upgraded(address implementation)

Emitted when the implementation is upgraded.

Parameters​

NameTypeDescription
implementationaddressAddress of the new implementation.

initialize​

function initialize(address _logic, address _initGovernor, bytes _data) public payable

Contract initializer with Governor enforcement

Parameters​

NameTypeDescription
_logicaddressAddress of the initial implementation.
_initGovernoraddressAddress of the initial Governor.
_databytesData to send as msg.data to the implementation to initialize the proxied contract. It should include the signature and the parameters of the function to be called, as described in https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.

admin​

function admin() external view returns (address)

Return Values​

NameTypeDescription
[0]addressThe address of the proxy admin/it's also the governor.

implementation​

function implementation() external view returns (address)

Return Values​

NameTypeDescription
[0]addressThe address of the implementation.

upgradeTo​

function upgradeTo(address newImplementation) external

Upgrade the backing implementation of the proxy. Only the admin can call this function.

Parameters​

NameTypeDescription
newImplementationaddressAddress of the new implementation.

upgradeToAndCall​

function upgradeToAndCall(address newImplementation, bytes data) external payable

Upgrade the backing implementation of the proxy and call a function on the new implementation. This is useful to initialize the proxied contract.

Parameters​

NameTypeDescription
newImplementationaddressAddress of the new implementation.
databytesData to send as msg.data in the low level call. It should include the signature and the parameters of the function to be called, as described in https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.

fallback​

fallback() external payable

Fallback function. Implemented entirely in _fallback.

_delegate​

function _delegate(address _impl) internal

Delegates execution to an implementation contract. This is a low level function that doesn't return to its internal call site. It will return to the external caller whatever the implementation returns.

Parameters​

NameTypeDescription
_impladdressAddress to delegate.

_willFallback​

function _willFallback() internal

Function that is run as the first thing in the fallback function. Can be redefined in derived contracts to add functionality. Redefinitions must call super._willFallback().

_fallback​

function _fallback() internal

fallback implementation. Extracted to enable manual triggering.

IMPLEMENTATION_SLOT​

bytes32 IMPLEMENTATION_SLOT

Storage slot with the address of the current implementation. This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is validated in the constructor.

_implementation​

function _implementation() internal view returns (address impl)

Returns the current implementation.

Return Values​

NameTypeDescription
impladdressAddress of the current implementation

_upgradeTo​

function _upgradeTo(address newImplementation) internal

Upgrades the proxy to a new implementation.

Parameters​

NameTypeDescription
newImplementationaddressAddress of the new implementation.

_setImplementation​

function _setImplementation(address newImplementation) internal

Sets the implementation address of the proxy.

Parameters​

NameTypeDescription
newImplementationaddressAddress of the new implementation.