This ERC adds refund functionality for initial token offerings to ERC-20, ERC-721, and ERC-1155. Funds are held in escrow until a predetermined time before they are claimable. Until that predetermined time passes, users can receive a refund for tokens they have purchased.
The NFT and token spaces lack accountability. For the health of the ecosystem as a whole, better mechanisms to prevent rugpulls from happening are needed. Offering refunds provides greater protection for buyers and increases legitimacy for creators.
A standard interface for this particular use case allows for certain benefits:
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
All implementations MUST use and follow the directions of ERC-165.
refundDeadlineOf uses blocks instead of timestamps, as timestamps are less reliable than block numbers.
The function names of refund, refundOf, and refundDeadlineOf were chosen to fit the naming style of ERC-20, ERC-721, and ERC-1155.
ERC-165 is required as introspection by DApps would be made significantly harder if it were not.
Custom ERC-20 tokens are not supported, as it needlessly increases complexity, and the refundFrom function allows for this functionality when combined with a DEx.
Batch refunds are optional, as account abstraction would make atomic operations like these significantly easier. However, they might still reduce gas costs if properly implemented.
No backward compatibility issues were found.
There is a potential re-entrancy risk with the refund function. Make sure to perform the ether transfer after the tokens are destroyed (i.e. obey the checks, effects, interactions pattern).
Copyright and related rights waived via CC0.