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
account
Control: Full control.
Constraints: If
account
is not equal tomsg.sender
,msg.sender
should beisApprovedOperator
.Impact: The deposit is credited to this account.
token
Control: Full control.
Constraints: No constraints.
Impact: The specified token address will be transferred.
amount
Control: Full control.
Constraints: The
funder
should have enough tokens to transfer.Impact: The specified token amount will be transferred.
fromOperator
Control: 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.sender
has provided tokens to the contract in the casefromOperator
is true.The
account
has provided tokens to the contract in the casefromOperator
is 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?
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? 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
.