Assessment reports>Y2K Finance>Threat Model>withdrawFromQueue

Function: withdrawFromQueue(address receiver, address owner)

This can be called only after requestWithdrawal. It allows the owner or user who has allowance to withdraw asset tokens that have been queued for withdrawal.

Inputs

  • 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

  • withdrawQueue[owner].shares == 0.

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

Function call analysis

  • _previewQueuedWithdraw(owner)

    • What is controllable? owner.

    • If return value controllable, how is it used and how can it go wrong? Return the full amount of shares in queue and calculate the appropriate amount of asset tokens.

    • What happens if it reverts, reenters, or does other unusual control flow? There is no problem.

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

Zellic © 2024Back to top ↑