fix: Fee-income calculation model needs documentation to make delta_bps auditable (#1084)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
johba 2026-03-23 03:23:23 +00:00
parent b2715b67c0
commit caedd5c4e6
2 changed files with 165 additions and 1 deletions

View file

@ -19,7 +19,28 @@ interface IWETH {
/// @title LmTotalEth
/// @notice Read-only script: prints total ETH controlled by LiquidityManager
/// (free ETH + free WETH + ETH locked in all 3 Uni V3 positions).
/// @dev forge script script/LmTotalEth.s.sol --rpc-url $RPC_URL
///
/// @dev **What is counted:**
/// 1. Free native ETH balance of the LM contract
/// 2. Free WETH (ERC-20) balance of the LM contract
/// 3. ETH-side principal of all 3 Uniswap V3 positions (FLOOR, ANCHOR, DISCOVERY),
/// computed via LiquidityAmounts.getAmountsForLiquidity at the current sqrtPrice.
///
/// **What is NOT counted:**
/// - Uncollected trading fees accrued inside positions (these only become visible
/// after a recenter() calls pool.burn + pool.collect and rolls them into free WETH).
/// - KRK held by the LM (either as free balance or as the KRK side of positions).
/// KRK fees collected during recenter() are transferred to feeDestination and
/// excluded from this measurement entirely.
/// - KRK sent to feeDestination is also subtracted from outstandingSupply for floor
/// calculation purposes (see LiquidityManager._getOutstandingSupply).
///
/// **Implication for delta_bps:** Because uncollected fees are invisible, delta_bps
/// measured between two LmTotalEth snapshots reflects position principal changes
/// plus any fees that were materialized by a recenter() between snapshots.
/// See evidence/README.md § "Fee-Income Calculation Model" for the full formula.
///
/// forge script script/LmTotalEth.s.sol --rpc-url $RPC_URL
/// Env: LM, WETH, POOL
contract LmTotalEth is Script {
function run() external view {