0

Please suggest that how two restric subscriber for single entry means no one can join twice.

function selectionW1(address subscribersW1, uint subscriberWheelW1) public  {

    require (subscriberWheelW1 == 1 && subscriberListW1.length < 2);
    subscriberListW1.push(subscribersW1);
    subscriberstructsW1[subscribersW1].W1 = subscriberWheelW1;

}
1

Use a mapping of bools to check if the user has already used the function:

mapping(address => bool) public registered.

function selectionW1(address subscribersW1, uint subscriberWheelW1) public  {

    require (subscriberWheelW1 == 1 && subscriberListW1.length < 2);
    require(!registered[msg.sender])
    registered[msg.sender] = true;
    subscriberListW1.push(subscribersW1);
    subscriberstructsW1[subscribersW1].W1 = subscriberWheelW1;

}

That will do. Hope this helps you.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.