Sol.College

Full lesson

solana-programs

Omniliquid is a fully decentralized trading platform built on Solana, enabling spot and perpetual markets for a wide range of assets including cryptocurrencies, stocks, forex, bonds, ETFs, commodities, and other real-world assets (RWAs) using a fully on-chain CLOB model.

What it does

From the project README:

Omniliquid is a fully decentralized trading platform built on Solana, enabling spot and perpetual markets for a wide range of assets including cryptocurrencies, stocks, forex, bonds, ETFs, commodities, and other real-world assets (RWAs). It utilizes a 100% on-chain Central Limit Order Book (CLOB) model for transparent and efficient price discovery.
Original
OmniliquidX/solana-programs
SuperStack fork
Blockchains/solana-programs @ 3eccc3e
Stars
2
Last push (original)
2025-05-17
Languages
Rust, TypeScript
Detected stack
Anchor
Categories
DeFi
Licence
MIT
Homepage
https://solana.omniliquid.xyz

Architecture

11 source files. By extension: .rs ×6, .ts ×5.

Top-level directorySource files
programs6
scripts4
tests1

On-chain programs: programs/omniliquid-clob, programs/omniliquid-olp-vault, programs/omniliquid-omni-token, programs/omniliquid-price-router, programs/omniliquid-registry, programs/omniliquid-trading-storage

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/solana-programs/. 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.

OmniliquidX/solana-programs · programs/omniliquid-omni-token/src/lib.rs L217–239 @ 3eccc3e · MIT · original
    pub authority: Signer<'info>,        #[account(mut)]    pub payer: Signer<'info>,        pub system_program: Program<'info, System>,    pub token_program: Program<'info, Token>,    pub rent: Sysvar<'info, Rent>,} #[derive(Accounts)]pub struct MintTokens<'info> {    #[account(        mut,        seeds = [b"token_config", mint.key().as_ref()],        bump,        has_one = mint,        has_one = authority @ TokenError::InvalidAuthority,    )]    pub token_config: Account<'info, TokenConfig>,        #[account(mut)]    pub mint: Account<'info, Mint>,
  1. Line 217 pub authority: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 228 pub struct MintTokens<'info> {: Mints new tokens. The mint authority must sign.
  3. Line 231 seeds = [b"token_config", mint.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 232 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  5. Line 233 has_one = mint,: Checks that a stored pubkey field matches the passed account.
OmniliquidX/solana-programs · programs/omniliquid-clob/src/lib.rs L589–612 @ 3eccc3e · MIT · original
        init,        payer = authority,        token::mint = base_mint,        token::authority = vault_signer,    )]    pub base_vault: Account<'info, TokenAccount>,        #[account(        init,        payer = authority,        token::mint = quote_mint,        token::authority = vault_signer,    )]    pub quote_vault: Account<'info, TokenAccount>,        /// CHECK: The vault signer PDA    #[account(        seeds = [b"vault_signer", market.key().as_ref()],        bump,    )]    pub vault_signer: AccountInfo<'info>,        #[account(mut)]    pub authority: Signer<'info>,
  1. Line 589 init,: Creates and pays for a new account. Space and payer must be specified.
  2. Line 606 seeds = [b"vault_signer", market.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 607 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 612 pub authority: Signer<'info>,: Requires this account to have signed the transaction.
OmniliquidX/solana-programs · programs/omniliquid-price-router/src/lib.rs L85–108 @ 3eccc3e · MIT · original
    #[account(        init,        payer = payer,        space = 8 + PriceRouter::SIZE,        seeds = [b"price_router"],        bump    )]    pub price_router: Account<'info, PriceRouter>,        /// CHECK: This is the registry account    pub registry: AccountInfo<'info>,        #[account(mut)]    pub payer: Signer<'info>,        pub system_program: Program<'info, System>,} #[derive(Accounts)]pub struct OnlyGov<'info> {    #[account(mut)]    pub price_router: Account<'info, PriceRouter>,        /// CHECK: Registry account, needed to verify gov role
  1. Line 86 init,: Creates and pays for a new account. Space and payer must be specified.
  2. Line 89 seeds = [b"price_router"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 90 bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 98 pub payer: Signer<'info>,: Requires this account to have signed the transaction.
OmniliquidX/solana-programs · programs/omniliquid-registry/src/lib.rs L265–288 @ 3eccc3e · MIT · original
    pub funding_rate_multiplier: u16,     // Multiplier for base funding rate    pub active: bool} #[derive(Accounts)]pub struct Initialize<'info> {    #[account(        init,        payer = owner,        space = 8 + Registry::MAX_SIZE,        seeds = [b"registry"],        bump    )]    pub registry: Account<'info, Registry>,        #[account(mut)]    pub owner: Signer<'info>,        /// CHECK: This is the PDA that will be the authority for various operations    #[account(        seeds = [b"authority", registry.key().as_ref()],        bump,    )]    pub registry_authority: AccountInfo<'info>,
  1. Line 272 init,: Creates and pays for a new account. Space and payer must be specified.
  2. Line 275 seeds = [b"registry"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 276 bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 281 pub owner: Signer<'info>,: Requires this account to have signed the transaction.

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
.npm run lintprettier */*.js "*/**/*{.js,.ts}" --check
.anchor buildcompile programs and generate IDLs
.anchor testlocal validator + test suite
.anchor run testyarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts
.anchor run deploy-localanchor deploy --provider.cluster localnet
.anchor run deploy-devnetanchor deploy --provider.cluster devnet
.anchor run buildanchor build
.cargo buildRust workspace build
.cargo testRust tests

What you could build from it

Used in lessons