- Deployed Website url
- Screencast link
- Project Description
- Workflow
- Directory structure
- Clone, Install and Build steps
- Auto-Funding
- Run
- Troubleshooting
https://eternal-market.vercel.app/
Eternal Domain is a marketplace where users can buy, sell and mint Eternal Characters, which are ERC-721 standard (NFT) tokens.
Eternal Characters are the residents of Eternal Domain world. They consists of 3 main characteristics, Area of Control, Weapon and Rank.
- Area of Control - Fire, Wind, Wave, Earth, Light, Shadow, Thunder, Space, Time, Gravity, Ice
- Weapon - Sword, Spear, Shield, Hammer, Saber, Axe, Bow, Staff, Wand, Fist, Dagger, Scythe, Mace, Blade, Katana
- Rank - Lord, King, Emperor, Venerable, Ancestor, Saint, God
- Enter the dApp and connect the wallet to rinkeby network.
- After entering the dApp the user can:
- Buy Characters
- Go to the Home page and click on the item which user want to buy.
- User will be redirected to the BuyNFT page which shows the price and other details about the item.
- Click on the Buy button to buy the item.
- Metamask pops up and asks to confirm the transaction for the price of the item.
- After the transaction is successfully processed user is redirected to the My NFT page.
- The bought item is displayed under the Bought Characters section
- Mint Characters
- Go to the mint page and click on the Mint Character button.
- Metamask pops up and asks to confirm the transaction.
- After the transaction is successfully processed the user can see the minted character.
- The minted character is also added to My NFT page under Minted Characters section.
- Sell Characters
- Go to the My NFT page and click on the Sell button under the minted item which user want to sell.
- User will be redirected to the SellNFT page where user can enter the price for the item.
- After entering the desired price, click on the Sell button to list the item in the market place.
- Metamask pops up and asks to confirm the transaction for the listing price.
- After the transaction is successfully processed user is redirected to the Home page.
- The item will be listed in the marketplace to be bought for the price entered by the user.
- Buy Characters
blockchain-developer-bootcamp-final-project
┣ client
┃ ┣ pages
┃ ┃ ┣ _app.js
┃ ┃ ┣ buynft.js
┃ ┃ ┣ index.js
┃ ┃ ┣ mint.js
┃ ┃ ┣ mynft.js
┃ ┃ ┗ sellnft.js
┃ ┣ public
┃ ┃ ┣ favicon.ico
┃ ┃ ┗ vercel.svg
┃ ┣ utils
┃ ┃ ┣ EternalMarketplace.json
┃ ┃ ┗ EternalNFT.json
┃ ┣ .gitignore
┃ ┣ README.md
┃ ┣ config.js
┃ ┣ package-lock.json
┃ ┣ package.json
┃ ┣ postcss.config.js
┃ ┗ tailwind.config.js
┣ contracts
┃ ┣ libraries
┃ ┃ ┗ Base64.sol
┃ ┣ EternalMarketplace.sol
┃ ┗ EternalNFT.sol
┣ scripts
┃ ┣ deploy.js
┃ ┗ run.js
┣ test
┃ ┗ eternalTest.js
┣ .gitignore
┣ README.md
┣ avoiding_common_attacks.md
┣ deployed_address.txt
┣ design_pattern_decisions.md
┣ hardhat.config.js
┣ package-lock.json
┗ package.json
- Git
- Node JS (everything was installed and tested under v15.12.0)
- A Browser with the MetaMask extension installed.
- Test Ether on the Rinkeby network.
- Clone the project repository on your local machine
git clone https://github.com/AbhinavXT/Eternal-Market.git
cd Eternal-Market
- Installing dependencies
- For contracts -
npm install
- For client -
cd client npm install
For testing contracts run command:
npx hardhat test
For running frontend locally run command:
cd client
npm run dev
This Starter Kit is configured by default to attempt to auto-fund any newly deployed contract that uses Any-API or Chainlink VRF, to save having to manually fund them after each deployment. The amount in LINK to send as part of this process can be modified in the Starter Kit Config, and are configurable per network.
Parameter | Description | Default Value |
---|---|---|
fundAmount | Amount of LINK to transfer when funding contracts | 1 LINK |
If you wish to deploy the smart contracts without performing the auto-funding, run the following command when doing your deployment:
npx hardhat deploy --tags main
- For deploying and running the dApp against a local instance run commands:
npx hardhat node
- This should create a local network with 19 accounts. Keep it running, and in another terminal run:
npx hardhat deploy --network localhost
- When the deployment is complete, the CLI should print out the addresses of the contracts that were deployed:
nftMarket contract deployed to: 'EternalMarketplace contract address'
nft contract deployed to: 'EternalNFT contract address'
- Copy these addresses and paste them in the config.js file inside the client folder, in place of current addresses.
export const nftContractAddress = 'EternalMarketplace contract address'
export const nftMarketAddress = 'EternalNFT contract address''
-
For importing account to metamask
- Import account using private key from one of the accounts that were logged on running
npx hardhat node
- Create a custom network (if not already there) pointing to http://127.0.0.1:8545 with chainId 1337
- Switch to this network and connect it to the dApp and reload it.
- For better testing of the transfer of tokens and transactions import at least 2 accounts*_
- For changing chainId and other possible errors see Troubleshooting
- Import account using private key from one of the accounts that were logged on running
-
Now run the frontend locally in another terminal using command:
cd client
npm run dev
After this you can run and test the dApp locally in your web browser.
The deployment output will give you the contract addresses as they are deployed. You can then use these contract addresses in conjunction with Hardhat tasks to perform operations on each contract
The VRFConsumer contract has two tasks, one to request a random number, and one to read the result of the random number request. This contract needs to be funded with link first:
npx hardhat fund-link --contract insert-contract-address-here --network network
Once it's funded, you can perform a VRF request with the request-random-number task:
npx hardhat request-random-number --contract insert-contract-address-here --network network
Once you have successfully made a request for a random number, you can see the result via the read-random-number task:
npx hardhat read-random-number --contract insert-contract-address-here --network network
The default chainId for network localhost8545 is 1337. To change the chainId, the user should follow these steps :
- Change the chainId in networks under hardhat in hardhat.config.js file.
hardhat: {
chainId: 1337,
}
- After this the user needs to change the chainId in the _app.js file on line 61 and 86 under the functions connectWallet() and checkCorrectNetwork() respectively.
const devChainId = 1337
While testing the dApp on against a local instance, if you get the Nonce too high error in the hardhat node terminal or the UI does not show processing your transaction after confirming a transaction, try resetting your metamask account. This can be done by going to Settings > Advanced > Reset Account in Metamask.