-
Notifications
You must be signed in to change notification settings - Fork 51
Description
🧐 Motivation
Currently, the unlockCallback function in BaseCustomAccounting separates the caller delta and fees accrued into the principal delta, which is then used to take/settle tokens. It can be more efficient if it instead uses the callerDelta for the case when the hook only takes a portion of fees accrued. Using principalDelta requires three transactions, versus two with callerDelta.
With this change, we can also calculate principal delta once in the add/removeLiquidity functions instead of twice (currently calculated both in unlockCallback and add/removeLiquidity)
📝 Details
If the hook takes a portion of fees accrued, this may affect how the tokens are taken/settled. Any modification to these deltas may need to also be reflected in add/removeLiquidity for the slippage checks which are based on the deltas returned by the pool manager.