Giter VIP home page Giter VIP logo

enft's Introduction

ENFT

The contracts directory provides interfaces and implementations of EIP token standards. All payable methods are writen for minimal gas consumption.

Automated tests execute standalone with npx hardhat test. Hardhat itself can be obtained with npm install --save-dev hardhat.

This is free and unencumbered software released into the public domain.

Build Status

Efficiency

A FixedNFTSet deployement costs 837 k gas.

Token transfers come in 3 variations.

  1. A plain transferFrom as the onwer of a token costs 49 k gas.
  2. An approve costs 48 k gas, with another 48 k gas on tranferFrom.
  3. A setApprovalForAll costs 46 k gas, with another 49 k gas on tranferFrom.

Use

The NFTBuyout contract is ready on the following chains. Please share when you deploy on a chain not listed here.

Custom tokens can simply inherit the FixedNFTSet contract. It is recommended to import contracts with a versioned path only.

// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.8.13;

import "https://github.com/pascaldekloe/enft/blob/v1.2.0/contracts/FixedNFTSet.sol";


// NFT example with 12 tokens.
contract MyDozen is FixedNFTSet {

// Constructor assigns all 12 tokens to the receiver address.
constructor(address receiver) FixedNFTSet(12, receiver) {
	// initial Transfer emission is optional
	for (uint token = 0; token < 12; token++) {
		emit Transfer(address(0), receiver, token);
	}
}

}

For a full NFT example with metadata and more, see CollectiblesSale on mainnet.

In a Node.js environment you can use the contracts in a project with npm install https://github.com/pascaldekloe/enft.git, and then import with import "enft/contracts/ERC721.sol"; instead of the HTTP URL.

Standard Compliance

  • “Token Standard” EIP-20
  • “Non-Fungible Token Standard” EIP-721

enft's People

Contributors

pascaldekloe avatar

Watchers

 avatar  avatar  avatar

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.