Skip to content

Instantly share code, notes, and snippets.

@rollendxavier
Created November 13, 2024 11:14
Show Gist options
  • Save rollendxavier/641fff023aa08a254a3a7b9c5589b3b2 to your computer and use it in GitHub Desktop.
Save rollendxavier/641fff023aa08a254a3a7b9c5589b3b2 to your computer and use it in GitHub Desktop.
Solidity Contract File
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MyToken {
    string public name = "MyToken";
    string public symbol = "MTK";
    uint8 public decimals = 18;
    uint256 public totalSupply = 1000000 * 10 ** uint256(decimals);
    mapping(address => uint256) public balanceOf;
    constructor() {
        balanceOf[msg.sender] = totalSupply;
    }
    function transfer(address _to, uint256 _value) public returns (bool success) {
        require(balanceOf[msg.sender] >= _value);
        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