> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usmewe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Loan Request Flow

> How to request and receive a peer-to-peer loan

# Loan Request Flow

The P2P lending process in usmewe is designed to be simple, transparent, and instant.

## Overview

```
┌─────────────────────────────────────────────────────────────────┐
│  1. REQUEST          2. MATCH           3. FUND          4. USE │
│  ───────────────────────────────────────────────────────────────│
│  User submits    →  System finds   →  Funds sent   →  Borrow   │
│  loan request       best rates        instantly       & repay   │
└─────────────────────────────────────────────────────────────────┘
```

## Step 1: Check Eligibility

Before requesting a loan, verify your borrowing limits:

<CardGroup cols={2}>
  <Card title="Trust Score" icon="star">
    Minimum score of 10 required to borrow
  </Card>

  <Card title="Active Loans" icon="clock">
    Maximum 3 active loans at once
  </Card>
</CardGroup>

```typescript theme={null}
// Check your borrowing eligibility
const eligibility = await usmewe.loans.checkEligibility();

// Response
{
  "eligible": true,
  "maxAmount": 100,
  "maxDuration": 30,
  "currentLoans": 1,
  "trustScore": 56
}
```

## Step 2: Submit Request

Create a loan request with your desired parameters:

| Parameter  | Description       | Constraints               |
| ---------- | ----------------- | ------------------------- |
| `amount`   | USDC amount       | Based on Trust Score tier |
| `duration` | Loan term in days | 7-90 days                 |
| `purpose`  | Reason for loan   | Optional but recommended  |

```typescript theme={null}
const loanRequest = await usmewe.loans.create({
  amount: 50,
  duration: 14,
  purpose: "Emergency expense"
});

// Response
{
  "requestId": "loan_req_abc123",
  "status": "pending",
  "amount": 50,
  "duration": 14,
  "interestRate": 0.03, // 3%
  "totalRepayment": 51.50,
  "expiresAt": "2024-01-15T12:00:00Z"
}
```

## Step 3: Automatic Matching

The system automatically matches your request with available liquidity:

<Steps>
  <Step title="Trust Vault Check">
    System checks if Trust Vault has sufficient liquidity
  </Step>

  <Step title="Rate Calculation">
    Interest rate calculated based on utilization and your Trust Score
  </Step>

  <Step title="Insurance Fee">
    10% of loan amount reserved for Insurance Pool
  </Step>

  <Step title="Instant Funding">
    Funds transferred to your wallet immediately
  </Step>
</Steps>

## Step 4: Receive Funds

Once matched, funds are sent instantly to your connected wallet:

```typescript theme={null}
// Loan funded event
{
  "event": "loan.funded",
  "loanId": "loan_xyz789",
  "amount": 50,
  "netAmount": 45, // After 10% insurance fee
  "walletAddress": "0x...",
  "txHash": "0x...",
  "repaymentDue": "2024-01-29T12:00:00Z"
}
```

<Note>
  The 10% insurance fee is deducted upfront. If you request $50, you receive $45.
</Note>

## Interest Rates

Interest rates are dynamic based on:

| Factor                | Impact                             |
| --------------------- | ---------------------------------- |
| **Trust Score**       | Higher score = lower rate          |
| **Vault Utilization** | Higher usage = higher rate         |
| **Loan Duration**     | Longer term = slightly higher rate |
| **Level Bonus**       | Gold+ levels get rate discounts    |

### Rate Tiers

| Trust Score | Base Rate |
| ----------- | --------- |
| 10-30       | 5%        |
| 31-50       | 4%        |
| 51-70       | 3%        |
| 71-85       | 2%        |
| 86-100      | 1%        |

## Loan States

Your loan can be in one of these states:

```
pending → funded → active → repaid
                      ↓
                   overdue → defaulted
```

| State       | Description                         |
| ----------- | ----------------------------------- |
| `pending`   | Request submitted, awaiting funding |
| `funded`    | Funds sent to wallet                |
| `active`    | Loan in progress                    |
| `repaid`    | Successfully repaid                 |
| `overdue`   | Past due date, grace period         |
| `defaulted` | Not repaid within grace period      |

## Cancellation

You can cancel a pending loan request before it's funded:

```typescript theme={null}
await usmewe.loans.cancel("loan_req_abc123");
```

<Warning>
  Once a loan is funded, it cannot be cancelled. You must repay the full amount.
</Warning>

## Next Steps

<CardGroup cols={2}>
  <Card title="Repayment Guide" icon="money-bill" href="/core-concepts/p2p-lending/repayment">
    How to repay your loan
  </Card>

  <Card title="Borrowing Limits" icon="chart-line" href="/core-concepts/trust-score/borrowing-limits">
    Understand your limits
  </Card>
</CardGroup>
