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
Name | Type | Description |
---|---|---|
_to | address | The address the message is intended for. |
_fee | uint256 | The fee being paid for the message delivery. |
_calldata | bytes | The 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
Name | Type | Description |
---|---|---|
_from | address | The address of the original sender. |
_to | address | The address the message is intended for. |
_fee | uint256 | The fee being paid for the message delivery. |
_value | uint256 | The value to be transferred to the destination address. |
_feeRecipient | address payable | The recipient for the fee. |
_calldata | bytes | The calldata to pass to the recipient. |
_nonce | uint256 | The 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
Name | Type | Description |
---|---|---|
_feeInWei | uint256 | New minimum fee in Wei. |
sender
function sender() external view returns (address originalSender)
_The messageSender address is set temporarily when claiming.
Return Values
Name | Type | Description |
---|---|---|
originalSender | address | The 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
Name | Type | Description |
---|---|---|
_feeInWei | uint256 | The fee paid for delivery in Wei. |
_to | address | The recipient of the message and gas refund. |
_calldata | bytes | The calldata of the message. |
_feeRecipient | address |