Function: deposit(address depositContract, address depositToken, uint256 amount)
This function is used to deposit tokens into the target ERC-4626 vault and collect fees.
Inputs
depositContractControl: Arbitrary.
Constraints: Mapped in
feeConfigs.Impact: Address of the ERC-4626 vault.
depositTokenControl: Arbitrary.
Constraints: Mapped in
feeConfigs.Impact: Address of the ERC-20 token to deposit.
amountControl: Arbitrary.
Constraints: Nonzero.
Impact: Amount of tokens to deposit.
Branches and code coverage
Intended branches
Invoke
computeFeeto calculate the fee with amount.Transfer the fee to the
feeRecipientiffeeRecipientexists.Transfer the fee to the
providerFeeRecipient.Receive the deposit amount from
msg.sender.Call approve to
depositContractwithdepositAmount.Call
depositContractInstance.depositwithdepositAmountandmsg.sender.
Negative behavior
Revert if
amountis zero.Revert if
depositContractanddepositTokenare not enabled infeeConfigs.Revert if the fee transfer to
feeRecipientfails.Revert if the provider-fee transfer fails.
Revert if the transfer deposit amount fails.
Revert if the deposit token approval fails.
Function call analysis
depositTokenInstance.transferFrom(msg.sender, feeConfig.feeRecipient, feeRecipientAmount)What is controllable?
feeRecipientAmountbased on the user's deposit amount.If the return value is controllable, how is it used and how can it go wrong? It could be executed if the transfer fails.
depositTokenInstance.transferFrom(msg.sender, this.providerFeeRecipient, feeAmount)What is controllable?
feeAmountbased on the user's deposit amount.If the return value is controllable, how is it used and how can it go wrong? It could be executed if the transfer fails.
depositTokenInstance.transferFrom(msg.sender, address(this), depositAmount)What is controllable?
depositAmountbased on the user's deposit amount.If the return value is controllable, how is it used and how can it go wrong? It could be executed if the transfer fails.
depositTokenInstance.approve(depositContract, depositAmount)What is controllable?
depositAmountbased on the user's deposit amount.If the return value is controllable, how is it used and how can it go wrong? Transfer will fail in
depositContractInstance.deposit.
depositContractInstance.deposit(depositAmount, msg.sender)What is controllable?
depositAmountbased on the user's deposit amount.If the return value is controllable, how is it used and how can it go wrong? The share could be manipulated to return a different value.