Stack
Minimal project
Boilerplate (client.ts)
as any casts are for IDL types that don’t perfectly satisfy the strict Anchor 0.32 IDL schema; they’re a no-op at runtime.
Loading the right IDL
Each IDL embeds the program ID. After clone-and-copy, verify they match the cluster you’re targeting:RPC choice
Public devnet (https://api.devnet.solana.com) is fine for one-off scripts. For anything that polls or runs continuously, use a private RPC. Helius, Triton, QuickNode all work. Examples:
Wallet
For browser apps use Solana Wallet Adapter. For scripts, use a file-loaded keypair as above. If you’re testing as the keeper authority on devnet, the relevant keypairs are:KEEPER_KEYPAIR- payer + arb signer.CLP_AUTHORITY_KEYPAIR- separate keypair that signs CLP CPI instructions.
Devnet fund-up
First call: read a market
Common pitfalls
Wrong IDL for the cluster. If the IDL’s embedded program ID doesn’t match the deployed program, every method call will fail withProgramId mismatch or similar. Re-fetch IDLs after switching clusters.
Missing ATAs. Mint and redeem instructions assume the user’s L, S, and cUSDC ATAs exist. Pre-create them with createAssociatedTokenAccountIdempotentInstruction to avoid AccountNotFound on first interaction.
Anchor 0.32 type issues. Some IDLs need as any casts on new Program() due to strict typing introduced in 0.32. Runtime behavior is unaffected.
Decimal mismatch. cUSDC and L/S all use 6 decimals. When computing display values, divide by 10**6. When constructing BN arguments to instructions, multiply by 10**6.
See also
IDLs and PDAs
Where IDLs ship, PDA derivation patterns.
Mint and redeem example
End-to-end script: drip cUSDC, mint, redeem, verify.

