Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.

Commit

Permalink
token-erc20: add event Approval to follow eip20
Browse files Browse the repository at this point in the history
> MUST trigger on any successful call to approve(address _spender, uint256 _value).

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#approval

We audited many tokens without event Approval.
Should comply EIP20 for a better dApp ecosystem.
  • Loading branch information
p0n1 committed Jun 9, 2018
1 parent 2dda522 commit 8f1a022
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions solidity/token-erc20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ contract TokenERC20 {

// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);

// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);

// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
Expand Down Expand Up @@ -97,6 +100,7 @@ contract TokenERC20 {
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}

Expand Down

0 comments on commit 8f1a022

Please sign in to comment.