block-commerce-contract
v1.1.2
Published
<div id="top"></div> </br> <div align="center"> <img src="https://i.ibb.co/xHDbBM5/Block-Commerce-Logo-Rendered.png" alt="BlockCommerce Logo_Rendered" width="100" height = "100"> <h3>BlockCommerce</h3> <p>A good tool for setting up Ethereum-base
Downloads
4
Readme
About The Project
Provide you with a package secured by Blockchain and Smart Contract to build, manage and revise all aspects between bulding and developing software for Ethereum-based marketplace projects.
Built with
Setting Up
This section is all about relevant softwares, extensions and how to install this package.
Prerequisites
For using BlockCommerce, you need first to have metamask available in your browser.
- Download metamask here (Choose the firefox to download it to your browser).
- See how to use metamask here.
Installation
Use the package manager npm to install.
- npm
npm install npm@latest -g
- block-commerce-contract
npm install block-commerce-contract
Features
Below are what BlockCommerce will provide for you:
- Contract: A smart library contract consists of a contract that creates, stores the NFT and a contract that serves its role as a marketplace for selling and exchanging NFTs. These contracts can be reused, secured and stored on blockchain, and are written by Solidity. Besides, all the functions are authorized according to the account's role.
- Upgradable contract: A set of contract and tool is used for creating and managing contracts, it allows for the separation of upgradeable contracts on Ethereum.
- Lazy minting: Advanced feature, this helps the seller not to pay any fee from the time a product is created to the time it is sold. The fee in the end will be paid by the end user.
- Authorization: Advanced feature, this helps both the seller and buyer can controll the contract by themselves and execute it as they wished, instead of the inherent automatic execution of the contract.
Example
These are some code snippets to help you have a better understand what block-commerce-contract can do.
- Generate a NFT with the recipient's address _to be obtained from the _hash of the artwork
createNewNFT(_to, string _hash)
- Reset the owner rights for a _to address with the _tokenId token you want to transfer, this function is only called by the owner of _tokenId.
setOwnerToTokenId(_to, _tokenId)
- Create a new product for selling with with hashed information (_hashInfo), hashed image (_hashImg), and the desired price (_price) for this product
createNewProduct(_hashInfo, _hashImg, _price)
- Buy the product with ETH cryptocurrency
buyWithETH(_tokenId)
- Buy the product with dollar currency
buyWithCurrency(_tokenId, transactionId)
- Create an offer for a product has id (_tokenId), with quantity of _amount, token ERC20 (_token20) as you wish, and the desired price (_price) for this product
offer(_tokenId, _amount, _token20, _timeout)
- Approve an offer
approveOffer(_tokenId, _index)
- Transfer owner after the offer was approved
Transfer(_tokenId, _oldOwner, _newOwner)
Usage
For better understanding on how to use block-commerce-contract for an Ethereum-based marketplace web application, you can go to this website. Some functions are currently availble:
- Create a new product.
- Create an offer.
- Approve an offer.
- Buy a product with ETH or other currency (currently Dollar).
Creators
We wish to give a big thanks to our contributors for building this project together and bringing it to life.
License
Distributed under MIT license. See LICENSE.md
for more infomation.