feat(core): HypNativeWethWrapper adapter and CREATE2 factory#8653
Draft
feat(core): HypNativeWethWrapper adapter and CREATE2 factory#8653
Conversation
Lets WETH holders bridge through an existing HypNative route by pulling WETH, unwrapping, and forwarding. Extends ITokenBridge with token(); retypes AbstractPredicateWrapper.token to address and updates mocks accordingly.
3 tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8653 +/- ##
==========================================
+ Coverage 79.33% 79.44% +0.11%
==========================================
Files 143 145 +2
Lines 4278 4306 +28
Branches 436 440 +4
==========================================
+ Hits 3394 3421 +27
Misses 855 855
- Partials 29 30 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Replaces the no-op MockWETH stub with a functional WETH9-compatible implementation and removes the inline TestWETH from the wrapper test. The TS hardhat test that deploys MockWETH only reads its address, so upgrading the stub to working behavior is a no-op for existing callers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HypNativeWethWrapper: anITokenBridgeadapter that pulls WETH from the caller, unwraps to native, and forwardstransferRemoteto an existingHypNativerouter. Quotes the full WETH amount up-front so no refund path ormsg.valueis required.HypNativeWethWrapperFactory: a CREATE2 factory committed to a fixed WETH address, producing one deterministic wrapper perHypNative(deploy(hypNative)/getAddress(hypNative)).ITokenBridgewithfunction token() external view returns (address)so callers can discover what to approve.TokenRouterandTokenBridgeDepositAddressgetoverride;AbstractPredicateWrapper.tokenretyped fromIERC20toaddress(auto-getter now matches the interface); mocks updated to exposetoken().Notes
HypNative— recipients get native ETH, not WETH. Safe for EOAs; may revert for contracts that don't accept ETH. For fully symmetric WETH-in/WETH-out, use aHypERC20Collateralwarp route wrapping WETH on both chains.transferRemoteis balance-neutral, and the factory pins WETH to a canonical deployment (WETH9'swithdrawusestransfer/2300 gas).Test plan
forge test --match-contract HypNativeWethWrapperTest(12 tests covering constructor, transferRemote, quoteTransferRemote, token(), and factory determinism/idempotency/bridging)PredicateRouterWrapper*,HypERC20*,HypNative*,MovableCollateralRouter,TokenBridgeDepositAddresstests after theITokenBridge.token()addition