GithubHelp home page GithubHelp logo

terryjiang2020 / eip2981-implementation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dievardump/eip2981-implementation

0.0 0.0 0.0 1.25 MB

Repository that shows how to easily implement EIP2981

JavaScript 50.89% Solidity 49.11%

eip2981-implementation's Introduction

EIP-2981 Example

Resume

Simple example of implementation of EIP-2981.

In all implementations, royalties are expected to be from 0 to 10000 which allows to define royalties with 2 decimals.

Contract wide royalties

The contract ERC2981ContractWideRoyalties.sol implements ERC2981 with every token having the same royalties recipient and amount.

./contracts/mocks/ERC721WithContractWideRoyalties.sol is an example of ERC721 that would work on a contract-wide royalty base.

Per Token royalties

The contract ERC2981PerTokenRoyalties.sol implements ERC2981 with every token having different royalties

The contracts

  • ./contracts/mocks/ERC721WithRoyalties.sol
  • ./contracts/mocks/ERC1155WithRoyalties.sol

show how to extend ERC2981 to set royalties at minting time.

Installation

Clone this repository using your favorite tool (i.e: git clone [email protected]:dievardump/EIP2981-implementation.git)

In the directory of installation:

npm install

Compilation

npm run compile

Tests

npm run test

eip2981-implementation's People

Contributors

dievardump avatar blmalone avatar freeslugs avatar richardrauser avatar terryjiang2020 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.