Home

Awesome

@gemstation/contracts-hardhat

Example smart contracts repo for Gemforge using Hardhat.

This contains the optimal folder structure for use with Gemforge:

There are two facets provided:

Note: A Foundry equivalent of this repo is available at https://github.com/gemstation/contracts-foundry

Requirements

Installation

In an empty folder:

npx gemforge scaffold --hardhat

Change into the folder and run in order:

$ git submodule update --init --recursive
$ pnpm i

Usage

Run a local dev node in a separate terminal:

pnpm devnet

To build the code:

$ pnpm build

Deploy to local devnet

To deploy to the local target:

$ pnpm dep local

Deploy to testnet (Base Sepolia)

You first need to configure the deployment wallet private key in your environment. Ensure that this wallet has a non-zero balance of Base Sepolia ETH (you can use Alchemy's faucet to get some):

$ export PRIVATE_KEY=<your Base Sepolia deployment wallet private key>

Now register on https://basescan.org and generate an API key to set in the environment. This will be used for contract source verification on basescan:

$ export BASESCAN_API_KEY=<api key obtained from basescan.org>

Now run:

$ pnpm dep base_sepolia

If you visit https://sepolia.basescan.org you should see the deployed contracts along with verified source code.

Miscellanous

For verbose output simply add -v to the commands:

$ pnpm build -v
$ pnpm dep -v

License

MIT - see LICSENSE.md