Skip to main content

UcuProxy

UcuProxy

_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

_ADMIN_SLOT

bytes32 _ADMIN_SLOT

_REPOSITORY_SLOT

bytes32 _REPOSITORY_SLOT

constructor

constructor(contract IImplementationRepository _repository, address _owner, uint256 _lineageId) public

Instantiate a proxy pointing to the current implementation in _repository of lineage _lineageId.

Reverts if either _repository or _owner is null Double check your lineageId because it can't be changed. In most cases you'll want the repository's currentLineageId

Parameters

NameTypeDescription
_repositorycontract IImplementationRepositoryrepository used for sourcing upgrades
_owneraddressowner of proxy
_lineageIduint256id of the lineage whose current implementation to set as the proxy's implementation.

upgradeImplementation

function upgradeImplementation() external

upgrade the proxy implementation

reverts if the repository has not been initialized or if there is no following version

transferOwnership

function transferOwnership(address newOwner) external

Set the address of the new owner of the contract

Set _newOwner to address(0) to renounce any ownership.

Parameters

NameTypeDescription
newOwneraddress

owner

function owner() external view returns (address)

Get the address of the owner

Return Values

NameTypeDescription
[0]addressThe address of the owner.

getRepository

function getRepository() external view returns (contract IImplementationRepository)

Returns the associated {Repo} contract used for fetching implementations to upgrade to

_upgradeImplementation

function _upgradeImplementation() internal

_implementation

function _implementation() internal view returns (address impl)

Returns the current implementation address.

_upgradeToAndCall

function _upgradeToAndCall(address newImplementation, bytes data) internal virtual

Emits an {Upgraded} event.

_setImplementationAndCall

function _setImplementationAndCall(address newImplementation, bytes data) internal

Stores a new address in the EIP1967 implementation slot.

_setRepository

function _setRepository(contract IImplementationRepository newRepository) internal

_getRepository

function _getRepository() internal view returns (contract IImplementationRepository repo)

_getOwner

function _getOwner() internal view returns (address adminAddress)

_setOwner

function _setOwner(address newOwner) internal

onlyOwner

modifier onlyOwner()

Upgraded

event Upgraded(address implementation)

Emitted when the implementation is upgraded.