Skip to content

Instantly share code, notes, and snippets.

@aunyks
Last active August 17, 2017 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aunyks/643fc6334b56b12e4f86e30c76c5c698 to your computer and use it in GitHub Desktop.
Save aunyks/643fc6334b56b12e4f86e30c76c5c698 to your computer and use it in GitHub Desktop.
contract MyERCToken {
// Create a table so that we can map
// the addresses of contract owners to
// those who are allowed to utilize the owner's contract
mapping(address => mapping (address => uint256)) allowed;
function approve(address _spender, uint256 _amount) returns (bool success) {
allowed[msg.sender][_spender] = _amount;
// Fire the event "Approval" to execute any logic
// that was listening to it
Approval(msg.sender, _spender, _amount);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment