- Overview
- Project Features
- Technologies
- Repo Setup
- Requirements
- Setup the Project
- Create the SmartContract
- Setup the Frontend
- Testing the Smartcontract
- Verified Contract Addresses
- Live Link
- Contributors
- Contributing to the project
Nestcoin is a filmhouse that would like to further engage with their audience. They would like to create a currency which would be used to reward loyal customers. The currency would later be traded for backstage passes and other perks.
Interestingly they began accepting crypto-based payments a year ealiers and would like to harness the power of Web3 to implement their solution.
-
Batch transfer rewards to a maximum of 200 addresses.
-
Distribute currency as quickly and effeciently as possible
| Stack | Usage |
|---|---|
Solidity |
Smart contract |
React JS |
Frontend |
To setup the repo, first fork the TeamResilient Nestcoin repo, then clone the forked repository to create a copy on the local machine.
$ git clone https://github.com/pauline-banye/Nestcoin.git
Change directory to the cloned repo and set the original Nestcoin repository as the "upstream" and your forked repository as the "origin" using gitbash.
$ git remote add upstream https://github.com/TeamResilient/Nestcoin.git
- Hardhat
- Alchemy key
- Metamask key
- Etherscan.io API Url
- Node JS
*Note:
This project was setup on a windows 10 system using the gitbash terminal. Some of the commands used may not work with the VScode terminal, command prompt or powershell.
The steps involved are outlined below:-
The first step involves cloning and installing hardhat.
$ cd Nestcoin
$ npm i -D hardhat
$ npm install
$ npm install --save-dev "@nomiclabs/hardhat-waffle" "ethereum-waffle" "chai" "@nomiclabs/hardhat-ethers" "ethers" "web3" "@nomiclabs/hardhat-web3" "@nomiclabs/hardhat-etherscan" "@openzeppelin/contracts" "dotenv"
# If you encounter errors installing the dependencies above, delete the old package-lock.json and run the `npm install --save-dev` command againNext create a .env file by using the sample.env. Retrieve your information from the relevant sites and input the information where needed in the .env file.
To retrieve your metamask private key.
- Open your account details by clicking on the three dots on the metamask extension on your chrome browser
- Click on export private key
- Verify your password
- Copy your private key and place it in the .env file
To retrieve your alchemy key.
- Login to your account on https://www.alchemy.com/
- Once youre redirected to your dashboard, click on create app.
- Fill in the relevant details especially the chain and network
- Once the app has been created, click on view key.
- Copy the HTTP and place it in the .env file.
To retrieve your etherscan key.
- Login to etherscan and hover over the dropdown arrow for your profile on the navbar.
- Click on API keys and add to create a new project (optional step).
- Once the project has been created, click on the copy button to copy the API key.
- Paste it in the .env file
Below is the setup for the hardhat.config.json
- First write the Smartcontract codes within the contracts folder.
- The next step involves the compilation, deployment and verification of the contract on the testnet.
- To compile the smartcontract before deployment:
$ npx hardhat compile
- To deploy the smartcontract:
$ npx hardhat run scripts/deploy.js --network rinkeby
- To verify the smartcontract:
$ npx hardhat verify 0x43f71fbd58e9600924f49a53c6fde787977c2b9d --network rinkeby "0x33d57e4712e4c4dc6ff50e3319e1e79d7eabc937"
*Note:
The first contract written after verify in the code above is the Nestdrop.sol address recieved after deployment while the second contract after rinkeby is the Nestcoin.sol address
- First run the frontend on your local server to ensure it's fully functional before building for production.
- Setup and install dependencies
$ cd frontend
$ npm install
$ npm install react-scripts@latest- Start the server on localhost
$ npm run start
- Create an optimized production build, which can be hosted on sites like Heroku, Netlify, Surge etc.
$ npm run build
- Coverage is used to view the percentage of the code required by tests and unittests were implemented to ensure that the code functions as expected
- Install Solidity Coverage
$ npm i solidity-coverage
-
Add
require('solidity-coverage')to hardhat.config.json -
Install Ganache
$ npm i install ganache-cli
- Run coverage
$ npx hardhat coverage --network localhost
- To test the smartcontract, first open a terminal and run the following command:
$ npx hardhat node
- Leave the previous terminal running and open new terminal.
- Run the command below:
$ npx hardhat test --network localhost
-
The NestDrop Contract Address
https://rinkeby.etherscan.io/address/0x43f71fbd58e9600924f49a53c6fde787977c2b9d#code
-
The NestCoin Contract Address
https://rinkeby.etherscan.io/address/0x33d57e4712e4c4dc6ff50e3319e1e79d7eabc937#code
This Project was created by the members of TeamResilient during the Blockgames Internship.
If you find something worth contributing, please fork the repo, make a pull request and add valid and well-reasoned explanations about your changes or comments.
Before adding a pull request, please note:
- This is an open source project.
- Your contributions should be inviting and clear.
- Any additions should be relevant.
- New features should be easy to contribute to.
All suggestions are welcome!