Skip to content

Instantly share code, notes, and snippets.

@agoiabel
Created April 19, 2020 17:48
Show Gist options
  • Save agoiabel/d33b69e1e431b9b38a59721f39f1e168 to your computer and use it in GitHub Desktop.
Save agoiabel/d33b69e1e431b9b38a59721f39f1e168 to your computer and use it in GitHub Desktop.
pragma solidity ^0.6.4;
contract Token {
...
...
mapping(address => uint) public balanceOf;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function transfer(address _to, uint _value) public returns (bool success) {
require(_to != address(0));
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment