ozUpgradeableBeacon

It's the beacon (aka pivot point) that holds the implementation and storage of the subsystem that all Accounts read from.

Whenever an Account is called, this contract gets called for the implementation to use and the storage to query. Other contracts call it as well for reading storage.

It inherits Open Zeppelin's UpgradeableBeacon contract.

A custom-made strategy has been added to upgrade the storage of the subsystem by containing an array of storage contracts which can be queried in any contract using their index within the array.

The diagram from below shows how the upgrade of StorageBeacon and future readings would work in practice if new implementations would come into play:

Diagram

Upgrading StorageBeacon

It also inherits Solmate's RolesAuthority to act as access control on saveUserToDetails() and saveTaskId() from the StorageBeacon contract, so they can be called only by ozERC1967Proxy.

Github repo here.

Open methods

canCall

function canCall( 
        address user_,
        address target_,
        bytes4 functionSig_
) external view returns(bool);

Used to determine if the Authority contract allows an user to call a restricted function.

Parameters:

Name
Type
Description

user_

address

Entity on which to query permission

target_

address

Contract where the restricted function is

functionSig_

bytes4

Selector of restricted function

Return values:

Type
Description

boolean

If user_ is allowed to call functionSig_ on target_

storageBeacon

function storageBeacon(uint version_) external view returns(address);

Queries a version of a StorageBeacon contract.

Parameters:

Name
Type
Description

version_

uint256

Index of the storage contract to get

Return values:

Type
Description

address

Version of StorageBeacon contract

Owner methods

setAuth

function setAuth(address auth_) external onlyOwner;

Sets up a new contract as the authority to decide the entity that can call saveUserToDetails() and saveTaskId() from StorageBeacon, but more access control can be applied.

Parameters:

Name
Type
Description

auth_

address

New Authority contract

upgradeStorageBeacon

function upgradeStorageBeacon(address newStorageBeacon_) external onlyOwner;

Upgrades the storage by adding a new StorageBeacon to the array of storage contracts.

Parameters:

Name
Type
Description

newStorageBeacon_

address

New StorageBeacon contract to add

Last updated