Skip to content

feat: Create Cloud Function for pool creation via PoolFactory #28

Description

@rafamiziara

Description

Develop a Firebase Cloud Function that interfaces with the PoolFactory smart contract to handle pool creation requests from the mobile application.

Acceptance Criteria

  • Create createPool Cloud Function endpoint
  • Implement contract interaction logic with PoolFactory
  • Add input validation and sanitization
  • Implement proper error handling and logging
  • Add transaction status tracking
  • Integrate with multi-sig Safe for admin actions
  • Add comprehensive unit tests

Technical Requirements

  • Use existing Firebase Functions architecture
  • Integrate with ethers.js for contract interaction
  • Implement proper gas estimation and management
  • Add transaction receipt verification
  • Include retry logic for failed transactions
  • Support both POL and ERC20 pool creation

Function Endpoints

  • POST /createPool - Create new lending pool
  • GET /poolStatus/:txHash - Check pool creation status
  • GET /pools - List created pools

Input Validation

  • Pool parameters validation (name, description, terms)
  • Token address validation (for ERC20 pools)
  • Creator authorization checks
  • Duplicate pool name prevention

Integration Features

  • PoolFactory contract interaction
  • Safe wallet integration for admin functions
  • Firestore integration for off-chain data
  • Event listening for PoolCreated events

Definition of Done

  • Cloud Function successfully creates pools via PoolFactory
  • Proper error handling and user feedback
  • Unit test coverage > 90%
  • Integration tests with contract on Amoy
  • API documentation complete

Metadata

Metadata

Assignees

Labels

comp: backendIssues for the Firebase Cloud Functions in packages/backend

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