Appearance

# Potentia Pool

## 1. initializePool

solidity

```
function initializePool(uint256 _initialLiq) external payable
onlyRole(DEFAULT_ADMIN_ROLE)
```

Once a new pool is deployed, it must be initialised using `initializePool`

. This functions sets the necessary parameters in the pool and adds the initial liquidity to start the pool. No other function on the `PotentiaPool.sol`

can be called unless the pool is initialised.

#### Parameters

Name | Type | Description |
---|---|---|

`_initialLiq` | uint256 | Initial Liquidity to add to the pool |

Only the Pool Operator call call this function.

## 2. getX

solidity

`function getX() public view returns (UD x, UD p)`

This function doesn't accept any parameters. It return 2 values i.e *view* only function that can be used to get the current price of the asset.

## 3. longCondition

solidity

`function longCondition() public view returns (UD)`

This function is a *view* function that returns the long condition in the payoff curve. It's used to determine the current long payoff. This doesn't accept any parameter and returns the long condition value.

## 4. shortCondition

solidity

`function shortCondition() public view returns (UD)`

This function is a *view* function that returns the short condition in the payoff curve. It's used to determine the current short payoff. This doesn't accept any parameter and returns the short condition value.

## 5. longPayoff

solidity

`function longPayoff(UD x) public view returns (UD)`

This function is also a *view* only function that returns the current Long Payoff(

#### Parameters

Name | Type | Description |
---|---|---|

`x` | uint256 | Price of the underlying asset |

## 6. shortPayoff

solidity

`function shortPayoff(UD x) public view returns (UD)`

This *view* only function returns the current Short Payoff(

#### Parameters

Name | Type | Description |
---|---|---|

`x` | uint256 | Price of the underlying asset |

## 7. liquidity

solidity

`function liquidity(UD x) public view returns (UD)`

This *view* only function returns the counter-party liquidity of the pool.

#### Parameters

Name | Type | Description |
---|---|---|

`x` | uint256 | Price of the underlying asset |

## 8. addLiquidity

solidity

`function addLiquidity(uint256 _amount) external nonReentrant`

This is a *write* function to add liquidity to the pool. All the liquidity added using this function is considered as counter-party liquidity. It transfers the underlying to the pool, mints the *LpPToken* and transfers them to the caller.

#### Parameters

Name | Type | Description |
---|---|---|

`_amount` | uint256 | Amount of underlying to be added to the pool |

## 9. removeLiquidity

solidity

`function removeLiquidity(uint256 _shares) external nonReentrant`

This is a *write* function to remove liquidity from the pool. It transfers the *LpPtoken* to the pool. The pool burns the *LpPToken* and transfers the calculated underlying asset to the caller.

#### Parameters

Name | Type | Description |
---|---|---|

`_shares` | uint256 | Amount of LpPTokens to be burnt |

## 10. openPosition

solidity

`function openPosition(uint256 amt, bool isLong) external nonReentrant`

This is a *write* function to open a position in the pool. It transfers the underlying asset to the pool and the pool mints the calculated number of long or short Ptokens to the caller.

#### Parameters

Name | Type | Description |
---|---|---|

`amt` | uint256 | Amount of underlying to add to the pool |

`isLong` | bool | true for long position; false for short position |

## 10. closePosition

solidity

`function closePosition(uint256 shares, bool isLong) external nonReentrant`

This is a *write* function to close a position in the pool. It transfers the PTokens to the pool and the pool calculates and transfers the underlying asset back to the caller.

#### Parameters

Name | Type | Description |
---|---|---|

`shares` | uint256 | Amount of Ptoken to burn |

`isLong` | bool | true for long position; false for short position |