OAppAuthSender
Inherits: OAppAuthCore
Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.
This Auth version of OAppCore uses solmate's Auth instead of OZ's Ownable for compatibility purposes
State Variables
SENDER_VERSION
Functions
oAppVersion
Retrieves the OApp version information.
Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented. ie. this is a SEND 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. |
_quote
Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.
Parameters
Name | Type | Description |
---|---|---|
|
| The destination endpoint ID. |
|
| The message payload. |
|
| Additional options for the message. |
|
| Flag indicating whether to pay the fee in LZ tokens. |
Returns
Name | Type | Description |
---|---|---|
|
| The calculated MessagingFee for the message. - nativeFee: The native fee for the message. - lzTokenFee: The LZ token fee for the message. |
_lzSend
Internal function to interact with the LayerZero EndpointV2.send() for sending a message.
Parameters
Name | Type | Description |
---|---|---|
|
| The destination endpoint ID. |
|
| The message payload. |
|
| Additional options for the message. |
|
| The calculated LayerZero fee for the message. - nativeFee: The native fee. - lzTokenFee: The lzToken fee. |
|
| The address to receive any excess fee values sent to the endpoint. |
Returns
Name | Type | Description |
---|---|---|
|
| The receipt for the sent message. - guid: The unique identifier for the sent message. - nonce: The nonce of the sent message. - fee: The LayerZero fee incurred for the message. |
_payNative
Internal function to pay the native fee associated with the message.
If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction, this will need to be overridden because msg.value would contain multiple lzFees.
Should be overridden in the event the LayerZero endpoint requires a different native currency.
Some EVMs use an ERC20 as a method for paying transactions/gasFees.
The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.
Parameters
Name | Type | Description |
---|---|---|
|
| The native fee to be paid. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of native currency paid. |
_payLzToken
Internal function to pay the LZ token fee associated with the message.
If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.
Any excess sent, is passed back to the specified _refundAddress in the _lzSend().
Parameters
Name | Type | Description |
---|---|---|
|
| The LZ token fee to be paid. |