Skip to content

christex-foundation/osusu-starter

Repository files navigation

Osusu - Rotating Savings Pool on Solana

A decentralized application (dApp) for creating and managing Osusu groups (rotating savings and credit associations) on the Solana blockchain. Built with Anchor framework and Next.js.

πŸ“– What is Osusu?

Osusu is a traditional West African savings system where a group of people contribute a fixed amount of money at regular intervals. Each cycle, one member receives the entire pot, rotating until everyone has received a payout. This smart contract brings this time-tested financial practice to Web3.

✨ Features

Current Implementation

  • Create Osusu Groups: Set up rotating savings pools with customizable contribution amounts
  • Member Management: Automatically includes creator as member with ability to add multiple participants
  • Contribution System: Members contribute fixed SOL amounts per cycle
  • Automated Payouts: Authority triggers payouts to members in rotation order
  • Group Dashboard: View all groups where you're a member or authority
  • Real-time Balance Tracking: Monitor vault balances and total contributions
  • Wallet Integration: Seamless Solana wallet connection and management

Smart Contract Architecture

This dApp contains:

  • Solana Program: Written in Rust using the Anchor framework
  • Frontend: Next.js app with React and TypeScript
  • Styling: Tailwind CSS with custom UI components
  • Wallet Support: Integration with @solana/web3.js and Solana Wallet Adapter

Getting Started

Prerequisites

Installation

Clone the repository and install dependencies:

git clone <repository-url>
cd osusu
npm install

Quick Start

  1. Build the Solana program:

    npm anchor-build
  2. Deploy to Devnet:

    anchor deploy --provider.cluster devnet
  3. Start the frontend:

    npm dev
  4. Open your browser: Navigate to http://localhost:3000 and connect your Solana wallet.

πŸ“ Project Structure

osusu/
β”œβ”€β”€ anchor/                   # Solana program
β”‚   β”œβ”€β”€ programs/osusu/      # Smart contract source code
β”‚   β”‚   └── src/lib.rs       # Main program logic
β”‚   β”œβ”€β”€ tests/               # Program tests
β”‚   └── Anchor.toml          # Anchor configuration
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                 # Next.js app directory
β”‚   β”œβ”€β”€ components/          # React components
β”‚   β”‚   β”œβ”€β”€ osusu/          # Osusu-specific components
β”‚   β”‚   β”œβ”€β”€ cluster/        # Network cluster management
β”‚   β”‚   └── solana/         # Wallet provider components
β”‚   └── lib/                # Utility functions
└── package.json

Apps

anchor

This is a Solana program written in Rust using the Anchor framework.

Commands

You can use any normal anchor commands. Either move to the anchor directory and run the anchor command or prefix the command with npm, eg: npm anchor.

Sync the program id:

Running this command will create a new keypair in the anchor/target/deploy directory and save the address to the Anchor config file and update the declare_id! macro in the ./src/lib.rs file of the program.

You will manually need to update the constant in anchor/lib/counter-exports.ts to match the new program id.

npm anchor keys sync

Build the program:

npm anchor-build

Start the test validator with the program deployed:

npm anchor-localnet

Run the tests

npm anchor-test

Deploy to Devnet

npm anchor deploy --provider.cluster devnet

web

This is a React app that uses the Anchor generated client to interact with the Solana program.

Commands

Start the web app

npm dev

Build the web app

npm build

πŸ—οΈ Implementation Phases

The Osusu smart contract was built in progressive phases:

Phase 1: Core Functionality βœ…

  • Basic group initialization with members and contribution amounts
  • Member contribution mechanism (transfer SOL to group vault)
  • Payout system with rotation logic
  • Authority-based payout trigger
  • PDA (Program Derived Address) vault for secure fund storage

Phase 2: Enhanced Features 🚧

Ideas for extending the current implementation:

Security & Validation

  • Add group size limits (min/max members)
  • Implement contribution deadlines
  • Add emergency pause mechanism
  • Member verification before contributions
  • Slashing mechanism for missed contributions

