Skip to main content
Oak Network supports multiple treasury models to accommodate different crowdfunding strategies. This section covers the available treasury types and their use cases.

Overview

Treasury contracts handle the actual fund collection and distribution in Oak Network. They are responsible for:
  • Fund Collection: Accepting contributions from backers
  • Fee Distribution: Distributing protocol and platform fees
  • Success Validation: Determining if campaigns meet their goals
  • Fund Disbursement: Releasing funds to campaign creators or backers

Available Treasury Models

All or Nothing

The All or Nothing model is the most common crowdfunding approach:
  • Success Condition: Campaign must reach its goal amount
  • Fund Release: Funds are only released if the goal is met
  • Refund Policy: All contributions are refunded if the goal is not met
  • Use Cases: Product launches, creative projects, charitable causes

Keep What’s Raised

The Keep What’s Raised model allows creators to keep all contributions:
  • Success Condition: Always considered successful
  • Fund Release: Funds are released regardless of goal achievement
  • Refund Policy: No refunds available
  • Use Cases: Ongoing projects, flexible funding, community support

Treasury Architecture

BaseTreasury

All treasury contracts inherit from BaseTreasury:

Key Functions

Fund Collection

Fee Distribution

Fund Withdrawal

Treasury Selection

Choosing the Right Model

All or Nothing

Best for:
  • Product launches with specific funding targets
  • Projects that require minimum funding to succeed
  • High-risk, high-reward projects
  • Campaigns with clear deliverables
Example Use Cases:
  • Hardware product development
  • Software development with specific milestones
  • Creative projects with production costs
  • Charitable causes with specific goals

Keep What’s Raised

Best for:
  • Ongoing projects and initiatives
  • Community support and donations
  • Flexible funding goals
  • Projects that can scale with available funds
Example Use Cases:
  • Open source software development
  • Community events and meetups
  • Research and development
  • Flexible creative projects

Advanced Treasury Features

Reward System Integration

Item Management

Fiat Integration

Treasury Lifecycle

Creation Phase

State Transitions

  1. Created: Treasury contract deployed and initialized
  2. Active: Campaign is live and accepting contributions
  3. Collecting: Contributions are being received
  4. Ended: Campaign deadline has passed
  5. Successful: Goal was reached, funds can be withdrawn
  6. Failed: Goal was not reached, refunds are available

Treasury Management

Campaign Owner Functions

Backer Functions

Best Practices

Treasury Design

  1. Clear Success Criteria: Define clear, measurable success conditions
  2. Appropriate Timeline: Set realistic campaign durations
  3. Fee Structure: Consider the impact of fees on campaign success
  4. Refund Policy: Clearly communicate refund policies to backers

Security Considerations

  1. Access Control: Implement proper permission checks
  2. Reentrancy Protection: Use checks-effects-interactions pattern
  3. Input Validation: Validate all user inputs
  4. Emergency Procedures: Have plans for pausing/cancelling campaigns

Gas Optimization

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

Next Steps