Sol.College

Full lesson

tide-dca

DCA without MEV. Bots blind, retail wins. Hidden-Liquidity DCA Pool for Solana — encrypted intents via Arcium MPC, single Jupiter swap per window, pro-rata distribution.

What it does

From the project README:

[](https://github.com/PugarHuda/tide-dca/actions/workflows/ci.yml) [](https://colosseum.com/frontier) [](https://arcium.com) [](https://www.anchor-lang.com) [](#what-works-today)
Original
PugarHuda/tide-dca
SuperStack fork
Blockchains/tide-dca @ b0790dc
Stars
0
Last push (original)
2026-05-12
Languages
TypeScript, JavaScript, Rust, CSS, HTML
Detected stack
@solana/kitAnchorNext.jsweb3.js
Categories
DeFiInfrastructure & Tooling
Licence
MIT
Homepage
https://tide-dca.vercel.app

Architecture

79 source files. By extension: .tsx ×33, .ts ×29, .rs ×16, .js ×1.

Top-level directorySource files
lib22
components21
programs15
app14
(root)3
migrations1
scripts1
confidential-ixs1

On-chain programs: programs/tide

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/tide-dca/. 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.

PugarHuda/tide-dca · programs/tide/src/instructions/trigger_aggregate.rs L13–36 @ b0790dc · MIT · original
    pub pool: Account<'info, Pool>,     #[account(        mut,        seeds = [Window::SEED_PREFIX, pool.key().as_ref(), &window.window_number.to_le_bytes()],        bump = window.bump,    )]    pub window: Account<'info, Window>,} pub fn handler(ctx: Context<TriggerAggregate>) -> Result<()> {    let window = &mut ctx.accounts.window;    let clock = Clock::get()?;     require!(        clock.unix_timestamp >= window.end_ts,        TideError::WindowNotExpired    );    require!(window.status == 0, TideError::AlreadyAggregated);     // Check pool size threshold    require!(        window.total_committed_usdc >= ctx.accounts.pool.min_pool_size_usdc,        TideError::PoolTooSmall
  1. Line 17 seeds = [Window::SEED_PREFIX, pool.key().as_ref(), &window.window_number.to_le_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  2. Line 18 bump = window.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  3. Line 25 let clock = Clock::get()?;: Reads on-chain time from the Clock sysvar.
  4. Line 27 require!(: An explicit validation that aborts the instruction with an error.
PugarHuda/tide-dca · programs/tide/src/instructions/init_pool.rs L13–35 @ b0790dc · MIT · original
#[derive(Accounts)]#[instruction(target_mint: Pubkey)]pub struct InitPool<'info> {    #[account(mut)]    pub authority: Signer<'info>,     pub input_mint: Account<'info, Mint>,     #[account(        init,        payer = authority,        space = Pool::SPACE,        seeds = [            Pool::SEED_PREFIX,            input_mint.key().as_ref(),            target_mint.as_ref(),        ],        bump,    )]    pub pool: Account<'info, Pool>,     pub system_program: Program<'info, System>,}
  1. Line 17 pub authority: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 22 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 25 seeds = [: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 30 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
PugarHuda/tide-dca · programs/tide/src/instructions/mark_window_failed.rs L37–60 @ b0790dc · MIT · original
        seeds = [Window::SEED_PREFIX, pool.key().as_ref(), &window.window_number.to_le_bytes()],        bump = window.bump,        constraint = window.pool == pool.key(),    )]    pub window: Account<'info, Window>,} pub fn handler(ctx: Context<MarkWindowFailed>) -> Result<()> {    let window = &mut ctx.accounts.window;     // Case 1: Aggregating window — standard escape hatch.    // Case 2: Open + expired + empty — unstick lifecycle when no commits    //         arrived. Empty check is critical: must NEVER let authority    //         skip a window with active commits, that'd freeze user funds.    let is_aggregating = window.status == 1;    let clock = Clock::get()?;    let is_open_expired_empty = window.status == 0        && clock.unix_timestamp >= window.end_ts        && window.intent_count == 0        && window.total_committed_usdc == 0;     require!(        is_aggregating || is_open_expired_empty,        TideError::AggregateNotReady
  1. Line 37 seeds = [Window::SEED_PREFIX, pool.key().as_ref(), &window.window_number.to_le_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  2. Line 38 bump = window.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  3. Line 52 let clock = Clock::get()?;: Reads on-chain time from the Clock sysvar.
  4. Line 58 require!(: An explicit validation that aborts the instruction with an error.
PugarHuda/tide-dca · programs/tide/src/instructions/setup_dca_position.rs L13–36 @ b0790dc · MIT · original
    pub owner: Signer<'info>,     pub pool: Account<'info, Pool>,     #[account(        init,        payer = owner,        space = DcaPosition::SPACE,        seeds = [            DcaPosition::SEED_PREFIX,            owner.key().as_ref(),            pool.key().as_ref(),        ],        bump,    )]    pub position: Account<'info, DcaPosition>,     pub system_program: Program<'info, System>,} pub fn handler(    ctx: Context<SetupDcaPosition>,    amount_per_window: u64,    max_slippage_bps: u16,
  1. Line 13 pub owner: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 18 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 21 seeds = [: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 26 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.

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 devnext dev
.npm run startnext start
.npm run buildnext build
.npm run lintnext lint
.anchor buildcompile programs and generate IDLs
.anchor testlocal validator + test suite
.anchor run testyarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts

What you could build from it

Used in lessons