Skip to content

GoodCollective pools should support BulkAdd members #307

@L03TJ3

Description

@L03TJ3

For DirectPayments and UbiPools only supports adding single members.
for some use-cases, with pre-defined larger member lists, it would make sense to support BulkAdding members.

OpenZeppelin’s AccessControl only exposes single-account grantRole/revokeRole.
there’s no native batch helper, so bulk member adds are commonly implemented by looping over an address[] in a custom function.
Gas is linear in addresses, so batches must stay below block limits.

  • Contract changes (both factories + pools):
  1. add addMembers(address[] ...) callable by pools/managers
  2. emit event,
  3. reuse current validation (uniqueness/membersValidator/onlyMembers), ensure factory memberPools registry updates per new member without double-counting. add revert/skip strategy for invalid entries.
  • Contract tests:
  1. Hardhat specs for UBI and DirectPayments factories/pools covering happy path (bulk adds all),
  2. mixed valid/invalid members, duplicate handling,
    3/ onlyPool/manager gating, and member registry lookups.
  • SDK changes (packages/sdk-js/src/goodcollective/goodcollective.ts):
  1. expose bulk method(s) to call new contract functions; update types/ABIs and regenerate typechain if needed.
  2. add a flow that returns the amount of gas and native token required for executing the bulk-add-member.

To keep in mind:

  • Research a bit on how to keep gas consumption at a minimum
  • Handle reverts gracefully, potentially hardcoding the max amount of members (above which it would not fit in a block)

Metadata

Metadata

Assignees

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions