Skip to main content
Campaigns are the heart of Oak Network. This section covers how campaigns work, their lifecycle, and how to manage them effectively.

Campaign Structure

CampaignData

Every campaign is defined by a CampaignData struct:

Campaign States

Campaigns can exist in several states:
  • Created: Campaign created but not yet active
  • Active: Campaign is live and accepting contributions
  • Paused: Campaign temporarily suspended
  • Cancelled: Campaign permanently cancelled
  • Successful: Campaign reached its goal
  • Failed: Campaign deadline passed without reaching goal

Campaign Creation

Prerequisites

Before creating a campaign, ensure you have:
  1. Valid Creator Address: Must be a valid Ethereum address
  2. Unique Identifier: Each campaign needs a unique bytes32 identifier
  3. Selected Platforms: At least one platform must be selected
  4. Valid Parameters: Launch time, deadline, and goal amount must be valid

Creation Process

Validation Rules

The protocol enforces several validation rules:
  • Launch Time: Must be in the future
  • Deadline: Must be after launch time
  • Goal Amount: Must be greater than zero
  • Platforms: Must be listed and valid
  • Identifier: Must be unique across all campaigns

Campaign Management

Parameter Updates

Campaign owners can update certain parameters before the campaign launches:

Launch Time Update

Deadline Update

Goal Amount Update

Platform Management

Adding Platforms

Campaign Lifecycle Events

Key Events

State Transitions

Access Control

Owner Functions

Only the campaign owner can:
  • Update campaign parameters (before launch)
  • Transfer ownership
  • Cancel the campaign

Admin Functions

Protocol and platform admins can:
  • Pause/unpause campaigns
  • Cancel campaigns (in emergencies)
  • Access campaign data

Public Functions

Anyone can:
  • View campaign information
  • Contribute to active campaigns
  • Claim refunds (when applicable)

Best Practices

Campaign Design

  1. Realistic Goals: Set achievable funding targets
  2. Appropriate Timeline: Balance urgency with feasibility
  3. Clear Communication: Provide detailed campaign information
  4. Platform Selection: Choose platforms that align with your audience

Security Considerations

  1. Parameter Validation: Always validate user inputs
  2. Access Control: Implement proper permission checks
  3. Emergency Procedures: Have plans for pausing/cancelling
  4. Regular Monitoring: Monitor campaign progress and health

Gas Optimization

  1. Batch Operations: Group related operations when possible
  2. Efficient Storage: Use appropriate data types
  3. Event Optimization: Emit only necessary events
  4. Function Optimization: Minimize external calls

Common Patterns

Campaign Factory Pattern

Campaign Monitoring

Next Steps