Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions contracts/ZkSync_SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import "./SpokePool.sol";

// https://github.com/matter-labs/era-contracts/blob/6391c0d7bf6184d7f6718060e3991ba6f0efe4a7/zksync/contracts/bridge/L2ERC20Bridge.sol#L104
interface ZkBridgeLike {
function withdraw(
address _l1Receiver,
address _l2Token,
uint256 _amount
) external;
function withdraw(address _l1Receiver, address _l2Token, uint256 _amount) external;
}
Comment on lines -11 to +12
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.


interface IZkErc20 {
function l2Bridge() external view returns (address);
}

interface IL2ETH {
Expand Down Expand Up @@ -166,7 +166,13 @@ contract ZkSync_SpokePool is SpokePool, CircleCCTPAdapter {
zkUSDCBridge.withdraw(withdrawalRecipient, l2TokenAddress, amountToReturn);
}
} 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

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

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);
}
}
}

Expand Down
Loading