Last active
March 29, 2023 16:46
-
-
Save jamesmurdza/250512d43cda025893fbdd40eb4440a3 to your computer and use it in GitHub Desktop.
Example of a smart contract
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.8.0; | |
contract MyToken { | |
mapping(address => uint) public balanceOf; | |
constructor(uint _initialSupply) { | |
balanceOf[msg.sender] = _initialSupply; | |
} | |
function transfer(address _to, uint _value) public { | |
require(balanceOf[msg.sender] >= _value); | |
balanceOf[msg.sender] -= _value; | |
balanceOf[_to] += _value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment