ERC-2019 Token funding request standard (Fundable Token)
Stagnant · Vaults & DeFi · created 2019-05-10
This standard adds to ERC-20 a procedure by which a token wallet owner can directly request funding on the blockchain, and the issuer approves or rejects the request and issues the tokens.
Why it is needed
Issuing tokens based on fiat-currency payment usually requires a centralized step first, such as a bank transfer, and it is difficult to track how that payment connects to the on-chain issuance. Without this standard, the wallet owner has to notify the issuer of the payment through a separate channel, and the issuer manually verifies it before minting the tokens. Because the records of this process are scattered off-chain, it is hard to track or audit state changes such as requested, processing, and rejected, and there is a risk that the same request gets processed twice or lost. There is also no standardized way to manage who has permission to request funding on someone's behalf.
What to implement
function authorizeFundOperator(address orderer) external returns (bool);: The wallet owner authorizes a specific address as the delegated orderer for their funding requests.function revokeFundOperator(address orderer) external returns (bool);: Revokes a previously authorized delegated orderer's permission.function orderFund(string calldata operationId, uint256 value, string calldata instructions) external returns (bool);: Requests funding for one's own wallet with a unique `operationId`, an amount, and payment instructions. Reverts if the `operationId` has already been used.function orderFundFrom(string calldata operationId, address walletToFund, uint256 value, string calldata instructions) external returns (bool);: An authorized orderer requests funding on behalf of another wallet owner.function cancelFund(string calldata operationId) external returns (bool);: The token holder or the orderer who made the request cancels a funding request that has not yet reached the processing state.function processFund(string calldata operationId) external returns (bool);: The operator changes a request to the processing state. It cannot be cancelled after this.function executeFund(string calldata operationId) external returns (bool);: The operator issues tokens, changing the request to the executed state.function rejectFund(string calldata operationId, string calldata reason) external returns (bool);: The operator rejects the request, stating a reason.function isFundOperatorFor(address walletToFund, address orderer) external view returns (bool);: Checks whether a specific address has permission to request funding for a specific wallet.function retrieveFundData(address orderer, string calldata operationId) external view returns (address walletToFund, uint256 value, string memory instructions, FundStatusCode status);: Returns detailed data for a funding request, viewable only by the operator, the token holder, or the orderer.event FundInProcess(address indexed orderer, string indexed operationId);: Emitted when the operator confirms the instructions and changes the request to the processing state.event FundExecuted(address indexed orderer, string indexed operationId);: Emitted when the operator executes the request and issues tokens.event FundRejected(address indexed orderer, string indexed operationId, string reason);: Emitted when the operator rejects the request, along with a reason.event FundCancelled(address indexed orderer, string indexed operationId);: Emitted when a request is cancelled before the operator begins processing it.event FundOperatorAuthorized(address indexed walletToFund, address indexed orderer);: Emitted when an address is authorized as a delegated orderer for a specific wallet.event FundOperatorRevoked(address indexed walletToFund, address indexed orderer);: Emitted when a delegated orderer's authorization is revoked.
In depth
Three roles
This standard distinguishes three roles: the token wallet owner, the token contract operator (the issuer or its delegate), and the orderer. The wallet owner is the party requesting funding for their own wallet, the operator reads all funding requests and decides to approve or reject them by comparing against actual payment records, and the orderer is a third party who can request funding on behalf of the wallet owner with delegated authority.
Managing delegated authority
authorizeFundOperator is the function by which a wallet owner designates a specific address as their proxy orderer, and revokeFundOperator withdraws that authorization. isFundOperatorFor lets you query whether a specific address has authorization for a specific wallet. The FundOperatorAuthorized and FundOperatorRevoked events fire whenever authorization is granted or revoked, respectively.
Creating a funding request and operationId
orderFund is used for one's own wallet, while orderFundFrom is used when an authorized orderer requests funding on behalf of another wallet owner. Both functions take an operationId, a value, and an instructions string. If a request is made again with an operationId that has already been used, the function must revert.
State transitions
FundStatusCode defines six states: Nonexistent, Ordered, InProcess, Executed, Rejected, and Cancelled. A request begins with orderFund (Ordered), moves through processFund (InProcess), and ends with executeFund (Executed) or is turned down with rejectFund (Rejected). cancelFund (Cancelled) can only be used by the token holder or orderer before the operator moves the request into the in-process state.
Restricting access to data retrieval
retrieveFundData returns the wallet, amount, instructions, and status of a funding request given its operationId, but it can only be called by the operator, the token holder, or the corresponding orderer. This design restricts read access so that sensitive payment-related information is not exposed to just anyone.
Why operationId is a string
operationId is defined as a string rather than a more gas-efficient format. This choice favors a human-readable identifier for better traceability, and implementers can choose whether to store the full string on-chain or just its hash. Since operationId is a contested resource, requesters are recommended to use a unique prefix to avoid collisions.
How payment instructions are handled
The format of the instructions field is not fixed, and formats such as ISO payment standards can be referenced. However, writing concrete routing information that specifies where funds should actually be withdrawn directly on-chain in plaintext is not recommended; instead, off-chain means such as private channels or encrypted storage are recommended, or if it must be written on-chain, it should be entered in encrypted form.
Proposal status
This ERC is in Stagnant status, meaning it is a proposal that is no longer actively discussed and has stalled. Its content may change or may never be adopted.