Skip to content
← Market recipes

List a tokenized stock on a Solana lending market, knowing what its issuer can stop

Before a Solana lending market lists a Token-2022 tokenized stock (xStocks TSLAx on Kamino, for example), do three things. Grade what the mint's issuer can do to holders. Pin it, so CI fails when it changes. Then replay the strongest power against the market's live binaries and see which paths stop.

Run it now (about 11 min) ↓For AI agents, the same recipe as Markdown: /llms/recipes/stock-lending-listing.md

What you end up with

Here's where you end up. A listing check that grades every mint you'd list and exits 1 when an issuer's powers change. A replay of what one of those powers does to Kamino's live lending binary. And a survey of the whole market, read today. Only read requests reach mainnet. There are no real keys: the replay's transactions are signed with test keys inside a local LiteSVM. Below is the output of our own run.

Solana mainnetToken-2022 stock mintissuer: permanent delegatefreeze · pause · hook · scaled UILending market (Kamino)one shared vault per reservevault must match its accountingcan move tokensout of the vaultreads the mintbinaries · snapshot · vaultsYour machine and CI (only reads mainnet)issuer-powersgrade: custodial · haltable · …pin the powersdiffPowers: exit 1 on a changeissuer-drillLiteSVM: mainnet klend + Token-2022replay each power, see what stopsvault_slack.py: every reservewhich power,what it stops
The listing check: TSLAx grades custodial (it has a permanent delegate), and the Ondo mint and USDC grade haltable. Change the pinned delegate, and the next run prints DRIFT and exits 1.
The listing check: TSLAx grades custodial (it has a permanent delegate), and the Ondo mint and USDC grade haltable. Change the pinned delegate, and the next run prints DRIFT and exits 1.
Kamino's mainnet binary in LiteSVM. Take 1 raw unit out of the TSLAx vault, and four paths panic (lending_checks.rs:442). Put 1 raw unit back, and all of them work.
Kamino's mainnet binary in LiteSVM. Take 1 raw unit out of the TSLAx vault, and four paths panic (lending_checks.rs:442). Put 1 raw unit back, and all of them work.
Kamino's xStocks market on 2026-11-14: ten xStocks reserves share one permanent delegate, and every vault has zero slack.
Kamino's xStocks market on 2026-11-14: ten xStocks reserves share one permanent delegate, and every vault has zero slack.

