-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat(hook-store): Add cow amm deposit hook dapp #5069
Conversation
@yvesfracari is attempting to deploy a commit to the cow Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hey @yvesfracari , great job, thank you!
But this is maybe there is not enough test instructions, or not enough balance to cover increased fees. Not sure what caused all these, just speculating on observations. |
Thanks for the review @elena-zh 1- Done |
Hey @yvesfracari , thank you. I've verified Done fixes, they are mostly look good. In addition, there are a few new issues to report:
Thanks |
Thanks for the testing! Both unsolved old issues should be solved now. About the latest issues:
|
Hey @yvesfracari , the app in the preview link is barely working in terms of performance. I've reporded a video for you, however, not sure what causes this as there are no 'special' logs on console for this. |
Hey @yvesfracari , I've retested these changes inside the #5082 PR. Some issues that I'm still facing:
Thanks! |
Thanks @elena-zh !
|
Hey @yvesfracari , thanks for addressing issues. Still, I have something to report you back :)
Not sure about a possible solution here:
|
Thanks for the review @elena-zh Issues 1,3: were fixed with your suggestion Issue 2: Not sure, but I think that is not related with this PR cc @shoom3301 maybe you can take a look Issue 4: This issue is harder to resolve because it is hard to know how many fees will be charged. We know that this issue has this issue but I think that we can just solve it on a second version of the store where a more dynamic kind of hook would be allowed (like encoding of the hook on the order review). To work around this, I disabled the Issue 5: I tried to implement this way but thought that the mobile view on small screens was kind of bad. Instead, I am aligning all this information on the right side. IMO this is the same way we did on the withdraw hook and we can use the same pattern here. Issue 6: Fixed, now you will be able to see the pool. The pool selector will always show the pools that have the token buy and the current selected pool. |
Hey @yvesfracari , great, thank you for your fixes! Just some comments:
Thanks! |
1-4 - Solved I rethink this case and in my perspective the "user input", "all from swap" and "all after swap" options are just helpers to allow the user to set the amounts and actually the usage of the "all after the swap" was the same of the "MAX" button. In that sense, I just add a "Buy amount" button as well. With that I think that the experience is better and more clear for the user. |
Hey @yvesfracari , thank you!
Thank you! |
1,3- Fixed 2- Now while the tooltip icon is being pressed the message should be displayed. I think that this is the default behavior right? 4- I think that this should be done on a separate PR since it would impact multiple hooks. Also, I think that this is something that if 5 is fixed it will not be necessary anymore. 5- It makes sense and this is exactly my view on how to solve it. However, this dynamic approach is outside our grant scope and so it is outside the scope of this PR. However, I agree that it is important and a must-have for the next grant that we want to propose. |
Hey @yvesfracari , thanks!
Opened #5129 task for this
Opened #5132 task for this (for the future development)
Not exactly. It works a bit differently in a mobile device: it is opened on click and remains to be displayed until a user taps outside/scroll up/down the screen. IMG_7572.MP4And I have not been able to add liquidity hook on Ethereum:
Could you please check it? |
@elena-zh Both two new reported issue should be fixed now |
Hey @yvesfracari , great job, thank you! I've been able to place order with this hook on every chain, and it works! Still, I have some nitpicks and concerns:
One more example: |
Thanks @elena-zh 1,2 were solved. 3 - I implemented this as well. Think that is a good option. 4 - I am not sure if there is much to be done on our side. This hook has a lot of call data and it can be kind of expansive (I double-checked ways to reduce it but it would create edge cases of worst UX like dust on the cow shed). All the gas quotes (used to generate fees) came from Tenderly and it is passed to the backend. There is some buffer but it shouldn't be that big. Maybe the gas cost changed during the quoting and execution decreased. However, the way of quoting is the same for all hooks, so if there is an overestimation issue all of the hooks are being affected and we should open a new PR/issue to solve it. |
Hey @yvesfracari , thank you for your fixes! One more nitpick I've noticed: when adding a dust into a pool, the app allows me to add this hook, but simulation immediately fails. See the images: Might it be possible to specify a min value to add (e.g. 0.01 USD)? As for fees estimation. The issue is relevant for this hook only.
As for the assumption of a gas price change before/after order execution, it is not the case as everything took about 1 minute (estimation/order placement/execution) while gas price was about 9-10 gwei. |
1 - About min USD prices, I think this can cause issues of blocking users when the price API is with some problem (we get the price from the balancer). To be honest, I think that receiving a failing simulation is a good handling for this case.
So, a difference of this magnitude is expected. However, as you reported the difference is bigger. I double-checked and we're passing the right values to the backend. If you want to check you can see the 1 - Proxy initialization: The first time you execute a hook it should be more expansive since the proxy will be initialized. However, this cost should happen for any first hook being executed on the same account. However, since you already executed some hooks I think that is not the case. |
Hey @yvesfracari , I've got response from the BE team: no issues from their side.
As for:
I partially agree with it. But my point here: we are adding a hook that shows 0 in one of fields. |
Thanks for the effort in checking this with the backend team. It seems then that there is no issue with the fee price, this hook is just more expansive. About the dust, makes sense, now I am disabling the button when 1 of the two amounts is zero. |
Hey @yvesfracari , thank you for the fix!
|
Also, as a recap of edge cases in this implementation:
|
About the simulation that you shared. It is the same issue of max amounts that don't work well because of the fee update after the hook creation. This should be fixed when we allow hooks that can be updated by the cow swap app #5132 . The strategy to estimate the gas of each hook is the same for all of them, which is about 40k gas you can check on the simulation that you reported of a failed hook simulation on the "Initial gas". On the order that you shared the gas consumed by the hook was 306341 and the limit was 347069. In that sense, we can confirm that we're passing the right gas for the hook. If we want to remove the buffer (or decrease it), it should be discussed, and since it would affect all hooks, it should be done on a separate PR. |
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.
Approved then
Summary
Add CoW AMM Deposit Hook Dapp
To Test
1- Access /#/11155111/swap/hooks/WXDAI
2- Connect your wallet and switch to any cow amm deployed chain
3- Fill some swap order
4- In Hooks > Add Post-Hook Action, the CoW AMM Deposit should appear in the "All hooks" section
5- Fill the form data and add the post-hook
6- Check with the simulation feature if it working as expected
Background
Optional: Give background information for changes you've made, that might be difficult to explain via comments