EIPs Explained

ERC-2021 · Stagnant · ERC · 2019-05-10

ERC-2021: Payoutable Token

A proposed ERC-20 extension that lets holders of an issuer-backed token (such as a bank-issued stablecoin) request an off-chain payout on-chain, with a tracked lifecycle from order to burn or rejection.

What problem does it solve?

For tokens that represent money held by an issuer, cashing out ("payout" or redemption) usually starts outside the chain: the holder contacts the issuer, the issuer burns tokens and sends a bank transfer. The request itself, its status and its outcome are invisible on-chain.

ERC-2021 moves the start of that workflow on-chain. A holder (or someone they authorise) places a payout order on the token contract, funds are locked, and the issuer's operator moves the order through defined states until the tokens are burned or returned.

How it works

Actors:

  • Token wallet owner: holds the tokens and orders the payout.
  • Orderer: an address the owner authorised (authorizePayoutOperator) to order payouts on their behalf.
  • Operator: the token issuer or its agent, who processes requests.

Lifecycle of one payout, identified by a string operationId:

  1. orderPayout(operationId, value, instructions) or orderPayoutFrom(...) puts the funds on hold (using ERC-1996 holds) and sets status Ordered. Reusing an operationId must revert.
  2. processPayout sets InProcess. From here the orderer can no longer cancel.
  3. putFundsInSuspenseInPayout executes the hold, moving funds to a suspense wallet: FundsInSuspense.
  4. The operator pays out off-chain, then executePayout burns the tokens: Executed.

Alternatively the operator can rejectPayout(operationId, reason) (Rejected, funds released), or the orderer can cancelPayout while still Ordered (Cancelled). Reasons may use ERC-1066 status codes. Every transition emits an event, and retrievePayoutData returns the wallet, amount, instructions and status.

Sample code

Ordering and tracking a payout with ethers v6 (the destination details are referenced, not stored in plain text):

import { Contract, Wallet, JsonRpcProvider, parseUnits } from "ethers";

const abi = [
  "function orderPayout(string operationId, uint256 value, string instructions) returns (bool)",
  "function retrievePayoutData(string operationId) view returns (address walletToDebit, uint256 value, string instructions, uint8 status)",
];
const STATUS = ["Nonexistent", "Ordered", "InProcess", "FundsInSuspense", "Executed", "Rejected", "Cancelled"];

const wallet = new Wallet(process.env.PRIVATE_KEY!, new JsonRpcProvider(process.env.RPC_URL));
const token = new Contract(process.env.TOKEN!, abi, wallet);

const opId = `myapp-${crypto.randomUUID()}`;          // unique prefix avoids collisions
await (await token.orderPayout(opId, parseUnits("100", 18), "ref:encrypted-instruction-id")).wait();

const [, , , status] = await token.retrievePayoutData(opId);
console.log(STATUS[Number(status)]);                    // "Ordered"

Things to know

  • Status is Stagnant, and it depends on ERC-1996 and ERC-1066, which are also Stagnant.
  • The spec explicitly warns against putting bank details or other payout instructions on-chain in plain text. Use private channels, or at most an encrypted value or reference.
  • Everything after the order relies on the operator: the standard records the workflow but cannot force the off-chain payment.
  • The spec text has inconsistencies (e.g. it names isApprovedToOrderPayout in prose but isPayoutOperatorFor in the interface), so check a concrete implementation's ABI.

#token #payout #stablecoin #e-money

Details

Authors
Fernando Paris <[email protected]>, Julio Faura <[email protected]>, Daniel Lehrner <[email protected]>
Status
Stagnant
Type
Standards Track / ERC
Created
2019-05-10
Requires
Required by

Machine-readable: Markdown · JSON