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

@0xdievardump/niftyforge

v1.0.0

Published

Package to import and use the contracts of NiftyForge.io

Downloads

8

Readme

NiftyForge contracts

A very easy way to launch your own contracts with few efforts, lots of goodies.

Deploy using the minimal proxy pattern, making deployments of a full NFT contract for around 0.025 eth at 50gwei.

Full loaded contracts:

  • Roles Management
  • Module Pattern very advances: delegates tokenURI, royaltyInfo and other stuff to the module that minted a token
  • Permits (EIP 4494 - draft)
  • On chain Royalties (EIP 2981)
  • mint / mintBatch with consecutive or arbitrary ids
  • Events Listeners sent to modules for specific behaviors on Mint/Burn/Transfer

Install

pnpm

pnpm add @0xdievardump/niftyforge

npm

npm install @0xdievardump/niftyforge

Two types of contracts

Full or Slim depending on your needs and use:

  • Slim will be more series / pfp-like minting in a consecutive order (only one minter)
  • Full will give lots of flexibility while still being easy to use it in a simple way

hardhat-deploy

Easily load the current deployments in your hardhat config and deploy new contracts using hardhat-deploy

external: {
    deployments: {
      mainnet: ['node_modules/@0xdievardump/niftyforge/deployments/mainnet'],
      rinkeby: ['node_modules/@0xdievardump/niftyforge/deployments/rinkeby']
    }
  }

then in your scripts

  // scripts/deployERC721.js
  const forgeMaster = await ethers.getContract('ForgeMaster');
  const tx = await forgeMaster.createERC721(
      "My NFT Contract", // name
      "MNC", // ticker
      'ipfs://QmYxUtFnPFntZsrxRTCT3rJZUWC7ti949f1hxnnfnzNB2u', // contract URI
      'https://mybaseuri.com/',  // baseURI
      ethers.constants.AddressZero, // owner
      [], // modules
      ethers.constants.AddressZero, // royaltiesRecipient
      0, // royalties amount 0-10000 (2 decimals)
      'my-nft-contract', // slug on niftyforge.io
      '' // context, blank if you don't know what is context ;)
  );

  const receipt = await tx.wait();
  console.log(receipt.logs);

Module Pattern

Create modules that you add as Minter on your contract. Those module can contain tokenURI royaltyInfo and a few other data specific to the NFTs they minted. This way: One contract, multiple sources for your NFTs, multiple royalties

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "@0xdievardump/niftyforge/contracts/Modules/NFBaseModule.sol";
import "@0xdievardump/niftyforge/contracts/Modules/INFModuleTokenURI.sol";
import "@0xdievardump/niftyforge/contracts/Modules/INFModuleWithRoyalties.sol";


/// @notice Simple Module exemple that manages its own tokenURI and royaltyInfo
/// @author Simon Fremaux (@dievardump)
contract MyModuleWithSomeMonsterNFT is
    Ownable,
    NFBaseModule,
    INFModuleTokenURI,
    INFModuleWithRoyalties
{
    /// @notice the nftContract on which MyModule will Mint
    address public nftContract;

    /// @notice the baseURI for this module
    string public baseURI;

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(INFModuleTokenURI).interfaceId ||
            interfaceId == type(INFModuleWithRoyalties).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /// @inheritdoc	INFModuleWithRoyalties
    function royaltyInfo(address, uint256 tokenId)
        public
        view
        override
        returns (address receiver, uint256 basisPoint)
    {
				// manage your own royalties.
        receiver = owner();
        // gets 10% royalties
        basisPoint = 1000;
    }

    /// @inheritdoc	INFModuleTokenURI
    function tokenURI(address, uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        // manage your own tokenURI.
        return string(abi.encodePacked(baseURI, tokenId.toString(), '.json'));
    }

    function mint() {
        // mint the next nft to msg.sender
        // there is no URI because it's managed in this contract
        // there are no royaltiesRecipient nor royaltieSamount because it's manage in this contract
        INiftyForge721(nftContract).mint(msg.sender, '', address(0), 0, address(0));
    }
}