-
Create a copy of
.env.example
and rename it to.env
.- For the smart contract deployment you will need the
PRIVATE_KEY
set in.env
. Never use a wallet with real funds for development. Always have a separate wallet for testing. - For the smart contract verification you will need a Celoscan API Key
CELOSCAN_API_KEY
set in.env
.
- For the smart contract deployment you will need the
-
Compile the contract
npx hardhat compile
- Deploy the contract
Make sure your wallet is funded when deploying to testnet or mainnet. You can get test tokens for deploying it on Alfajores from the Celo Faucet.
npx hardhat ignition deploy ./ignition/modules/Lock.ts --network <network-name>
On Alfajores
npx hardhat ignition deploy ./ignition/modules/Lock.ts --network alfajores
On Celo Mainnet
npx hardhat ignition deploy ./ignition/modules/Lock.ts --network celo
- Verify the contract
For Alfajores (Testnet) Verification
npx hardhat verify <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS> --network alfajores
For the Lock.sol contract that could look like this:
npx hardhat verify 0x756Af13eafF4Ef0D9e294222F9A922226567C39e 1893456000 --network alfajores
For Celo Mainnet Verification
npx hardhat verify <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS> --network celo
Check the file hardhat.config.js
for Celo specific hardhat configuration.
- ABI Synchronization
The project includes automatic ABI synchronization with your React frontend. ABIs are synced to ../react-app/src/abis/
during compilation.
-
Automatic Syncing:
- The ABIs only sync automatically when you run:
or
yarn compile
npm run compile
- The ABIs only sync automatically when you run:
-
Manual Syncing:
- To sync ABIs manually without compilation:
- With npm:
npm run sync:abis
- With Yarn:
yarn sync:abis
- With npm:
- To sync ABIs manually without compilation:
- The sync script (
sync-abis.js
) is made executable automatically duringnpm install
oryarn install
by thepostinstall
hook inpackage.json
. - To disable automatic syncing, remove the
sync-abis.js
call from thecompile
script inpackage.json
. This configuration provides a flexible and consistent workflow for bothyarn
andnpm
users.