---
eip: 1592
label: ERC-1592
title: Address and ERC20-compliant transfer rules
status: Stagnant
type: Standards Track
category: ERC
created: 2018-11-09
official: https://eips.ethereum.org/EIPS/eip-1592
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1592.md
canonical: https://eips.huatuo.xyz/eip-1592/
lang: en
tldr: A proposed interface for small, pluggable rule contracts that decide whether an address or an ERC-20 transfer is allowed, so anyone can check a transfer before sending it.
tags: [token, compliance, transfer-rules, erc20, security-token]
---

# ERC-1592: Address and ERC20-compliant transfer rules

> We propose a standard and an interface to define transfer rules, in the context of ERC20 tokens and possibly beyond.

**TL;DR:** A proposed interface for small, pluggable rule contracts that decide whether an address or an ERC-20 transfer is allowed, so anyone can check a transfer before sending it.

## What problem does it solve?

Regulated tokens, such as tokenized shares, often need transfer restrictions: frozen accounts, lock-up periods, KYC whitelists. Each token tends to hard-code its own checks inside `transfer`. The result is that when a transfer fails, a wallet or exchange usually cannot tell why, and cannot cheaply check in advance whether it would succeed. It is also hard to notice when the rules change.

ERC-1592 proposes moving each restriction into its own small **rule** contract with a common interface, and attaching an ordered list of rules to the token through a **rule engine**. Anyone, for example an exchange preparing a withdrawal, can ask the engine or a single rule whether a transfer is valid before sending it.

## How it works

**`IRule`** is the interface for one rule:

- `isAddressValid(address)`: is this address allowed at all?
- `isTransferValid(from, to, amount)`: is this specific transfer allowed?

If one check does not apply, the rule simply returns `true`. Rules should be small and single-purpose, so that knowing which rule failed explains why.

**`IWithRules`** is the rule engine, usually inherited by the token:

- `ruleLength()` and `rule(id)` list the active rules.
- `validateAddress` and `validateTransfer` run every rule.
- `defineRules(IRule[])` replaces the whole rule set in one call, and emits `RulesDefined(count)`.

Order matters: the authors recommend putting cheap rules and rules most likely to fail first to save gas. The token then guards `transfer` and `transferFrom` with modifiers that call the engine.

## Sample code

A rule that freezes specific addresses, plus a token check (Solidity 0.8, simplified, no access control on `freeze` for brevity):

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

interface IRule {
    function isAddressValid(address _address) external view returns (bool);
    function isTransferValid(address _from, address _to, uint256 _amount) external view returns (bool);
}

contract FreezeRule is IRule {
    mapping(address => bool) public frozen;

    function freeze(address a, bool f) external { frozen[a] = f; }

    function isAddressValid(address a) public view returns (bool) {
        return !frozen[a];
    }

    function isTransferValid(address from, address to, uint256 /* amount */) external view returns (bool) {
        return isAddressValid(from) && isAddressValid(to);
    }
}

abstract contract WithRules {
    IRule[] internal rules;
    event RulesDefined(uint256 count);

    function validateTransfer(address from, address to, uint256 amount) public view returns (bool) {
        for (uint256 i = 0; i < rules.length; i++) {
            if (!rules[i].isTransferValid(from, to, amount)) return false;
        }
        return true;
    }

    modifier whenTransferRulesAreValid(address from, address to, uint256 amount) {
        require(validateTransfer(from, to, amount), "transfer rule violated");
        _;
    }
}
```

## Things to know

- **Status: Stagnant.** The spec's interfaces are written for Solidity 0.4.25 and the reference implementation comes from Mt Pelerin's protocol.
- Every rule adds an external call to every transfer, so long rule lists make transfers noticeably more expensive.
- The owner can swap rules at any time with `defineRules`. That flexibility is the point, but it also means holders must trust whoever controls the rule set.
- It overlaps with other transfer-restriction efforts such as [EIP-902](/eip-902/), [EIP-1066](/eip-1066/) status codes and [ERC-1462](/eip-1462/). Later security-token work, such as [ERC-3643](/eip-3643/), uses a similar idea of pluggable compliance checks.


---

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