# Deployment

Initial deployment of the MetaStreet v2 Pool contracts is proxied to allow for upgrades and bug fixes. However, deployment will ultimately migrate to immutable Pools, which are already supported by the codebase.

Proxied contracts are currently owned by the MetaStreet Labs multisig, but will ultimately be transferred to protocol governance.

#### Pool Factory

The [`PoolFactory`](https://github.com/metastreet-labs/metastreet-contracts-v2/blob/master/contracts/PoolFactory.sol) contract is deployed as an ERC1967 proxy, with a permissioned `upgradeToAndCall()` API to facilitate upgrades, and permissioned `addPoolImplementation()` and `removePoolImplementation()` to add and remove supported Pool implementations.

#### Pool Deployment

Proxied pools are deployed as an ERC1967 `BeaconProxy` with the [`PoolFactory`](https://github.com/metastreet-labs/metastreet-contracts-v2/blob/master/contracts/PoolFactory.sol) `createProxied()` function, which accepts a Pool implementation beacon and initialization parameters.

Immutable pools are deployed as an ERC1167 minimal clone proxy with the [`PoolFactory`](https://github.com/metastreet-labs/metastreet-contracts-v2/blob/master/contracts/PoolFactory.sol) `create()` function, which accepts a Pool implementation contract and initialization parameters.

Pools can be created permissionlessly. The admin for all Pools is the [`PoolFactory`](https://github.com/metastreet-labs/metastreet-contracts-v2/blob/master/contracts/PoolFactory.sol), which currently is only used to set the admin fee rate and withdraw admin fees. See the [Admin Fees](/technical-overview/protocol-design/admin-fees.md) section for more information on admin fees.

As the Pool contract stabilizes, deployment will ultimately switch from `createProxied()` to `create()` and use versioned Pool implementations for newly created Pools.

#### Collateral Liquidator Deployment

The [`EnglishAuctionCollateralLiquidator`](https://github.com/metastreet-labs/metastreet-contracts-v2/tree/master/contracts/liquidators) contract is deployed as an ERC1967 `BeaconProxy`. This contract can also be deployed immutably.

#### Collateral Wrapper Deployment

The [`BundleCollateralWrapper`](https://github.com/metastreet-labs/metastreet-contracts-v2/blob/master/contracts/wrappers/BundleCollateralWrapper.sol) and [`ERC1155CollateralWrapper`](https://github.com/metastreet-labs/metastreet-contracts-v2/blob/master/contracts/wrappers/ERC1155CollateralWrapper.sol) contracts are deployed as ERC1967 `TransparentUpgradeableProxy`. These contracts can also be deployed immutably.


---

# 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.metastreet.xyz/technical-overview/protocol-design/deployment.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.
