Unlockd

Unlockd.sol is the main entry point for the Unlockd Protocol. It serves as a proxy dispatcher, routing calls to the appropriate module contracts based on the provided module ID.

Key variables:

_moduleLookup: A mapping that stores the implementation address for each module ID.

_proxyLookup: A mapping that stores the proxy address for each module ID (only for single-proxy modules).

Key functions:

_constructor(address aclManager, address installerModule)

Initializes the contract with the ACL manager and installer module addresses. It also sets up the initial module and proxy lookups.

Parameters:

aclManager: The address of the ACL manager contract.

installerModule: The address of the installer module contract.


function moduleIdToImplementation(
    uint256 moduleId
) external view returns (address)

Returns the implementation address for a given module ID.

Parameters:

moduleId: The ID of the module.

Returns:

The implementation address of the module.


function moduleIdToProxy(
    uint256 moduleId
) external view returns (address)

Returns the proxy address for a given module ID.

Parameters:

moduleId: The ID of the module.

Returns:

The proxy address of the module.


function dispatch() external reentrantOK

It dispatches the incoming call to the corresponding module contract based on the caller's trusted module ID and implementation address. It uses assembly to extract the module ID and implementation address from the caller's storage slot and delegate the call to the appropriate module contract.

Last updated