Im trying to do what The DAO did and do something when a sender sent money to my contract address. But im not sure how to. The something I want to do is to just create a new user in a mapping with the string sent in the msg.data object.
I have heard about the fallback function, and thought I could extract the msg.data. But that seems to be bytes. Do I have to convert it? If so how do you do that?
Here is my code:
Premium.sol
struct User {
address user;
bool paid;
}
mapping(string => User) PremiumUsers;
address owner;
function Premium() {
owner = msg.sender;
}
function () {
var mail = byteconverterToString(msg.data);
var newUser = PremiumUsers[mail];
newUser.user = msg.sender;
newUser.paid = true;
}