celo-org / celo-composer

celo-composer is a starter project with all code needed to build, deploy, and upgrade a dapps on Celo.
MIT License
119 stars 112 forks source link

[Feature]: the commands to compile, verify and deploy a contract should be in one place #290

Open GigaHierz opened 3 months ago

GigaHierz commented 3 months ago

Tell us about your idea

Right now we have a few places in the project that hold information on how to compile, verify and deploy a contract. I suggest collecting that information and making sure it is accessible in all of them to serve different developer preferences

  1. README.md

Proposed update


Celo Composer | Hardhat

How to use

  1. Create a copy of .env.example and rename it to .env.

  2. Compile the contract

Run

yarn run compile
  1. Deploy the contract

You will need the PRIVATE_KEY set in .env. Make sure you hold CELO tokens to pay for the deployment. If you are deploying on Alfajroes, get the tokens from the Celo faucet.

To deploy your contract on Alfajores

npx hardhat run scripts/deploy.js --network alfajores

To deploy your contract on Mainnet

npx hardhat run scripts/deploy.js --network celo
  1. For the verification you will need the Celoscan API Key CELOSCAN_API_KEY set in .env.

For Alfajores (Testnet) Verification

npx hardhat verify [CONTRACT_ADDRESS] [...CONSTRUCTOR_ARGS] --network alfajores

For Mainnet Verification

npx hardhat verify [CONTRACT_ADDRESS] [...CONSTRUCTOR_ARGS] --network celo

Check the file hardhat.config.js for Celo specific hardhat configuration.

Anything else?

No response