Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to keep array of admins and blacklisted #10

Open
madvas opened this issue Jan 25, 2023 · 0 comments
Open

No need to keep array of admins and blacklisted #10

madvas opened this issue Jan 25, 2023 · 0 comments
Assignees

Comments

@madvas
Copy link

madvas commented Jan 25, 2023

For purposes of this smart-contract there's no actual need to maintain arrays of admins and blacklisted. It's enough to just maintain isAdmin[*address*] and isBlacklisted[*address*] mappings. Looping through those lists cost unnecessary gas fees.

Function addAdmin should emit adminAdded event
Function removeAdmin should emit adminRemoved event
Function addBlacklisted should emit blacklistedAdded event (I suggest we rename addToBlacklist to addBlacklisted)
Function removeBlacklisted should emit blacklistedRemoved event
With these events we'll be able to construct list of admins and blacklisted on server-side so the whole list can be displayed in the UI.

address[] public admins;
address[] public blacklisted;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants