Skip to content

feat(core): HypNativeWethWrapper adapter and CREATE2 factory#8653

Draft
yorhodes wants to merge 2 commits intomainfrom
feat/hyp-native-weth-wrapper
Draft

feat(core): HypNativeWethWrapper adapter and CREATE2 factory#8653
yorhodes wants to merge 2 commits intomainfrom
feat/hyp-native-weth-wrapper

Conversation

@yorhodes
Copy link
Copy Markdown
Member

Summary

  • Adds HypNativeWethWrapper: an ITokenBridge adapter that pulls WETH from the caller, unwraps to native, and forwards transferRemote to an existing HypNative router. Quotes the full WETH amount up-front so no refund path or msg.value is required.
  • Adds HypNativeWethWrapperFactory: a CREATE2 factory committed to a fixed WETH address, producing one deterministic wrapper per HypNative (deploy(hypNative) / getAddress(hypNative)).
  • Extends ITokenBridge with function token() external view returns (address) so callers can discover what to approve. TokenRouter and TokenBridgeDepositAddress get override; AbstractPredicateWrapper.token retyped from IERC20 to address (auto-getter now matches the interface); mocks updated to expose token().

Notes

  • Delivery semantics are inherited from the underlying 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 a HypERC20Collateral warp route wrapping WETH on both chains.
  • No reentrancy guard — each transferRemote is balance-neutral, and the factory pins WETH to a canonical deployment (WETH9's withdraw uses transfer/2300 gas).

Test plan

  • forge test --match-contract HypNativeWethWrapperTest (12 tests covering constructor, transferRemote, quoteTransferRemote, token(), and factory determinism/idempotency/bridging)
  • Full solidity suite: verify no regressions in PredicateRouterWrapper*, HypERC20*, HypNative*, MovableCollateralRouter, TokenBridgeDepositAddress tests after the ITokenBridge.token() addition
  • Review delivery-asymmetry tradeoff (native-out vs WETH-out) for target routes

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.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.44%. Comparing base (6fe3c83) to head (2bc38fa).
⚠️ Report is 21 commits behind head on main.

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     
Flag Coverage Δ
solidity 80.71% <90.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 87.80% <ø> (ø)
hooks 78.11% <ø> (ø)
isms 81.46% <ø> (ø)
token 88.17% <90.00%> (+0.17%) ⬆️
middlewares 87.76% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

1 participant