The goal of ERC721R is to add refund functionality to the ERC721 and ERC1155 standards. This repo contains community provided examples you can use in your own NFT smart contract.
This code is still in beta and undergoing reviews. Use at your own risk.
The NFT space needs greater accountability. The space faces too many rugpulls and for the health of the NFT ecosystem as a whole we need better mechanisms to prevent these from happening.
Offering refunds provides greater protection for buyers and more legitimacy for creators.
The Azuki ERC721A provided gas improvements to the original ERC721 standard. ERC721R provides trustless refunds.
When you mint an NFT in an ERC721R collection the funds are held by the smart contract in escrow. The creators are unable to withdraw the funds till the waiting period has been completed. During this waiting period the buyer is able to return their NFT to the smart contract and receive their ETH back.
If the creators decide to rug, buyers will request their funds back before the waiting period has completed only losing gas costs for the transactions.
Add the following code snippets to your smart contracts to add refunds:
uint256 public constant refundPeriod = 45 days;
uint256 public refundEndTime;
address public refundAddress;
constructor() ERC721A("ERC721RExample", "ERC721R") {
refundAddress = msg.sender;
toggleRefundCountdown();
}
function isRefundGuaranteeActive() public view returns (bool) {
return (block.timestamp <= refundEndTime);
}
function getRefundGuaranteeEndTime() public view returns (uint256) {
return refundEndTime;
}
function refund(uint256[] calldata tokenIds) external {
require(isRefundGuaranteeActive(), "Refund expired");
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 tokenId = tokenIds[i];
require(msg.sender == ownerOf(tokenId), "Not token owner");
transferFrom(msg.sender, refundAddress, tokenId);
}
uint256 refundAmount = tokenIds.length * mintPrice;
Address.sendValue(payable(msg.sender), refundAmount);
}
function toggleRefundCountdown() public onlyOwner {
refundEndTime = block.timestamp + refundPeriod;
}
function setRefundAddress(address _refundAddress) external onlyOwner {
refundAddress = _refundAddress;
}
For buyers:
- Low risk purchase (worst case scenario you get your money back minus gas costs)
- Protects against rug pulls
- Forces greater accountability from creators to deliver
For sellers:
- Builds trust with buyers
A benefit to both:
- The project floor price is unlikely to drop below the mint price while refunds are open.
- Short term flippers leave the project early leaving a high quality core intact.
Another thread on the benefits of refunds can be found in Daniel Tenner's Twitter thread: https://twitter.com/swombat/status/1492484783036936192
There's no one answer to this question, but some things to consider:
A longer refund period means:
- More time for the team to deliver before the refund period runs out.
- A longer delay till the team can access the funds.
What some other projects have done:
- Exodia offered a 14 day refund period.
- Curious Addy’s Trading Club offered a 100 day refund period.
- CryptoFighters is offering a 45 day refund period.
We've created a list of high-quality buyers that have committed to purchase from the next 10 NFT projects to implement refunds. If you'd like to be added to the list you can fill in this form.
As long as the project has a mint price of 0.2ETH or less with at least a 14-day trustless refund period, everyone in the list commits to mint. Of course, there's no guarantee minters won't execute a refund.
- CryptoFighters (for which ERC721R was built)
- Exodia - 14 day refund. Sold out
- Curious Addys Trading Club - 100 day refund. Sold out
In the future we may see more complex implementations of ERC721R that include:
- Vesting over a period of time. For example, the creator is able to release 25% of the funds in the smart contract each month.
- Cliffs. For example, 10% of funds are immediately available for release, and the rest is released at a later date (allowing buyers to receive a 90% refund upon purchase). The benefit is that the creators have access to some of the funds raised while still mostly protecting buyers.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Exodia Labs is not liable for any outcomes as a result of using ERC721R. DYOR.
- elie222 (owner) - @elie2222