-
Notifications
You must be signed in to change notification settings - Fork 45
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
BAL Hookathon -SafeSwap Hook #91
base: main
Are you sure you want to change the base?
Conversation
@harpreettrader is attempting to deploy a commit to the Matt Pereira's projects Team on Vercel. A member of the Team first needs to authorize it. |
SwapDiscountHookOverviewThe Features
PrerequisitesBefore getting started, ensure you have the following installed: Installation
DeploymentTo deploy the
TestingTo ensure the contract works as intended, comprehensive tests are included. To run the tests, use the following command: forge test This will execute all the test cases, verifying the functionality of the UsageOnce deployed, the
Refer to the Balancer V3 documentation for additional information on integrating hooks with pools. LicenseThis project is licensed under the GPL-3.0 License. Acknowledgements
|
Interesting use case. Code/tests look pretty clean. I'll leave it for our solidity devs to do a detailed review there. Just a few comments about this hook in the wild. There is a way to potentially exploit the intent of the system. If it is possible to buy and sell the discount token on-chain for less of a fee then the available discount, this is how a lot of trading would occur. A user of this hook could solve this to some degree by setting up primary liquidty for the discount token with a high enough swap fee to make this not profitable. Another option would be to require tokens be locked into some kind of a locker and ensuring that the token is there. It seems like even a few blocks, or 15 minutes would help. None of these are suggestions for changing the hook itself. There's many examples of locker contracts that one could use to lock tokens for some time and present the locked balance outward via an ERC20 interface, and the economics around costs to trade a discount token needed atomically for a discount is an interesting thought-space in and of itself. Nice work. |
Just a couple ideas/some feedback about how you could make this hook more useful in the wild. 1: Allow more versatile fees. 2: Discount on a liquid token is easy to cheat. |
No description provided.