Skip to content

Commit 3b8d801

Browse files
authored
Natspec: Inflated feeGrowthGlobal (#366)
* natspec around inflated fee growth global * updated note * lint
1 parent b8dcc0a commit 3b8d801

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/interfaces/ISubscriber.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import {PositionInfo} from "../libraries/PositionInfoLibrary.sol";
66

77
/// @notice Interface that a Subscriber contract should implement to receive updates from the v4 position manager
88
interface ISubscriber {
9+
/// @notice Called when a position subscribes to this subscriber contract
910
/// @param tokenId the token ID of the position
1011
/// @param data additional data passed in by the caller
1112
function notifySubscribe(uint256 tokenId, bytes memory data) external;
13+
1214
/// @notice Called when a position unsubscribes from the subscriber
1315
/// @dev This call's gas is capped at `unsubscribeGasLimit` (set at deployment)
1416
/// @dev Because of EIP-150, solidity may only allocate 63/64 of gasleft()
1517
/// @param tokenId the token ID of the position
1618
function notifyUnsubscribe(uint256 tokenId) external;
19+
1720
/// @notice Called when a position is burned
1821
/// @param tokenId the token ID of the position
1922
/// @param owner the current owner of the tokenId
@@ -22,8 +25,13 @@ interface ISubscriber {
2225
/// @param feesAccrued the fees accrued by the position if liquidity was decreased
2326
function notifyBurn(uint256 tokenId, address owner, PositionInfo info, uint256 liquidity, BalanceDelta feesAccrued)
2427
external;
28+
29+
/// @notice Called when a position modifies its liquidity or collects fees
2530
/// @param tokenId the token ID of the position
2631
/// @param liquidityChange the change in liquidity on the underlying position
2732
/// @param feesAccrued the fees to be collected from the position as a result of the modifyLiquidity call
33+
/// @dev Note that feesAccrued can be artificially inflated by a malicious user
34+
/// Pools with a single liquidity position can inflate feeGrowthGlobal (and consequently feesAccrued) by donating to themselves;
35+
/// atomically donating and collecting fees within the same unlockCallback may further inflate feeGrowthGlobal/feesAccrued
2836
function notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) external;
2937
}

0 commit comments

Comments
 (0)