Run it (11 min)

  1. 1

    Grade the mints you would list

    3 min
    mkdir listing-check && cd listing-check   # needs Node 18+
    npm init -y && npm i github:psyto/issuer-powers
    # save check.mjs (below), then:
    node check.mjs

    check.mjs

    // Grade each mint's issuer powers; pin them on the first run, then fail on any change.
    import { existsSync, readFileSync, writeFileSync } from "node:fs";
    import { readIssuerPowers, assess, gating, diffPowers } from "issuer-powers";
    
    const RPC = process.env.RPC ?? "https://api.mainnet-beta.solana.com"; // read-only
    const MINTS = {
      TSLAx: "XsDoVfqeBukxuZHWhdvWHBhgEHjGNst4MLodqsJHzoB", // xStocks
      NVDAon: "gEGtLTPNQ7jcg25zTetkbmF7teoDLcrfTnQfmn2ondo", // Ondo
      USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    };
    
    const pins = existsSync("pins.json") ? JSON.parse(readFileSync("pins.json", "utf8")) : {};
    let drift = 0;
    for (const [name, mint] of Object.entries(MINTS)) {
      const p = await readIssuerPowers(mint, RPC);
      const a = assess(p);
      console.log(`${name.padEnd(7)} ${a.level.padEnd(10)} gating=${gating(p).model}`);
      for (const why of a.custodial) console.log(`        ${why}`);
      if (!pins[name]) pins[name] = p;
      else for (const d of diffPowers(pins[name], p)) (drift++, console.log(`        DRIFT ${d}`));
    }
    writeFileSync("pins.json", JSON.stringify(pins, null, 1));
    process.exit(drift ? 1 : 0);

    You will see

    TSLAx   custodial  gating=latent
            permanentDelegate=5aMN…FvEq (move or burn any holder's balance)
    NVDAon  haltable   gating=latent
    USDC    haltable   gating=boundary

    One read-only getAccountInfo per mint, over a public mainnet RPC. No keys. assess grades the strongest power. TSLAx (xStocks) has a permanent delegate that can move or burn any holder's balance, so it's custodial. The Ondo mint (NVDAon) and USDC have a freeze authority, so they're haltable. gating says how transfers between holders are gated. latent means they move freely today, but the hook or freeze authority could gate them later. boundary means nothing is checked on transfer. A grade is a fact about the mint, not a verdict on the issuer. The first run writes pins.json.

  2. 2

    Pin it and watch CI catch a change

    2 min
    node check.mjs; echo "exit $?"   # same powers as the pin: exit 0
    # replay a delegate rotation: put another address in the pin
    node -e 'const fs=require("fs"),p=JSON.parse(fs.readFileSync("pins.json")),t=p.TSLAx;t.permanentDelegate=t.extensionAuthorities["permanentDelegate.delegate"]="PrevDe1egate111111111111111111111111111111";fs.writeFileSync("pins.json",JSON.stringify(p))'
    node check.mjs; echo "exit $?"

    You will see

    TSLAx   custodial  gating=latent
            permanentDelegate=5aMN…FvEq (move or burn any holder's balance)
    NVDAon  haltable   gating=latent
    USDC    haltable   gating=boundary
    exit 0
    TSLAx   custodial  gating=latent
            permanentDelegate=5aMN…FvEq (move or burn any holder's balance)
            DRIFT authorities.permanentDelegate.delegate: expected "PrevDe1egate111111111111111111111111111111", got "5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq"
    NVDAon  haltable   gating=latent
    USDC    haltable   gating=boundary
    exit 1

    diffPowers compares the pinned posture with the live one: every authority, the extension set and the hook program. A Token-2022 mint can't gain a permanent delegate after it's initialized, but the delegate can hand the power to another address. Here we change the pin to play that, and the run exits 1, which fails any CI job that runs it. It ignores the pause flag and the scaled-UI multiplier, because those move in normal operation. So check paused on its own.

  3. 3

    Replay the delegate against Kamino's live binary

    5 min
    cd ..   # needs Rust (cargo), the Solana CLI and Python 3
    git clone https://github.com/psyto/issuer-drill && cd issuer-drill
    scripts/dump-programs.sh   # read-only: klend and Token-2022 from mainnet
    cargo run --release 2>/dev/null | sed 's/Program KLend.*Program log: //' | grep -A8 -E '^## seize-1(\+refill)?:'

    You will see

    Wrote program to klend.so
    Wrote program to token_2022.so
    6482390f659a6774b059768313b6f701b14819110f9e10db8fa651a311e9c97b  klend.so
    15a2e615a42e20f31714bbaaee43002ae6f1cda2e8d7118243117ab3c1342e2d  token_2022.so
    ## seize-1: permanent delegate moves 1 raw unit (1e-8 TSLAx) out of Kamino's TSLAx vault
       TSLAx vault 729892224197 -> 729892224196 raw units
       liquidate TSLAx-backed loan    REFUSED  panicked at 'attempt to subtract with overflow', programs/klend/src/lending_market/lending_checks.rs:442:9
       borrower repays USDC           ok
       TSLAx depositor withdraws      REFUSED  panicked at 'attempt to subtract with overflow', programs/klend/src/lending_market/lending_checks.rs:442:9
       depositor takes cTokens out    ok
       TSLAx borrower repays TSLAx    REFUSED  panicked at 'attempt to subtract with overflow', programs/klend/src/lending_market/lending_checks.rs:442:9
       new TSLAx deposit              REFUSED  panicked at 'attempt to subtract with overflow', programs/klend/src/lending_market/lending_checks.rs:442:9
       lend USDC (other reserve)      ok
    --
    ## seize-1+refill: as seize-1, then anyone sends 1 raw unit back into the vault
       TSLAx vault 729892224197 -> 729892224197 raw units
       liquidate TSLAx-backed loan    ok
       borrower repays USDC           ok
       TSLAx depositor withdraws      ok
       depositor takes cTokens out    ok
       TSLAx borrower repays TSLAx    ok
       new TSLAx deposit              ok
       lend USDC (other reserve)      ok

    LiteSVM runs Kamino's mainnet klend binary and Token-2022 against a one-slot mainnet snapshot of the xStocks market (slot 465177911). The issuer's keys are swapped for test keys, so the run can act as the issuer; the README lists every substitution. Kamino keeps every depositor's TSLAx in one vault. So when the delegate moves 1 raw unit (1e-8 TSLAx) out of it, liquidations, withdraw-and-redeem, TSLAx repayments and new deposits panic for every position. USDC repayments, taking cTokens out and lending USDC still work. Once anyone sends the unit back, everything works again. Without the filter, the full table also shows a pause, a hook and a frozen vault; Kamino's own checks refuse those with an error. The hashes match the ones the README dumped on 2026-11-04.

  4. 4

    Survey the whole market today

    1 min
    python3 tools/vault_slack.py 5wJeMrUYECGq41fxRESKALVcHnNX26TAWy4W98yULsua   # read-only

    You will see

       MSTRx $   9,053,971 vault=8132552631585 avail=8132552631585 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
        USDC $   5,845,809 vault=399725254944 avail=399725254944 slack=0 deleg=None
        SPYx $   3,850,449 vault=495779384820 avail=495779384820 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
        QQQx $   3,726,206 vault=537743268258 avail=537743268258 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
      GOOGLx $   3,392,202 vault=1144107960561 avail=1144107960561 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
       TSLAx $   2,693,983 vault=690009984179 avail=690009984179 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
       NVDAx $   2,033,429 vault=1243396039981 avail=1243396039981 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
       CRCLx $   1,015,958 vault=1634686279997 avail=1634686279997 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
       cbBTC $     303,923 vault=472517849 avail=472517849 slack=0 deleg=None
       HOODx $     289,218 vault=371722130458 avail=371722130458 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
       AAPLx $     280,900 vault=78550588862 avail=78550588862 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq
        USDG $      11,862 vault=2518743439 avail=2518743439 slack=0 deleg=2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk
       METAx $           1 vault=100000 avail=100000 slack=0 deleg=5aMNNLQJwAEeoemTEMkv5NVjqKwvvefRYCQ5Z67HFvEq

    Every reserve in Kamino's xStocks market at one slot: the supplied value, the vault balance against the reserve's own accounting (slack), and the token's permanent delegate. The ten xStocks reserves share one delegate and have zero slack. That's the condition under which step 3 halted the TSLAx reserve (only TSLAx was run end to end). A negative slack would mean a vault already below its accounting. USDC and cbBTC have no delegate; USDG has its own. It reads Kamino's public API for the reserve list, and a public RPC, and rewrites fixtures/vault_slack.json in your clone.

Why: what went wrong (measured)

Put together: the parts

1. Grade the issuer's powers and pin them in CI: issuer-powers (opens in a new tab)

Reads a mint's Token-2022 extensions and grades them: custodial (a permanent delegate), haltable (freeze, pause, default-frozen accounts), mutable (scaled UI, hook, fee, mint or close authority), or benign. gating says where transfers between holders are gated. diffPowers compares every authority across all extensions, including ones it doesn't model by name. TypeScript, ESM, no runtime dependencies. Only readIssuerPowers uses the network. Apache-2.0.

npm i github:psyto/issuer-powers
import { readIssuerPowers, assess, gating, diffPowers } from "issuer-powers";

const p = await readIssuerPowers(mint, RPC); // one getAccountInfo, jsonParsed
assess(p).level;       // "custodial" | "haltable" | "mutable" | "benign"
gating(p).model;       // "latent", "boundary", "per-transfer", …
diffPowers(pinned, p); // [] while nothing changed

2. Replay a power against the market's live binaries: issuer-drill (opens in a new tab)

A harness that reproduces one finding, not a library. Two things carry over to your own market: loading the protocol's mainnet binaries against a one-slot mainnet snapshot in LiteSVM (src/main.rs, tools/snapshot.py), and the market-wide survey of vault slack and permanent delegates (tools/vault_slack.py). You need Rust, the Solana CLI and Python 3. Apache-2.0.

git clone https://github.com/psyto/issuer-drill && cd issuer-drill
scripts/dump-programs.sh && cargo run --release
python3 tools/vault_slack.py <market>   # any Kamino market: vault slack and delegates

Go deeper, in order

  1. Token-2022 permanent delegate: What it can do, how it is set and given up, and why it matters most where tokens are pooled.
  2. Token-2022 extensions (opens in a new tab): The other powers issuer-powers reads: freeze, pause, transfer hook, scaled UI amount, default account state.
  3. Solana Internals, chapter 12: a vault program: How a program pools deposits in one vault and keeps its own accounting beside it.
  4. Kamino-Finance/klend#95 (opens in a new tab): The report: the handler path, the post-transfer check that overflows, and why a refill restores the reserve.
  5. issuer-drill: what is real and what is not (opens in a new tab): Every substitution the replay makes, before you trust or reuse it.

Before real money

Run end to end

2026-11-14 We followed it from the public repositories on 2026-11-14 UTC: all four steps from 21:16 to 21:18. After issuer-powers' one-line DRIFT output was released, we ran steps 1 and 2 again at 21:53 in a fresh folder (the outputs above are from that pass). npm i github:psyto/issuer-powers (resolved to 269a636; an earlier install at f8f6f05 also worked without SSH access), and check.mjs above against mainnet (issuer-powers' own tests at 269a636: 31 passed). A fresh clone of psyto/issuer-drill at d07ad1f, with scripts/dump-programs.sh (sha256 as shown, the same as the README's) and cargo run --release (all seven scenes as in the README's table; out/results.json unchanged). Then tools/vault_slack.py at slot 469475563. The first pass took about 70 seconds of machine time here (the cargo build took 45 s, with crates already downloaded). The minutes above include reading and pasting. The images are renders of these outputs.

Fabrknt is independent. We're not affiliated with Kamino, xStocks or Ondo. The parts aren't audited.