Skip to content

Szeberr/Diamondhands

Repository files navigation

💎 DiamondHands — Solana Staking Platform

Stake $DIAMOND tokens, earn real SOL from pump.fun trading fees. Every trade simultaneously burns DIAMOND (reducing supply) and pays stakers in SOL. Built on Solana mainnet.

Live site: diamondhands.ink


How It Works

Someone trades $DIAMOND on PumpSwap
         |
         v
pump.fun pays creator fees in SOL to admin wallet
         |
         v
Hourly crank splits the fees 30 / 70
    |                        |
    v                        v
30% buys DIAMOND        70% deposited to
via Jupiter → burns      on-chain reward vault
(supply decreases)       |
                         v
               Stakers claim their SOL share
               proportional to weighted stake

Rewards are deposit-driven — when trading is active the vault fills. Dead volume means no rewards. Stakers always see exactly what they are getting.


Staking Tiers & Multipliers

Tier Lock Period Multiplier Benefit
0 7 days 1.0× Base rate
1 14 days 1.2× +20% more rewards
2 30 days 1.5× +50% more rewards
3 60 days 2.0× Double rewards

Multipliers redistribute the fixed reward pool — they do not create SOL out of thin air. A 60-day staker earns exactly 2× the share of a 7-day staker with the same amount. Locks are enforced on-chain — there is no early-exit path.


Buyback & Burn

Every hour the crank uses 30% of accumulated fees to buy $DIAMOND on PumpSwap via Jupiter and immediately burns those tokens, while 70% goes directly to stakers as claimable SOL. This creates:

  • Constant buy pressure on the token
  • Permanent reduction in circulating supply
  • A self-reinforcing loop: more trading → more burns + more SOL rewards → more reason to hold and stake

Each burn is verifiable on-chain via the Solscan link logged in GitHub Actions.


On-Chain Addresses (Mainnet)

Account Address
Program 9naSqjFzcYVPoPaVYyVNdjptXoGju651njajJKHQAsEu
Token Mint Fc992e4qZ95EGwEBBKdcBiFzy2g5G3gd1UZjghUspump
Pool State 8WvhBdLNsNoMVEZVmoha2HDtVcCHA2YXqimJfVZuiVMz
Stake Vault B5NqQjAj25XuFMRCmZ5ydAhVg1fAWp7fhjQHHa861MdQ
Reward Vault HnoNcbMbquNmcoUsaEuqhicoMFEztG8kcRUgwEnhQEjk
DexScreener Chart HwTTxLQKgGHus5Zc2JahBH3ygLkoEmyhsrv6QFrqCusz
Token Program Token-2022 (TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb)

Reward Math (MasterChef Accumulator)

acc_reward_per_share += deposited_lamports * PRECISION / total_weighted_stake

staker_pending = (staker_weighted * acc_reward_per_share / PRECISION) - reward_debt

weighted_stake = amount_staked * tier_multiplier

Same battle-tested pattern used by Sushi, Curve, and most major DeFi protocols.


Repository Structure

├── public/
│   └── index.html          # Frontend — Win98-style UI, all JS inline
├── scripts/
│   └── deposit-rewards.js  # Hourly crank: buyback+burn + deposit rewards
├── netlify/
│   └── functions/
│       └── rpc.js          # Serverless RPC proxy (bypasses CORS on mainnet-beta)
├── .github/
│   └── workflows/
│       └── crank.yml       # GitHub Actions: runs every hour automatically
├── programs/
│   └── staking/src/
│       └── lib.rs          # Anchor smart contract (live on mainnet)
└── netlify.toml            # Deploys public/ to diamondhands.ink + RPC proxy route

Automated Crank

The crank runs every hour via GitHub Actions. It requires one secret:

Secret Value
ADMIN_KEYPAIR JSON byte array of admin wallet secret key — [1,2,3,...]

The admin wallet receives pump.fun creator fees automatically from trading. No manual action is needed after the secret is configured.

