Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contract MyToken {
- string public name;
- string public symbol;
- uint8 public decimals;
- uint numContact;
- struct Contact{
- //address alamat;
- string name;
- string phone;
- }
- mapping (address => uint256) public balanceOf;
- mapping (uint => Contact) contacts;
- function MyToken(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol) {
- balanceOf[msg.sender] = initialSupply;
- name = tokenName;
- symbol = tokenSymbol;
- decimals = decimalUnits;
- }
- function transfer(address _to, uint256 _value) {
- if (balanceOf[msg.sender] < _value || balanceOf[_to] + _value < balanceOf[_to])
- throw;
- balanceOf[msg.sender] -= _value;
- balanceOf[_to] += _value;
- }
- function saveContact(string _name, string _phone) returns (uint ContactID){
- ContactID = numContact++;
- Contact c = contacts[ContactID];
- //c.alamat = _alamat;
- c.name = _name;
- c.phone = _phone;
- }
- }
Add Comment
Please, Sign In to add comment