-
-
Save troverman/809dba32d8510e7713aaa5c869e607ae to your computer and use it in GitHub Desktop.
ERC888
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
contract MultidimensionalToken { | |
mapping (address => mapping (string => uint)) balances; | |
event Transfer(address indexed _from, address indexed _to, string indexed _id, uint256 _value); | |
function balanceOf(address _owner, string _id) constant returns (uint256 balance) { | |
return balances[_owner][_id]; | |
} | |
function transfer(address _to, string _id, uint256 _value) returns (bool success) { | |
if (balances[msg.sender][_id] >= _value && _value > 0) { | |
balances[msg.sender][_id] -= _value; | |
balances[_to][_id] += _value; | |
Transfer(msg.sender, _to, _id, _value); | |
return true; | |
} | |
else {return false;} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment