Skip to content

Instantly share code, notes, and snippets.

@troverman

troverman/ERC888 Secret

Last active July 4, 2018 21:04
Show Gist options
  • Save troverman/809dba32d8510e7713aaa5c869e607ae to your computer and use it in GitHub Desktop.
Save troverman/809dba32d8510e7713aaa5c869e607ae to your computer and use it in GitHub Desktop.
ERC888
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