Verified contractPartial
MyToken
Address0xbc57e1b65011aa7ffb16edf2ff0156117e8204e2
- Balance
0 ETH
- Transactions
3
- Compiler
solc 0.4.21
- Same code
3 more contracts
Details
- Compiler
- solc 0.4.21+commit.dfe3193c
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 8,604,368
- Creation transaction
- 0xac0b67e3b6…b697c9242f
MyToken.sol
pragma solidity ^0.4.21;
contract MyToken {
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;
/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);
/* Initializes contract with initial supply tokens to the creator of the contract */
function MyToken(uint256 _supply, string _name, string _symbol, uint8 _decimals) public{
/* if supply not given then generate 1 million of the smallest unit of the token */
if (_supply == 0) _supply = 1000000;
/* Unless you add other functions these variables will never change */
balanceOf[msg.sender] = _supply;
name = _name;
symbol = _symbol;
/* If you want a divisible token then add the amount of decimals the base unit has */
decimals = _decimals;
}
/* Send coins */
function transfer(address _to, uint256 _value) public{
/* if the sender doenst have enough balance then stop */
if (balanceOf[msg.sender] < _value) require(balanceOf[msg.sender] < _value);
if (balanceOf[_to] + _value < balanceOf[_to]) require(balanceOf[msg.sender] < _value);
/* Add and subtract new balances */
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
/* Notifiy anyone listening that this transfer took place */
emit Transfer(msg.sender, _to, _value);
}
}Compiler settingsShow
{
"optimizer": {
"runs": 0,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.