Function: _deposit(address _token, address _to, uint256 _amount, byte[] _data, uint256 _gasLimit)
Facilitates the deposit of tokens from L1 to L2.
Inputs
_token
Control: Fully controlled by the caller.
Constraints: Ensured that it is the
l1Token
address.Impact: The token to be deposited.
_to
Control: Fully controlled by the caller.
Constraints: None.
Impact: The destination address for the deposit.
_amount
Control: Fully controlled by the caller.
Constraints: Ensured that it is a nonzero amount.
Impact: The amount of tokens to be deposited.
_data
Control: Fully controlled by the caller.
Constraints: None.
Impact: The data to be passed to the recipient.
_gasLimit
Control: Fully controlled by the caller.
Constraints: None.
Impact: The gas limit for the deposit.
Branches and code coverage (including function calls)
Intended branches
Increase the balance of
_token
by_amount
foraddress(this)
.Decrease the balance of
_token
by_amount
formsg.sender
.Generate the message to be sent cross-chain.
Forward the cross-chain
finalizeDepositERC20
message to L2LidoGateway.Ensure that
depositsEnabled
is true.Ensure that
token
is supported.
Negative behavior
Should not allow sending tokens if there is not enough balance. Handled in
_transferERC20In
.