Giter Club home page Giter Club logo

nft-editions's Introduction

Zora NFT Editions

What are these contracts?

  1. SingleEditionMintable Each edition is a unique contract. This allows for easy royalty collection, clear ownership of the collection, and your own contract ๐ŸŽ‰
  2. SingleEditionMintableCreator Gas-optimized factory contract allowing you to easily + for a low gas transaction create your own edition mintable contract.
  3. SharedNFTLogic Contract that includes dynamic metadata generation for your editions removing the need for a centralized server. imageUrl and animationUrl can be base64-encoded data-uris for these contracts totally removing the need for IPFS

How do I create a new contract?

Directly on the blockchain:

  1. Find/Deploy the SingleEditionMintableCreator contract
  2. Call createEdition on the SingleEditionMintableCreator

Through a GUI:

Rinkeby: https://edition-drop.vercel.app/?network=4

Mainnet: https://edition-drop.vercel.app/?network=1

Polygon: https://edition-drop.vercel.app/?network=137

Mumbai: https://edition-drop.vercel.app/?network=80001

Where is the factory contract deployed:

Mainnet ETH: 0x91A8713155758d410DFAc33a63E193AE3E89F909

note: ~ Deployed with 1.0.1 version of code. Missing public getter for description.

Rinkeby: 0x85FaDB8Debc0CED38d0647329fC09143d01Af660

note: ~ Deployed with 1.0.1 version of code. Missing public getter for description.

Polygon: 0x4500590AfC7f12575d613457aF01F06b1eEE57a3

note: Deployed with 1.0.2 version of code with public getter for description.

Mumbai: 0x773E5B82179E6CE1CdF8c5C0d736e797b3ceDDDC

note: Deployed with 1.0.2 version of code with public getter for description.

How do I create a new edition?

call createEdition with the given arguments to create a new editions contract:

  • Name: Token Name Symbol (shows in etherscan)
  • Symbol: Symbol of the Token (shows in etherscan)
  • Description: Description of the Token (shows in the NFT description)
  • Animation URL: IPFS/Arweave URL of the animation (video, webpage, audio, etc)
  • Animation Hash: sha-256 hash of the animation, 0x0 if no animation url provided
  • Image URL: IPFS/Arweave URL of the image (image/, gifs are good for previewing images)
  • Image Hash: sha-256 hash of the image, 0x0 if no image url provided
  • Edition Size: Number of this edition, if set to 0 edition is not capped/limited
  • BPS Royalty: 500 = 5%, 1000 = 10%, so on and so forth, set to 0 for no on-chain royalty (not supported by all marketplaces)

How do I sell/distribute editions?

Now that you have a edition, there are multiple options for lazy-minting and sales:

  1. To sell editions for ETH you can call setSalePrice
  2. To allow certain accounts to mint setApprovedMinter(address, approved).
  3. To mint yourself to a list of addresses you can call mintEditions(addresses[]) to mint an edition to each address in the list.

Benefits of these contracts:

  • Full ownership of your own created minting contract
  • Each serial gets its own minting contract
  • Gas-optimized over creating individual NFTs
  • Fully compatible with ERC721 marketplaces / auction houses / tools
  • Supports tracking unique parts (edition 1 vs 24 may have different pricing implications) of editions
  • Supports free public minting (by approving the 0x0 (zeroaddress) to mint)
  • Supports smart-contract based minting (by approving the custom minting smart contract) using an interface.
  • All metadata is stored/generated on-chain -- only image/video assets are stored off-chain
  • Permissionless and open-source
  • Simple integrated ethereum-based sales, can be easily extended with custom interface code

Potential use cases for these contracts:

  • Giveaways for events showing if youโ€™ve attended
  • Serial editioned artworks that can be sold in the Zora auction house / work in any ERC721 market
  • Fundraisers for fixed-eth amounts
  • Can be used to issue tokens in response for contributing to a fundraiser
  • Tickets/access tokens allowing holders to access a discord or mint

Deploying:

(Replace network with desired network)

hardhat deploy --network rinkeby

Verifying:

hardhat sourcify --network rinkeby && hardhat etherscan-verify --network rinkeby

Bug Bounty

5 ETH for any critical bugs that could result in loss of funds. Rewards will be given for smaller bugs or ideas.

nft-editions's People

Contributors

bjfresh avatar iainnash avatar karmacoma-eth avatar tbtstl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nft-editions's Issues

Use Local Memory Type Variable Instead of Global Storage Type Variable in Event to Save Gas

Hi, we recently have conducted a systematic study about Solidity event usage, evolution, and impact, and we are attempting to build a tool to improve the practice of Solidity event use based on our findings. We have tried our prototype tool on some of the most popular GitHub Solidity repositories, and for your repository, we find a potential optimization of gas consumption arisen from event use.

The point is that when we use emit operation to store the value of a certain variable, local memory type variable would be preferable to global storage type (state) variable if they hold the same value. The reason is that an extra SLOAD operation would be needed to access the variable if it is storage type, and the SLOAD operation costs 800 gas.

For your repository, we find that the following event use can be improved:

  • SingleEditionMintable.sol
    function name:โ€ƒsetSalePrice
    event name:โ€ƒโ€ƒPriceChanged
    variable:โ€ƒโ€ƒโ€ƒโ€ƒsalePrice->_salePrice
    function setSalePrice(uint256 _salePrice) external onlyOwner {
        salePrice = _salePrice;
        emit PriceChanged(salePrice);
    }

Do you find our results useful? Your reply and invaluable suggestions would be greatly appreciated, and are vital for improving our tool. Thanks a lot for your time!

Require unique content hashes for NFT-Editions

Apologies if this was already considered, but it might be a good idea to enforce unique content hashes, like core/Media.sol.

For contract storage mapping(bytes32 => bool) private _contentHashes;

Then in createEdition():

require(
    _contentHashes[_imageHash] == false,
    "Media: a token has already been created with this content hash"
);

...

_contentHashes[_imageHash] = true;

contractURI not supported

This may be out of scope since this repository is largely meant for the Zora.co nft marketplace but adding contractURI to SingleEditionMintable would enable contract metadata support for Polygon/MATIC and Opensea platform, etc.

`totalSupply` call would be helpful

Sorry if this was already considered but a totalSupply function would be useful for a few reasons:

  • Check if the edition is still mintable: editionSize > totalSupply
  • if editonSize is 0, get how many have been minted so far
  • Easily get % of supply owned by a single address: balanceOf / totalSupply

Cheers ๐Ÿป

royaltyInfo returns 0 if the result of the royaltyAmount calculation is less than 1

royaltyBPS isn't public, but royaltyInfo is callable, and it returns a royaltyAmount equal to the passed in _salePrice * royaltyBPS / 10_000.

Assuming a smallest royalty of 0.1%, if the sale price passed in is less than 1000, then the royaltyAmount will be less than 1, and since it's a uint256, its value is 0.

To avoid returning 0 when the royalty should be greater than 0, and in fact the royaltyBPS is greater than 0 in the contract, we can pass in a _salePrice of 10000 to reconstruct the royaltyBPS value. We can then calculate the royaltyInfo based on the actual sale price off chain. Therefore this is not critical, but the royaltyInfo call is misleading and can result in unexpected results.

Feature request: Open editions

Would it be possible to introduce open editions or a max size of 0 that could be turned off or on given certain criteria by the admin user.

Setting edition size = 0, don't show edition size in title and allow unlimited minting as long as the edition is open by owner().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.