Skip to content

Commit

Permalink
feat: using short premia in collateral calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
guil-lambert committed Oct 6, 2023
1 parent df0b612 commit 4c96959
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions contracts/CollateralTracker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,7 @@ contract CollateralTracker is ERC20Minimal, Multicall {
// get all collateral required for the incoming list of positions
tokenRequired = _getTotalRequiredCollateral(atTick, positionBalanceArray);

// If premium is negative, increase the short premium requirement by the maintenance margin ratio
if (premiumAllPositions < 0) {
unchecked {
tokenRequired +=
Expand Down
6 changes: 2 additions & 4 deletions contracts/PanopticPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,12 @@ contract PanopticPool is ERC1155Holder, Multicall {
// cache to avoid stack to deep errors
int24 currentTick = tickStateCallContext.currentTick();

// compute accumulated premia for long options only
// this is used to compute the collateral requirement
// we only calculate long premium here as a protection buffer against minting a large number defined risk positions -eg. tiny spreads
// compute accumulated premia for all open options
// Additionally Read all position balances from the Panoptic pool
(portfolioPremium, positionBalanceArray) = _calculateAccumulatedPremia(
msg.sender,
positionIdList,
COMPUTE_LONG_PREMIA,
COMPUTE_ALL_PREMIA,
currentTick
);

Expand Down

0 comments on commit 4c96959

Please sign in to comment.