-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Hi, the implementation of your logic is excellent, I had some suggestion tho. While adding participants I see that you call/define a function every time. I have some improvements on your code which will make it follow the DRY principle. Right now there is a lot of repetitive code which does not make your code dry and difficult to comprehend easily. Instead o specifying so many functions why don't you try using a single function
// Participant Characteristic.
struct participant {
string userName;
string password;
string participantType;
address participantAddress;
}
mapping(uint32 => participant) public participants;
function addParticipant(
string memory _name,
string memory _pass,
address _pAdd,
string memory _pType
) public returns (uint32) {
uint32 userId = participant_id++;
participants[userId].userName = _name;
participants[userId].password = _pass;
participants[userId].participantAddress = _pAdd;
participants[userId].participantType = _pType;
return userId;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels