-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Provide feesAccrued to afterLiquidity Hooks #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
test/CustomAccounting.t.sol
Outdated
// Assert that the hook took the fee revenue | ||
assertApproxEqAbs(hookGain0, feeRevenue0, 1 wei); | ||
assertApproxEqAbs(hookGain1, feeRevenue1, 1 wei); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it irks me that addLiquidity assertions arent as robust as the removeLiquidity ones, however this test is to confirm that feesAccrued
is properly passed & used by the hook, so this is OK to me
the assertions for addLiquidity were tricky because of autocompounding + wei imprecision
Forge code coverage:
|
292858 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow this snapshot name is ocnfusing... not your fault but what is "create"?? add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like its the first cold write of modifyLiquidity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one tiny nit
src/interfaces/IHooks.sol
Outdated
@@ -84,7 +86,8 @@ interface IHooks { | |||
/// @param sender The initial msg.sender for the remove liquidity call | |||
/// @param key The key for the pool | |||
/// @param params The parameters for removing liquidity | |||
/// @param delta The caller's balance delta after removing liquidity | |||
/// @param delta The caller's balance delta after removing liquidity; the sum of principal delta and fees accrued |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
principal delta, fees accrued, and hook delta
Related Issue
Closes #587
Description of changes
after{Add|Remove}Liquidity hooks now receive
feesAccrued
alongsidecallerDelta
, wherecallerDelta = principal + feesAccrued
Added a test hook where all feesAccrued is taken, to validate the data is provided correctly