Function: _deposit(address _token, address _to, uint256 _amount, byte[] _data, uint256 _gasLimit)
Facilitates the deposit of tokens from L1 to L2.
Inputs
_tokenControl: Fully controlled by the caller.
Constraints: Ensured that it is the
l1Tokenaddress.Impact: The token to be deposited.
_toControl: Fully controlled by the caller.
Constraints: None.
Impact: The destination address for the deposit.
_amountControl: Fully controlled by the caller.
Constraints: Ensured that it is a nonzero amount.
Impact: The amount of tokens to be deposited.
_dataControl: Fully controlled by the caller.
Constraints: None.
Impact: The data to be passed to the recipient.
_gasLimitControl: 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
_tokenby_amountforaddress(this).Decrease the balance of
_tokenby_amountformsg.sender.Generate the message to be sent cross-chain.
Forward the cross-chain
finalizeDepositERC20message to L2LidoGateway.Ensure that
depositsEnabledis true.Ensure that
tokenis supported.
Negative behavior
Should not allow sending tokens if there is not enough balance. Handled in
_transferERC20In.