Assessment reports>EtherFi>Threat Models>deposit

Function: deposit(address _erc20Contract, uint256 _amount)

Used to deposit ERC20 tokens into the contract.

Inputs

  • _erc20Contract

    • Control: Fully controlled.

    • Constraints: Must be one of the whitelisted tokens (rETH, sfrxETH, wstETH, cbETH).

    • Impact: This is the token that is transferred out of the user's wallet to this contract.

  • _amount

    • Control: Fully controlled.

    • Constraints: Must be between minDeposit (0.1 Ether) and maxDeposit (100 Ether).

    • Impact: This is the amount of tokens transferred out of the user's wallet to this contract.

Branches and code coverage (including function calls)

Intended branches

  • User is successfully able to deposit all four tokens into the contract.

  • The correct events are successfully emitted.

Negative behavior

  • Deposit should fail if the user provides an unsupported token contract address.

  • Deposit should fail if claiming is open (i.e., depositing is closed).

Function call analysis

  • deposit -> _erc20Contract.transferFrom(msg.sender, address(this), _amount)

    • What is controllable?: _amount.

    • If return value 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?: If it reverts, nothing happens. If it reenters, no harm can be done as the checks-effects-interactions pattern is used.

Zellic © 2024Back to top ↑