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

# Nft Loans

> Nft Loans — Dark Matter Protocol on Robinhood Chain.

# NFT Loan Pool

`NftLoanPool` is a pooled NFT lending market: lenders deposit ETH and earn interest
pro-rata; borrowers lock whitelisted NFTs as collateral and borrow against a
collection floor price.

## Parameters (admin-tunable, all defaults live)

| Parameter | Default | Meaning |
| - | - | - |
| `ltvBps` | **4000 (40%)** | Borrow up to 40% of the admin-set collection floor |
| `aprBps` | **2000 (20%)** | APR, linear, accrued per second |
| `protocolFeeBps` | **1000 (10%)** | Share of interest → DarkMatterTreasury |
| `loanTerm` | **90 days** | Fixed borrow term |

## Lender side

Deposits mint shares; interest accrues through a **cumulative per-share track** (the
FounderPass pattern — lenders never claim interest earned before they existed):

```solidity theme={null}
accumPerShare += interest * 1e18 / totalShares;   // per interest event
claimable = (accumPerShare − claimedPerShare[lender]) / 1e18;
```

* `withdraw(shares)` pays principal + accrued interest together — the liquidity check
  excludes the caller's own interest so a lender can never be unable to withdraw
  principal + interest in one call.
* `claimInterest()` pays just the interest.
* 90% of all interest goes to lenders pro-rata; 10% is the treasury fee.

## Borrower side

```
borrow(collection, tokenId):
    principal = floorPriceOf[collection] × ltvBps / 10000     // 40% of floor
    dueAt     = now + 90 days
    NFT moves into the pool via transferFrom

debt at time t = principal + (principal × aprBps × elapsed) / (10000 × 31_536_000)
                 // interest FROZEN at dueAt — no snowballing
```

| Action | Effect |
| - | - |
| **Repay** | Pay principal + accrued interest → NFT returns to you |
| **Liquidate** (permissionless, after due) | Repay the debt → NFT goes to the liquidator |

Liquidation is **permissionless and incentive-aligned**: the liquidator pays the debt
and receives the NFT, so overdue loans clear without any bot infrastructure.

## Worked example

A collection has a 1 ETH admin-set floor. Borrower locks one NFT:

| Step | Math | Value |
| - | - | - |
| Borrow | 1 ETH × 40% | **0.40 ETH** received |
| Debt after exactly 90 days | 0.40 × (1 + 0.20 × 90/365) | **≈ 0.4197 ETH** |
| Interest | 0.4197 − 0.40 | ≈ 0.0197 ETH |
| Treasury fee | 10% of interest | ≈ 0.0020 ETH |
| Lenders receive | 90% pro-rata by shares | ≈ 0.0177 ETH |

Borrower repays 0.4197 ETH → NFT returns. If they don't, anyone liquidates by paying
0.4197 ETH and takes the NFT.

## Pool solvency — no receive() on purpose

The pool has **no `receive()`** and only `deposit()` / `liquidate()` bring ETH in.
This guarantees a simple invariant: every wei of unclaimed lender interest is covered
by real pool balance, and withdrawals re-check:

```solidity theme={null}
// withdraw(): remaining unclaimed interest must stay covered after payout
require(address(this).balance − amount ≥ totalUnclaimedInterest − interest);
```

## Safety model

| Concern | Answer |
| - | - |
| Floor price manipulation | Floors are admin-set per collection, not oracle-fed from AMMs |
| Interest snowball past due | Frozen at `dueAt` by design |
| Share dilution of old lenders | Checkpoint at deposit — no lender earns interest from before their deposit |
| Fee skimming | Treasury fee only ever takes 10% of *interest*, never principal |
| Admin rug | Parameters are tunable but principal/interest accounting is not; two-step admin handover |

Next: [Fee Matrix](../reference/fee-matrix.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.