---
eip: 5507
label: ERC-5507
title: Refundable Tokens
status: Final
type: Standards Track
category: ERC
created: 2022-08-19
requires: 20, 165, 721, 1155
official: https://eips.ethereum.org/EIPS/eip-5507
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5507.md
canonical: https://eips.huatuo.xyz/eip-5507/
lang: en
tldr: "Adds a standard refund interface to ERC-20, ERC-721 and ERC-1155 sales: buyers can return tokens for ETH until a deadline block, after which the creator can claim the escrowed funds."
tags: [token, nft, refund, escrow]
---

# ERC-5507: Refundable Tokens

> Adds refund functionality to ERC-20, ERC-721, and ERC-1155 tokens

**TL;DR:** Adds a standard refund interface to ERC-20, ERC-721 and ERC-1155 sales: buyers can return tokens for ETH until a deadline block, after which the creator can claim the escrowed funds.

## What problem does it solve?

Token and NFT launches often take buyers' ETH up front and give no recourse if the project disappears ("rug pull"). Some projects promised refunds, but each implemented them differently, so wallets and marketplaces could not show or trigger them.

ERC-5507 standardizes a refund window for initial sales. Funds stay in escrow until a predetermined block; before then, holders can hand tokens back and get ETH. The spec also mentions consumer-protection rules such as refund periods for online purchases as motivation.

## How it works

There is one extension per token standard, each detectable via [ERC-165](/eip-165/):

| Extension | ERC-165 ID | `refund` takes |
| --- | --- | --- |
| [ERC-20](/eip-20/) Refund | `0xf0ca2917` | `amount` |
| [ERC-721](/eip-721/) Refund | `0xe97f3c83` | `tokenId` |
| [ERC-1155](/eip-1155/) Refund | `0x94029f5c` | `tokenId, amount` |

Each has the same shape:

- `refund(...)`: the caller returns their own tokens and receives ETH.
- `refundFrom(from, ...)`: an approved operator refunds someone else's tokens; the ETH goes to `msg.sender` (useful for marketplaces or DEXs).
- `refundOf(...)`: ETH (in wei) paid back per token, or per whole token unit for ERC-20.
- `refundDeadlineOf(...)`: the **first block** at which refunds are no longer possible.
- `Refund` / `RefundFrom` events.

ERC-721 and ERC-1155 also have optional batch versions that succeed or fail as a whole. Deadlines use block numbers rather than timestamps, which the spec considers more reliable.

## Sample code

A minimal refundable ERC-721 (OpenZeppelin v5), following checks-effects-interactions:

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

import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";

contract RefundableNFT is ERC721 {
    uint256 public constant PRICE = 0.05 ether;
    uint256 public immutable refundDeadline;   // first block with no refunds
    uint256 private nextId;

    constructor(uint256 refundBlocks) ERC721("Refundable", "RFD") {
        refundDeadline = block.number + refundBlocks;
    }

    function mint() external payable {
        require(msg.value == PRICE, "price");
        _safeMint(msg.sender, nextId++);
    }

    function refundOf(uint256) external pure returns (uint256) { return PRICE; }
    function refundDeadlineOf(uint256) external view returns (uint256) { return refundDeadline; }

    function refund(uint256 tokenId) external {
        require(block.number < refundDeadline, "refund closed");
        require(ownerOf(tokenId) == msg.sender, "not owner");
        _burn(tokenId);                                   // effects first
        (bool ok, ) = msg.sender.call{value: PRICE}("");  // interaction last
        require(ok, "transfer failed");
    }
    // Owner withdrawal after refundDeadline omitted for brevity.
}
```

## Things to know

- Status is **Final**.
- Re-entrancy is the main risk: destroy or reclaim tokens **before** sending ETH.
- `refundOf` can differ per token; a buyer who acquired tokens on a secondary market at a different price still receives the contract's refund amount.
- The sample omits `supportsInterface`, `refundFrom` and the owner's withdrawal; production code needs all of them and an audit.


---

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