From 98675c7b024a369ce113f7c75bebae02102f422b Mon Sep 17 00:00:00 2001 From: roigecode Date: Tue, 17 Sep 2024 08:54:08 +0200 Subject: [PATCH] poc: modifyHedgePosition --- src/Hedge/hedge-manager.sol | 6 ++++-- src/Hook/univ4-risk-neutral-hook.sol | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Hedge/hedge-manager.sol b/src/Hedge/hedge-manager.sol index 4a01c16..3a29ccc 100644 --- a/src/Hedge/hedge-manager.sol +++ b/src/Hedge/hedge-manager.sol @@ -1,10 +1,12 @@ pragma solidity ^0.8.19; contract HedgeManager { - function modifyHedgePosition(uint256 priceMovement) external onlyOwner{ + function modifyHedgePosition(uint256 deltaDifference, uint256 gammaDifference) external onlyOwner{ // Detect from mapping if LP is delta-gamma hedge with a power-perp or future / borrowing // Change accordingly to price movement and rebalance threshold if only delta-neutral - + // 1. conditional statement to check if LP is delta-gamma hedge or only delta + // 2. if LP is delta hedged, check rebalance threshold, if exceeded, rebalance accordingly --> futures / borrowing + // 3. if LP is delta-gamma hedged, ensure both are within expected boundaries --> power perps } } \ No newline at end of file diff --git a/src/Hook/univ4-risk-neutral-hook.sol b/src/Hook/univ4-risk-neutral-hook.sol index f36734a..05f31ad 100644 --- a/src/Hook/univ4-risk-neutral-hook.sol +++ b/src/Hook/univ4-risk-neutral-hook.sol @@ -108,6 +108,8 @@ contract univ4riskneutralhook is BaseHook, Ownable { bool isBorrowing; } + mapping(address => (mapping LpHedge => LpGreeks)) public hedgeMap; + // Hedge Manager HedgeManager hedgeManager; @@ -329,7 +331,7 @@ contract univ4riskneutralhook is BaseHook, Ownable { // updateLpGreeks(); // Re-hedge positions accordingly - // hedgeManager.modifyHedgePosition(); + // hedgeManager.modifyHedgePosition(uint256 deltaDifference, uint256 gammaDifference); // Update the gas price moving average with the gas price of this swap updateMovingAverage();