# BaseCore

`BaseCore.sol` contains the base logic for the proxy contracts used in the Unlockd Protocol. It provides functions for creating and managing module proxies and handling module-specific logic.

### 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).

`_trustedSenders`: A mapping that stores the trusted sender information for each proxy address, including the module ID and implementation address (only for external single-proxy modules).

### Key functions:

```solidity
function _createProxy(
    uint256 proxyModuleId
) internal returns (address)
```

Creates a new proxy contract for the specified module ID. It deploys a new instance of the `UnlockdMinimalProxy` contract and stores the proxy address in the `_proxyLookup` mapping if the module ID is within the range of external single-proxy modules. It also updates the `_trustedSenders` mapping with the module ID and implementation address for the proxy.

### Parameters:

`proxyModuleId`: The ID of the module for which to create a proxy.

### Returns:&#x20;

The address of the created proxy contract.

***

```solidity
function callInternalModule(
    uint256 moduleId,
    bytes memory input
  ) internal returns (bytes memory)
```

Performs a delegatecall to the specified module contract with the provided input data. It retrieves the module implementation address from the `_moduleLookup` mapping and delegates the call using assembly. If the call fails, it reverts with the returned error data.

### Parameters:

`moduleId`: The ID of the module to call.

`input`: The input data for the module call.

### Returns:&#x20;

The return data from the module call.
