Function: withdraw(address token, uint256 amount)
This function allows the InfiniCard Vault to withdraw a specified amount of the token from the strategy vault.
Inputs
token
Control: Controlled by the caller with
INFINI_CARD_VAULT
.Constraints: None.
Impact: The token to withdraw.
amount
Control: Controlled by the caller with
INFINI_CARD_VAULT
.Constraints: None.
Impact: The amount of tokens to withdraw.
Branches and code coverage
Intended branches
Retrieves the vault's balance of the token.
Sets
actualAmount
tovaultBalance
if the vault's balance is smaller than the amount; otherwise, it setsactualAmount
toamount
.Transfers the
actualAmount
of tokens from the vault.
Negative behavior
Reverts if the caller does not have the
INFINI_CARD_VAULT
role.