---
eip: 7565
label: ERC-7565
title: Perpetual Contract NFTs as Collateral
status: Draft
type: Standards Track
category: ERC
created: 2023-11-27
requires: 721, 4907
official: https://eips.ethereum.org/EIPS/eip-7565
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7565.md
canonical: https://eips.huatuo.xyz/ko/eip-7565/
lang: ko
tldr: "잠긴 DeFi 포지션(LP 토큰, 스테이킹 락)을 나타내는 NFT의 보유자가 이를 담보로 대출받을 수 있게 한다. ERC-4907의 'user' 역할로 NFT가 담보로 잡혔음을 표시하고, 소유자는 포지션과 그 보상을 계속 유지한다."
tags: [nft, defi, collateral, lending, erc4907]
---

# ERC-7565: Perpetual Contract NFTs as Collateral

> Lock financial assets as NFTs and use them as collateral for borrowing funds in DeFi, facilitating liquidity provision.

**TL;DR:** 잠긴 DeFi 포지션(LP 토큰, 스테이킹 락)을 나타내는 NFT의 보유자가 이를 담보로 대출받을 수 있게 한다. ERC-4907의 'user' 역할로 NFT가 담보로 잡혔음을 표시하고, 소유자는 포지션과 그 보상을 계속 유지한다.

## 어떤 문제를 해결하나요?

많은 DeFi 프로토콜은 자산을 잠그면 NFT를 줍니다. AMM 유동성 포지션, 기간이 잠긴 스테이크, vote-escrow 락 등입니다. 자산은 계속 수수료, 이자, 투표권을 만들어 내지만 유동성은 없습니다. 현금이 필요하면 인출해야 하는데, 그러면 그 혜택을 잃고 풀에서 유동성이 빠져나갑니다(다른 모든 사람의 슬리피지가 커집니다).

ERC-7565는 이런 NFT를 대출 담보로 잡힐 수 있는 "영구 컨트랙트 NFT(perpetual contract NFT)"로 취급하자고 제안합니다. 기반 포지션은 잠긴 채 계속 수익을 내는 동안 유동성을 얻을 수 있습니다. 이 아이디어는 저자들의 2022년 IEEE Access 논문에서 나왔습니다.

## 어떻게 동작하나요?

이 표준은 [ERC-721](/eip-721/)과, NFT의 **소유자**와 기간이 제한된 **user**를 분리하는 대여 확장 [ERC-4907](/eip-4907/)을 기반으로 합니다.

- `collateralize(tokenId, loanAmount, interestRate, loanDuration)`: 소유자(또는 승인된 오퍼레이터)가 NFT를 담보로 잡힙니다. 레퍼런스 구현에서는 대출 컨트랙트가 `loanDuration` 동안 자신을 ERC-4907의 `user`로 설정하고 대출 조건을 기록합니다. `Collateralized`를 발생시킵니다.
- `repayLoan(tokenId, repayAmount)`: 차입자가 상환합니다. 잔액이 0이 되면 `user`가 해제되고 NFT는 다시 자유로워집니다. `LoanRepaid`를 발생시킵니다.
- 대출이 채무 불이행되어 NFT가 대여자에게 넘어가면 `Defaulted(tokenId, lender)`를 반드시 발생시켜야 합니다.
- 읽기 헬퍼: `getLoanTerms`, `viewRepayAmount`(원금과 현재까지의 이자), `currentOwner`.

레퍼런스의 `viewRepayAmount`는 이자를 경과한 시간(정수 시간 단위)에 비례해 계산하고, 대출 기간을 상한으로 하며, 올림합니다. 따라서 기간의 절반 시점에 상환하면 이자도 대략 절반이 듭니다.

## 샘플 코드

명세의 인터페이스:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

interface IPerpetualContractNFT {
    event Collateralized(uint256 indexed tokenId, address indexed owner, uint256 loanAmount, uint256 interestRate, uint256 loanDuration);
    event LoanRepaid(uint256 indexed tokenId, address indexed owner);
    event Defaulted(uint256 indexed tokenId, address indexed lender);

    function collateralize(uint256 tokenId, uint256 loanAmount, uint256 interestRate, uint64 loanDuration) external;
    function repayLoan(uint256 tokenId, uint256 repayAmount) external;
    function getLoanTerms(uint256 tokenId) external view returns (uint256 loanAmount, uint256 interestRate, uint256 loanDuration, uint256 loanDueDate);
    function currentOwner(uint256 tokenId) external view returns (address);
    function viewRepayAmount(uint256 tokenId) external view returns (uint256);
}
```

대출받고 전액 상환하기(ethers v6):

```ts
import { parseEther } from "ethers";

await nft.collateralize(1n, parseEther("1"), 5n, 7n * 24n * 3600n); // 1 ETH, 5 %, 7 days
console.log(await nft.userOf(1n));          // lending contract while the loan is open

const due = await nft.viewRepayAmount(1n);
await nft.repayLoan(1n, due);
console.log(await nft.userOf(1n));          // zero address once repaid
```

## 알아둘 점

- 상태는 **Draft**이며 Security Considerations 섹션은 아직 비어 있습니다.
- 인터페이스는 대출 조건을 기록하지만, 자금이 실제로 어떻게 대출되고 상환되는지, 대출 금액이 잠긴 자산의 가치와 어떤 관계인지, 청산이 어떻게 동작하는지는 명시하지 않습니다. 레퍼런스 코드는 채무 불이행 처리와 자금 이동을 "추가 로직"으로 남겨 둡니다.
- 잠금으로 ERC-4907의 `user` 역할을 쓰는 것은 레퍼런스 구현의 관례입니다. 대여자는 대출이 열려 있는 동안 소유자가 기반 포지션을 그냥 전송하거나 인출할 수 없도록 해야 합니다.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7565
