Function: deposit(bytes _to, uint256 _amount, uint256 _keyId)
This function allows a user to deposit ETH to Cloak. It converts ETH to WETH for users and deposits through the contract L1ERC20GatewayValidium.
Inputs
_toControl: Fully controlled by the caller.
Constraints: N/A.
Impact: The encrypted address of the recipient on Cloak.
_amountControl: Fully controlled by the caller.
Constraints: Must be less than
msg.valueand must be greater than zero.Impact: The amount of ETH to deposit.
_keyIdControl: Fully controlled by the caller.
Constraints: Must be the latest key ID.
Impact: The encryption-key ID of the key used to encrypt the address of the recipient.
Branches and code coverage
Intended branches
This function can be successfully executed without reverting.
The WETH balance of the
gatewayincreases by_amount.
Negative behavior
Reverts if
msg.valueis less than_amount.Reverts if
_amountis zero.
Function call analysis
IL1ERC20GatewayValidium(this.gateway).depositERC20{value: msg.value - _amount}(this.WETH, msg.sender, _to, _amount, L1WETHGatewayValidium.GAS_LIMIT, _keyId)What is controllable?
msg.value,_amount,_to, and_keyId.If the return value is controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters or does other unusual control flow? N/A.