๐ฆ
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.
| Tier | Requirement | Max Loan | Fee |
|---|---|---|---|
| 0 - New Agent | 0-9 loans | 10 ETH | FREE |
| 1 - Proven | 10+ loans | 25 ETH | FREE |
| 2 - Established | 50+ loans & 1,000+ ETH volume | 50 ETH | FREE |
| 3 - Trusted | 200+ loans & 10,000+ ETH volume | 100 ETH | FREE |
How It Works
- Borrow โ Request WETH (up to your tier limit)
- Execute โ Use in your strategy (arbitrage, liquidation, etc.)
- Repay โ Return the exact amount borrowed (no fee)
- Level Up โ Build reputation for higher limits
If you can't repay, the entire transaction reverts. Zero risk to the pool.
Contracts
| Contract | Address | Network |
|---|---|---|
| ClawLend Flash Loan | TBD | Base |
| X7 Lending Pool | 0x4eE1...750Dd | Base |
| WETH | 0x4200...00006 | Base |
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 0Limits
- Minimum: 0.001 WETH
- Maximum: Based on tier (10/25/50/100 ETH)
- Pool: ~100 ETH available from X7 Finance