> For the complete documentation index, see [llms.txt](https://pangeaswap.gitbook.io/pangeaswap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pangeaswap.gitbook.io/pangeaswap/en/developers/contracts/core-contracts/masterdeployer.md).

# MasterDeployer

{% embed url="<https://github.com/pangea-protocol/pangea-core/blob/main/contracts/deployer/MasterDeployer.sol>" %}

## Overview

![](/files/hbM95qvFBMP6H7dSppDz)

Pangea adopted the design that separates the factory that creates the pool and the deployer that distributes the pool, as suggested by the Trident. By doing so, specification changes of the pool in the future became more flexible. And furthermore, implementing a customized pool according to the requirements of other DAPPs is made possible.

For example, rebasing tokens such as Ampleforth, whose total supply changes over time, were difficult to be accommodated with the existing pool spec. However, in Pangea, which separates the deployer and the factory, custom pools for such tokens can be developed and distributed according to the request of the protocol.

## Methods

### airdropDistributor

```solidity
function airdropDistributor() external nonpayable returns (address)
```

Returns Airdrop Distributor address

### deployPool

```solidity
function deployPool(address factory, bytes deployData) external nonpayable returns (address)
```

Creates pool through factory

### getFactoryAddress

```solidity
function getFactoryAddress(address pool) external view returns (address factory)
```

Returns the address of the Factory which deployed the pool

### getPoolAddress

```solidity
function getPoolAddress(uint256 idx) external view returns (address pool)
```

Return the address of the pool by index

### pools

```solidity
function pools(address pool) external view returns (bool)
```

Returns whether the pool was deployed via a deployer

### protocolFeeTo

Returns the address receiving protocol fees from Pool

```solidity
function protocolFeeTo() external view returns (address)
```

### totalPoolsCount

```solidity
function totalPoolsCount() external view returns (uint256 total)
```

Returns the number of pools deployed from the masterDeployer

## Events

### AddToWhitelistFactory

```solidity
event AddToWhitelistFactory(address indexed factory)
```

### DeployPool

```solidity
event DeployPool(address indexed factory, address indexed pool, bytes deployData)
```

### ProtocolFeeToUpdated

```solidity
event ProtocolFeeToUpdated(address protocolFeeTo)
```

### RemoveFromWhitelistFactory

```solidity
event RemoveFromWhitelistFactory(address indexed factory)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://pangeaswap.gitbook.io/pangeaswap/en/developers/contracts/core-contracts/masterdeployer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
