---
eip: 5528
label: ERC-5528
title: Refundable Fungible Token
status: Final
type: Standards Track
category: ERC
created: 2022-08-16
requires: 20
official: https://eips.ethereum.org/EIPS/eip-5528
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5528.md
canonical: https://eips.huatuo.xyz/eip-5528/
lang: en
tldr: "An ERC-20 extension for trustless escrow: buyers and sellers fund an escrow contract, swap tokens if the deal's conditions are met, and buyers can take a refund if it fails."
tags: [token, erc20, escrow, refund, defi]
---

# ERC-5528: Refundable Fungible Token

> Allows refunds for EIP-20 tokens by escrow smart contract

**TL;DR:** An ERC-20 extension for trustless escrow: buyers and sellers fund an escrow contract, swap tokens if the deal's conditions are met, and buyers can take a refund if it fails.

## What problem does it solve?

On-chain payments are final: once you send tokens there is no chargeback. Traditional commerce solves this with a trusted escrow agent. ERC-5528 defines a standard interface so a smart contract can play that role without a third-party arbitrator. Funds are locked under fixed rules, exchanged if the deal succeeds, and returned if it doesn't.

Typical use cases are token sales and crowdfunding-style offerings, where buyers want their money back if a target is not reached.

## How it works

Two kinds of contract are involved:

- **Payable contract**: an [ERC-20](/eip-20/) token (seller's token or buyer's token) that also implements the escrow functions.
- **Escrow contract**: holds both tokens and enforces the policy fixed in its constructor. It MUST name the seller and buyer token contracts and MAY set a period, min/max investors or amounts, an exchange rate, KYC checks and so on.

Three functions, with roles mirrored between the two contracts:

| Function | On the token (payable) contract | On the escrow contract |
| --- | --- | --- |
| `escrowFund(to, value)` | `to` = escrow; forwards the call with the user as `msg.sender`, then moves tokens | records the user's deposit after checking policy; caller must be a token contract |
| `escrowRefund(from, value)` | `from` = escrow; forwards the call, then returns tokens to the user | checks policy and reduces the user's deposit |
| `escrowWithdraw()` | optional | after success, sends seller tokens to buyers and buyer tokens to the seller per the rate |

Flow: the seller deploys the escrow and funds it with seller tokens; buyers fund buyer tokens; once success conditions are met, each side withdraws what it is owed. While the escrow is still running or if it fails, buyers can call `escrowRefund`.

## Sample code

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

interface IERC5528 {
    function escrowFund(address to, uint256 value) external returns (bool);
    function escrowRefund(address from, uint256 value) external returns (bool);
    function escrowWithdraw() external returns (bool);
}
```

Buyer side with ethers v6. You call the **token** contract, which notifies the escrow:

```ts
const buyerToken = new Contract(buyerTokenAddr, [
  "function escrowFund(address to, uint256 value) returns (bool)",
  "function escrowRefund(address from, uint256 value) returns (bool)",
], signer);

await (await buyerToken.escrowFund(escrowAddr, parseUnits("100", 18))).wait();
// later, if the sale has not succeeded:
await (await buyerToken.escrowRefund(escrowAddr, parseUnits("100", 18))).wait();
```

## Things to know

- Status: **Final**. The payable token must implement the hooks itself, so existing ERC-20s cannot be used directly.
- The escrow contract is fully trusted for the deal's rules. A bug in it can lock or lose both sides' funds, so audit it.
- The example code in the spec is illustrative (written for old Solidity and with typos) and should not be deployed as is.
- The token stays fully ERC-20 compatible; plain `transfer` to the escrow bypasses the bookkeeping and should be avoided.


---

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