-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix/controller swap fees #80
Conversation
src/DFMM.sol
Outdated
uint256 fees = | ||
state.deltaLiquidity.mulWadDown(_pools[poolId].controllerFee); |
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.
Let's use mulWadUp, which will only make fees == 0 when deltaLiquidity == 0, then we can just try to avoid deltaLiquidity == 0 in the other parts of the code to avoid the fees == 0 code branch
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.
Also, should we be checking if controllerFee > 0 in the if?
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.
Maybe there's a case where you want to burn liquidity (dumb idea ik), in which case you might want non-zero controllerFee but feeCollector == address(0)?
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.
Maybe there's a case where you want to burn liquidity (dumb idea ik), in which case you might want non-zero controllerFee but feeCollector == address(0)?
Yeah, I think it makes sense to check the controller fee in the if condition instead of the address.
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.
If we want to prevent swap from burning liquidity we can still reintroduce the address check later.
Cf https://github.com/cantinasec/review-primitive-excalibur/pull/1#discussion_r1528840907