Function: withdraw(uint256 shares, address receiver, address owner)
Withdraws assets by burning shares and transferring assets to the receiver
Inputs
sharesControl: Fully controlled.
Constraints: No constraints.
Impact: The amount of shares to burn for withdrawal.
receiverControl: Fully controlled.
Constraints: No constraints.
Impact: The address to receive the withdrawn assets.
ownerControl: Fully controlled.
Constraints: Owner should either be the caller of the function or should have enough allowance
Impact: The owner of the shares.
Branches and code coverage (including function calls)
Intended branches
The function calculates the assets to be withdrawn based on shares.
If the sender is not the owner, it updates the allowance for the sender to spend the owner's shares.
The function calls
beforeWithdrawto perform any necessary prewithdraw actions.The function burns the specified shares from the owner's balance.
The function emits a
Withdrawevent.The function transfers assets to the receiver.
Negative behavior
The function reverts if the sender tries to withdraw more shares than allowed by their allowance.
Function call analysis
beforeWithdraw(assets, shares)What is controllable?
assetsandshares.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 the
beforeWithdrawreverts, the entire function would revert.
_burn(owner, shares)What is controllable?
ownerandshares.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 the burning of shares fails, it will revert and the transaction will be rolled back.
asset.safeTransfer(receiver, assets)What is controllable?
receiverandassets.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 the asset transfer fails, it will revert and the transaction will be rolled back.