Skip to content
Lattice

SuperchainETHBridgeAdapterLib

Git Source

Title: SuperchainETHBridgeAdapterLib

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Optimism (https://github.com/ethereum-optimism/optimism)

Logic for the OP Stack SuperchainETHBridge interop adapter. A thin, OUTBOUND-ONLY payable passthrough: sendETH forwards msg.value to the SUPERCHAIN_ETH_BRIDGE predeploy, which burns the ETH, messages the destination via the L2ToL2CrossDomainMessenger, and force-sends it to the recipient there.

STATELESS — the predeploy is a compile-time constant, so there is NO ERC-7201 storage struct, no config, no trusted-remote registry, and no admin surface (nothing to gate). The only init effect is registering the ISuperchainETHBridgeAdapter ERC-165 id. No reentrancy guard: the adapter holds no ETH/state, the call target is a trusted immutable predeploy, and it is outbound-only (the predeploy never calls back into this diamond), so there is no reentrancy surface to guard.

Functions

__SuperchainETHBridgeAdapter_init

Registers the ISuperchainETHBridgeAdapter ERC-165 id. Called inside the initializing window.

function __SuperchainETHBridgeAdapter_init() internal;

registerInterface

Writes true to the ERC-165 map slot for ISuperchainETHBridgeAdapter.

function registerInterface() internal;

sendETH

Bridges msg.value native ETH to to on Superchain chain chainId via the predeploy.

Reverts InvalidRecipient on a zero to (before the external call, though the predeploy also rejects it) and ZeroValue on a zero msg.value. Forwards exactly msg.value; the diamond retains no ETH afterward.

function sendETH(address to, uint256 chainId) internal returns (bytes32 msgHash);

Parameters

NameTypeDescription
toaddress
chainIduint256

Returns

NameTypeDescription
msgHashbytes32

bridge

The fixed SuperchainETHBridge predeploy this adapter forwards to.

function bridge() internal pure returns (address);

Returns

NameTypeDescription
<none>address