Skip to main content

L2MessageServiceV1

MINIMUM_FEE_SETTER_ROLE

bytes32 MINIMUM_FEE_SETTER_ROLE

The role required to set the minimum DDOS fee.

_messageSender

address _messageSender

The temporary message sender set when claiming a message.

nextMessageNumber

uint256 nextMessageNumber

minimumFeeInWei

uint256 minimumFeeInWei

REFUND_OVERHEAD_IN_GAS

uint256 REFUND_OVERHEAD_IN_GAS

DEFAULT_SENDER_ADDRESS

address DEFAULT_SENDER_ADDRESS

The default message sender address reset after claiming a message.

constructor

constructor() internal

sendMessage

function sendMessage(address _to, uint256 _fee, bytes _calldata) external payable

Adds a message for sending cross-chain and emits a relevant event.

The message number is preset and only incremented at the end if successful for the next caller.

Parameters

NameTypeDescription
_toaddressThe address the message is intended for.
_feeuint256The fee being paid for the message delivery.
_calldatabytesThe calldata to pass to the recipient.

claimMessage

function claimMessage(address _from, address _to, uint256 _fee, uint256 _value, address payable _feeRecipient, bytes _calldata, uint256 _nonce) external

Claims and delivers a cross-chain message.

_feeRecipient Can be set to address(0) to receive as msg.sender. messageSender Is set temporarily when claiming and reset post.

Parameters

NameTypeDescription
_fromaddressThe address of the original sender.
_toaddressThe address the message is intended for.
_feeuint256The fee being paid for the message delivery.
_valueuint256The value to be transferred to the destination address.
_feeRecipientaddress payableThe recipient for the fee.
_calldatabytesThe calldata to pass to the recipient.
_nonceuint256The unique auto generated message number used when sending the message.

setMinimumFee

function setMinimumFee(uint256 _feeInWei) external

The Fee Manager sets a minimum fee to address DOS protection.

MINIMUM_FEE_SETTER_ROLE is required to set the minimum fee.

Parameters

NameTypeDescription
_feeInWeiuint256New minimum fee in Wei.

sender

function sender() external view returns (address originalSender)

_The messageSender address is set temporarily when claiming.

Return Values

NameTypeDescription
originalSenderaddressThe original sender stored temporarily at the _messageSender address in storage.

distributeFees

modifier distributeFees(uint256 _feeInWei, address _to, bytes _calldata, address _feeRecipient)

The unspent fee is refunded if applicable.

Parameters

NameTypeDescription
_feeInWeiuint256The fee paid for delivery in Wei.
_toaddressThe recipient of the message and gas refund.
_calldatabytesThe calldata of the message.
_feeRecipientaddress