The FinalProxy contract is a proxy that can be upgraded to a final implementation that uses less gas than regular proxy calls. It inherits from the Proxy contract and implements the IFinalProxy interface.
bytes32 FINAL_IMPLEMENTATION_SALT
constructor(address implementationAddress, address owner, bytes setupParams) public
Constructs a FinalProxy contract with a given implementation address, owner, and setup parameters.
Name | Type | Description |
---|---|---|
implementationAddress | address | The address of the implementation contract |
owner | address | The owner of the proxy contract |
setupParams | bytes | Parameters to setup the implementation contract |
function implementation() public view returns (address implementation_)
The final implementation address takes less gas to compute than reading an address from storage. That makes FinalProxy more efficient when making delegatecalls to the implementation (assuming it is the final implementation).
Name | Type | Description |
---|---|---|
implementation_ | address | The address of the final implementation if it exists, otherwise the current implementation |
function isFinal() external view returns (bool)
Checks if the final implementation has been deployed.
Name | Type | Description |
---|---|---|
[0] | bool | bool True if the final implementation exists, false otherwise |
function _finalImplementation() internal view virtual returns (address implementation_)
Computes the final implementation address.
Name | Type | Description |
---|---|---|
implementation_ | address | The address of the final implementation, or the zero address if the final implementation has not yet been deployed |
function finalUpgrade(bytes bytecode, bytes setupParams) external returns (address finalImplementation_)
Upgrades the proxy to a final implementation.
Name | Type | Description |
---|---|---|
bytecode | bytes | The bytecode of the final implementation contract |
setupParams | bytes | The parameters to setup the final implementation contract |
Name | Type | Description |
---|---|---|
finalImplementation_ | address | The address of the final implementation contract |