# Pool Addresses Provider

The PoolAddressesProvider is the central registry of addresses for Tydro. It stores the addresses of all core modules and permissioned roles within a specific market. The PoolAddressesProvider also works as the admin of proxy contracts and can update their implementations when needed. For example:

* Updating the address of the [ACLManager](/developers/smart-contracts/aclmanager.md)
* Updating the implementation of the [Pool](/developers/smart-contracts/pool.md)

This contract defines the initial holder of the  [DEFAULT\_ADMIN\_ROLE](/developers/smart-contracts/aclmanager.md#acl_admin), which is immutable once set.

When interacting with the Pool, it is recommended to always fetch the address directly from the PoolAddressesProvider to ensure the correct implementation is used.

The source code is available on Aave's [<mark style="color:blue;">GitHub</mark>](https://github.com/aave-dao/aave-v3-origin/blob/main/src/contracts/protocol/configuration/PoolAddressesProvider.sol).

### Write Methods

#### setMarketId

```
function setMarketId(string memory newMarketId) external override onlyOwner
```

Updates the identifier of the Aave market by associating an id with a specific PoolAddressesProvider. This can be used to create an on-chain registry of pool addresses providers to identify and validate multiple Aave markets.

**Input Parameters:**

| Name        | Type   | Description              |
| ----------- | ------ | ------------------------ |
| newMarketId | string | The new id of the market |

#### setAddress

```
function setAddress(bytes32 id, address newAddress) external override onlyOwner
```

Sets the address of the protocol contract stored at the given id, replacing the address saved in the addresses map.

For example, utils.keccak256(utils.toUtf8Bytes("INCENTIVES\_CONTROLLER")), is set to the address of INCENTIVES\_CONTROLLER.

Use this function carefully, as it will do a hard replacement of the current address in the addresses map.

**Input Parameters:**

| Name       | Type    | Description                                              |
| ---------- | ------- | -------------------------------------------------------- |
| id         | bytes32 | keccak256 hash of UTF8Bytes string representing contract |
| newAddress | address | The new address to be set corresponding to the id        |

#### setAddressAsProxy

```
function setAddressAsProxy(bytes32 id, address newImplementationAddress) external override onlyOwner
```

Updates the implementation address of a proxy contract with a specified id.

If there is no proxy registered, it will instantiate one and set the implementation as the newImplementationAddress.

Use this function carefully, only for ids that do not have an explicit setter function in order to avoid unexpected consequences.

**Input Parameters:**

| Name                     | Type    | Description                                                           |
| ------------------------ | ------- | --------------------------------------------------------------------- |
| id                       | bytes32 | The id of the proxy contract                                          |
| newImplementationAddress | address | The address of new implementation contract corresponding to the proxy |

#### setPoolImpl

```
function setPoolImpl(address newPoolImpl) external override onlyOwner
```

Updates the implementation of the [Pool](/developers/smart-contracts/pool.md) contract, or creates a proxy.

**Input Parameters:**

| Name        | Type    | Description                                     |
| ----------- | ------- | ----------------------------------------------- |
| newPoolImpl | address | The address of new Pool implementation contract |

#### setPoolConfiguratorImpl

```
function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external override onlyOwner
```

Updates the implementation of the [PoolConfigurator](/developers/smart-contracts/pool-configurator.md) contract, or creates a proxy.

**Input Parameters:**

| Name                    | Type    | Description                                                 |
| ----------------------- | ------- | ----------------------------------------------------------- |
| newPoolConfiguratorImpl | address | The address of new PoolConfigurator implementation contract |

#### setPriceOracle

```
function setPriceOracle(address newPriceOracle) external override onlyOwner
```

Updates the address of the price oracle.

**Input Parameters:**

| Name           | Type    | Description                     |
| -------------- | ------- | ------------------------------- |
| newPriceOracle | address | The address of new price oracle |

#### setACLManager

```
function setACLManager(address newAclManager) external override onlyOwner
```

Updates the address of the Access Control List Manager.

**Input Parameters:**

| Name          | Type    | Description                       |
| ------------- | ------- | --------------------------------- |
| newAclManager | address | The address of the new ACLManager |

#### setACLAdmin

```
function setACLAdmin(address newAclAdmin) external override onlyOwner
```

Updates the address of the Access Control List Admin.

**Input Parameters:**

| Name        | Type    | Description                 |
| ----------- | ------- | --------------------------- |
| newAclAdmin | address | The address of new ACLAdmin |

#### setPriceOracleSentinel

```
function setPriceOracleSentinel(address newPriceOracleSentinel) external override onlyOwner
```

Updates the address of the price oracle sentinel.

**Input Parameters:**

| Name                   | Type    | Description                            |
| ---------------------- | ------- | -------------------------------------- |
| newPriceOracleSentinel | address | The address of new PriceOracleSentinel |

#### setPoolDataProvider

```
function setPoolDataProvider(address newDataProvider) external override onlyOwner
```

Updates the address of the data provider.

**Input Parameters:**

| Name            | Type    | Description                     |
| --------------- | ------- | ------------------------------- |
| newDataProvider | address | The address of new DataProvider |

### View Methods

#### getMarketId

```
function getMarketId() external view override returns (string memory)
```

Returns the market id of the associated Tydro market.

**Return Values:**

| Type   | Description                              |
| ------ | ---------------------------------------- |
| string | A string representation of the market id |

#### getAddress

```
function getAddress(bytes32 id) public view override returns (address)
```

Returns the address of protocol contract stored at the given id. The returned address might be an EOA or a contract, which may be proxied. It will return ZERO if there is no registered address with the given id.

**Input Parameters:**

| Name | Type    | Description                                                 |
| ---- | ------- | ----------------------------------------------------------- |
| id   | bytes32 | The id. For example, the Protocol Data Provider uses id 0x1 |

**Return Values:**

| Type    | Description                               |
| ------- | ----------------------------------------- |
| address | The address associated with the id passed |

**Example:**

```
// Get address of incentive controllerimport { utils } from "@ethers/lib/utils";
const id = utils.keccak256(utils.toUtf8Bytes("INCENTIVES_CONTROLLER"));const address = poolAddressProvider.getAddress(id);
```

#### getPool

```
function getPool() external view override returns (address)
```

Returns the address of the latest Pool proxy contract.

**Return Values:**

| Type    | Description                              |
| ------- | ---------------------------------------- |
| address | The address of the associated Pool proxy |

#### getPoolConfigurator

```
function getPoolConfigurator() external view override returns (address)
```

Returns the address of the PoolConfigurator proxy. Used for configuration methods, like init reserves or update token implementation etc, of the market.

**Return Values:**

| Type    | Description                        |
| ------- | ---------------------------------- |
| address | The PoolConfigurator proxy address |

#### getPriceOracle

```
function getPriceOracle() external view override returns (address)
```

Returns the address of the Price Oracle used by the market.

**Return Values:**

| Type    | Description                                                   |
| ------- | ------------------------------------------------------------- |
| address | The address of the price oracle used by the associated market |

#### getACLManager

```
function getACLManager() external view override returns (address)
```

Returns the address of the Access Control List Manager (ACLManager) that manages the system role of the market.

**Return Values:**

| Type    | Description                                                                             |
| ------- | --------------------------------------------------------------------------------------- |
| address | The address of the ACLManger contract managing the system role of the associated market |

#### getACLAdmin

```
function getACLAdmin() external view override returns (address)
```

Returns the address of the Access Control List Admin (ACLAdmin) of the market which holds the DEFAULT\_ADMIN\_ROLE in ACLManager.

**Return Values:**

| Type    | Description                                                           |
| ------- | --------------------------------------------------------------------- |
| address | The address of the Access Control List admin of the associated market |

#### getPriceOracleSentinel

```
function getPriceOracleSentinel() external view override returns (address)
```

Returns the address of the price oracle sentinel.

**Return Values:**

<table data-header-hidden><thead><tr><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td>Type</td><td>Description</td><td></td></tr><tr><td>address</td><td>The address of the PriceOracleSentinel of the associated market</td><td></td></tr></tbody></table>

#### getPoolDataProvider

```
function getPoolDataProvider() external view override returns (address)
```

Returns the address of latest pool data provider.

**Return Values:**

| Type    | Description                                                    |
| ------- | -------------------------------------------------------------- |
| address | The address of the pool data provider of the associated market |


---

# 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.tydro.com/developers/smart-contracts/pool-addresses-provider.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.
