Skip to content

refactor(contracts): Modify PoolFactory for MVP - Remove poolOwner parameter #68

Description

@rafamiziara

Overview

Update PoolFactory contract for MVP with lazy whitelisting. Pool ownership is automatically assigned to transaction sender, and authorization is managed via backend lazy whitelisting.

Tasks

  • Keep onlyAuthorizedCreator modifier on createPool() function (spam protection)
  • Remove poolOwner from PoolParams struct
  • Set poolOwner = msg.sender automatically in createPool() function
  • Keep whenNotPaused, nonReentrant, and _validatePoolOwner() for security
  • Update contract tests to reflect new parameter structure

Lazy Whitelisting Approach

Instead of removing authorization completely, we're implementing lazy whitelisting:

  • ✅ Only authenticated app users can create pools (spam protection)
  • ✅ Backend automatically whitelists users on first pool creation attempt
  • ✅ User pays pool creation gas, backend pays whitelisting gas
  • ✅ Maintains decentralization (users submit transactions directly)
  • ✅ Can revoke access if needed

Acceptance Criteria

  • Contract compiles without errors
  • Pool owner is automatically set to msg.sender
  • onlyAuthorizedCreator modifier remains active
  • All security modifiers remain in place
  • Tests pass with updated parameter structure

Related Documentation

  • See .dev/POOL_CREATION_ARCHITECTURE.md Phase 3 (Lazy Whitelisting)
  • See .dev/POOL_CREATION_TASKS.md Tasks 1-3

Depends On

Backend lazy whitelisting function (Issue #83)

Part of Epic

#35

Metadata

Metadata

Assignees

Labels

comp: contractsIssues related to the smart contracts in packages/contractstype: refactorImproving code structure without changing its external behavior

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions