Use casesHow it worksDocsLaunch app
WEDESAKWEDESAK

Flash Loans

scroll

to explore

The flash loan program

built on Solana

Launch app Use cases

Why flash loans?

It runs in one tx

What began as a hackathon test harness for flash loans is now a full program on Solana — borrow, use and repay all live in one transaction. If the repay ever fails, the whole thing simply never happened. So we built everything around that.

Want to try it?

Open the composer

Need the details? Read the docs

Want to try it?

Open the composer

Need the details? Read the docs

so we built
flash loans

Enter
Wedesak

As they should be

Wedesak is an open, on-chain program that turns idle SOL into atomic credit in a single transaction. Test every path with the test kit, and keep everything permissionless on Solana. Powered by $WEDESA.

Building on Wedesak? Open the composer or read the docs.

01

One line borrow — borrow()

02

Tests beside your code, same repo, same CI

03

Cheatcodes: warp, prank, deal

04

Repay checked before the transaction closes

05

Borrow SOL and any SPL token

06

Composes with any program

07

Atomic
(or it never happened)

Borrow. Use. Repay.

Three instructions in one transaction. The program only lends if it can already see the repay.

Two linked steel rings — borrow and repay locked together
  1. 01

    Borrow

    The first instruction pulls liquidity from the vault. Before a single lamport moves, the program reads the Instructions sysvar and refuses to run unless a matching repay sits later in the same transaction.

  2. 02

    Use

    Everything in between is yours: route through two pools, repay a position, swap collateral. Borrow and repay stay top-level instructions, so your own program never has to be called back.

  3. 03

    Repay

    The last instruction returns principal plus 1 bp. Short by one lamport and the whole transaction reverts — nothing was ever borrowed.

use wedesak::cpi::{borrow, repay};

// ix[0]  wedesak::borrow   — checks ix[n] is a repay for the same vault
// ix[1..n-1]  your instructions
// ix[n]  wedesak::repay    — principal + fee, or the tx reverts
let ixs = vec![
    wedesak::ix::borrow(vault, user, 250 * ONE_SOL),
    route_a.swap(SOL, USDC),
    route_b.swap(USDC, SOL),
    wedesak::ix::repay(vault, user),
];

Contract

CA—

Vault liquidity

$26.38M

Flash loans · 24h

5,973

AuditRepay-path review · read the report

Follow

  • 54% → <1%

    Share of DeFi losses from flash-loan attacks, 2020 vs 2025

    Source · Immunefi

  • $160M+

    Deposits exposed by a lender-side flash-loan bug, patched Sept 2025 with no loss

    Source · Asymmetric Research

  • $7.5B

    Flash-loan volume through a single lender in three months, mid-2025

    Source · Cryptonews

  • $100

    Fee on a $1M flash loan at 1 bp — against $500 at the Aave V3 default

    Source · Aave docs

1 bp. That’s it.

Atomic arbitrage lives on a few basis points of edge, so a fee priced in tenths of a percent eats the trade. Wedesak charges one basis point of principal, all of it paid to vault depositors — no origination fee, no keeper cut, nothing on reverted transactions.

ProtocolVMFlash feeHow repayment is enforced
WedesakSVM0.01% · 100% to depositorsBorrow reads the Instructions sysvar; one matching top-level repay required, nested borrows rejected
Kamino LendSVMPer reserve (0.001% documented)Introspection: one borrow, one matching repay, nested calls rejected
marginfiSVM0%Start/end flags; end must be the last step, then a health check
Jupiter LendSVM0%Borrow → your steps → payback in one transaction
Aave V3EVM0.05% default (governance-set)Callback, then the pool pulls principal + fee
MorphoEVM0%Callback, then pulls back the exact amount
Balancer V3EVM0%Vault reverts unless every debt nets to zero

Fees as published in each protocol’s docs, November 2026. Governance can change them.

Questions we get

  • The borrow instruction reads the Instructions sysvar before it moves anything. If there is no Wedesak repay later in the same transaction — same vault, same borrower, principal plus fee — it errors and the runtime rolls the whole transaction back.

  • Cross-program invocation depth is capped at 4 and a program cannot be called back into itself mid-chain, so there is no callback. Keeping both ends top-level is what lets the program see the repay before lending. Borrows made through CPI are rejected.

  • Up to the free liquidity of the reserve, one borrow per transaction. In practice the limit is the transaction itself: 1,400,000 compute units and 1,232 bytes for the borrow, your route and the repay together. The composer budgets all three before you sign.

  • Depositors. One basis point of every repaid loan accrues to the reserve it came from; nothing is charged on a reverted transaction.

  • It runs your program and the loan in-process on a local runtime. You can warp to any slot or timestamp, seed or overwrite accounts, deal tokens to any address and sign as another key — then assert the repay path and the revert path in plain Rust.

  • No. Borrowing only needs a wallet that can pay the transaction fee. $WEDESA is the protocol token described in the whitepaper.

Still stuck? The docs cover every instruction and error code.