Created
November 28, 2018 16:10
-
-
Save fromjyk/8be0499b3f0709ba04995ba8dd3039ac 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.4.20; | |
contract MyToken { // 모든 잔액에 대한 배열을 만듭니다. | |
mapping (address => uint256) public balanceOf; | |
// 컨트렉터에게 초기공급 토큰과의 계약을 초기화합니다. | |
function MyToken(uint256 initialSupply) public { | |
balanceOf[msg.sender] = initialSupply; // 컨트렉터에게 모든 초기토큰을 제공하십시오. | |
} | |
/* 코인 보내기 */ | |
function transfer(address _to, uint256 _value) public returns (bool success) { | |
require(balanceOf[msg.sender] >= _value); // 보낸 사람의 자산이 충분한지 확인합니다. | |
require(balanceOf[_to] + _value >= balanceOf[_to]); // 자산보다 넘게 보내는지 확인합니다. | |
balanceOf[msg.sender] -= _value; // 발신자에게서 입력한 값을 뺍니다. | |
balanceOf[_to] += _value; // 받는 사람에게 같은 값을 입력합니다. | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment