I want to require two variables for the execution of my function, firstly a string shall not be undefined and then a mapping (address => uint) that shall be undefined. In the latter case, I have user numbers from 0...n, so 0 would be the first user. Is there an easy way to do this, or do I have to do complicated workarounds with eg. keccak hashes?
struct userData {
string name;
string role;
mapping (address => uint) accountToId;
}
mapping (address => userData) addressToUserData;
function register(string _name, string _role) public {
require(_name !== false); // to avoid empty names
require(addressToUserData[msg.sender] == false); // make sure mapping is undefined
addressToUserData[msg.sender] = userData(_name, _role);
}
[I hope by now there is better solution than this]