Skip to content

Commit 175f205

Browse files
committed
LimitOrderHook: L-04 correct the principal rounding comment
`_principalOwed` claimed a payout is independent of the order in which the owners withdraw. A payout truncates and its remainder rolls forward to the owners still in the order, so the last owner out carries it.
1 parent 2ae32be commit 175f205

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/general/LimitOrderHook.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,8 @@ abstract contract LimitOrderHook is BaseHook, IUnlockCallback {
728728

729729
/**
730730
* @dev Returns `liquidity`'s share of the principal credited to `orderInfo`, which is what a withdrawal
731-
* of that liquidity pays out. The principal is credited once by the fill and never grows, so splitting it
732-
* pro-rata while the total liquidity decreases alongside it is exact and independent of the order in
733-
* which the owners withdraw.
731+
* of that liquidity pays out. Each payout truncates and its remainder rolls forward to the owners still
732+
* in the order, so the principal is paid out exactly and the last owner out carries every remainder.
734733
*/
735734
function _principalOwed(OrderInfo storage orderInfo, uint128 liquidity)
736735
private

0 commit comments

Comments
 (0)