diff --git a/src/interfaces/IPoolManager.sol b/src/interfaces/IPoolManager.sol index 88c200a41..85703ef79 100644 --- a/src/interfaces/IPoolManager.sol +++ b/src/interfaces/IPoolManager.sol @@ -136,6 +136,9 @@ interface IPoolManager is IProtocolFees, IERC6909Claims, IExtsload, IExttload { /// @param hookData The data to pass through to the add/removeLiquidity hooks /// @return callerDelta The balance delta of the caller of modifyLiquidity. This is the total of both principal, fee deltas, and hook deltas if applicable /// @return feesAccrued The balance delta of the fees generated in the liquidity range. Returned for informational purposes + /// @dev Note that feesAccrued can be artificially inflated by a malicious actor and integrators should be careful using the value + /// For pools with a single liquidity position, actors can donate to themselves to inflate feeGrowthGlobal (and consequently feesAccrued) + /// atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme function modifyLiquidity(PoolKey memory key, ModifyLiquidityParams memory params, bytes calldata hookData) external returns (BalanceDelta callerDelta, BalanceDelta feesAccrued); diff --git a/src/libraries/Pool.sol b/src/libraries/Pool.sol index 1dfb56cc9..65a77a203 100644 --- a/src/libraries/Pool.sol +++ b/src/libraries/Pool.sol @@ -76,7 +76,10 @@ library Pool { uint256 feeGrowthOutside1X128; } - /// @dev The state of a pool + /// @notice The state of a pool + /// @dev Note that feeGrowthGlobal can be artificially inflated + /// For pools with a single liquidity position, actors can donate to themselves to freely inflate feeGrowthGlobal + /// atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme struct State { Slot0 slot0; uint256 feeGrowthGlobal0X128; diff --git a/src/libraries/StateLibrary.sol b/src/libraries/StateLibrary.sol index 52cf3b0b9..a8cd62137 100644 --- a/src/libraries/StateLibrary.sol +++ b/src/libraries/StateLibrary.sol @@ -150,6 +150,9 @@ library StateLibrary { * @param poolId The ID of the pool. * @return feeGrowthGlobal0 The global fee growth for token0. * @return feeGrowthGlobal1 The global fee growth for token1. + * @dev Note that feeGrowthGlobal can be artificially inflated + * For pools with a single liquidity position, actors can donate to themselves to freely inflate feeGrowthGlobal + * atomically donating and collecting fees in the same unlockCallback may make the inflated value more extreme */ function getFeeGrowthGlobals(IPoolManager manager, PoolId poolId) internal