Function: _withdraw(address _l2Token, address _to, uint256 _amount, byte[] _data, uint256 _gasLimit)
Facilitates the withdrawing of tokens from L2 to L1.
Inputs
_l2Token
Control: Fully controlled by the caller.
Constraints: Ensure it is a supported L2 token.
Impact: The L2 token to be withdrawn.
_to
Control: Fully controlled by the caller.
Constraints: None.
Impact: The address to which the tokens will be sent.
_amount
Control: Fully controlled by the caller.
Constraints: Ensured
from
possesses at least_amount
tokens.Impact: The amount of tokens to be withdrawn.
_data
Control: Fully controlled by the caller.
Constraints: None.
Impact: The data to be forwarded cross-chain.
_gasLimit
Control: 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
l2Token
is supported.Ensure that withdrawals are enabled.
Burn the
amount
of 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
.