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

erc721e

v0.2.0

Published

ERC721E contract for Solidity

Downloads

33

Readme

ERC721E

What is ERC721E?

ERC721E is a royalty-sharing contract that complies with ERC721 contract. It brings all royalties generated by every transaction to NFT minters while providing continuous low gas mint like ERC721A.

Problems solved by ERC721E

It is well known that NFT project parties derive their income from two main sources:

  • Presale / Public sale
  • Royalty income

The following is a comparison of the two income components in some current projects.

| Collections | Presale + Public sale | Royalty | | --- | --- | --- | | Bored Ape Yacht Club | 800 ETH | 15220 ETH | | Azuki | 8700 ETH | 12435 ETH | | Doodles | 1230 ETH | 6700 ETH |

This shows that there is a huge volume of transactions in top-streaming projects, which leads to a much larger royalty income than pre-sales/public sales. And again, we see a new possibility for higher income for early investors (OG or Early Minter): an equal share of royalty income for Minter, which would greatly encourage people to mint in top-streaming projects.

How the ERC721E works

// Access balance + amount already withdrawn by the project owner + amount already withdrawn by the user + accidental withdrawals >= contract revenue (excluding accidental withdrawals) = (sell profit + royalty profit)
// Contract revenue = (sell profit + royalty profit) = (project owner's undrawn cash + project owner's withdrawn cash) + (user's undrawn cash + user's withdrawn cash)
// Contract revenue = money to the project owner + money to the user = (amount of cash undrawn by the project owner + amount of cash withdrawn by the project owner) + (amount of cash undrawn by the user + amount of cash withdrawn by the user)
// Contract Revenue = Projector's undrawn cash + Projector's withdrawn cash + User's undrawn cash + User's withdrawn cash = (sell profit + royalty profit)
uint256 overage = address(this).balance;

// Project revenue = number of units currently sold * selling price = amount of cash undrawn by the project + amount of cash withdrawn by the project
// Project's undrawn cash = Number of units currently sold * Sold price - Project's withdrawn cash
uint256 notWithdrawnProfit = (_currentIndex - _burnCounter - _startTokenId()) *
  _price - withdrawned;

// royalty profit = balance + amount withdrawn by the project owner + amount withdrawn by the user - sell profit = balance + amount withdrawn by the user - (sell profit - amount withdrawn by the project owner)
// Royalty Earnings = Balance + User's Withdrawn Cash - Projector's Undrawn Cash = Balance + (Royalty Earnings - User's Undrawn Cash) - Projector's Undrawn Cash
// User's undrawn cash = balance - project owner's undrawn cash
uint256 royaltyProfit = overage - notWithdrawnProfit;

// sender's share of royalties = royalty profit / total number of issues * number of sender's purchases - the sender's share of royalties
uint256 giveSender = (royaltyProfit /
                      (_currentIndex - _burnCounter - _startTokenId())) *
  mintMountOfAddress[userAddress] -
  hadWithdrawedAddress[userAddress];

// If there is a situation where a late mint user comes in, and the total undrawn amount for all current users < the calculation of the equal share (royalties to be shared), it will need to be calculated after subsequent royalty increases
// This case returns 0
if (giveSender <= 0) return 0;
return giveSender;

How to use ERC721E in your project?

Install

npm install erc721e

UseCase

import "erc721e/contracts/ERC721E.sol";

contract Coroodles is ERC721E {
  uint256 public publicSalePrice = 0.06 ether;
  constructor(
    string memory _name,
    string memory _symbol,
  ) ERC721E(_name, _symbol, publicSalePrice) {
    setNotRevealedURI(_initNotRevealedURI);
  }
  // your project code
  ……
}

Precautions

  • If there are operational tools in your program that involve changes in contract balances such as airdrops, or whitelist price reductions, please replenish the discount amount in time.
  • Disclaimer: The use of this program does not guarantee that the collection of this contract will be free from other deceptive practices so we remind you to invest with caution.

Disclaimer

Using ERC721E doesn't mean minters can get the royalty, it still depends how project use ERC721E, and there's certain risk that project uses ERC721E as a title to rug users. There's some sample of flaws

  • The project party doesn't submit address on opensea
  • The project party sets the wrong price or doesn't make the payment in time to the contract when there's a discount like presale price.
  • There are other withdrawal codes or loopholes in the project contract
  • There are loopholes in this contract

This contract is just a tech sample. ERC721E assumes no responsibility for errors or flaws of project using ERC721E contract. Coroodles reserves the right to make additions, deletions, or modifications to the contents on the Service at any time without prior notice.

How to contribute to the ERC721E

Disclosure of safety issues

If there is any security vulnerabilities in ERC721E, please submit it to [email protected] so that we can address it before the issue is publicly disclosed.

Other contributions

  • Optimise code to reduce gas costs
  • Refine automated unit tests in the Test directory
  • Submit best practice in Example
  • Tell everyone in Project.md that you are applying erc721e to your project