Full lesson
axis-sol
Axis is the first crypto index built on Solana that lets investors gain diversified exposure to the digital asset market with a single token.
What it does
From the project README:
The **Axis Index** is the first full fledged benchmark on Solana that reflects the performance of top tier assets from across the entire crypto market. Composed of a multi-chain basket of assets, it serves as a new financial Lego block for the DeFi ecosystem.
- Original
- AxisProtocol/axis-sol
- SuperStack fork
- Blockchains/axis-sol @
2ec1c78 - Stars
- 4
- Last push (original)
- 2025-12-17
- Languages
- TypeScript, CSS, JavaScript
- Detected stack
- MetaplexNext.jsweb3.js
- Categories
- DeFiNFTs & Digital Assets
- Licence
- Apache-2.0
- Homepage
- https://axis-protocol.xyz
Architecture
117 source files. By extension: .tsx ×72, .ts ×44, .js ×1.
| Top-level directory | Source files |
|---|---|
solana-index-demo | 114 |
axis-sdk | 3 |
Dapp: devnet deploy pending
⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/axis-sol/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
solana-index-demo/src/lib/settlementProcessor.ts L1–24 @ 2ec1c78 · Apache-2.0 · originalimport { PublicKey, ComputeBudgetProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js'import { getOrCreateAssociatedTokenAccount, createTransferCheckedInstruction, TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'import axios from 'axios'import { connection, loadTreasurySigner, TREASURY_OWNER } from '@/lib/solana'import { putPending, markPaid, markFailed } from '@/lib/settlementStore' function safePk(raw?: string | null): PublicKey | null { try { const v = (raw || '').trim(); if (!v) return null; return new PublicKey(v) } catch { return null }} const USDC_DEV_MINT = safePk(process.env.USDC_DEV_MINT)const TREASURY_USDC_ATA = safePk(process.env.TREASURY_USDC_ATA)const AXIS_MINT_2022 = safePk(process.env.AXIS_MINT_2022)const AXIS_DEC = parseInt(process.env.AXIS_DECIMALS || '9', 10)let PYTH_PRICE_IDS: string[] = []try { PYTH_PRICE_IDS = JSON.parse(process.env.PYTH_PRICE_IDS || '[]') } catch { PYTH_PRICE_IDS = [] } const L = (o: any) => console.log(JSON.stringify({ ts:new Date().toISOString(), mod:'settlement-processor', ...o })) // --- Simple TTL cache for index value ---let __INDEX_CACHE__: { ts: number, value: number } | null = nullconst INDEX_TTL_MS = 45_000 export async function fetchIndexValue(): Promise<number> {- Line 1
import { PublicKey, ComputeBudgetProgram, Transaction, sendAndConfirmTransaction } from '@: Sets the compute-unit limit or price (priority fee). - Line 1
import { PublicKey, ComputeBudgetProgram, Transaction, sendAndConfirmTransaction } from '@: Submits the signed transaction to the cluster. - Line 2
import { getOrCreateAssociatedTokenAccount, createTransferCheckedInstruction, TOKEN_2022_P: A checked token transfer, which also verifies the mint and decimals. - Line 2
import { getOrCreateAssociatedTokenAccount, createTransferCheckedInstruction, TOKEN_2022_P: Targets the Token-2022 program instead of the original Token Program.
axis-sdk/AxisSDK.ts L1–23 @ 2ec1c78 · Apache-2.0 · original// /src/axis-sdk/AxisSDK.ts/* eslint-disable @typescript-eslint/explicit-module-boundary-types */import { Connection, PublicKey, VersionedTransaction, TransactionMessage, TransactionInstruction, } from '@solana/web3.js' import { getAssociatedTokenAddress, createTransferInstruction, // USDC (legacy SPL) createTransferCheckedInstruction, // AXIS (Token-2022) TOKEN_2022_PROGRAM_ID, } from '@solana/spl-token' import { Buffer } from 'buffer' // Define a minimal wallet interface interface WalletContextState { publicKey: PublicKey | null signTransaction: (transaction: VersionedTransaction) => Promise<VersionedTransaction> signAllTransactions: (transactions: VersionedTransaction[]) => Promise<VersionedTransaction[]> }- Line 12
createTransferInstruction, // USDC (legacy SPL): An SPL token transfer through the Token Program. - Line 13
createTransferCheckedInstruction, // AXIS (Token-2022): A checked token transfer, which also verifies the mint and decimals. - Line 14
TOKEN_2022_PROGRAM_ID,: Targets the Token-2022 program instead of the original Token Program.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
solana-index-demo | npm run dev | next dev |
solana-index-demo | npm run start | next start |
solana-index-demo | npm run build | pnpm run cf-typegen && next build |
solana-index-demo | npm run test | jest |
solana-index-demo | npm run lint | next lint |
solana-index-demo | npm run deploy | opennextjs-cloudflare build && opennextjs-cloudflare deploy |
axis-sdk | npm run build | tsc |
axis-sdk | npm run test | echo "Error: no test specified" && exit 1 |
What you could build from it
- Fork the SuperStack copy and extend it within the DeFi gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)
- Learn the pattern first: SPL Tokens: mints, accounts and transfers