# AlgebraFactory and roles

The AlgebraFactory contract is the central contract in the Algebra Integral protocol and is responsible for creating new liquidity pools and managing access to sensitive actions.

### Pool creation

With Algebra Factory, any user can create a pool for a token pair. Only one liquidity pool can exist for each token pair.

When created, the pool will have default values for a number of settings (default values can be changed in Algebra Factory).

If a plugin factory is connected to Algebra Factory, the corresponding plugin will be created and connected for the new pool.

**It is important to note** that Algebra Factory is not a direct pool creator (important for calculating addresses using `create2`). Algebra Factory creates pools using a special smart contract called AlgebraPoolDeployer.

### Access control and role mechanism

Algebra Factory uses OpenZeppelin's implementation of the role mechanism (`AccessControlEnumerable`). Because of this, Algebra Factory can be used as a role manager for various smart contracts in the protocol.

It is important to note that for most secure owner actions Algebra Factory is superuser and has access rights. For security reasons, it is recommended to use a more granular role policy for different tasks and pass the title owner of Algebra Factory to a multisig / DAO / special smart contract.

Standard roles in the Core part of the Algebra Integral protocol:

* `POOLS_ADMINISTRATOR` - the owner of this role can change parameters in pools. This includes the right to change plugins and plugin settings in the pool.
* `COMMUNITY_FEE_WITHDRAWER` - the holder of this role can retrieve accumulated communityFee from the AlgebraCommunityVault.

The `AccessControlEnumerable` mechanism allows you to create new roles and use them for protocol needs.


---

# 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.algebra.finance/algebra-integral-documentation/algebra-integral-technical-reference/core-logic/algebrafactory-and-roles.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.
