npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

erc721r

v0.0.3

Published

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.

Downloads

3

Readme

ERC721R

About The Project

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.

Beta

This code is still in beta and undergoing reviews. Use at your own risk.

Motivation

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.

How it works in practice

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.

Usage

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 refundGuaranteeActive() public view returns (bool) {
    return (block.timestamp <= refundEndTime);
}

function refund(uint256[] calldata tokenIds) external {
    require(refundGuaranteeActive(), "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;
}

Benefits

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

How long should the refund period be?

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.

Supporting ERC721R projects

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.

Projects using ERC721R

Roadmap

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.

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Disclaimer

Exodia Labs is not liable for any outcomes as a result of using ERC721R. DYOR.

Contact