Skip to main content

LZBridgeActivator

Git Source

Inherits: Owned

Title: LZBridgeActivator

Single-use contract to configure and activate the LZBridgeGateway during the OCG proposal. Batches all endpoint configuration, peer setup, enforced options, per-endpoint bidirectional rate limits and enablement into a single proposal action, working around the governor's 15-action limit.

Assumes:

  • The admin, bridge_admin, and bridge_configurator roles have been granted to this contract for the duration of the activation. bridge_configurator is the role that gates the privileged configuration mutators on the gateway and the LZ endpoint delegate; granting it temporarily lets the activator drive setup directly, without routing the calls through the LZBridgeAndDelegateConfig timelock. All three are revoked immediately after activate(), leaving bridge_configurator only on the LZBridgeAndDelegateConfig policy.
  • The gateway and the LZEndpointDelegate policy have been activated in the Kernel (by the DAO MS pre-OCG).
  • The caller is this contract's owner (the OCG timelock).

activate() points the gateway's endpoint delegate at the LZEndpointDelegate policy and drives all OApp-authorized endpoint calls through that policy (libraries, ULN/Executor config). Gateway-level operations (setPeer, setEnforcedOptions, enable) are called through the gateway's role-gated functions directly. The delegate assignment is the steady-state configuration and is not revoked when activation completes; subsequent OApp-authorized endpoint operations continue to go through LZEndpointDelegate.

Constants​

_REMOTE_CHAIN_COUNT​

Number of remote chains configured by this activator.

uint256 internal constant _REMOTE_CHAIN_COUNT = 4;

GATEWAY​

address public immutable GATEWAY;

DELEGATE​

address public immutable DELEGATE;

ENDPOINT​

address public immutable ENDPOINT;

ARB_GATEWAY​

address public immutable ARB_GATEWAY;

OPT_GATEWAY​

address public immutable OPT_GATEWAY;

BASE_GATEWAY​

address public immutable BASE_GATEWAY;

BERA_GATEWAY​

address public immutable BERA_GATEWAY;

State Variables​

isActivated​

bool public isActivated;

Functions​

constructor​

constructor(
address owner_,
address gateway_,
address delegate_,
address endpoint_,
address arbGateway_,
address optGateway_,
address baseGateway_,
address beraGateway_
) Owned(owner_);

Parameters

NameTypeDescription
owner_addressThe OCG timelock address.
gateway_addressThe LZBridgeGateway address on this chain.
delegate_addressThe LZEndpointDelegate policy address on this chain.
endpoint_addressThe LayerZero V2 endpoint address.
arbGateway_addressRemote gateway on Arbitrum.
optGateway_addressRemote gateway on Optimism.
baseGateway_addressRemote gateway on Base.
beraGateway_addressRemote gateway on Berachain.

activate​

Configures and activates the LZBridgeGateway.

This function assumes:

  • The admin, bridge_admin, and bridge_configurator roles have been granted to this contract for the duration of the activation.
  • The LZEndpointDelegate policy is active in the Kernel.

This function reverts if:

  • The caller is not the owner.
  • The function has already been run.
function activate() external onlyOwner;

_configureLZEndpoint​

Configures the LZ V2 endpoint via the LZEndpointDelegate policy: pin libraries and set ULN/Executor config for all 4 remote chains.

function _configureLZEndpoint() internal;

_setPeers​

Sets peers on the gateway for all 4 remote chains.

function _setPeers() internal;

_setEnforcedOptions​

Sets enforced options (200k gas minimum) for all 4 remote chains.

function _setEnforcedOptions() internal;

_setRateLimits​

Sets bidirectional rate limits on the gateway for all 4 remote chains. Outbound limit applies to OHM leaving the canonical chain; inbound limit applies to OHM arriving from a remote chain. Window and per-direction limits are sourced from LZConfigLib.

function _setRateLimits() internal;

_enable​

Enables the gateway policy.

function _enable() internal;

_requireNonzeroAddress​

function _requireNonzeroAddress(address address_, string memory parameter_) private pure;

Parameters

NameTypeDescription
address_address
parameter_string

Events​

Activated​

event Activated(address caller);

Parameters

NameTypeDescription
calleraddress

Errors​

AlreadyActivated​

error AlreadyActivated();

InvalidParams​

error InvalidParams(string reason);

Parameters

NameTypeDescription
reasonstring