# MarketRegistry

*Register uToken and UserManager contracts to their tokens*

### userManagers

```solidity
mapping(address => address) userManagers
```

Token address mapped to userManager

*Assumption there will only ever be one UserManager per token*

### uTokens

```solidity
mapping(address => address) uTokens
```

Token address mapped to uToken

*Assumption there will only ever be one UToken per token*

### LogAddUToken

```solidity
event LogAddUToken(address tokenAddress, address contractAddress)
```

*New UToken contract registered*

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| tokenAddress    | address | The address of the underlying token |
| contractAddress | address | The contract address                |

### LogAddUserManager

```solidity
event LogAddUserManager(address tokenAddress, address contractAddress)
```

*New UserManager contract registered*

#### Parameters

| Name            | Type    | Description                         |
| --------------- | ------- | ----------------------------------- |
| tokenAddress    | address | The address of the underlying token |
| contractAddress | address | The contract address                |

### \_\_MarketRegistry\_init

```solidity
function __MarketRegistry_init() public
```

@dev Initialization function

### hasUToken

```solidity
function hasUToken(address token) external view returns (bool)
```

### hasUserManager

```solidity
function hasUserManager(address token) external view returns (bool)
```

### setUToken

```solidity
function setUToken(address token, address uToken) external
```

*Register a new UToken contract*

#### Parameters

| Name   | Type    | Description                        |
| ------ | ------- | ---------------------------------- |
| token  | address | The underlying token e.g DAI       |
| uToken | address | the address of the uToken contract |

### setUserManager

```solidity
function setUserManager(address token, address userManager) external
```

*Register a new UToken contract*

#### Parameters

| Name        | Type    | Description                             |
| ----------- | ------- | --------------------------------------- |
| token       | address | The underlying token e.g DAI            |
| userManager | address | the address of the UserManager contract |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.union.finance/developers/core/imarketregistry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
