Development of NFT Collateral Lending Protocol (NFTfi)
An NFT collection of 10,000 tokens with a 2 ETH floor price represents 20,000 ETH in locked value. Selling a single NFT quickly at market price is difficult: listing, waiting for buyers, losing a rare asset. An NFTfi protocol lets you borrow ETH against NFT collateral without selling—a CryptoPunk or Bored Ape holder gets liquidity, a lender gets yield. The development challenge is building a system where both lender and borrower are protected by smart contracts, and NFT valuation prevents lending 5 ETH against an asset with a 1 ETH floor.
The Core Problem: How to Value NFTs On-Chain
This is the only fundamental difficulty in NFTfi that cannot be solved standardly. ERC-20 tokens have liquid markets and Chainlink Price Feeds. NFTs have no unified price—only floor, last sale, rarity score, trait-based pricing. All these metrics are manipulable with insufficient trading volume.
Valuation Approaches and Trade-Offs
Peer-to-peer model (NFTfi, Arcade.xyz)—lenders and borrowers agree on amount, rate, and duration themselves. The smart contract merely holds the NFT in escrow and executes conditions. Valuation is a matter for the parties, not the protocol. This eliminates oracle manipulation risk but reduces liquidity: borrowers must wait for a lender's offer.
Pool-based model (BendDAO, JPEG'd)—liquidity in a pool, loans issued instantly at the oracle's floor price. Fast and convenient but creates systemic risk: if a collection's floor price falls faster than liquidations can occur, the pool loses money. BendDAO faced this in August 2022: massive BAYC floor price decline created a threat of $5,000 ETH in bad debt; the protocol was forced to urgently change liquidation parameters.
Hybrid model—peer-to-peer for large loans, pool for standard collections with verified floors. More complex to develop but more resilient.
In pool-based approaches, the floor price oracle is critical. Use a median of multiple sources: Chainlink NFT Floor Price Feeds (available for top collections), Reservoir Protocol API with on-chain verification, TWAP of recent sales from marketplace events. A single oracle source is vulnerable to flash loan manipulation.
Protocol Architecture
Loan Lifecycle
Borrower → depositsNFT() → NFT goes to escrow contract
Borrower → requestLoan(nftId, amount, duration) → creates LoanTerms struct
Lender → fundLoan(loanId) → sends ETH/ERC-20 to borrower
...loan period...
Borrower → repayLoan(loanId) → repay principal + interest, NFT returns
OR
Lender → liquidate(loanId) → after expiry, NFT transfers to lender
Key smart contracts:
- LoanCore—core logic, stores loan state
- OriginationController—condition validation, signature verification for P2P
- VaultFactory—creates individual vault for each NFT (asset isolation)
- RepaymentController—interest calculation, repayment processing
- FeeController—protocol fee
Splitting into separate contracts is not overengineering but necessary: LoanCore upgrades via UUPS; OriginationController can be replaced without migrating loan data.
ERC-721 and ERC-1155 Handling
ERC-1155 adds complexity: a token may be fungible (if supply > 1) or semi-fungible. For lending, you must decide whether to accept partial collateral (100 of 1000 tokens of one ID). Most protocols limit themselves to ERC-721 and ERC-1155 with supply = 1. Supporting fractional ERC-1155 collateral multiplies the complexity of valuation and liquidation logic.
Accepting NFT collateral via safeTransferFrom with onERC721Received hook. The hook verifies that the NFT comes from allowlisted collections—accepting any ERC-721 is risky, you might receive trash tokens as collateral.
Liquidation: The Trickiest Part
In pool-based models, liquidation must be atomic or protected from MEV. A typical attack scenario: a liquidator sees a position is healthy (health factor > 1), sends a liquidate transaction; a MEV bot front-runs by buying the NFT on the marketplace at floor price and relisting it—classic sandwich. Solution: a grace period before liquidation and an auction mechanism (Dutch auction for NFT collateral), not immediate transfer to the lender.
Development Stack
Contracts: Solidity 0.8.x, framework: Foundry. For the P2P portion, use EIP-712 signature verification—borrower signs LoanTerms off-chain, lender verifies the signature on-chain. This eliminates approve transactions for the borrower.
Tests include fork-tests on Ethereum mainnet: real collections (BAYC, Azuki), real marketplace events to simulate floor price changes. Foundry's vm.warp simulates loan expiration.
Frontend (if needed): wagmi + viem, NFT data via Alchemy NFT API or Reservoir.
Work Process
Design (1 week). Choose model (P2P/pool/hybrid), list supported collections, set risk parameters (max LTV, liquidation threshold), define protocol fee tokenomics.
Development (4-8 weeks). Core contracts, oracle integration, tests with >95% coverage, fuzz tests on loan math.
Audit (2-4 weeks). Mandatory for protocols with TVL. At least one external auditor. Recommend Spearbit, Trail of Bits, or Code4rena contest for peer review.
Deployment. First testnet with real users, then mainnet via Gnosis Safe multisig. Risk parameters via governance or timelocked admin.
Timeline Estimates
P2P protocol without a pool: 6-8 weeks development. Pool-based with oracle integration and auction liquidation: 10-16 weeks. Add 4-6 weeks for audit and mainnet preparation.







