This project implements a simple marketplace to manage / selling product. It's based on great course of Celo in the Dacade. It helps us to understand about Solidity, Celo blockchain, and how to make a fullstack application base on them.
The feature includes:
On-going implementation (by order)
Demo website: https://marketplace-andyle83.vercel.app/
Blockchain
0x052F92eF1B97c0dD68B7150a8BBeBf962dD8a4e7
(can be changed)Backend [TBD]
Frontend
There are two variants of implementation:
Node.js application (app
folder)
Next.js framework (react-app
folder)
use-contractkit
libraryMarketplace
Wallet Connect
Purchase Product
Create Product
Purchase History
Running Unit Testing Smart Contract
npm run test
npx hardhat node
npx hardhat test
npx hardhat test --network alfajores
Running manual test (using Laika)
npx hardhat run scripts/sample-script.js --network alfajores
Output
No need to generate any newer typings.
Marketplace deployed to: 0xB67880E89e79aA1529532677Cc07e2ab007e6443
npx hardhat laika-sync --contract Marketplace --address 0xB67880E89e79aA1529532677Cc07e2ab007e6443
Vercel
)
vercel
vercel --prod
Celo-cli
celocli account:new
celocli config:get
celocli config:set --node=https://alfajores-forno.celo-testnet.org
celocli account:balance 0xbDEA9f367e9a92b41e91525AEC13d3aDFb027a68
Hardhat
npx hardhat console
npx hardhat accounts
npx hardhat clean
npx hardhat compile
npx hardhat node
npx hardhat test
npx hardhat test --network alfajores
npx hardhat run scripts/sample-script.js --network alfajores
Laika (similar as Postman)
npx hardhat laika-sync --contract Marketplace --address 0x052F92eF1B97c0dD68B7150a8BBeBf962dD8a4e7
Not able to run in localhost. Solution
Trying to insert concurrent (multi products) at the same time in Testnet, and get an issue
Error: replacement fee too low [ See: https://links.ethers.org/v5-errors-REPLACEMENT_UNDERPRICED
Trying to make unit test for buyProduct
but transaction was reverted with error:
ProviderError: VM Exception while processing transaction: revert
npx hardhat node
npx hardhat test --network localhost
eth_chainId
eth_getTransactionByHash
eth_chainId
eth_getTransactionReceipt
eth_chainId
eth_estimateGas
Contract call: Marketplace#buyProduct
From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
To: 0x0165878a594ca255338adfa4d48449f69242eb8f
Value: 0 ETH
Error: Transaction reverted: function call to a non-contract account
at Marketplace.buyProduct (contracts/Marketplace.sol:88)
at async EthModule._estimateGasAction (/Users/Anh.Le/Workspace/GitHub/celo-101/contract/node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:425:7)
at async HardhatNetworkProvider._sendWithLogging (/Users/Anh.Le/Workspace/GitHub/celo-101/contract/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:139:22)
at async HardhatNetworkProvider.request (/Users/Anh.Le/Workspace/GitHub/celo-101/contract/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:116:18)
at async JsonRpcHandler._handleRequest (/Users/Anh.Le/Workspace/GitHub/celo-101/contract/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:188:20)
at async JsonRpcHandler._handleSingleRequest (/Users/Anh.Le/Workspace/GitHub/celo-101/contract/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:167:17)
at async Server.JsonRpcHandler.handleHttp (/Users/Anh.Le/Workspace/GitHub/celo-101/contract/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:52:21)
Reference