Skip to content

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

NameTypeDescription
_initialLiquint256Initial 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 x, the normalised price of the underlying asset and p exchange rate of the asset in USDC. It's a 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(Φ) of the pool.

Parameters

NameTypeDescription
xuint256Price of the underlying asset

6. shortPayoff

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

This view only function returns the current Short Payoff(Ψ) of the pool.

Parameters

NameTypeDescription
xuint256Price 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

NameTypeDescription
xuint256Price 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

NameTypeDescription
_amountuint256Amount 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

NameTypeDescription
_sharesuint256Amount 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

NameTypeDescription
amtuint256Amount of underlying to add to the pool
isLongbooltrue 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

NameTypeDescription
sharesuint256Amount of Ptoken to burn
isLongbooltrue for long position; false for short position