mapping(addressaccount=>uint256)privatebalances;// easy to understanding// uint256 amount = allowance[A][B], means that// B can transfer `amount` of token from A's balance to another one,// will reduce the allowance[A][B] each time the same amount that transferedmapping(addressaccount=>mapping(addressspender=>uint256))privateallowances;addressmsg_sender;// just who call the contracts function.
Assuming I'm the B , want to transfer tokens to C.
If I call the contract.transfer(C, 1)
It means reduce my(A) balance and add it to C's balance:
```c
address B = msg.sender; // me
address C = to;
balances[B] -=1;
balance[C] +=1;
Text Only
1 2 3 4 5 6 7 8 910
- If I call the `contract.transferFrom(A, C, 1)`
- It means I will use the allowance that A approve to me, then direct transfer tokens from A to C:
```c
address B = msg.sender; // me
address C = to;
address A = from;
allowance[A][B] -=1;
balance[A]-=1;
balacne[C]+=1;