Skip to content
View 2xsol's full-sized avatar

Block or report 2xsol

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
2XSOL/README.md

2xSOL

2x leveraged SOL exposure — on-chain, non-custodial, built on Solana

License: MIT Solana Website

Launch App · View on Explorer · Risk Disclosures


Overview

2xSOL is a leveraged vault protocol on Solana that provides 2x exposure to SOL through a deposit/mint/redeem model. Users deposit SOL, receive 2xSOL shares representing their leveraged position, and can redeem at any time based on the current NAV.

The protocol integrates Percolator (a formally verified accounting and risk engine created by Anatoly Yakovenko) for solvency constraints and Pyth Network for real-time oracle pricing. Swaps are routed through Jupiter.

Higher leverage tiers (3x, 5x, 10x) are planned for future release.

Key Properties

  • Non-custodial — Users maintain control; vault authority is a PDA
  • Oracle-validated pricing — Pyth SOL/USD feed with staleness and confidence checks
  • Solvency-first risk engine — Percolator CPI enforces withdrawal safety gates and margin constraints
  • On-chain execution — All state transitions happen on Solana, fully verifiable
  • Transparent NAV — Share price derived from vault assets and oracle inputs

Deployed Addresses (Devnet)

Component Address
Program 4QVqGD1rKE1tfGNPU9X23oEjxcL2C9WZPYf7TzpWmDnG
Vault State (PDA) GW9Gqgmaq36eSHSv2vdpwBeBSHbXzni3qHvecW22vUUz
Vault Authority (PDA) 9dF8hzBRJFoZRQRhpDEnp2pGnv8rub1zkzAHWXVgh3j3
Shares Mint (2xSOL) E4iu5gixbf27tpAVpDaLYpynUoP3DiNVPjhSSK4xYC67
Vault Underlying ygoQfU4sZgqkyiyM5mYr14SeyPY11tuNNDsHhingziC
Percolator Program 2SSnp35m7FQ7cRLNKGdW5UzjYFF6RBUNq7d3m5mqNByp
Pyth Oracle (SOL/USD) J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix

Vault Configuration

Parameter Value
Target Leverage 2x (20,000 bps)
Management Fee 2% APR (200 bps)
Oracle Max Staleness 300 slots
Oracle Max Confidence 5% (500 bps)

Architecture

flowchart LR
  U[User Wallet] -->|Deposit SOL| FE[Frontend]
  FE -->|Swap via| JUP[Jupiter]
  FE -->|Deposit/Withdraw| V[2xSOL Vault Program]
  V -->|Price checks| PYTH[Pyth Oracle]
  V -->|Solvency CPI| PERC[Percolator]
  V -->|Mint/Burn| SPL[2xSOL Shares]
Loading

How It Works

  1. Deposit — User deposits SOL into the vault
  2. Mint — Vault mints 2xSOL shares proportional to deposit value at current NAV
  3. Leverage — Vault maintains 2x SOL exposure through Percolator-managed positions
  4. Rebalance — Periodic rebalancing keeps leverage near the 2x target
  5. Redeem — User burns 2xSOL shares to withdraw SOL at current NAV

Percolator Integration

Percolator is a formally verified accounting and risk engine for perpetual futures and leveraged strategies on Solana, created by Anatoly Yakovenko (co-founder of Solana). Its core invariant: no account can withdraw more value than exists on the balance sheet.

2xSOL uses Percolator for:

  • Solvency-first withdrawal safety gates
  • Margin checks and socialization/ADL constraints
  • Collateral tracking and PnL accounting
  • On-chain verifiable risk parameters

Oracle System

Pricing uses Pyth Network v2 API with:

  • Real-time SOL/USD price feed
  • Staleness checks (max 300 slots)
  • Confidence interval validation (max 5% band)
  • Automatic price rejection if oracle data is stale or unreliable

Repository Structure

2xsol/
├── contracts/                  # Solana smart contracts (Rust + Anchor)
│   ├── programs/
│   │   └── two_xsol_vault/
│   │       └── src/
│   │           ├── lib.rs          # Program entrypoints (initialize, deposit, withdraw, rebalance)
│   │           ├── state.rs        # VaultState, OracleConfig, FeeConfig, RiskConfig
│   │           └── percolator.rs   # Percolator CPI integration
│   ├── deployments/            # Deployment records (addresses, tx hashes)
│   └── Anchor.toml
├── frontend/                   # Next.js 14 application
│   ├── src/
│   │   ├── app/                # Pages (trade, dashboard, risk, percolator)
│   │   ├── components/         # UI components (trade widget, charts, layout)
│   │   └── lib/
│   │       └── services/       # Pyth, Solana, Jupiter integrations
│   └── .env.local.example
└── docs/                       # Documentation

Tech Stack

Layer Technology
Smart Contracts Rust, Anchor Framework
Risk Engine Percolator (CPI)
Oracle Pyth Network (v2 API)
Swaps Jupiter Aggregator
Frontend Next.js 14, TypeScript, Tailwind CSS
UI Library shadcn/ui
Wallet Solana Wallet Adapter
Deployment Vercel (frontend), Solana Devnet (contracts)

Development

Prerequisites

  • Node.js 20+
  • Rust + Cargo
  • Solana CLI
  • Anchor CLI

Frontend

cd frontend
npm ci
cp .env.local.example .env.local  # Configure RPC and program addresses
npm run dev

Smart Contracts

cd contracts
anchor build
anchor test

Deploy to Devnet

cd contracts
solana program deploy target/deploy/two_xsol_vault.so \
  --program-id target/deploy/two_xsol_vault-keypair.json
node init_vault_devnet.js

Program Instructions

Instruction Description
initialize Create vault state, underlying token account, and shares mint
deposit Deposit SOL, receive 2xSOL shares at current NAV
withdraw Burn 2xSOL shares, receive SOL at current NAV
rebalance Adjust leverage back toward 2x target
pause / unpause Emergency circuit breaker (admin/guardian only)
set_guardian Assign guardian role for operational controls
set_percolator_config Update Percolator integration parameters
init_percolator_user Initialize user account in Percolator
update_oracle Update oracle configuration

Risk Disclosures

Leveraged products amplify both gains and losses.

  • At 2x leverage, a 50% drop in SOL could wipe out your entire position
  • Losses compound over time even if SOL recovers
  • Smart contract bugs could result in partial or total loss
  • Oracle failures could trigger incorrect rebalances
  • Network congestion may prevent timely rebalancing
  • No FDIC insurance or regulatory protections

Read the full risk disclosures before participating.


Security

  • See SECURITY.md for vulnerability reporting
  • Threat model: contracts/security/THREAT_MODEL.md
  • The protocol is currently deployed on devnet only
  • Audit status: in progress

Never commit secrets. Secret scanning runs in CI.


Links


License

MIT — see LICENSE.


2xSOL is experimental software deployed on Solana devnet. Use at your own risk.

Not financial advice. Not an offer to sell or solicit. Read the risk disclosures.

Popular repositories Loading

  1. 2XSOL 2XSOL Public

    TypeScript 2