- See the site deployed here: https://artmarket.netlify.app
- See the site walkthrough here: https://www.loom.com/share/dd5886c281654d8d9a93e07b13fe23bf
https://www.loom.com/share/4604b575788848e983be0953adae0f02?sharedAppSource=personal_library (original link didn't work. Posted from a new Loom account above. Here is the original link which did not work.
- Should allow only creator to log in and upload content to her marketplace page. To achieve this this app uses nextauth simple credentials.
TBD Uses credentials stored in .env Server-side access control not exceptionally secure. Need to base this on NFT ownership validation like BAYC. Not yet implemented.
-
When a user purchases an item, the purchase price will be transferred from the buyer to the seller (the artist in this case should be the only one who can create) and the item will be transferred from the marketplace to the buyer.
-
The marketplace owner will be able to set a listing fee. This fee will be taken from the seller and transferred to the contract owner upon completion of any sale, enabling the owner of the marketplace to earn recurring revenue from any sale transacted in the marketplace.
-
Users can search on the homepage by querying the GraphQL (TBD) Not implemented in this project.
- Clone repository
- Run "npm install" for all dependencies
- Compile contracts with "npx hardhat compile" to generate the artifacts
- In config.js, populate the following variables with the deployed address of all the contracts and the testnet or mainnet of your choice where deployed. This example uses infura:
- export const nftmarketaddress = "0x..."
- export const nftaddress = "0x..."
- export const rpc_url = "https://polygon-mumbai.infura.io/v3/{projectIDHere}"
-
In project directory, spin up a hardhat node: npx hardhat node
-
Create file ".secret" with a private key of the address 0 from the node terminal window
-
In seperate terminal window, run command npx hardhat run scripts/deploy.js --network mumbai
-
Run "npm run dev" in terminal
-
Navigate to localhost in your browser
-
You will not be able to sign in without creating a .env file with the following three parameters( make the URL localhost and the username and password of your choice. Password needs to be between quotations to work):
- NEXTAUTH_URL=
- NEXTAUTH_USERNAME=
- NEXTAUTH_PASSWORD=""
-
Import a few accounts including account 0 from the node running into metamask to test.
-
Don't forget to log out before switching addresses to test purchasing. Otherwise, any address can create items.
-
In Pages docs create-item, index, my-assets and creator-dashboard, replace the two import statements with the path to the .json files for both contracts in your artifacts directory after compiling. The Import paths to replace will resemble '../artifacts/contracts/Market.sol/NFTMarket.json' Below are the import statements to change:
-import NFT from './NFT.json' -import Market from './NFTMarket.json'
-
After changing the import path, you can delete NFT.json and NFTMarket.json in the pages directory
- In terminal, in root directory, run npx hardhat test
- Tests should be running on port 8545