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 directory | Source files |
|---|---|
programs | 6 |
scripts | 4 |
tests | 1 |
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.
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>,- Line 217
pub authority: Signer<'info>,: Requires this account to have signed the transaction. - Line 228
pub struct MintTokens<'info> {: Mints new tokens. The mint authority must sign. - 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. - Line 232
bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 233
has_one = mint,: Checks that a stored pubkey field matches the passed account.
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>,- Line 589
init,: Creates and pays for a new account. Space and payer must be specified. - 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. - Line 607
bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 612
pub authority: Signer<'info>,: Requires this account to have signed the transaction.
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- Line 86
init,: Creates and pays for a new account. Space and payer must be specified. - Line 89
seeds = [b"price_router"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 90
bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 98
pub payer: Signer<'info>,: Requires this account to have signed the transaction.
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>,- Line 272
init,: Creates and pays for a new account. Space and payer must be specified. - Line 275
seeds = [b"registry"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 276
bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - 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.
| Directory | Command | Runs |
|---|---|---|
. | npm run lint | prettier */*.js "*/**/*{.js,.ts}" --check |
. | anchor build | compile programs and generate IDLs |
. | anchor test | local validator + test suite |
. | anchor run test | yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts |
. | anchor run deploy-local | anchor deploy --provider.cluster localnet |
. | anchor run deploy-devnet | anchor deploy --provider.cluster devnet |
. | anchor run build | anchor build |
. | cargo build | Rust workspace build |
. | cargo test | Rust tests |
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