Skip to content

Commit

Permalink
Merge pull request #202 from celo-org/therealharpaljadeja/hardhat
Browse files Browse the repository at this point in the history
Changes to the hardhat package
  • Loading branch information
viral-sangani authored Jul 10, 2023
2 parents 81c6ccb + 570770d commit 7278b19
Show file tree
Hide file tree
Showing 20 changed files with 1,694 additions and 1,100 deletions.
34 changes: 17 additions & 17 deletions packages/hardhat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ This project demonstrates a basic Hardhat use case. It comes with a sample contr

1. Create a `.env` file similar to `.envexample`.
2. Paste the private key in `.env`.
> note: depending on how you generate your private key, you may have to prepend `0x` in the private key does not already have it prepended.

Alternatively, you can also run the following command to generate a new account

```sh
npx hardhat create-account
```

> **Note** : Depending on how you generate your private key, you may have to prepend `0x` in the private key does not already have it prepended.
3. Faucet your account with the Alfajores testnet faucet [here](https://celo.org/developers/faucet).

## Develop
Expand Down Expand Up @@ -71,6 +79,14 @@ You can get a local copy of mainnet by forking with Ganache. Learn more about [f

There is a script provided (`yarn fork-mainnet`) to fork mainnet and fund the same test accounts that come with Celo devchain. Sometimes sending transactions from the first account (which defaults to `0x5409ED021D9299bf6814279A6A1411A7e866A631`) is delayed and sending test transactions from the other accounts works better for some reason. :shrug: The private keys of the associated test accounts are printed in `account_keys.json`.

## Celo Core Contracts

You can easily import Celo Core contracts to be used by your contracts like so:

```solidity
import '@celo/contracts/common/Accounts.sol';
```

## Verify your contracts

### hardhat-celo
Expand Down Expand Up @@ -106,19 +122,3 @@ On Mainnet:
```bash
npx hardhat --network celo sourcify
```

## Deploy with [Figment Datahub](https://datahub.figment.io/)

Figment Datahub provides RPC & REST APIs for Celo network. To learn more about Datahub refer this doc - [https://docs.figment.io/introduction/what-is-datahub](https://docs.figment.io/introduction/what-is-datahub). Follow these steps to deploy your smart contract with Figment datahub's RPC.

- Create account on [Datahub](https://datahub.figment.io/).
- On the dashboard, click on `Create new app` and select **Celo** from the protocol list.
- Once you have created an app, copy the api key.
- Edit `hardhat.config.js` and update `alfajoresDatahub` and `celoDatahub` with the API Key.
- Run the test or deploy the contract with following commands.

```bash
npx hardhat run scripts/run.ts --network alfajoresDatahub

npx hardhat run scripts/deploy.ts --network celoDatahub
```
Loading

0 comments on commit 7278b19

Please sign in to comment.