1

Does vyper have an equivalent of a hashset? The documentation doesn't say anything about a hashset, but given the existence of a hashmap, I imagine a hashset would be simple to have.

1 Answer 1

0

There's no need to use a separate type. You can use a hashmap with bool as target type

exampleSet: HashMap[address, bool]

Then you can use

if exampleSet[msg.sender]:
    # Remove msg.sender
    exampleSet[msg.sender] = False
else:
    # Add msg.sender
    exampleSet[msg.sender] = True

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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