← 返回 Skills 市场
aroushanpurdue

AI Agent Lending - Wallet Credit

作者 aroushanpurdue · GitHub ↗ · v2.0.0 · MIT-0
cross-platform ✓ 安全检测通过
130
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install ai-agent-lending
功能描述
Wallet-based credit system for AI agents. Borrow USDC on Somnia without collateral - build credit with successful repayments.
使用说明 (SKILL.md)

AI Agent Lending Protocol

Wallet-based credit for AI agents. Borrow USDC for tasks based on your repayment history. No collateral required - just build your credit score.

Quick Start

# Set environment variable
LENDING_API_URL=https://yoursite.com/api

Skill Files

File URL
SKILL.md (this file) https://yoursite.com/skill.md
skill.json https://yoursite.com/skill.json

Network Information

Somnia Testnet (Shannon)

  • Chain ID: 50312
  • RPC: https://dream-rpc.somnia.network
  • Explorer: https://shannon-explorer.somnia.network

Contract Addresses:

  • USDC: 0xa5906CF6b40842aE6CdDcB051C3dd388ddD9535f
  • BotRegistry: 0x8eA60104DEB3229a05534E4629C0C08Deac39609
  • PermissionsRegistry: 0x02a7EE2fD25A8987a3e9276530c830735e0C5e8C
  • LendingPool: 0x11f49c44eA263FC886B3C011DC171ffE479A48BF

🔹 Credit System

Your borrowing limit depends on your wallet's repayment history:

Tier System (No Deposit Required)

Tier Repayments Max Borrow
🆕 NEW 0-49 $10
🥉 IRON 50-99 $50
🥈 BRONZE 100-199 $150
🥇 SILVER 200-499 $350
💎 GOLD 500+ $750

Formula:

Credit Ratio = [(repays + 1) / (borrows + 2) + (total repaid + 1) / (total borrowed + 2)] / 2

With Deposit:

Max Borrow = Credit Ratio × Your Deposit Amount

🔹 Step-by-Step Guide

Step 1: Register Your Bot

Register on-chain using the BotRegistry contract:

// Using ethers.js or viem
import { parseUnits } from 'viem'

const tx = await walletClient.writeContract({
  address: '0x8eA60104DEB3229a05534E4629C0C08Deac39609',
  abi: BOT_REGISTRY_ABI,
  functionName: 'registerBot',
  args: [
    'My Trading Agent',  // name
    operatorAddress      // your wallet address
  ]
})

const receipt = await publicClient.waitForTransactionReceipt({ hash: tx })
const botId = receipt.logs[0].args.botId  // Save this!

Step 2: Grant Borrow Permission

Set your max spend limit on-chain:

import { keccak256, toUtf8Bytes, parseUnits } from 'ethers'

const borrowScope = keccak256(toUtf8Bytes("BORROW"))
const maxSpend = parseUnits("10", 6)  // $10 for NEW tier
const expiry = 0  // Never expires

await walletClient.writeContract({
  address: '0x02a7EE2fD25A8987a3e9276530c830735e0C5e8C',
  abi: PERMISSIONS_ABI,
  functionName: 'setPermissions',
  args: [botId, borrowScope, maxSpend, expiry]
})

Step 3: Check Your Credit Limit

Before borrowing, check your wallet stats:

GET {LENDING_API_URL}/wallet-stats?wallet=0xYourAddress

Response:

{
  "success": true,
  "stats": {
    "borrowCount": 0,
    "repayCount": 0,
    "totalBorrowedAmount": 0,
    "totalRepaidAmount": 0,
    "creditScoreRatio": 0.5,
    "creditAmountRatio": 0.5,
    "finalCreditRatio": 0.5,
    "tier": "NEW",
    "maxBorrow": 10
  }
}

Step 4: Borrow USDC

Call the lending pool contract:

const borrowAmount = parseUnits("5", 6)  // 5 USDC

await walletClient.writeContract({
  address: '0x11f49c44eA263FC886B3C011DC171ffE479A48BF',
  abi: LENDING_POOL_ABI,
  functionName: 'borrow',
  args: [botId, borrowAmount]
})

// Stats are automatically updated in database after transaction confirms

Amount format: USDC uses 6 decimals

  • 1000000 = 1 USDC
  • 5000000 = 5 USDC
  • 10000000 = 10 USDC

Step 5: Repay the Loan

Repay principal + interest:

const repayAmount = parseUnits("5.01", 6)  // Principal + interest

// First approve USDC
await walletClient.writeContract({
  address: '0xa5906CF6b40842aE6CdDcB051C3dd388ddD9535f',
  abi: ERC20_ABI,
  functionName: 'approve',
  args: ['0x11f49c44eA263FC886B3C011DC171ffE479A48BF', repayAmount]
})

// Then repay
await walletClient.writeContract({
  address: '0x11f49c44eA263FC886B3C011DC171ffE479A48BF',
  abi: LENDING_POOL_ABI,
  functionName: 'repay',
  args: [botId, repayAmount]
})

// Your credit score automatically increases!

🔹 Check Your Progress

View Your Rank

GET {LENDING_API_URL}/leaderboard?sortBy=creditScore

Response:

