Function: deposit(address account, address token, uint256 amount, bool fromOperator)
This function allows an account itself or approved operator to provide the deposit of the arbitrary token. Funds can be provided from the operator or from the account, depending on the fromOperator. But only the account will be credited.
Inputs
accountControl: Full control.
Constraints: If
accountis not equal tomsg.sender,msg.sendershould beisApprovedOperator.Impact: The deposit is credited to this account.
tokenControl: Full control.
Constraints: No constraints.
Impact: The specified token address will be transferred.
amountControl: Full control.
Constraints: The
fundershould have enough tokens to transfer.Impact: The specified token amount will be transferred.
fromOperatorControl: Full control.
Constraints: No constraints.
Impact: If true, tokens will be transferred from the caller.
Branches and code coverage
Intended branches
The provided account address has been credited by the specified amount.
The
msg.senderhas provided tokens to the contract in the casefromOperatoris true.The
accounthas provided tokens to the contract in the casefromOperatoris false.
Negative behavior
The caller is not an account and is not an approved operator.
Function call analysis
SafeTransferLib.safeTransferFrom(token, funder, address(this), amount)What is controllable?
tokenandamount.If the return value is controllable, how is it used and how can it go wrong? This function does not return a value.
What happens if it reverts, reenters or does other unusual control flow? Reverts if the funder does not have enough balance or has not approved a sufficient allowance.
CLOBManagerStorageLib.creditAccount(ds, account, token, amount)What is controllable?
account,token, andamount.If the return value is controllable, how is it used and how can it go wrong? This function does not return a value.
What happens if it reverts, reenters or does other unusual control flow? This function increases the internal account balance with the specified
amount.