Assessment reports>Y2K Finance>Threat Model>deposit

Function: deposit(uint256 assets, address receiver)

If fundsDeployed is true, the deposit will be done over _queueDeposit. It allows any caller to perform deposit of assets tokens and receive the shares. In case fundsDeployed == true, then the funds will be placed in the deposit queue.

Inputs

  • assets

    • Constraints: The caller should own this amount of asset tokens.

    • Impact: The amount of asset tokens will be deposited.

  • receiver

    • Constraints: N/A.

    • Impact: The receiver of shares.

Branches and code coverage (including function calls)

Intended branches

  • The balance of the receiver's shares has increased properly.

  • The asset balance of msg.sender decreased by assets amount.

Negative behavior

  • The balance of msg.sender is less than assets.

Function call analysis

  • _queueDeposit(receiver, assets)

    • What is controllable? receiver and assets.

    • 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? The function is called in case of fundsDeployed == true after the deployPosition function call by owner. Will revert if assets is less than minDeposit, if queueContract has not been approved from msg.sender.

  • asset.safeTransferFrom(msg.sender, address(this), assets);

    • What is controllable? N/A.

    • 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 current contract does not have an approve from msg.sender and if balance of msg.sender is less than assets amount.

  • _mint(receiver, shares);

    • What is controllable? receiver.

    • 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? There is no problem.

  • hook.addr.afterDeposit(assets)

    • What is controllable? assets.

    • 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 reenter but without negative impact because the function is called after all states changes.

Zellic © 2024Back to top ↑