{
  "success": true,
  "leaderboard": [
    {
      "rank": 1,
      "walletAddress": "0x...",
      "creditScore": 950,
      "totalLoans": 100,
      "successfulRepayments": 95,
      "successRate": 95,
      "tier": "GOLD"
    }
  ]
}

🔹 Building Credit Over Time

Example progression:

  1. Day 1 - NEW tier ($10 max)

    • Borrow $5, repay on time
    • Credit score: 500 → 550
  2. Week 1 - Still NEW (need 50 repays for IRON)

    • Complete 10 small loans successfully
    • Credit score: 550 → 650
  3. Month 2 - IRON tier ($50 max)

    • 50+ successful repayments
    • Can now borrow $50 per loan
  4. Month 6 - BRONZE tier ($150 max)

    • 100+ successful repayments
    • Credit score: 800+
  5. Year 1 - SILVER/GOLD tier ($350-$750)

    • 200-500+ successful repayments
    • Trusted borrower status

🔹 Smart Contract ABIs

BotRegistry ABI

[
  {
    "inputs": [
      {"name": "name", "type": "string"},
      {"name": "operator", "type": "address"}
    ],
    "name": "registerBot",
    "outputs": [{"name": "botId", "type": "uint256"}],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

PermissionsRegistry ABI

[
  {
    "inputs": [
      {"name": "botId", "type": "uint256"},
      {"name": "scope", "type": "bytes32"},
      {"name": "maxSpend", "type": "uint256"},
      {"name": "expiry", "type": "uint256"}
    ],
    "name": "setPermissions",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

LendingPool ABI

[
  {
    "inputs": [
      {"name": "botId", "type": "uint256"},
      {"name": "amount", "type": "uint256"}
    ],
    "name": "borrow",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {"name": "botId", "type": "uint256"},
      {"name": "amount", "type": "uint256"}
    ],
    "name": "repay",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  }
]

Error Handling

Code Error Solution
400 Exceeds credit limit Check your tier limit or make more repayments
400 Insufficient liquidity Wait for deposits or request less
403 No permissions set Call setPermissions first (Step 2)
404 Bot not found Register bot first (Step 1)

Best Practices

  1. Start small — Begin with $1-5 USDC loans
  2. Always repay on time — Build your credit score
  3. Check your tier — View /wallet-stats before borrowing
  4. Monitor the pool — Check /pools for liquidity
  5. Gradual growth — Each repayment increases your limit
  6. Be consistent — Regular successful repayments build trust

Links


Build your credit. Unlock higher limits. Autonomous lending for AI agents. 🤖

安全使用建议
This skill appears internally consistent for a lending integration, but it depends on an external API URL (LENDING_API_URL) you must trust. Before using: verify the smart-contract addresses on the Somnia explorer; confirm the operator (yoursite.com) is legitimate; test using a throwaway/testnet wallet first; never set or share private keys or secrets as env vars for this skill; when approving USDC, avoid granting unlimited allowances — approve only the specific lending pool and amount you intend to use; and review the lending protocol's audited code/contract sources if available. If you don't trust the API domain, do not set LENDING_API_URL to it, or run equivalent calls against a verified endpoint you control.
能力评估
Purpose & Capability
The name/description, listed smart-contract addresses, and instructions all describe a lending protocol that queries a lending API and performs on-chain transactions. Requiring LENDING_API_URL (the protocol API base URL) is consistent with the stated purpose.
Instruction Scope
SKILL.md stays within the lending workflow: setting an API URL, reading wallet stats from {LENDING_API_URL}, registering a bot on-chain, granting a BORROW permission, borrowing and repaying via the LendingPool contract. It does not ask for local files or system secrets, but it does instruct the agent (or developer) to submit transactions and to send wallet addresses to the external API endpoint, which will reveal wallet activity to that endpoint.
Install Mechanism
Instruction-only skill with no install spec and no code files — nothing is written to disk by the skill bundle itself. This minimizes install-time risk.
Credentials
Only one env var is required: LENDING_API_URL (the API base URL). This is proportionate to the skill's function, but note that the primaryEnv is an endpoint (not a secret token). Because the skill will call that endpoint with wallet addresses and other parameters, you must trust the operator of that URL. The skill does not request private keys or tokens, which is appropriate.
Persistence & Privilege
The skill does not request always: true and has no install hooks. It does not request system-level persistence or modify other skills' configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ai-agent-lending
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ai-agent-lending 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.0
Initial release with wallet-based credit system. Supports Somnia testnet with tier-based borrowing (NEW $10 → GOLD $750). No collateral required.
元数据
Slug ai-agent-lending
版本 2.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

AI Agent Lending - Wallet Credit 是什么?

Wallet-based credit system for AI agents. Borrow USDC on Somnia without collateral - build credit with successful repayments. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 130 次。

如何安装 AI Agent Lending - Wallet Credit?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ai-agent-lending」即可一键安装,无需额外配置。

AI Agent Lending - Wallet Credit 是免费的吗?

是的,AI Agent Lending - Wallet Credit 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

AI Agent Lending - Wallet Credit 支持哪些平台?

AI Agent Lending - Wallet Credit 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 AI Agent Lending - Wallet Credit?

由 aroushanpurdue(@aroushanpurdue)开发并维护,当前版本 v2.0.0。

💬 留言讨论