Scheduling & Automation

  • Time-based contribution windows
  • Automated payout scheduling using Clockwork
  • Missed contribution penalties
  • Grace period for late contributions

Governance

  • Democratic voting for rule changes
  • Multi-signature authority for large groups
  • Dispute resolution mechanism
  • Member removal/replacement voting

πŸš€ Additional Features Students Can Implement

Beginner Level

  1. Contribution History

    • Track individual member contribution records
    • Display contribution timestamps
    • Add contribution counter per member
  2. Group Status Indicators

    • Active/Inactive/Completed status
    • Visual progress tracking
    • Cycle completion percentage
  3. Member Profiles

    • On-chain reputation scores
    • Contribution reliability metrics
    • Participation badges/NFTs
  4. Basic Notifications

    • Event logs for contributions
    • Payout completion events
    • New member joining events

Intermediate Level

  1. Flexible Contribution Amounts

    • Allow variable contributions (weighted payouts)
    • Bonus contributions for early payers
    • Minimum/maximum contribution limits per cycle
  2. Multiple Payout Strategies

    • Lottery-based selection (random winner)
    • Bidding system (highest bidder gets payout first)
    • Need-based priority system
    • Auction mechanism for rotation order
  3. Savings Goals

    • Set group financial targets
    • Track progress towards goals
    • Milestone celebrations/rewards
    • Goal-based group completion
  4. Group Templates

    • Pre-configured group types (weekly, monthly, etc.)
    • Default rules and settings
    • Quick setup for common use cases
  5. Contribution Reminders

    • On-chain deadline tracking
    • Integration with notification services
    • Automated reminder system
  6. Interest/Yield Integration

    • Stake idle funds in lending protocols
    • Distribute earned interest among members
    • Integration with DeFi protocols (Marinade, Jupiter)

Advanced Level

  1. Cross-Chain Support

    • Support multiple tokens (USDC, USDT, custom SPL tokens)
    • Token swap integration
    • Multi-currency groups
  2. Insurance Fund

    • Optional insurance pool for defaults
    • Risk assessment mechanism
    • Claim process for affected members
  3. Credit Scoring System

    • On-chain credit history
    • Reputation-based group matching
    • Defaulter tracking and penalties
  4. Automated Market Maker (AMM) Integration

    • Allow early payout requests (with fee)
    • Secondary market for payout positions
    • Liquidity provision for emergency withdrawals
  5. DAO Governance

    • Token-based voting system
    • Proposal submission and voting
    • Treasury management
    • Protocol fee distribution
  6. Advanced Security Features

    • Time-locked funds
    • Multi-signature payouts
    • Gradual payout release (vesting)
    • Smart contract upgradability with governance
  7. Social Features

    • Group chat integration (using Dialect)
    • Member discovery and matching
    • Public/Private group options
    • Invite-only groups with verification
  8. Analytics Dashboard

    • Group performance metrics
    • Member participation statistics
    • Historical data visualization
    • Predictive analytics for contributions
  9. Compliance & KYC

    • Optional identity verification
    • Regulatory compliance features
    • Transaction limits and reporting
    • Geographic restrictions
  10. Mobile App Integration

    • Mobile-first wallet connection
    • Push notifications
    • QR code payments
    • Biometric authentication

πŸ“š Learning Resources

🀝 Contributing

This project is designed for educational purposes. Students are encouraged to:

  1. Fork the repository
  2. Implement additional features from the suggestions above
  3. Test thoroughly on devnet
  4. Document your changes
  5. Share your improvements with the community

πŸ“„ License

This project is open source and available for educational use.

⚠️ Disclaimer

This is an educational project. Do not use in production without proper security audits and testing. Always test on devnet/testnet before considering mainnet deployment.

About

A decentralized application (dApp) for creating and managing Osusu groups (rotating savings and credit associations) on the Solana blockchain. Built with Anchor framework and Next.js.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors