harb/onchain/test/helpers
openhands 2c21462e1e fix: LM: accrue fees as liquidity when feeDestination is self (#533)
When feeDestination == address(this), _scrapePositions() now skips the
fee safeTransfer calls so collected WETH/KRK stays in the LM balance
and is redeployed as liquidity on the next _setPositions() call.

Also fixes _getOutstandingSupply(): kraiken.outstandingSupply() already
subtracts balanceOf(liquidityManager), so when feeDestination IS the LM
the old code double-subtracted LM-held KRK, causing an arithmetic
underflow once positions were scraped.  The subtraction is now skipped
for the self-referencing case.

VWAP recording is refactored to a single unconditional block so it fires
regardless of fee destination.

New test testSelfFeeDestination_FeesAccrueAsLiquidity() demonstrates
that a two-recenter cycle with self-feeDestination completes without
underflow and without leaking WETH to any external address.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 10:11:41 +00:00
..
LiquidityBoundaryHelper.sol Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks (#51) 2025-10-04 15:17:09 +02:00
TestBase.sol fix: LM: accrue fees as liquidity when feeDestination is self (#533) 2026-03-10 10:11:41 +00:00
UniswapTestBase.sol Add Solidity linting with solhint, Foundry formatter, and pre-commit hooks (#51) 2025-10-04 15:17:09 +02:00