Assessment reports>Y2K Finance>Threat Model>withdraw

### Function: withdraw(uint256 shares, address receiver, address owner)

The user cannot withdraw if fundsDeployed is true. It allows to withdraw assets tokens from strategy.

### Inputs

  • shares

    • Constraints: If shares is less than the owner balance, the function will be reverted during burn.

    • Impact: The amount of shares to withdraw. The asset number will be calculated using the shares amount.

  • receiver

    • Constraints: No verification, but if msg.sender is not an owner, allowance[owner][msg.sender] should be more than or equal to shares.

    • Impact: The address of the receiver of asset tokens.

  • owner

    • Constraints: withdrawQueue[owner].shares should not be zero.

    • Impact: The owner of shares.

Branches and code coverage (including function calls)

Intended branches

  • The assets tokens were transferred properly and shares were burned.

Negative behavior

  • msg.sender != owner and allowance < shares.

  • The balance of owner is less than shares.

Function call analysis

  • _withdraw(assets, shares, receiver, owner)

    • What is controllable? receiver and owner.

    • 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? Can revert if asset balance of the contract is less than assets amount. Also, it can revert if the owner does not have enough shares.

Zellic © 2024Back to top ↑