Function: transferFrom(address _sender, address _recipient, uint256 _amount)
Allows transferring tokens from an account to another.
Inputs
_sender
Control: Fully controlled by the caller.
Constraints: None --- only checked that
msg.sender
has enough allowance for the particular_sender
.Impact: The account that will send the tokens.
_recipient
Control: Fully controlled by the caller.
Constraints: None.
Impact: The account that will receive the tokens.
_amount
Control: Fully controlled by the caller.
Constraints: Ensured that
msg.sender
has enough allowance for the particular_sender
.Impact: The amount of tokens to be transferred.
Branches and code coverage (including function calls)
Intended branches
Assumes no malicious intent on behalf of the handler.
If
msg.sender
is the handler, do not check allowance.Checks that the
_sender
has enough balance. Ensured in_transfer
.Checks that the
_recipient
is not the zero address. Ensured in_transfer
.Checks that the
_amount
is greater than zero. Ensured in_transfer
.Decreases the
balances
for the_sender
. Ensured in_transfer
.Increases the
balances
for the_recipient
. Ensured in_transfer
.Decreases the allowance of
_sender
formsg.sender
by_amount
. Ensured in_approve
.Ensures enough allowance for
msg.sender
has been granted by_sender
.
Negative behavior
Should not allow tranferring more tokens than the
_sender
has, even if the allowance is greater than the balance.Should not allow transferring more tokens than the allowance granted by the
_sender
.