From 3b8d801aa767b86d6d81442dd0ff2bf687269819 Mon Sep 17 00:00:00 2001 From: saucepoint <98790946+saucepoint@users.noreply.github.com> Date: Wed, 4 Dec 2024 19:55:42 -0500 Subject: [PATCH] Natspec: Inflated feeGrowthGlobal (#366) * natspec around inflated fee growth global * updated note * lint --- src/interfaces/ISubscriber.sol | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/interfaces/ISubscriber.sol b/src/interfaces/ISubscriber.sol index f2fc94df..238c88f3 100644 --- a/src/interfaces/ISubscriber.sol +++ b/src/interfaces/ISubscriber.sol @@ -6,14 +6,17 @@ import {PositionInfo} from "../libraries/PositionInfoLibrary.sol"; /// @notice Interface that a Subscriber contract should implement to receive updates from the v4 position manager interface ISubscriber { + /// @notice Called when a position subscribes to this subscriber contract /// @param tokenId the token ID of the position /// @param data additional data passed in by the caller function notifySubscribe(uint256 tokenId, bytes memory data) external; + /// @notice Called when a position unsubscribes from the subscriber /// @dev This call's gas is capped at `unsubscribeGasLimit` (set at deployment) /// @dev Because of EIP-150, solidity may only allocate 63/64 of gasleft() /// @param tokenId the token ID of the position function notifyUnsubscribe(uint256 tokenId) external; + /// @notice Called when a position is burned /// @param tokenId the token ID of the position /// @param owner the current owner of the tokenId @@ -22,8 +25,13 @@ interface ISubscriber { /// @param feesAccrued the fees accrued by the position if liquidity was decreased function notifyBurn(uint256 tokenId, address owner, PositionInfo info, uint256 liquidity, BalanceDelta feesAccrued) external; + + /// @notice Called when a position modifies its liquidity or collects fees /// @param tokenId the token ID of the position /// @param liquidityChange the change in liquidity on the underlying position /// @param feesAccrued the fees to be collected from the position as a result of the modifyLiquidity call + /// @dev Note that feesAccrued can be artificially inflated by a malicious user + /// Pools with a single liquidity position can inflate feeGrowthGlobal (and consequently feesAccrued) by donating to themselves; + /// atomically donating and collecting fees within the same unlockCallback may further inflate feeGrowthGlobal/feesAccrued function notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) external; }