DeclarationError: Undeclared identifier.on line 8,12,14.
1 Answer
_success
is not defined anywhere. Is just a parameter of the event isNotify
but is not a field neither in your function nor in your contract.
So you need to define your local field and then use it to emit the event.
function register(string _name) public {
bool _success = false;
if (nameToAddress[_name] == address(0)) {
nameToAddress[_name] = msg.sender;
_success = true;
}
emit isNotify(_success);
}
please note that tx.oring
is not safe to use, better to use msg.sender
; more info here and here.