torch-domain-auction-bot
Domain lending protocol on Solana. Domains become tokens. Tokens become collateral. Top holder controls the domain. Borrow SOL against your position -- but get liquidated and you lose the domain. Built on torchsdk v3.7.23 and the Torch Market protocol.
What this skill does
# Torch Domain Auction
Domains become tokens. Tokens become collateral. Top holder controls the domain.
---
## The Idea
Every domain has a name. Every name has a price. But who decides that price?
On Torch Market, domains are launched as tokens with bonding curves. The market decides the price. After bonding completes and the token migrates to Raydium, the domain is permanently linked to that token. From that point forward:
- **The top token holder controls the domain.** Buy enough tokens, you get the domain. Someone buys more, they get it.
- **Holders can borrow SOL against their tokens.** Lock your domain tokens as collateral and extract liquidity — up to 50% LTV, 2% weekly interest.
- **Get liquidated, lose the domain.** If your loan goes underwater (LTV > 65%), anyone can liquidate you. Your collateral changes hands. The domain lease rotates to whoever is now the top holder.
This creates something that doesn't exist in traditional domain markets: **a continuously-priced, borrowable, liquid domain asset** with built-in consequences for overleveraging.
The bot in this kit runs the infrastructure side. It discovers promising domains, launches them as tokens, monitors all active lending positions, and liquidates underwater loans through a Torch Vault. When a liquidation happens, the domain automatically rotates.
---
## How Domains Work on Torch
### Phase 1: Launch (Bonding Curve)
A domain is launched as a Torch Market token. The bonding curve creates the initial market — early buyers get a lower price, the curve rises as demand increases. This is the price discovery phase.
```
domain "pixel.art" → token PIXEL → bonding curve → market cap grows
```
Anyone can buy in. The curve sets the price. Trading fees flow to the community treasury.
### Phase 2: Migration (Domain Becomes Permanent)
When the bonding curve completes, the token migrates to a Raydium liquidity pool. At this point, the domain is **permanently linked** to the token. There is no delisting, no expiry, no central authority. The token IS the domain.
### Phase 3: Lending (Borrow Against Your Domain)
After migration, Torch's built-in lending market activates. Any holder can lock their tokens as collateral and borrow SOL from the community treasury.
```
holder locks 10,000 PIXEL tokens → borrows 0.5 SOL → LTV = 40%
```
The loan accrues 2% interest per epoch (~weekly). As long as the loan stays healthy (LTV < 65%), the borrower keeps their position and their domain control.
### Phase 4: Liquidation (Domain Rotates)
If the token price drops or interest accrues enough to push LTV past 65%, the position becomes liquidatable. A keeper (this bot) pays off the debt using vault SOL and receives the borrower's collateral tokens at a 10% discount.
```
PIXEL price drops → LTV hits 68% → keeper liquidates → collateral moves to vault
→ top holder changes
→ domain lease rotates
```
The borrower loses their tokens. The domain rotates to whoever is now the largest holder. The keeper's vault profits from the 10% bonus.
**This is the key insight: liquidation has real consequences beyond money.** The borrower doesn't just lose capital — they lose control of the domain. This natural tension makes the lending market meaningful. Borrowers are incentivized to maintain healthy positions because the domain itself is at stake.
---
## What the Bot Does
```
┌─────────────────────────────────────────────────────────────────┐
│ DOMAIN AUCTION BOT │
│ │
│ DISCOVER │
│ scrape expiring domains → evaluate quality → generate tickers │
│ │
│ LAUNCH │
│ buildCreateTokenTransaction → bonding curve → domain = token │
│ │
│ MONITOR │
│ for each domain token: │
│ scan lending markets (getLendingInfo) │
│ discover borrowers (getHolders → getLoanPosition) │
│ profile wallets (SAID verification, trade history) │
│ score risk (LTV proximity, momentum, wallet, interest) │
│ │
│ LIQUIDATE │
│ if position.health === 'liquidatable' && risk > threshold: │
│ buildLiquidateTransaction(vault = creator) │
│ sign with agent keypair → submit → confirm │
│ │
│ ROTATE │
│ after liquidation or any holder change: │
│ check top holder → update domain lease │
│ │
│ All SOL from vault. All collateral to vault. Agent holds nothing. │
└─────────────────────────────────────────────────────────────────┘
```
### The Scan Loop
The bot runs a continuous loop:
1. **Scan** — discover all migrated domain tokens with active lending markets
2. **Score** — for each borrower, compute a risk score across four weighted factors:
- LTV proximity (35%) — how close to the 65% liquidation threshold
- Price momentum (25%) — recent token price trend (drops increase risk)
- Wallet reputation (20%) — SAID verification status and trade history
- Interest burden (20%) — accrued interest relative to principal
3. **Liquidate** — execute vault-routed liquidation for positions above the risk threshold
4. **Rotate** — check top holders and update domain leases
5. **Sleep** — wait for the next cycle
### The Agent Keypair
The bot generates a fresh `Keypair` in-process on every startup. No private key file needed. The keypair is disposable — it signs transactions but holds nothing of value (~0.01 SOL for gas).
On first run, the bot verifies vault linkage. If the agent isn't linked, it prints instructions:
```
=== torch domain auction bot ===
agent wallet: 7xK9...
vault creator: 4yN2...
scan interval: 60000ms
--- ACTION REQUIRED ---
agent wallet is NOT linked to the vault.
link it by running (from your authority wallet):
buildLinkWalletTransaction(connection, {
authority: "<your-authority-pubkey>",
vault_creator: "4yN2...",
wallet_to_link: "7xK9..."
})
then restart the bot.
-----------------------
```
### The Vault
All economic activity routes through a Torch Vault:
| Direction | What Happens |
|-----------|-------------|
| **Liquidation: SOL out** | Vault SOL pays off the borrower's debt |
| **Liquidation: tokens in** | Borrower's collateral tokens go to vault ATA at 10% discount |
| **Net per liquidation** | Vault receives collateral worth 110% of SOL spent |
| **Domain rotation** | Collateral changes hands → top holder changes → lease rotates |
The human principal retains full control:
- **Withdraw SOL** from the vault at any time
- **Withdraw tokens** (liquidated collateral) at any time
- **Unlink the agent** — revoke bot access in one transaction
If the agent keypair is compromised, the attacker gets dust and vault access you revoke instantly.
---
## Getting Started
### 1. Install
```bash
npm install [email protected]
```
### 2. Create and Fund a Vault
From your authority wallet:
```typescript
import { Connection } from "@solana/web3.js";
import { buildCreateVaultTransaction, buildDepositVaultTransaction } from "torchsdk";
const connection = new Connection(process.env.SOLANA_RPC_URL);
// Related in Web3
xaut-trade
IncludedBuy or sell XAUT (Tether Gold) on Ethereum. Supports market orders (Uniswap V3) and limit orders (UniswapX). Wallet modes: Foundry keystore or WDK. Delegates non-XAUT intents to registered skills (e.g. Polymarket prediction markets, Hyperliquid trading). Triggers: buy XAUT, XAUT trade, swap USDT for XAUT, sell XAUT, swap XAUT for USDT, limit order, limit buy XAUT, limit sell XAUT, check limit order, cancel limit order, XAUT when, create wallet, setup wallet, polymarket, prediction market, bet on, odds on, hyperliquid, perp, perpetual, long, short, open long, open short, close position, leverage.
qfc-openclaw-skill
IncludedQFC blockchain interaction — wallet, faucet, chain queries, staking, epoch & finality, AI inference
gate-dex-trade
IncludedExecutes on-chain token swaps via Gate DEX. Use when user wants to swap, buy, sell, exchange, or convert tokens, or bridge cross-chain. Covers full swap flow: price quotes, transaction build, signing, and submission. Do NOT use for read-only data lookups or wallet account management.
hunch
IncludedDiscover, bet on, track, and settle Hunch prediction markets in natural language. Trigger when a user wants to bet, take a position, or get odds on a crypto outcome — token market-cap milestones and flips, launchpad races (Bankr vs pump.fun volume / #1-days / launches over a cap), token head-to-head outperformance, mcap strike-ladders, and up/down price rounds. Also trigger on "what can I bet on about $TOKEN", "odds on …", "take YES/NO on …", "show my Hunch bets", "did my market resolve". Settles in USDC on Base via x402 (≤ $10 / bet); every bet returns an on-chain proof.
opensea
IncludedQuery NFT data, trade on the Seaport marketplace, and swap ERC20 tokens across Ethereum, Base, Arbitrum, Optimism, Polygon, and more.
polymarket
IncludedTrade on Polymarket prediction markets (CLOB V2) from a Privy EOA wallet. Search markets, place/cancel orders, manage positions. No private key handling. Use when the user wants to bet on event outcomes (e.g. "buy YES at 0.65 on the ceasefire market", "what are my open positions", "close my Trump bet").