ERC-902 Token transfer eligibility verification standard (Token Validation)
Stagnant · Tokens · created 2018-02-14
A shared interface that checks with an external validator contract, before tokens are issued or transferred, whether rules such as KYC and volume limits are satisfied.
Why it is needed
Assets subject to legal regulation, such as security tokens, can only be transferred if rules like KYC, AML, residency checks, and volume limits are followed. Without this standard, each token would have to implement these rules and whitelists directly inside its own contract, and the same user would have to repeat identity verification for every different token. There was also no common way to combine judgments from multiple regulators or compliance providers into a single transfer decision. As a result, verification logic was duplicated across tokens, and wallets or exchanges had no way to know in advance whether a transfer would be rejected, wasting gas on failed transactions.
What to implement
function check(address _token, address _subject) public returns (byte _resultCode): Checks whether a user or contract (_subject) meets general eligibility requirements, such as role or whitelist registration, for a given token, and returns an ERC1066 status code.function check(address token, address from, address to, uint256 amount) public returns (byte resultCode): Checks whether transferring _amount of a token from _from to _to is allowed, and returns an ERC1066 status code.event Validation(address indexed subject, byte indexed resultCode): An event logging the result of a check/2 call, announcing the subject checked and the status code.event Validation( address indexed from, address indexed to, uint256 amount, byte indexed statusCode ): An event logging the result of a check/4 call, announcing the parties involved, the amount, and the status code.
In depth
Purpose and scope of the proposal
ERC902 is an interface for separating regulatory and business rules commonly required when tokenizing assets, such as KYC, AML, residency checks, and volume limits, into a shared resource outside the token contract. Instead of each token maintaining its own whitelist, it asks one or more TokenValidator contracts whether a transfer is permitted. The scope covers token issuance (transfers from the contract to an owner), transfers between users, and spending of tokens.
The difference in roles between check/2 and check/4
check(_token, _subject) is a general-purpose check for whether a particular user or contract meets general eligibility requirements, such as role or whitelist registration, and does not specify an amount or counterparty. check(token, from, to, amount) checks an actual transfer situation, including the sender, receiver, and amount. Both functions return an ERC1066 status code as a byte type.
The event is emitted by the token, not the validator
The Validation event MUST be emitted by the calling token contract, not by the TokenValidator. The reasoning given is that because a validator can delegate to another validator or aggregate multiple results, having the validator emit the event would cause unnecessary duplicate events to pile up. For the same reason, the check/4 call includes the token address as an argument, since the validator cannot tell from msg.sender alone which token the call concerns.
Dependence on ERC1066 status codes
Both check functions return a status code of type byte, following the general-purpose status code scheme defined in EIP-1066 (specified via requires). ERC902 itself does not specify exactly which codes mean success or failure, leaving the choice of code scheme to implementers and to EIP-1066.
Why the spender field was not included
After comparing with the R-Token design and considering an approach that would also verify the spender when calling approve, it was excluded because usage frequency was not high enough to justify the cost of having to pass a dummy value on every call. Instead, the proposal gives as an example a pattern where approve logic calls check/4 in the form check(this, msg.sender, spender, amount).
Does not define a registry or a Validated interface
This proposal leaves it up to implementers whether the validator address is public, private, or hardcoded, and does not include a central registry. It also does not define a formal Validated interface specifying how a token must call the validator. Since the number and purpose of validators needed varies by token, the design deliberately does not force a single unified set of methods, and only provides example contracts for common use cases separately.
Compatibility with other token standards
Because it is a minimal interface defining only the check function, it is explained as applicable to ERC-20, EIP-721, EIP-777, future token standards, and both centralized and decentralized exchanges.
Proposal status
This proposal is in Stagnant status, a draft where no further revision or adoption discussion is progressing.