OAppAuthCore

Git Source

Inherits: IOAppCore, Auth

Abstract contract implementing the IOAppCore interface with basic OApp configurations.

This Auth version of OAppCore uses solmate's Auth instead of OZ's Ownable for compatibility purposes

State Variables

endpoint

ILayerZeroEndpointV2 public immutable endpoint;

peers

mapping(uint32 eid => bytes32 peer) public peers;

Functions

constructor

Constructor to initialize the OAppCore with the provided endpoint and delegate.

The delegate typically should be set as the owner of the contract.

constructor(address _endpoint, address _delegate);

Parameters

setPeer

Sets the peer address (OApp instance) for a corresponding endpoint.

this contract replaces the OZ Ownable onlyOwner with Solmate requiresAuth

Only the owner/admin of the OApp can call this function.

Indicates that the peer is trusted to send LayerZero messages to this OApp.

Set this to bytes32(0) to remove the peer address.

Peer is a bytes32 to accommodate non-evm chains.

function setPeer(uint32 _eid, bytes32 _peer) public virtual requiresAuth;

Parameters

_setPeer

Sets the peer address (OApp instance) for a corresponding endpoint.

Indicates that the peer is trusted to send LayerZero messages to this OApp.

Set this to bytes32(0) to remove the peer address.

Peer is a bytes32 to accommodate non-evm chains.

function _setPeer(uint32 _eid, bytes32 _peer) internal virtual;

Parameters

_getPeerOrRevert

Internal function to get the peer address associated with a specific endpoint; reverts if NOT set. ie. the peer is set to bytes32(0).

function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32);

Parameters

Returns

setDelegate

Sets the delegate address for the OApp.

this contract replaces the OZ Ownable onlyOwner with Solmate requiresAuth

Only the owner/admin of the OApp can call this function.

Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.

function setDelegate(address _delegate) public requiresAuth;

Parameters