Function: _depositToVault(uint256 id, uint256 amount, address inputToken, address vaultAddress)
Deposits ERC-20 or ETH to the vault.
Inputs
idConstraints: Should be the correct epoch ID for the Y2K vault.
Impact: The epoch ID for the Y2K vault.
amountConstraints: No constraints.
Impact: The amount of the token to deposit.
inputTokenConstraints: No constraints.
Impact: The address of the token to deposit.
vaultAddressConstraints: Should be a valid vault address.
Impact: The address of the vault to deposit to.
Branches and code coverage (including function calls)
Intended branches
The function checks if
inputTokenis equal tosgEthto determine if an ETH or ERC-20 deposit is needed.The function returns
trueif the deposit is successful andfalseif it fails.
Negative behavior
The function returns
falseif any of the deposit attempts (ETH or ERC-20) fail.
Function call analysis
IEarthquake(vaultAddress).depositETH{value: amount}(id, address(this))What is controllable?
id,amount,vaultAddress.If return value controllable, how is it used and how can it go wrong? This function call does not return a value --- only success/failure.
What happens if it reverts, reenters, or does other unusual control flow? If the deposit of ETH fails, the function would return false.
IEarthquake(vaultAddress).deposit(id, amount, address(this))What is controllable?
id,amount, andvaultAddress.If return value controllable, how is it used and how can it go wrong? This function call does not return a value --- only success/failure.
What happens if it reverts, reenters, or does other unusual control flow? If the deposit of ERC-20 tokens fails, the function would return false.