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

@rsksmart/rif-marketplace-nfts

v0.1.4

Published

RIF NFTs Marketplace

Downloads

11

Readme

RIF Marketplace

npm CircleCI

Smart Contracts designed to support the buying and selling of NFT tokens using multiple payment options. A specific implementation for RNS domains has been included to be used by the RIF Marketplace .

RIF Name Service (RNS) enables the use of human readable names for blockchain addresses helping users to receive transactions in personalized domains. New RNS Domains can be obtained through the RNS Manager.

This contract allows users to list an NFT token for a fixed price in multiple payment methods (ERC-20, ERC-677, ERC-777, and R-BTC). The contract acts as an escrow, ensuring the NFT is released only when a valid payment is received, allowing the seller to keep control at all times.

Usage

npm i @rsksmart/rif-marketplace-nfts

Run locally

Run tests:

npm test

Run test linter:

npm run lint

Contracts

ERC721 Simple Placements

Place an NFT for a fixed price.

  • Receives payments in:
    • ERC-20
    • ERC-677
    • ERC-777
    • Gas

To place an NFT:

  1. Execute approve in NFT giving approval to Simple Placements contract.
  2. Execute place with the desired price and payment token. Use token payment 0x00 address for gas payments.

To buy a placed NFT:

  • Get the price with placement method.
  • Via ERC-20:
    1. Execute approve in token giving allowance of the price amount to Simple Placements.
    2. Execute buy.
  • Via ERC-677:
    1. Execute transferAndCall with parameters:
    • to: Simple Placements contract.
    • amount: given by price -- leftover tokens are not returned
    • data: the token ID.
  • Via ERC-777:
    1. Execute send with parameters:
    • to: Simple Placements contract.
    • amount: given by price -- leftover tokens are not returned
    • data: the token ID.
  • Via gas:
    1. Execute buy method with transaction value paying for price.

To unplace an NFT:

  • Remove approval the ERC-721 token.
  • Execute unplace with the toke id.

Admin:

  • Ownable contract. The owner can:
    • Set whitelisted tokens and their accepted methods with setWhitelistedPaymentToken
    • Change gas payment allowance with allowGasPayments
    • Set another owner with transferOwnership

RNS Simple Placements

A specific implementation has been included for RNS which in addition to the basic features explained before it ensures to clean up the domain resolver and owner before transferring to the buyer.

TypeScript typings

There are TypeScript typing definitions of the contracts published together with the original contracts. Supported contract's libraries are:

  • web3 version 1.* - web3-v1-contracts
  • web3 version 2.* - web3-v2-contracts
  • truffle - truffle-contracts
  • ethers - ethers-contracts

Troubleshot

  • Problems installing erc1820:
    • Workaround 1:
      1. Remove it from devDependencies
      2. Run npm i
      3. Run npm i --save-dev erc1820
    • Workaround 2: use node v10.16.0