Skip to content

Sameer2748/lst-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SamSOL Staking Platform

A decentralized staking platform built on Solana that allows users to stake SOL tokens and receive SamSOL tokens in return. The platform consists of a Solana program (smart contract), a Next.js web frontend, and a React Native mobile app.

πŸš€ Live Applications

πŸ“‹ Table of Contents

πŸ” Overview

SamSOL Staking Platform enables users to:

  • Stake SOL: Deposit SOL tokens and receive SamSOL tokens (1:1 ratio)
  • Unstake SamSOL: Burn SamSOL tokens to withdraw original SOL
  • Cross-platform: Access via web browser or mobile app
  • Testnet Ready: Currently deployed on Solana Devnet

The platform uses a vault-based architecture where staked SOL is stored in user-specific Program Derived Addresses (PDAs) and SamSOL tokens are minted/burned accordingly.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Web Frontend  β”‚    β”‚  Mobile App     β”‚    β”‚  Solana Program β”‚
β”‚   (Next.js)     β”‚    β”‚  (React Native) β”‚    β”‚  (Anchor/Rust)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  Solana Devnet  β”‚
                    β”‚   (Testnet)     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

Core Functionality

  • Staking: Convert SOL to SamSOL tokens
  • Unstaking: Convert SamSOL back to SOL
  • Wallet Integration: Support for Phantom, Solflare, Backpack wallets
  • Mobile Support: Native mobile app with wallet adapter
  • Real-time Updates: Live transaction status and balance updates

Security Features

  • PDA-based Vaults: Each user has a unique vault for SOL storage
  • Authority Controls: Global mint authority for SamSOL token management
  • Input Validation: Comprehensive amount and authorization checks
  • Error Handling: Detailed error messages and transaction rollbacks

πŸ› οΈ Tech Stack

Smart Contract

  • Framework: Anchor (Solana)
  • Language: Rust
  • Program ID: AFU3sLSc7vXEEuBbEnZn2R3XnoFXryRaPqDEaoaJri9d
  • Network: Solana Devnet

Web Frontend

  • Framework: Next.js 15.5.0
  • Language: TypeScript
  • Styling: Tailwind CSS
  • Wallet: Solana Wallet Adapter
  • UI Components: Lucide React icons, Sonner notifications

Mobile App

  • Framework: React Native with Expo
  • Language: TypeScript
  • Wallet: Solana Mobile Wallet Adapter
  • Platform: Android (APK available)

πŸ“ Project Structure

lst-platform-latest/
β”œβ”€β”€ my-new-program/           # Solana smart contract
β”‚   β”œβ”€β”€ programs/
β”‚   β”‚   └── my-new-program/
β”‚   β”‚       └── src/lib.rs    # Main contract logic
β”‚   β”œβ”€β”€ tests/                # Contract tests
β”‚   β”œβ”€β”€ migrations/           # Deployment scripts
β”‚   └── Anchor.toml          # Anchor configuration
β”œβ”€β”€ frontend/                 # Next.js web application
β”‚   β”œβ”€β”€ components/          # React components
β”‚   β”‚   β”œβ”€β”€ StakeComponent.tsx
β”‚   β”‚   β”œβ”€β”€ UnStakeComponent.tsx
β”‚   β”‚   └── WalletConnectionProvider.tsx
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/             # Next.js app router
β”‚   β”‚   └── utils/           # Contract utilities
β”‚   └── package.json
β”œβ”€β”€ staking-app/             # React Native mobile app
β”‚   β”œβ”€β”€ components/          # Mobile components
β”‚   β”œβ”€β”€ contexts/            # React contexts
β”‚   β”œβ”€β”€ utils/               # Mobile utilities
β”‚   └── package.json
└── scripts/                 # Utility scripts

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn
  • Rust and Cargo
  • Solana CLI tools
  • Anchor framework
  • Git

Installation

  1. Clone the repository

    git clone <repository-url>
    cd lst-platform-latest
  2. Install dependencies for each component

    Smart Contract:

    cd my-new-program
    yarn install

    Web Frontend:

    cd frontend
    npm install

    Mobile App:

    cd staking-app
    npm install
  3. Configure Solana CLI

    solana config set --url devnet
    solana-keygen new --outfile ~/.config/solana/staking-wallet.json

Running the Applications

Web Frontend:

cd frontend
npm run dev
# Access at http://localhost:3000

Mobile App:

cd staking-app
npm start
# Follow Expo CLI instructions

Contract Testing:

cd my-new-program
anchor test

πŸ“„ Contract Details

Program ID

AFU3sLSc7vXEEuBbEnZn2R3XnoFXryRaPqDEaoaJri9d

Key Accounts

  • Global Mint Authority: Controls SamSOL token minting/burning
  • User Stake Account: Tracks individual user staking data
  • User Vault: PDA storing user's staked SOL
  • SamSOL Mint: The token mint for SamSOL

Instructions

  1. initialize_global_authority: Sets up the global mint authority
  2. create_user_stake_account: Creates a user's staking account
  3. stake: Stakes SOL and mints SamSOL (1:1 ratio)
  4. unstake: Burns SamSOL and returns SOL

Error Handling

The contract includes comprehensive error handling:

  • InvalidAmount: Amount must be greater than 0
  • InsufficientStake: Not enough staked amount to unstake
  • Unauthorized: User doesn't own the stake account
  • Overflow/Underflow: Arithmetic operation errors

πŸ”§ Development

Contract Development

  1. Build the contract:

    cd my-new-program
    anchor build
  2. Deploy to devnet:

    anchor deploy
  3. Run tests:

    anchor test

Frontend Development

  1. Environment Setup:

    • Ensure contract is deployed
    • Update contract address in frontend utils
    • Configure RPC endpoint
  2. Development Server:

    cd frontend
    npm run dev

Mobile Development

  1. Expo Development:

    cd staking-app
    npm start
  2. Android Build:

    expo build:android

πŸš€ Deployment

Contract Deployment

The contract is currently deployed on Solana Devnet. To redeploy:

cd my-new-program
anchor deploy --provider.cluster devnet

Web Frontend Deployment

The web frontend is deployed at https://lst.100xsam.store/.

Mobile App Distribution

The Android APK (app-release.apk) is available for direct installation.

πŸ§ͺ Testing

Contract Tests

cd my-new-program
anchor test

Frontend Testing

cd frontend
npm run lint

Integration Testing

  1. Connect wallet to web app
  2. Test staking functionality
  3. Verify SamSOL token minting
  4. Test unstaking process
  5. Confirm SOL withdrawal

πŸ“± Demo Videos

Web Demo

Watch the complete walkthrough of the web application demonstrating staking and unstaking functionality:

Watch the Web Demo

πŸ“Ί View Web Demo on Google Drive

This demo covers:

  • Wallet connection process
  • Staking SOL to receive SamSOL tokens
  • Unstaking SamSOL to withdraw SOL
  • Real-time transaction status updates

About

Stake your SOL, earn SamSol tokens.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors