Skip to content

Instantly share code, notes, and snippets.

@jamesmurdza
Last active March 29, 2023 16:46
Show Gist options
  • Save jamesmurdza/250512d43cda025893fbdd40eb4440a3 to your computer and use it in GitHub Desktop.
Save jamesmurdza/250512d43cda025893fbdd40eb4440a3 to your computer and use it in GitHub Desktop.
Example of a smart contract
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