๐Ÿฆž

ClawLend Documentation

Free Flash Loans for AI Agents

Flash loans are free. Always.

Borrow WETH, repay exactly what you borrowed. Build reputation to unlock larger limits.

Quick Start

npm install clawlend

import { ClawLend } from "clawlend"

const clawlend = new ClawLend({ privateKey: process.env.PRIVATE_KEY })

// Execute flash loan (FREE - no fees)
const result = await clawlend.flashLoan({
  amount: "10"  // Borrow 10 WETH, repay 10 WETH
})

Agent Credit System

Build on-chain reputation through successful loans. Higher tiers unlock larger borrowing limits. All tiers are free.

TierRequirementMax LoanFee
0 - New Agent0-9 loans10 ETHFREE
1 - Proven10+ loans25 ETHFREE
2 - Established50+ loans & 1,000+ ETH volume50 ETHFREE
3 - Trusted200+ loans & 10,000+ ETH volume100 ETHFREE

How It Works

  1. Borrow โ€” Request WETH (up to your tier limit)
  2. Execute โ€” Use in your strategy (arbitrage, liquidation, etc.)
  3. Repay โ€” Return the exact amount borrowed (no fee)
  4. Level Up โ€” Build reputation for higher limits

If you can't repay, the entire transaction reverts. Zero risk to the pool.

Contracts

ContractAddressNetwork
ClawLend Flash LoanTBDBase
X7 Lending Pool0x4eE1...750DdBase
WETH0x4200...00006Base

Example: Arbitrage Bot

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IClawLend {
    function flashLoan(address receiver, address token, uint256 amount, bytes calldata data) external;
}

interface IClawLendBorrower {
    function onFlashLoan(address initiator, address token, uint256 amount, uint256 fee, bytes calldata data) external returns (bytes32);
}

contract ArbitrageBot is IClawLendBorrower {
    address public constant CLAWLEND = 0x...;
    address public constant WETH = 0x4200000000000000000000000000000000000006;

    function executeArbitrage(uint256 amount) external {
        IClawLend(CLAWLEND).flashLoan(address(this), WETH, amount, "");
    }

    function onFlashLoan(
        address initiator,
        address token,
        uint256 amount,
        uint256 fee,  // Always 0 - flash loans are free
        bytes calldata
    ) external returns (bytes32) {
        require(msg.sender == CLAWLEND, "Unauthorized");

        // YOUR STRATEGY HERE
        // 1. Buy low on DEX A
        // 2. Sell high on DEX B
        // 3. Keep ALL the profit (no fee!)

        // Approve repayment (just the principal, no fee)
        IERC20(token).approve(CLAWLEND, amount);

        return keccak256("IClawLendBorrower.onFlashLoan");
    }
}

MCP Server (for Claude, Cursor)

No code required. Install the MCP server and talk to ClawLend directly.

npm install -g @clawlend/mcp-server

Add to ~/.claude/settings.json:

{
  "mcpServers": {
    "clawlend": {
      "command": "npx",
      "args": ["@clawlend/mcp-server"],
      "env": { "PRIVATE_KEY": "0x..." }
    }
  }
}

Then just ask:

  • "What's my ClawLend tier?"
  • "How much liquidity is available?"
  • "Find arbitrage between WETH and USDC"
  • "Simulate borrowing 10 ETH"

SDK Integration

import { ClawLend } from "clawlend"

// Initialize
const clawlend = new ClawLend({
  privateKey: process.env.PRIVATE_KEY,
  network: "base"
})

// Check your tier and limits
const profile = await clawlend.getProfile()
console.log(`Tier: ${profile.tier} (${profile.tierName})`)
console.log(`Max loan: ${profile.maxLoan} ETH`)
console.log(`Loans until next tier: ${profile.nextTierLoans}`)

// Check available liquidity
const poolInfo = await clawlend.getPoolInfo()
console.log(`Available: ${poolInfo.available} WETH`)

// Execute flash loan (FREE)
const result = await clawlend.flashLoan({
  amount: "10",
  receiver: myBotAddress,
  data: "0x..."
})

console.log(`Borrowed: ${result.amount} WETH`)
console.log(`Fee: ${result.fee} WETH`)  // Always 0

Limits

  • Minimum: 0.001 WETH
  • Maximum: Based on tier (10/25/50/100 ETH)
  • Pool: ~100 ETH available from X7 Finance

Links

Free flash loans for AI agents

Built on Base ยท Powered by X7 Finance