Core Concepts

🏷️ Namespaces

Namespaces in Repo.trade organize repositories by source platform:

Info

Currently only the github namespace is supported. Fees may vary between namespaces.

Key Features:

  • Each namespace has a unique name and URI
  • Namespaces are associated with an authority (owner)
  • They include a swap fee setting (in basis points)

Technical Implementation:

#[account]
pub struct Namespace {
    // A running index for namespaces
    pub index: u32,
    // Namespace name
    pub name: String,
    // Uri
    pub uri: String,
    // owner of the namespace
    pub authority: Pubkey,
    // Deprecated field, take care of tumbstones
    pub padding0: [u16; 1],
    // Fee in basis points (e.g., 100 = 1%)
    // We copy this fee over to the repo when it is initialzied
    pub auction_fee_bps: u16,
    // bump for the PDA
    pub bump: u8,
    // padding
    pub padding: [u64; 8],
}

📊 Repository Structure

In Repo.trade, a repository represents a project with its own token economy:

Key Characteristics:

  • Each repo belongs to a namespace
  • Repos have an auction period for initial contributions
  • After the auction, repos enter a swapping state for trading

Technical Implementation:

// Repository state structure
pub struct Repo {
    // name of the repo - unique as its part of the pda's seed
    pub name: String,
    // namespace this belongs to
    pub namespace_index: u32,
    // if available, the owner of the repository, can claim owner fees
    pub owner: Pubkey,
    // status of the repo
    pub status: RepoStatus,
    // deprecated field, used to be swap fee bps. Careful of tumbstones
    // when using it again!
    pub padding0: [u16; 1],
    // Fee in basis points (e.g., 100 = 1%)
    pub auction_fee_bps: u16,
    // Pump of the PDA
    pub bump: u8,
    pub bump_mint: u8,
    /// padding
    pub padding: [u16; 30],
}

🔨 Auction Structure

Key Characteristics

  • Time-Limited Period: Each auction runs for a fixed duration (14 days)
  • Threshold Requirement: Auctions must meet a minimum contribution threshold to succeed
  • Start Time Control: Auctions begin at a predetermined timestamp
  • Daily Tracking: Contributions are tracked on a daily basis
  • Status Transitions: Auctions progress through states (Pending → Auctioning → Success/Failed)
  • Initial Liquidity: Upon success, auction funds are used to establish the initial trading pool
  • Token Distribution: Contributors receive repository tokens proportional to their contributions

Technical Implementation:

pub struct Auction {
    // Pump of the PDA
    pub bump: u8,
    // repo for this auction
    pub repo: Pubkey,
    // mint for the assets in this auction
    pub mint: Pubkey,
    // no interaction prior to this date time
    pub start_time: i64,
    // total amount auctioned in
    pub total_auctions: u64,
    // threshold that needs to be crossed for the auction to be successful
    pub total_threshold: u64,
    // amounts auctioned per day
    pub daily_auctions: [u64; 14],
    // auctioning status
    pub status: AuctionStatus,
    // initial token provided and obtained
    pub initial_token_pool_deposit: u64,
    pub initial_base_pool_deposit: u64,
    pub initial_lp_tokens: u64,
    // padding
    pub padding: [u64; 4],
}

🙋 Backer Structure

Key Characteristics

  • Contribution Tracking: Records all contributions made during the auction period
  • Daily Allocation: Tracks contributions on a day-by-day basis throughout the 14-day auction
  • Identity Association: Links contributions to a specific wallet address
  • Repository Binding: Each backer record is tied to a specific repository
  • Token Eligibility: Successful backers can claim repository tokens proportional to their contribution
  • Historical Record: Maintains a permanent record of early supporters
  • Claim Verification: Enables verification of token claims after auction completion

Technical Implementation:

pub struct Backer {
    // Pump of the PDA
    pub bump: u8,
    // toal amount contributed in auction
    pub total_auction: u64,
    // amounts per day (14 items)
    pub auctions: [u64; 14],
    // owner pubkey
    pub payer: Pubkey,
    // repo
    pub repo: Pubkey,
    /// padding
    pub padding: [u64; 12],
}