Created
April 19, 2020 17:48
-
-
Save agoiabel/d33b69e1e431b9b38a59721f39f1e168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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