OAppAuthReceiver
Inherits: IOAppReceiver, OAppAuthCore
Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.
This Auth version of OAppCore uses solmate's Auth instead of OZ's Ownable for compatibility purposes
State Variables
RECEIVER_VERSION
Functions
oAppVersion
Retrieves the OApp version information.
Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented. ie. this is a RECEIVE only OApp.
If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.
Returns
Name | Type | Description |
---|---|---|
|
| The version of the OAppSender.sol contract. |
|
| The version of the OAppReceiver.sol contract. |
isComposeMsgSender
Indicates whether an address is an approved composeMsg sender to the Endpoint.
*_origin The origin information containing the source endpoint and sender address.
srcEid: The source chain endpoint ID.
sender: The sender address on the src chain.
nonce: The nonce of the message.*
_message The lzReceive payload.
Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.
The default sender IS the OAppReceiver implementer.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| The sender address. |
Returns
Name | Type | Description |
---|---|---|
|
| isSender Is a valid sender. |
allowInitializePath
Checks if the path initialization is allowed based on the provided origin.
This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.
This defaults to assuming if a peer has been set, its initialized. Can be overridden by the OApp if there is other logic to determine this.
Parameters
Name | Type | Description |
---|---|---|
|
| The origin information containing the source endpoint and sender address. |
Returns
Name | Type | Description |
---|---|---|
|
| Whether the path has been initialized. |
nextNonce
Retrieves the next nonce for a given source endpoint and sender address.
_srcEid The source endpoint ID.
_sender The sender address.
The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
Is required by the off-chain executor to determine the OApp expects msg execution is ordered.
This is also enforced by the OApp.
By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.
Returns
Name | Type | Description |
---|---|---|
|
| The next nonce. |
lzReceive
Entry point for receiving messages or packets from the endpoint.
Entry point for receiving msg/packet from the LayerZero endpoint.
Parameters
Name | Type | Description |
---|---|---|
|
| The origin information containing the source endpoint and sender address. - srcEid: The source chain endpoint ID. - sender: The sender address on the src chain. - nonce: The nonce of the message. |
|
| The unique identifier for the received LayerZero message. |
|
| The payload of the received message. |
|
| The address of the executor for the received message. |
|
| Additional arbitrary data provided by the corresponding executor. |
_lzReceive
Internal function to implement lzReceive logic without needing to copy the basic parameter validation.