Skip to content

Conversation

@pxrl
Copy link
Contributor

@pxrl pxrl commented Sep 2, 2025

zkSync ERC20s are typically explicit about the L2 bridge to use, but Lens ERC20s are not. Lens WETH does supplies a valid l2Bridge address that can be used to withdraw from the chain.

zkSync ERC20s are typically explicit about the L2 bridge to use, but
Lens ERC20s are not. Lens WETH does supplies a valid l2Bridge address
that can be used to withdraw from the chain.
Comment on lines -11 to +12
function withdraw(
address _l1Receiver,
address _l2Token,
uint256 _amount
) external;
function withdraw(address _l1Receiver, address _l2Token, uint256 _amount) external;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being reflowed by the commit hook. Not sure when that was implemented.

// Elastic chain bridged tokens advertise custom bridge interface via the l2Bridge() getter.
address l2Bridge = IZkErc20(l2TokenAddress).l2Bridge();
if (l2Bridge != address(0)) {
ZkBridgeLike(l2Bridge).withdraw(withdrawalRecipient, l2TokenAddress, amountToReturn);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbd catch andrevert to zkErc20Bridge? These tokens are managed by governance, so there's some control over which interfaces the ERC20s implement.

}
} else {
zkErc20Bridge.withdraw(withdrawalRecipient, l2TokenAddress, amountToReturn);
// Elastic chain bridged tokens advertise custom bridge interface via the l2Bridge() getter.
Copy link
Contributor Author

@pxrl pxrl Sep 2, 2025

} else {
zkErc20Bridge.withdraw(withdrawalRecipient, l2TokenAddress, amountToReturn);
// Elastic chain bridged tokens advertise custom bridge interface via the l2Bridge() getter.
address l2Bridge = IZkErc20(l2TokenAddress).l2Bridge();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: Add test

@pxrl
Copy link
Contributor Author

pxrl commented Sep 9, 2025

(nb. currently waiting on feedback from Matter Labs to confirm this strategy is OK)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant