Appearance
User flows
Pool Creation
- The Pool Operator(PO) deploys the Potentia Pool using the Potentia Factory. The PO calls the
createPool
function on the PoolFactory.sol contract which further deploys the pool usingCREATE
method. - In the same atomic transaction, the PotentiaPool.sol deploys 3 PToken.sol contracts i.e LpPtoken, LongPToken, and ShortPToken.
- Once the pool is deployed, the PO calls
initializePool
on the pool to initialise the pool with some initial liquidity.
Add Liquidity
- The Liquidity Provider(LP) calls the
addLiquidity
function on the Potentia Pool. - Potentia Pool interacts with the underlying asset's contract (denoted as underlying) by calling
safeTransferFrom
, which transfers the specified amount of the underlying asset from the LP to the pool. - Potentia Pool then mints LpPToken (representing the LP's share in the pool) by calling the
mint
function.
Remove Liquidity
- The LP calls the
removeLiquidity
function on the pool. - Pool calls the
burn
function on the LpPToken'sPToken.sol
to burn the specified LP shares. - Pool then transfers the underlying asset from the pool to the LP.
Open Position
Consider opening a Long Position.
- The trader calls the
openPosition
function on the Pool. - Pool interacts with the underlying asset's smart contract by calling the
safeTransferFrom
, that transfers the approved amount from trader to the pool. - Pool then mints the LongPToken by calling the
mint
function on the LongPToken contract.
Close Position
Consider closing a Short Position.
- The trader calls the
closePosition
function on the Pool. - Pool interacts with the ShortPToken contract by calling the
burn
function, that burns the specified amount of ShortPTokens. - Pool then transfers the underlying asset from the pool to the trader.