A basic marketplace dapp for the Celo blockchain.
Try the online version here.
Boilerplate forked from dacadeorg/celo-react-boilerplate.
- React - A JavaScript library for building user interfaces.
- use-Contractkit - A frontend library for interacting with the Celo blockchain.
- Hardhat - A tool for writing and deploying smart contracts.
- Bootstrap - A CSS framework that provides responsive, mobile-first layouts.
Clone the project, install the dependencies and run the app
npm install
npm start
To properly test the dapp you will need to have a wallet with testnet tokens.
You can use Metamask or the CeloExtensionWallet and you can get some tokens on the testnet here by putting down your address (remember that it needs to start with 0x
).
The code of the smart contract is located in the contracts
folder, all solidity contracts must be here.
If you modify the file name of a smart contract, you need to modify it also in the test and the deploy script.
Simply run
npm run compile
or
npx hardhat compile
In the test
folder you will find the test for the smart contracts.
To start the test run
npm run test-contract
or
npx hardhat test
The following envirorment variables are needed:
MNEMONIC
, the mnemonic phase of your testnet wallet, it needs to have some CELO coins to deploy the contractERC20_TOKEN_ADDRESS
, the addres of the token that will be used as 'currency' in the marketplaceERC20_TOKEN_SYMBOL
, the symbol of the token shown in the marketplace
You can copy the content of .env-sample and fill with your needs
MNEMONIC = "...";
ERC20_TOKEN_ADDRESS = "0x...";
ERC20_TOKEN_SYMBOL = "...";
NB: the project is configured to use a mnemonic phrase generated with the CeloExtensionWallet, if you want to use one generated with Metamask you need to change the generation path in the hardhat.config.js at line 42 file from m/44'/52752'/0'/0
to m/44'/60'/0'/0
.
When you're ready to deploy the smart contract you can run
npm run deploy
or
npx hardhat run --network alfajores scripts/deploy.js
This command will update the src/contract files with the deployed smart contract ABI and contract address.
To create an optimized build of the frontend ready to publish run the command:
npm run build
The optimized app will be saved in the build
folder.