Function: _withdraw(address _l2Token, address _to, uint256 _amount, byte[] _data, uint256 _gasLimit)
Facilitates the withdrawing of tokens from L2 to L1.
Inputs
_l2TokenControl: Fully controlled by the caller.
Constraints: Ensure it is a supported L2 token.
Impact: The L2 token to be withdrawn.
_toControl: Fully controlled by the caller.
Constraints: None.
Impact: The address to which the tokens will be sent.
_amountControl: Fully controlled by the caller.
Constraints: Ensured
frompossesses at least_amounttokens.Impact: The amount of tokens to be withdrawn.
_dataControl: Fully controlled by the caller.
Constraints: None.
Impact: The data to be forwarded cross-chain.
_gasLimitControl: Fully controlled by the caller.
Constraints: None.
Impact: The gas limit for the cross-chain transaction.
Branches and code coverage (including function calls)
Intended branches
Ensure that
l2Tokenis supported.Ensure that withdrawals are enabled.
Burn the
amountof tokens fromfrom.Generate the message to be sent to L1.
Forward the message to L1.
Negative behavior
Should not allow sending tokens if there is not enough balance. Handled in
burn.