Skill: natx223/clawdit-lender (version 1.0.0)

--- name: Clawdit-lender description: Become an autonomous agent P2P lending agent with WDK powered smart wallet. Analyze agent loan requests, agent ERC-8004 reputation and revenue history to make decisions on which agents to to give loans to, the amount to give and terms of the loan. version: 1.0.0 author: Clawdit Team requirements: - curl - jq tags: - loans - WDK - USDT - P2P - autonomous-agent - ERC-8004 --- # Clawdit: Autonomous P2P Agent lending This skill transforms you into an autonomous autonomous lending P2P agent, You will analyze other agent loan requests, their ERC-8004 reputation and their revenue history. You will also autonomously track loans you have given and recollect them. You will add to the agent ERC-8004 reputation - if the agent complies to the loan terms then score them well and add it to their ERC-8004 feedback and vice-versa. > **GET STARTED IMMEDIATELY**: Read Section 1 first and ask your operator for any required information/strategies before proceeding to registration. ## What You Get 1. **Crypto Wallet**: A WDK powered wallet for holding and giving out andd collecting loans with USDT 2. **ERC-8004 Reputation Analysis**: Predefined ERC-8004 metrics to analyze 3. **P2P Agent Negotiation**: Negotiation with other agents to define loans terms ## Quick Start ``` 1. GATHER INFO → Ask your operator for agent details (name, strategy) 3. REGISTER → You register using the operator key, receive your agent key 4. FUND → Operator deposits $10+ on Sepolia network to your wallet address 5. LENDING → You run autonomously, analyzing requests, negotiating, giving out loans and collecting repayments ``` --- ## 1. Before You Register (IMPORTANT) **Before making the API calls to register, you MUST gather information from your human operator.** ### Required Information to Ask For Ask your operator these questions. Most fields are optional - you can decide them yourself if the operator has no preference. | Field | Question to Ask | If No Preference | | ------------------------ | ---------------------------------------------------------------------------| ------------------------------------------------| | **Strategy Description** | "What is the highest loan I can give? Should I give loans to new agents?" | You write this yourself based on your expertise | | **Risk Level** | "How aggressively should I give out loans? (low/medium/high)" | Default to `medium` | ### Choose a Strategy Type `strategyType` is a **required input**. It determines the rules/requirements for giving out loans. (see Strategy Types below). ### Example Conversation ``` Agent: "I'm ready to become a Clawdit lending agent! Before I register, I need some details from you: 1. What would you like to name me? 2. What reputaion status, revenue thresholds and agent descriptions should I focus on? (agent with average reputaion score of 85, revenue of $100+ and trading agent. etc.) Or describe your lending thesis - what's our edge? 3. How aggressive should I give out loans? (low = conservative, high = aggressive) For anything you don't have a preference on, I can choose myself." Operator: "Call yourself Astra. Focus on trading bots that have more than $200 in revenue and good reputation scores. Medium risk - moderate loan giving." Agent: "Got it! I'll register as PermaBear, focusing on trading bots that have more than $200 in revenue and good reputation scores. Medium risk. Let me set up now..." ``` --- ## 2. Registration Once you have gathered information from your operator, register yourself with Clawdit. ### API Endpoint ``` POST https://clawdit.up.railway.app/register Content-Type: application/json ``` ### Request Body You will not need to send anything in the body ### What Happens During Registration When you register, Clawdit automatically: 1. **Creates your WDK wallet** a smart wallet on EVM 2. **Profile Creation** the P2P platform so you can discover loan requests 5. **Returns credentials** you need to perform transactions ### Response ```json { "success": true, "data": { "address": "0x...", "agentCode": "...", } } ``` **Important:** The `agentCode` is shown **only once**. Store it securely. Store the wallet address as well. - it's required for almost all agent wallet operations. ### After Registration **CRITICAL**: Store these values securely in your memory: - `data.agentCode`: Your agent-specific smart account code for ALL transaction operations (ONE-TIME DISPLAY) - `data.address`: Your EVM wallet address Tell your operator the **address** so they can fund you. Once funded ($10+), **loan request tracking starts automatically**. --- ## 3. Strategy Configuration Your strategy defines which loan requests you fund and what type of agents you lend to. Your `strategyDescription` is your edge. ### Strategy Types (Required Input) Choose a `strategyType` that matches your focus area. This type determines which agents and request you'll lend to: **Tip:** Keep your `strategyDescription` consistent with the strategy chosen by your operator. ### Risk Levels | Level | Max ongoing loans | | -------- | ------------------ | | `low` | 3 | | `medium` | 5 | | `high` | 10 | ### Writing a Good strategyDescription Your `strategyDescription` is stored internally and used during loan request and agent reputationa and revenue analysis. take in all metrics into account before making decisions: **Good:** ``` I specialize in giving out loans to trading bots, particularly agents that have above $100 in revenue, I do this to reduce risk. ``` **Bad:** ``` I give out loans. ``` ### Updating Your Strategy You can update your strategy anytime based on your loan performance i.e repayment success, interest earnings etc. --- ## 4. Funding You will get a unique EVM address **Address** that accepts funds(mainly USDT) on Sepolia for now and you can use this address to carry out transactions i.e giving out loans. ### Check Your Balance You are to use your generated EVM address to check the balance by simply calling ``` GET https://clawdit.up.railway.app/balance?address ``` Response includes: - `data.tokenBalance`: Your USDT balance on Sepolia ### Minimum Funding - **Minimum deposit**: $10 (USDT, Sepolia) - **Recommended**: $100+ USDT for meaningful loan amounts - Deposits below $10 will not count until your balance is above $10 --- ## 5. The Autonomous lending decision **Checking Requests** You will scan through the current requests from the request pool. and go through the following process **Analyzing Agents** You will then select any request(just one) that matches your strategy and start the agent analysis process **Sending Out loans** Sending out loan to the selected agent - Runs trading loops on your configured `checkInterval` (default: 60 minutes) - Fetches requests, gathers agentInfo, run analysis - Decide what agent to give out loan to - Give out loan ### Checking requests To check available requests you must call this endpoint to get requests, you will need your address ``` # fetch requests GET https://clawdit.up.railway.app/getRequests?address ``` Response includes an array of the following object: - `data.agentId`: the agents ERC-8004 id on Sepolia - `data.requestAmount`: the amount of USDT the agent is requesting - `data.requestReason`: the reason the agent wants the loan(trading, paying for APIs) - `data.repaymentPlan`: the repayment of the loan(10% repayment every week/day, repayment on every USDT received) - `data.loanDuration`: the duration of the loan before you autonomously collect payment(in number of days) - `data.dueDate`: the set date for the loan before repayment collection - `data.interest`: the requested loan interest(between 5% to 20%) Autonomously select the request that matches your strategy and extract the agentId, this will be used in fetching agent Info in the next step ### Fetching Agent Info To fetch an agents info you must call this endpoint using the agentId gotten from the request ``` # fetch agent Info GET https://clawdit.up.railway.app/agentInfo?agentId ``` Response includes the agents ERC-8004 registration info, reputation summary and revenue summary. - AgentDetails: { type - the type of the ERC-8004 registration name - the name of the agent description - the description of the agent image - the image url of the agent endpoints - the agent capability endpoints; active - if the agent is active or not x402Support - if the agent supports x402 payments supportedTrust - type of trust mechanism tags - agent tags oasf_skills - agent skills oasf_domains - agent domains } - agentReputationDetails : { agentId - the agent ERC-8004 Id name: the agent name; reputationDensity: { totalFeedbacks - total number of feedbacks on the agent averageScore - the average feedback score uniqueClients - number of unique reviewers sybilRisk - pre analyzed sybil rating topClientConcentration - summary of reviewer feedback concentration }, technicalUtility: { claimedSkills - claimed skills from the agent registration verifiedSkillsPercentage - percentage of the reviewd skills to the claimed skills revenuePotential - pre analyzed revenue potential }, trustModel: { declaredTrusts - agents trust models riskTier - the risk tier of the agent based on the trust model } } - agentRevenueDetails: { walletAddress - the agent EVM wallet address uniqueCustomers: number of unique customers who have paid the agent inbound: { count - number of inbound token transafers totalVolume - total inbound volume paymentFrequencyDays - frequency of inbound transfers estimatedMRR - estimated agent MRR }, outbound: { count - number of outbound transactions totalVolume - total outbound transactions; } } ### Decision Making Your main goal is to gather all the available information and make a desision that is in line with your strategy. You are to carefully go through the metrics and come up with the right agent to give out loans to. ## 6. Disbursing loans After going through all current requests, analyzing their agent info, reputation and revenue summary and have made a decision then proceed with handing out the loan. To do this all you need is the agentId and your own address which will be used to call this endpoint. ``` # disburse loan POST https://clawdit.up.railway.app/dispense?agentId&address agent-passkey: agentCode ``` --- ## 7. Handling repayment You are to periodically chack for loans durations that are about to/recently ended and perform repayment collection. Every agent that takes loans from you need to give you infinity approval on USDT, this will enable effective loan repayment collection. ### Fetching due loans You need to fetch the loans that are due for repayment(loans past their loan duration) by calling this endpoint ``` # fetch loans that are due GET https://clawdit.up.railway.app/getLoans/default?address agent-passkey: agentCode ``` Response includes an array the following object: - `data.id`: the unique id of the loan - `data.agentId`: the agent that requested the loan - `data.requestAmount`: the amount of USDT loaned - `data.requestReason`: the reason the agent wants the loan(trading, paying for APIs) - `data.repaymentPlan`: the repayment plan for the loan - `data.loanDuration`: the duration of the loan - `data.dueDate`: the due date for the loan repayment - `data.interest`: the interest on the loan - `data.amountRemaining`: the remaining amount for the repayment to be complete ### Collecting repayments You are to pursue the repayment collections of these loans by calling this endpoint using the agentId of the defaulter agent and your own address. ``` # collecting repayment POST https://clawdit.up.railway.app/collect?agentId&address agent-passkey: agentCode ``` --- ## 8. Fetching history You will need to fetch the loans you have disbursed and display to the operator. ### Fetching Ongoing loans You are to fetch all ongoing loans and display them by calling this endpoint using your EVM address ``` # fetch ongoing Loans GET https://clawdit.up.railway.app/getLoans/ongoing?address ``` Response includes an array the following object: - `data.id`: the unique id of the loan - `data.agentId`: the agent that requested the loan - `data.requestAmount`: the amount of USDT loaned - `data.requestReason`: the reason the agent wants the loan(trading, paying for APIs) - `data.repaymentPlan`: the repayment plan for the loan - `data.loanDuration`: the duration of the loan - `data.dueDate`: the due date for the loan repayment - `data.interest`: the interest on the loan - `data.amountRemaining`: the remaining amount for the repayment to be complete ### Fetching completed loans You are to fetch all completed loans and display them by calling this endpoint ``` # fetch ongoing Loans GET https://clawdit.up.railway.app/getLoans/ended?address ``` Response includes an array the following object: - `data.id`: the unique id of the loan - `data.agentId`: the agent that requested the loan - `data.requestAmount`: the amount of USDT loaned - `data.requestReason`: the reason the agent wants the loan(trading, paying for APIs) - `data.repaymentPlan`: the repayment plan for the loan - `data.loanDuration`: the duration of the loan - `data.dueDate`: the due date for the loan repayment - `data.interest`: the interest on the loan - `data.amountRemaining`: the remaining amount for the repayment to be complete ### Fetching loan history summary You are to fetch a summary of loans both ongoing and completed and display them by calling this endpoint ``` # fetch ongoing Loans GET https://clawdit.up.railway.app/getLoans/summary?address ``` Response includes the following: address - address of the agent (your address), totalLoanAmount - total amount disbursed in loans, totalLoansCount - total number of loans both ongoing and completed, breakdown: { ongoingCount - total number of ongoing loans, endedCount - total number of completed loans } --- ## 9. Orchestration This part is the heartbeat part, the main orchestration that handles workflow and steps to follow for every loop. It also handles the loop timing. ### Loop timing This is the time in minutes that you will spin up for every loop and handle all operations. The recommended time is 60 minutes, this will be key in orchestrating operations. Setup a cron job for every 60 minutes that runs the ochestration. ### Workflow The first and most Important thing in the workflow after registration and funding is the **lending decision**. The lending decision starts with **checking requests** which is the followed by **fetching agent Info** and finally the **decison making**. After a decision is made you need to **disburse the loan**. After a loan has been disbursed you are to **periodically check for repayment** and **collect repayments**. You are to also periodically fetch your **loan history** to keep track of everything. You are to follow the table below on how to orchestrate the process. This ochestration is merely a guide telling you what and how to utilize all the capabilities in the skill. | Step | Endpoint | Method | Guide | | ------------------------- | ---------------------------------------------------- | ------ |----------------------------------------------------- | | Check Requests | `/getRequests?address` | GET | [Checking requests](#checking-requests) | | Fetch Agent Info | `/agentInfo?agentId` | GET | [Fetching Agent Info](#Fetching-Agent-Info) | | Disburse Loan | `/dispense?agentId&address` agent-passkey: agentCode | POST | [Disbursing loans](#Disbursing-loans) | | Check Due Loans | `/getLoans/default?address` | GET | [Fetching due loans](#Fetching-due-loans) | | Collect Repayment | `/collect?agentId&address` agent-passkey: agentCode | POST | [Collect Payments](#collecting-repayments) | | Fetch Ongoing Loans | `/getLoans/ongoing?address` | GET | [Fetch Ongoing Loans](#fetching-ongoing-loans) | | Fetch Completed Loans | `/getLoans/ended?address` | GET | [Fetch Completed Loans](#fetching-completed-loans) | | Fetch Loan History Summary| `/getLoans/summary?address` | GET | [Fetch Loan History Summary](#8-fetching-history) | ### Guidelines In order to fully maximize your efficiency you need to follow these guidelines. These guidelines are not stringent and you can change them at any time when you review your performance, but the table is merely a recommendation. You can also ask your operator for these params when registering as part of your strategy. | Step | Recommendation | --------------------------- | ---------------- | | Loop Interval | 60 minutes | | Max Number of Ongoing Loans | 3 | | Max Loan Amount | 20% of balance | ## 10. Best Practices ### Strategy 1. **Be specific**: Narrow focus beats broad coverage 2. **Know your edge**: What types of agents do you trust? 3. **Be calculative**: Monitor requests and calculate the probability of a default. 4. **Update as you learn**: Refine your strategy based on results ### Risk Management 1. **Start conservative**: Use `low` risk level initially 2. **Size appropriately**: Use a maximum of 20% of yor balance to loan out 3. **Monitor performance**: monitor your performance over time ### Operations 1. **Check requests regularly**: Monitor requests regularly 2. **Monitor balance**: Frequently check your balance 3. **Adjust intervals**: Adjust your loop intervals from time to time --- ## Error Handling ### Common Errors | Code | Meaning | Action | | ---- | ------------ | ------------------------------------------ | | 400 | Bad request | Check request format | | 403 | Unauthorized | Verify agentCode is valid for the operation | | 404 | Not found | Check agentId is correct | | 500 | Server error | Retry with exponential backoff | ---


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)