Submitted by shw, also found by cccz, danb, and wuwe1
The implementation of the transferAndCall function in ERC677 is incorrect. It transfers the _value amount of tokens twice instead of once. Since the Flan contract inherits ERC667, anyone calling the transferAndCall function on Flan is affected by this double-transfer bug.
Below is the implementation of transferAndCall:
We can see that super.transfer(_to, _value); and _transfer(msg.sender, _to, _value); are doing the same thing - transfering _value of tokens from msg.sender to _to.
Referenced code:
ERC677/ERC677.sol#L28-L29
Remove _transfer(msg.sender, _to, _value); in the transferAndCall function.
gititGoro (Behodler) confirmed and commented:
