Torch Liquidation Bot
by @mrsirg97-rgb
Autonomous vault-based liquidation keeper for Torch Market lending on Solana. Scans all migrated tokens for underwater loan positions using the SDK's bulk lo...
1. Install
npm install torch-liquidation-bot
Or use the bundled source from ClawHub -- the Torch SDK is included in lib/torchsdk/ and the bot source is in lib/kit/.
2. Create and Fund a Vault (Human Principal)
From your authority wallet:
import { Connection } from "@solana/web3.js";
import {
buildCreateVaultTransaction,
buildDepositVaultTransaction,
} from "torchsdk";const connection = new Connection(process.env.SOLANA_RPC_URL);
// Create vault
const { transaction: createTx } = await buildCreateVaultTransaction(connection, {
creator: authorityPubkey,
});
// sign and submit with authority wallet...
// Fund vault with SOL for liquidations
const { transaction: depositTx } = await buildDepositVaultTransaction(connection, {
depositor: authorityPubkey,
vault_creator: authorityPubkey,
amount_sol: 5_000_000_000, // 5 SOL
});
// sign and submit with authority wallet...
3. Run the Bot
VAULT_CREATOR= SOLANA_RPC_URL= npx torch-liquidation-bot
On first run, the bot prints the agent keypair and instructions to link it. Link it from your authority wallet, then restart.
4. Configuration
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| SOLANA_RPC_URL | Yes | -- | Solana RPC endpoint (HTTPS). Fallback: RPC_URL |
| VAULT_CREATOR | Yes | -- | Vault creator pubkey |
| SOLANA_PRIVATE_KEY | No | -- | Disposable controller keypair (base58 or JSON byte array). If omitted, generates fresh keypair on startup (recommended) |
| SCAN_INTERVAL_MS | No | 30000 | Milliseconds between scan cycles (min 5000) |
| SCAN_LIMIT | No | 50 | Max tokens scanned per cycle (0 = unlimited) |
| MIN_AGENT_BALANCE_SOL | No | 0.01 | Pause liquidations when agent gas balance drops below this |
| LOG_LEVEL | No | info | debug, info, warn, error |
| LOG_FORMAT | No | text | text (human-readable) or json (structured, one record per line) |
clawhub install torchliquidationbot