Sol.College

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 directorySource files
solana-index-demo114
axis-sdk3

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.

AxisProtocol/axis-sol · solana-index-demo/src/lib/settlementProcessor.ts L1–24 @ 2ec1c78 · Apache-2.0 · original
import { 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> {
  1. Line 1 import { PublicKey, ComputeBudgetProgram, Transaction, sendAndConfirmTransaction } from '@: Sets the compute-unit limit or price (priority fee).
  2. Line 1 import { PublicKey, ComputeBudgetProgram, Transaction, sendAndConfirmTransaction } from '@: Submits the signed transaction to the cluster.
  3. Line 2 import { getOrCreateAssociatedTokenAccount, createTransferCheckedInstruction, TOKEN_2022_P: A checked token transfer, which also verifies the mint and decimals.
  4. Line 2 import { getOrCreateAssociatedTokenAccount, createTransferCheckedInstruction, TOKEN_2022_P: Targets the Token-2022 program instead of the original Token Program.
AxisProtocol/axis-sol · 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[]>  }
  1. Line 12 createTransferInstruction, // USDC (legacy SPL): An SPL token transfer through the Token Program.
  2. Line 13 createTransferCheckedInstruction, // AXIS (Token-2022): A checked token transfer, which also verifies the mint and decimals.
  3. 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.

DirectoryCommandRuns
solana-index-demonpm run devnext dev
solana-index-demonpm run startnext start
solana-index-demonpm run buildpnpm run cf-typegen && next build
solana-index-demonpm run testjest
solana-index-demonpm run lintnext lint
solana-index-demonpm run deployopennextjs-cloudflare build && opennextjs-cloudflare deploy
axis-sdknpm run buildtsc
axis-sdknpm run testecho "Error: no test specified" && exit 1

What you could build from it

Used in lessons