-
Notifications
You must be signed in to change notification settings - Fork 530
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
Add weth wrapping hook #436
Conversation
Note one constraint of this approach is that the input currency must already exist in poolmanager before the swap call. This could either be from existing standing liquidity or else the user must transfer input assets first |
73bb4a1
to
a13739b
Compare
src/hooks/WETHHook.sol
Outdated
} | ||
|
||
/// @inheritdoc BaseTokenWrapperHook | ||
function withdraw(uint256 wrapperAmount) internal override returns (uint256 underlyingAmount) { |
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.
nit but these are internal so would rather _withdraw
and _deposit
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 remove named return variable from both functions because youre never using it and returning a different variable
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.
I feel like the named variables are helpful for future implementers, no? I.e. when I make stETH<>ETH hook I will need to do a conversion
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.
i think thats true on the abstract base hook (which is what your stETH hook would inherit from), i'm happy for them to remain with names there, because those are abstract functions. But then in this specific implementation contract I'd argue that the named return variable makes it more confusing
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.
ohh I thought you were referencing hte abstract
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.
ok fixed
@@ -0,0 +1,185 @@ | |||
pragma solidity ^0.8.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.
there's no license identifier in this file
token wrapper adapter
Overview
This PR introduces a WETH (Wrapped Ether) hook for Uniswap v4, enabling native ETH to WETH conversions directly through v4 pools. The implementation provides a convenient way to wrap and unwrap ETH within a v4 lock / route.