Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Pool Creation Wizard Implementation #256

@JosueBrenes

Description

@JosueBrenes

Description

Create an intuitive step-by-step wizard interface that guides users through the process of creating custom lending pools with the Blend Protocol. This feature will democratize pool creation and allow for more diverse lending opportunities.

What to Implement

  • Multi-step wizard with progress indication
  • Pool configuration validation and recommendations
  • Asset selection with balance verification
  • Parameter optimization suggestions
  • Cost estimation and deployment preview

Acceptance Criteria

  • 4-step wizard: Assets → Parameters → Review → Deploy
  • Form validation at each step with helpful error messages
  • Real-time cost estimation for pool deployment
  • Pool parameter recommendations based on best practices
  • Progress saving (users can return to incomplete wizards)
  • Integration with existing pool deployment helper

Technical Requirements

Files to Create

  1. Pool Creation Components Directory

    • Path: src/components/modules/pool-creation/
    • Contents: Wizard steps and related components
  2. Pool Creation Hook

    • Path: src/hooks/usePoolCreation.ts
    • Purpose: Wizard state management and validation
  3. Pool Validation Helper

    • Path: src/helpers/pool-validation.helper.ts
    • Purpose: Pool configuration validation logic
  4. Pool Recommendation Engine

    • Path: src/services/pool-recommendations.service.ts
    • Purpose: Parameter optimization suggestions
  5. Pool Creation Types

    • Path: src/@types/pool-creation.entity.ts
    • Purpose: TypeScript interfaces for wizard

New Route to Create

  • Path: src/app/dashboard/create-pool/page.tsx
  • Purpose: Pool creation wizard page

Wizard Step Implementation

Step 1: Asset Selection

Component: AssetSelectionStep.tsx

Features:

  • Multi-asset selection (USDC, XLM, TBRG)
  • Balance verification for each selected asset
  • Asset role configuration (collateral, borrowable)
  • Minimum balance requirements

Validation:

  • At least one asset must be selected
  • User must have sufficient balance for initial supply
  • Asset compatibility checks
interface AssetConfig {
  symbol: string;
  address: string;
  role: 'collateral' | 'borrowable' | 'both';
  initialSupply: string;
  userBalance: string;
  minInitialSupply: string;
}

Step 2: Pool Parameters

Component: ParametersStep.tsx

Features:

  • Collateral factors for each asset
  • Liquidation thresholds
  • Interest rate models
  • Backstop configuration
  • Maximum positions setting

Smart Recommendations:

  • Suggested parameters based on asset types
  • Risk level indicators
  • Comparison with existing successful pools
  • Parameter impact explanations
interface PoolParameters {
  name: string;
  backstopRate: number;
  maxPositions: number;
  reserves: ReserveConfig[];
}

interface ReserveConfig {
  asset: string;
  collateralFactor: number;
  liabilityFactor: number;
  targetUtilization: number;
  maxUtilization: number;
  baseRate: number;
  slope1: number;
  slope2: number;
}

Step 3: Review & Preview

Component: ReviewStep.tsx

Features:

  • Complete pool configuration summary
  • Cost breakdown (deployment + initial supply)
  • Risk assessment and warnings
  • Estimated APY calculations
  • Pool performance projections

Cost Estimation:

  • Smart contract deployment gas costs
  • Initial supply requirements
  • Ongoing operational costs
  • Total investment required

Step 4: Deployment

Component: DeploymentStep.tsx

Features:

  • Transaction sequence explanation
  • Real-time deployment progress
  • Error handling and retry mechanisms
  • Success confirmation with pool details
  • Next steps guidance

Wizard State Management

Wizard Context

interface PoolWizardState {
  currentStep: number;
  completed: boolean;
  assets: AssetConfig[];
  parameters: PoolParameters;
  review: ReviewData;
  deployment: DeploymentStatus;
  validation: ValidationResults;
}

