L1Withdrawer
Table of Contents
Summary
An optional periphery contract designed to be used as a recipient for a portion of the shares sent
by the FeeSplitter. Its sole purpose is to initiate a withdrawal to L1 via L2CrossDomainMessenger.sendMessage()
once it has received enough funds. Using the CrossDomainMessenger allows failed withdrawal messages to be replayed,
providing better reliability than direct message passing.
Functions
receive
Initiates the withdrawal process to L1 if and only if the contract holds funds equal to or above the
minWithdrawalAmount threshold.
receive() external payable
- MUST initiate a withdrawal to the set recipient if and only if the
minWithdrawalAmountthreshold is reached, usingL2CrossDomainMessenger.sendMessage()with the following parameters:_target: the configuredrecipientaddress_message: empty bytes (hex"") for direct ETH transfer_minGasLimit: the configuredwithdrawalGasLimitvaluemsg.value: the contract's entire balance
- MUST emit the
FundsReceivedevent with the sender, amount received and balance. - MUST emit the
WithdrawalInitiatedevent only if the threshold is reached.
setMinWithdrawalAmount
Updates the minimum withdrawal amount the contract must hold before the withdrawal process can be initiated.
function setMinWithdrawalAmount(uint256 _newMinWithdrawalAmount) external
- MUST only be callable by
ProxyAdmin.owner(). - MUST emit the
MinWithdrawalAmountUpdatedevent. - MUST update the
minWithdrawalAmountstorage variable.
setRecipient
Updates the address that will receive the funds on L1 during the withdrawal process.
function setRecipient(address _newRecipient) external
- MUST only be callable by
ProxyAdmin.owner(). - MUST emit the
RecipientUpdatedevent. - MUST update the
recipientstorage variable.
setWithdrawalGasLimit
Updates the gas limit for the withdrawal on L1.
function setWithdrawalGasLimit(uint32 _newWithdrawalGasLimit) external
- MUST only be callable by
ProxyAdmin.owner(). - MUST emit the
WithdrawalGasLimitUpdatedevent. - MUST update the
withdrawalGasLimitstorage variable.
Events
WithdrawalInitiated
Emitted when a withdrawal to L1 is initiated.
event WithdrawalInitiated(address indexed recipient, uint256 amount)
MinWithdrawalAmountUpdated
Emitted when the minimum withdrawal amount before the withdrawal can be initiated is updated.
event MinWithdrawalAmountUpdated(uint256 oldMinWithdrawalAmount, uint256 newMinWithdrawalAmount)
RecipientUpdated
Emitted when the recipient of the funds on L1 is updated.
event RecipientUpdated(address oldRecipient, address newRecipient)
WithdrawalGasLimitUpdated
Emitted when the withdrawal gas limit on L1 is updated.
event WithdrawalGasLimitUpdated(uint32 oldWithdrawalGasLimit, uint32 newWithdrawalGasLimit)
FundsReceived
Emitted whenever funds are received.
event FundsReceived(address indexed sender, uint256 amount, uint256 newBalance)