Technology Stack

Oracle Degen is built with production-grade web3 technologies, optimized for Solana's speed and low transaction costs.


Frontend

React 19

  • Component-based UI architecture

  • Fast rendering with concurrent features

  • Hooks for state management (useState, useEffect, useMemo)

Why React? Industry standard for web3 dApps with extensive wallet adapter support.

Solana Web3.js v1.98.4

  • Direct blockchain interaction

  • Transaction construction and signing

  • Account fetching and parsing

React Router DOM v7.9.3

  • Client-side routing between User and Admin pages

  • Smooth navigation without page reloads

Tailwind CSS (implied via custom CSS)

  • Responsive design system

  • Dark mode optimized for trading environments

  • Custom components for market cards and betting UI


Wallet Integration

Solana Wallet Adapter v0.15.39

  • Supported Wallets: Phantom, Solflare, Backpack, and 20+ others

  • Features:

    • One-click wallet connection

    • Automatic network detection (Devnet/Mainnet)

    • Secure transaction signing

    • Session persistence across page reloads

Current Implementation:

// App.js - Wallet configuration
const endpoint = clusterApiUrl('devnet');
const wallets = [new PhantomWalletAdapter()];

Users connect any Solana wallet they already own—no new downloads required.


Smart Contracts (Deployed on Devnet)

Anchor Framework v0.26.0 (Rust)

Oracle Degen uses Anchor, Solana's standard framework for secure smart contract development.

Program ID: 72NfqpTZiUhbWKRR7qXxvnqSmUEwfKu55VMFUsX7bEt5

Contract Architecture

1. Platform Account

  • Stores admin pubkey, total markets, volume, and fee percentage

  • PDA: ["platform"]

  • Fee: 2% on winnings

2. Market Accounts

  • Each market is a PDA: ["market", market_id]

  • Contains: title, description, category, end timestamp, settlement source

  • AMM liquidity pools (YES/NO)

  • Max bet enforcement: 50,000,000 lamports (0.05 SOL)

3. Bet Accounts

  • User-specific PDAs: ["bet", user_pubkey, market_id]

  • Tracks: amount, prediction, shares, claimed status, payout

  • One bet per user per market

Key Functions

rust

// Smart contract instructions
initialize(admin) → Creates platform
create_market(...) → Admin creates new market
place_bet(market_id, prediction, amount) → User places bet
settle_market(market_id, result, actual_value) → Admin settles
auto_claim() → User claims winnings
delete_market(market_id) → Admin soft-deletes market

Security Features:

  • Admin-only functions (create, settle, delete)

  • Timestamp validation (can't bet after market ends)

  • Max bet limits (prevents manipulation)

  • Non-custodial (funds locked in PDAs, not admin wallet)


Data Sources & Settlement

DexScreener API

Oracle Degen currently uses DexScreener for price and market cap data.

Settlement Source Format:

dexscreener:TOKEN_ADDRESS/metric

Example:

dexscreener:5Gzs2DxqK44fK3ob2LuxdmLfYRyuUe1QeE9MRSM3pump/price

API Integration (UserPage.js):

javascript

const fetchCurrentPrice = async (settlementSource) => {
  const [source, pair] = settlementSource.split(':');
  if (source === 'dexscreener') {
    const [token] = pair.split('/');
    const response = await axios.get(
      `https://api.dexscreener.com/latest/dex/tokens/${token}`
    );
    return parseFloat(response.data.pairs[0].priceUsd);
  }
};

Why DexScreener?

  • Free, public API

  • Real-time Solana DEX data

  • Supports memecoins and long-tail assets

  • No authentication required

Future Considerations:

  • Pyth Network for high-frequency price feeds (currently not implemented)

  • Chainlink for verified data (if needed for mainnet)

  • Multi-oracle redundancy for critical markets


Image Hosting

Cloudinary

Token logos uploaded via admin panel are stored on Cloudinary.

Implementation (AdminPanel.js):

javascript

const uploadToCloudinary = async (file) => {
  const formData = new FormData();
  formData.append('file', file);
  formData.append('upload_preset', CLOUDINARY_UPLOAD_PRESET);
  
  const response = await fetch(
    `https://api.cloudinary.com/v1_1/${CLOUDINARY_CLOUD_NAME}/image/upload`,
    { method: 'POST', body: formData }
  );
  
  return response.data.secure_url;
};

Why Cloudinary?

  • Free tier sufficient for testnet

  • HTTPS URLs (secure)

  • Automatic image optimization

  • CDN distribution for fast loads


Development Tools

Anchor CLI

  • Build, test, and deploy Solana programs

  • IDL generation for type-safe frontend integration

React Scripts v5.0.1

  • Build tooling and development server

  • Hot reloading for fast iteration

Axios v1.12.2

  • HTTP client for API requests (DexScreener)

  • Promise-based, easy error handling

Browserify Polyfills

Required for Solana Web3.js in browser:

  • buffer, crypto-browserify, stream-browserify, process

  • Configured via react-app-rewired


Network & Infrastructure

Solana Devnet

  • RPC Endpoint: https://api.devnet.solana.com

  • Explorer: Solscan Devnet, Solana Explorer

  • Faucet: Free SOL from https://faucet.solana.com

Testnet Benefits:

  • Zero cost testing

  • Fast iteration cycles

  • Safe environment for user testing

Mainnet Migration Plan:

  • Switch clusterApiUrl('devnet') to 'mainnet-beta'

  • Deploy program to mainnet

  • Update frontend to point to new Program ID


Performance Optimizations

Frontend

  • useMemo for expensive calculations (program instance, odds calculation)

  • Conditional rendering to avoid unnecessary re-renders

Smart Contract

  • Efficient account structure with fixed-size allocations

  • AMM calculations in u128 to prevent overflow

  • Minimal compute units (simple math, no complex loops)


Security Considerations

Smart Contract

  • ✅ Admin authorization checks on privileged functions

  • ✅ Timestamp validation (no late bets)

  • ✅ Max bet enforcement (0.05 SOL limit)

  • ✅ Claimed status tracking (no double-claim)

  • ✅ Non-custodial design (PDA escrow, not admin wallet)

Frontend

  • ✅ Wallet adapter signature verification

  • ✅ Input validation before blockchain calls

  • ✅ Error handling for failed transactions

Future Enhancements

  • Multi-signature admin wallet for critical functions

  • Time-locked settlements (no immediate admin control)

  • Community governance for dispute resolution


Last updated