interface WizardActions {
  goToStep: (step: number) => void;
  nextStep: () => void;
  previousStep: () => void;
  updateAssets: (assets: AssetConfig[]) => void;
  updateParameters: (params: PoolParameters) => void;
  saveProgress: () => void;
  loadProgress: () => void;
  resetWizard: () => void;
}

Progress Persistence

  • Save wizard state to localStorage
  • Resume incomplete wizards
  • Clear saved state after successful deployment
  • Handle expired saved states

Validation Engine

Asset Validation

  • Sufficient user balance
  • Valid asset addresses
  • Supported asset types
  • Minimum supply requirements

Parameter Validation

  • Collateral factor ranges (0-95%)
  • Interest rate model constraints
  • Backstop rate limits
  • Pool risk assessment

Economic Validation

  • Pool viability analysis
  • Liquidity requirements
  • Risk/reward balance
  • Market demand assessment

Recommendation System

Parameter Optimization

interface ParameterRecommendation {
  parameter: string;
  currentValue: number;
  recommendedValue: number;
  reasoning: string;
  impact: 'positive' | 'negative' | 'neutral';
  confidence: number; // 0-1
}

Best Practice Suggestions

  • Industry standard ranges
  • Similar pool analysis
  • Risk mitigation advice
  • Liquidity optimization tips

UI/UX Design

Wizard Layout

┌─ Progress Bar ──────────────────────┐
│  ●━━━○━━━○━━━○  Step 2 of 4          │
├─ Step Content ─────────────────────┤
│                                    │
│  [Step-specific content here]      │
│                                    │
├─ Navigation ───────────────────────┤
│  [Back]  [Save Progress]  [Next]   │
└───────────────────────────────────┘

Visual Design Elements

  • Progress indicator with step names
  • Visual validation feedback
  • Warning and info callouts
  • Parameter impact visualizations
  • Cost estimation breakdowns

Responsive Design

  • Mobile-friendly step layouts
  • Touch-optimized form controls
  • Scrollable content areas
  • Optimized for smaller screens

Advanced Features

Pool Templates

  • Pre-configured pool types (Conservative, Moderate, Aggressive)
  • Template customization options
  • Community-shared templates
  • Template performance analytics

Collaborative Creation

  • Multi-user pool creation (future)
  • Shared ownership structures
  • Governance parameter setting
  • Stakeholder approval flows

Integration Features

  • Import from existing pools
  • Clone and modify existing configurations
  • Batch pool creation
  • API integration for external tools

Error Handling

Validation Errors

  • Real-time field validation
  • Clear error messaging
  • Suggestions for fixing errors
  • Progress blocking for critical errors

Deployment Errors

  • Transaction failure recovery
  • Gas estimation errors
  • Network connectivity issues
  • Smart contract deployment failures

User Experience

  • Auto-save progress on errors
  • Clear recovery instructions
  • Support contact information
  • Detailed error logs for debugging

Testing Strategy

Unit Tests

  • Validation logic testing
  • Parameter calculation accuracy
  • State management correctness
  • Error handling coverage

Integration Tests

  • End-to-end wizard flow
  • Backend integration
  • Transaction processing
  • Error recovery scenarios

User Testing

  • Wizard usability testing
  • Parameter recommendation accuracy
  • Mobile experience validation
  • Accessibility compliance

Performance Considerations

  • Lazy load wizard steps
  • Efficient validation debouncing
  • Optimized parameter calculations
  • Responsive UI during deployments

Security Considerations

  • Input sanitization
  • Parameter bounds checking
  • Transaction simulation before deployment
  • User authorization verification

Dependencies

  • Existing pool deployment helper
  • Blend Protocol SDK
  • Form validation library (react-hook-form + zod)
  • Cost estimation APIs
  • Parameter recommendation algorithms

Definition of Done

  • All 4 wizard steps are fully functional
  • Validation works correctly for all inputs
  • Pool deployment integrates with existing system
  • Cost estimation is accurate
  • Parameter recommendations are helpful
  • Progress saving and resuming works
  • Mobile experience is optimized
  • Error handling covers all scenarios
  • Performance meets requirements
  • Security measures are implemented

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions