Is it possible to have unique constraint on parameters of an event? I will have a number of users using my Dapp, and I have provided functionality to delete the users. So while reading from the transaction log, I will get a list of all the users created to date. I want only the users that are active on my Dapp.

  • Too general. Please show your code and ask for more specific guidance on it. – goodvibration Apr 16 at 16:03

To get the active set users you need to combine the transaction logs of

All created users - All deleted users

Or considering storing your users in EnumerableSet and you can directly query the active users using smart contract calls, instead of events.

| improve this answer | |
  • What if the same user with the same public address decides to create an account again? This method won't work then, right? – Mayur Choudhary Apr 17 at 9:25
  • Also will using EnurmerableSet be cheap? As each user has its own struct. – Mayur Choudhary Apr 17 at 9:27
  • It is as cheap as it gets. Also naturally you can check in your createAccount if the address already exists in the set. – Mikko Ohtamaa Apr 17 at 10:28

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