Skip to main content

Collateral

How Panoptic calculates collateral requirements

Collateral tracking

Panoptic uses a collateral tracking system that is similar to TradFi margin accounts. While users can borrow and effectively control funds several times larger than their deposited collateral, they cannot withdraw those funds from the Panoptic-Uniswap ecosystem. All funds are always owned by the Panoptic protocol, but users will 1) collect any fees generated by selling an option and 2) receive any gains in capital that result from buying an option that becomes in-the-money.

Depositing collateral

Users that interact with the Panoptic protocol for the first time will have to deposit collateral before they are able to trade an option. This is done by calling the deposit(uint128 assets, address token) function in PanopticPool.sol.

The PanopticPool smart contract will issue a receipt token (similar to Aave's aToken or Compound's cToken) which uses a shares model to track yield distribution. The amount of shares received after depositing uint128 assets is computed using the convertToShares(uint128 assets) function from ReceiptBase.sol:

uint256 shares =
(uint256(assets) * totalSupply()) / totalBalance();

where totalSupply() returns the total amount of receipt token issued and totalBalance() returns the amount of token available to withdraw

uint256 totalBalance() =
underlyingToken.balanceOf(panopticPool) - // total amount in the PanopticPool
lockedFunds() + // amount of collected fees (protected)
inAMM(); // amount moved from PanopticPool to UniswapV3Pool (available)

Here, the accumulator lockedFunds() tracks the amount of fees that have been collected up to that point. This amount does not count towards totalBalance() because it is reserved to pay the option sellers' premia.

The accumulator inAMM() tracks the amount of token that has been moved from the PanopticPool to the UniswapV3Pool. This amount does count towards totalBalance() because it has not left the Panoptic-Uniswap ecosystem.

Withdrawing collateral

When a user wants to withdraw their tokens out of the Panoptic pool, they have to call withdraw(uint256 shares, address token, uint256[] calldata positionIdList). Accumulated yields from the deposited collateral will be transferred pro-rata to the user according to the shares model, where:

uint128 assets =
(shares * totalBalance()) / totalSupply();

where totalBalance() and totalSupply() are computed as described in the Deposit section.

The third argument of the withdraw() function, positionIdList, must be the list of all positions held by msg.sender. The positionIdList will be used to compute the collateral requirement for the account, and will fail if the position will be margin called or underwater (i.e. collateralRequired / collateralBalance < 1).

Cross-collateralization

In Panoptic, every user must deposit collateral in the PanopticPool before they can mint long or short options. Panoptic Liquidity Providers (PLPs) can simply deposit their collateral like they would do in a lending protocol, and in return will collect yield each time a user mints an option.

Single-collateral

Let's consider Alice and Bob, two traders who chose to deposit a single type of collateral. Alice deposits 4500 DAI as collateral, and Bob deposits 3 ETH. If the price of ETH is 1500 DAI, then Alice and Bob would have the same buying power — about 4500 DAI to sell puts and 3 ETH to sell calls.

The maximum loss for Alice when selling puts would be 4500 DAI, which would happen if the price of ETH goes to 0. On the other hand, the maximum loss if she chooses to sell naked calls could potentially be infinite: the max loss is unbounded and continues to linearly increase as the price goes to \infty.

Similarly, the maximum loss for Bob when selling calls is 3 ETH (if the price of ETH goes to \infty) and could potentially be infinite (in terms of ETH) if he chooses to sell naked puts (which happens if the price of ETH goes to 0).

Cross-collateral

Since losses could potentially be infinite, we recommend that users deposit both types of collateral when trading puts and calls simultaneously. For example, let's consider what happens if Charlie deposits 1500 DAI and 2 ETH into the ETH-DAI Panoptic Pool when the price of ETH is 1500 DAI. Their buying power is 4500 DAI on the put side and is 3 ETH on the call side, which is the same as Alice's and Bob's from the example above.

The maximum loss for Charlie, however, will be constrained by the amount of collateral deposited. Charlie's max loss for selling naked calls will be partially covered by his 2 ETH of collateral, and the max loss will increase more slowly than Alice's Similarly, Charlie's max loss for selling puts will also be partially covered by his 1500 DAI of collateral. In that case, Charlie's max loss will increase more slowly than Bob's.

However, in all these scenarios, any change in price or accumulation of long premium could make Alice's, Bob's, or Charlie's account insolvent, leading their account to be liquidated.