Intercoin / CommunityContract

Smart contract for managing community membership and roles
https://intercoin.org
GNU Affero General Public License v3.0
1 stars 2 forks source link

Make getAddresses without any params #21

Closed EGreg closed 1 year ago

EGreg commented 1 year ago

It would return all roles and the addresses in all roles. Basically it would make a loop through all roles, and return the following array:

[ addressesForRole0, addressesForRole1, addressesForRole2, ]

If a role index wasn't being used somehow, then send empty array of addresses for that role

Also here please rename rolesIndex to roleIndex ... also here rename to roleIndexes everywhere rename "rolesIndex" to "roleIndex" in the code

EGreg commented 1 year ago

You should probably modify getAddresses(roles) to return the above format, but in this case role0, role1 would not be the roles with index 0, 1 in roles array, but rather in the array passed

See if you use this format of getAddresses in any other repos, and then change the expected result from a single-dimensional array (concatenated basically) to a two-dimensional array.

Then duplicates look better, anyway.

EGreg commented 1 year ago

Example for getAddresses([2, 5, 7]) => [ [0x..., 0x....], [0x....], [] ]

EGreg commented 1 year ago

Also implement getAddressesByRole(roleIndex, offset, limit)

artman325 commented 1 year ago

If a role index wasn't being used somehow, then send empty array of addresses for that role

getAddresses(uint8 rolesIndex) replaced with getAddresses(uint8[] calldata roleIndexes) Also if roleIndexes is empty then need to use function signature getAddresses without paramaters like getAddresses(),