To trigger a manual run: Actions → Daily Reward Crank → Run workflow


Frontend Features

Wallets

  • Phantom and Backpack wallet support — modal detects which are installed and shows a "Detected" badge
  • Auto-reconnect on page load (tries both wallets silently)
  • Account-switch and disconnect event listeners

Live Data

  • Live pool stats bar — Reward Pool (SOL), Total Locked (DIAMOND), Staker count, Est. APY — all read from chain in real time
  • Live DIAMOND price from DexScreener (PumpSwap pair) — updates every 30 seconds, shown in taskbar and chart window
  • DexScreener chart window — opens directly on the PumpSwap pair chart (1s candles, dark theme), draggable Win98-style window
  • Pool data and positions refresh after every stake/claim/unstake

Staking UI

  • Windows 98 retro UI with boot sequence, draggable windows, start menu
  • Numbered step-by-step staking flow (Steps 1–4)
  • Live positions panel: amount staked, lock countdown badge, pending SOL earned, claim and unstake buttons
  • Claim All button — claims all positions with rewards in one click
  • Auto-Compound button — claims SOL, swaps to DIAMOND via Jupiter v6, stakes the received DIAMOND into current selected tier automatically
  • Instant optimistic UI update on claim — pending drops to zero immediately

Portfolio

  • Portfolio USD stat — total value of staked DIAMOND + pending SOL rewards in USD, using live DexScreener prices

Hall of Fame Leaderboard

  • All stakers ranked by amount, loaded from /leaderboard.json generated by the crank
  • Highlights your wallet address
  • Live countdown to next hourly reward distribution (synced to real clock)
  • Refresh button to reload latest data

Transaction History

  • 📋 History window — shows up to 25 recent wallet transactions from Solana
  • Each row: success/fail icon, Solscan link, timestamp
  • Opens from the desktop icon or start menu

Other

  • Share on X button after successful stake — pre-filled tweet with amount and tier
  • Contract address copy button
  • SOL Claimed counter saved in localStorage per wallet (survives page refresh)
  • Risk disclaimer window on first visit

RPC Proxy

Solana mainnet-beta blocks getTokenAccountsByOwner from browsers due to the Origin header. The frontend routes all RPC calls through a Netlify serverless function at /rpc which forwards requests server-side without an Origin header.

Browser → /rpc (Netlify Function) → api.mainnet-beta.solana.com

The function is at netlify/functions/rpc.js and is wired up via netlify.toml.


Smart Contract Instructions

Instruction Who calls it Description
initialize_pool Admin (once) Creates pool, stake vault, reward vault
stake(tier, amount) User Lock tokens into a tier position
unstake(amount) User Return tokens after lock expires
claim User Collect pending SOL rewards (anytime)
deposit_rewards(lamports) Crank Add SOL to the reward vault

Security Notes

  • The program has no admin withdraw instruction — no account, including the deployer, can remove staked tokens or vault SOL except through normal unstake and claim flows
  • Locks are enforced on-chain by unix_timestampunstake reverts if called before unlock_time
  • The admin wallet controls only deposit_rewards — it cannot touch any user funds
  • Rewards scale with real trading volume — no promises, no emissions, no inflation
  • Token uses Token-2022 program (not SPL Token) — standard for pump.fun launches
  • pump.fun creates non-standard token accounts (not derivable as ATA) — the frontend discovers the user's real token account via getTokenAccountsByOwner

Stack

  • Program: Anchor 0.31.0, Token-2022, Solana 4.0.0
  • Frontend: Vanilla HTML/CSS/JS, @solana/web3.js, Phantom + Backpack wallets
  • Hosting: Netlify (auto-deploys on push to main)
  • RPC Proxy: Netlify serverless function (Node.js)
  • Crank: Node.js, @solana/web3.js, Jupiter Aggregator API v6
  • Price data: DexScreener API (PumpSwap pair)
  • Swaps: Jupiter v6 quote + swap API
  • CI: GitHub Actions (hourly cron 0 * * * *)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors