Skip to content

flare-foundation/flare-hardhat-starter

Repository files navigation

Flare Logo

Flare Hardhat Starter Kit

This is a starter kit for interacting with Flare blockchain. It provides example code for interacting with enshrined Flare protocol, and useful deployed contracts. It also demonstrates, how the official Flare smart contract periphery package can be used in your projects.

Getting started

If you are new to Hardhat please check the Hardhat getting started doc

  1. Clone and install dependencies:

    git clone https://github.com/flare-foundation/flare-hardhat-starter.git
    cd flare-hardhat-starter

    and then run:

    yarn

    or

    npm install --force
  2. Set up .env file

    cp .env.example .env
  3. Change the PRIVATE_KEY in the .env file to yours

  4. Compile the project

    yarn hardhat compile

    or

    npx hardhat compile

    This will compile all .sol files in your /contracts folder. It will also generate artifacts that will be needed for testing. Contracts Imports.sol import MockContracts and Flare related mocks, thus enabling mocking of the contracts from typescript.

  5. Run Tests

    yarn hardhat test

    or

    npx hardhat test
  6. Deploy

    Check the hardhat.config.ts file, where you define which networks you want to interact with. Flare mainnet & test network details are already added in that file.

    Make sure that you have added API Keys in the .env file

    npx hardhat run scripts/tryDeployment.ts

Repository structure

├── contracts: Solidity smart contracts
├── scripts: Typescript scripts that interact with the blockchain
├── test
├── hardhat.config.ts
├── package.json
├── README.md
├── tsconfig.json
└── yarn.lock

Contributing

Before opening a pull request, lint and format the code. You can do that by running the following commands.

yarn format:fix
yarn lint:fix

Clean repository

If you want to start building your projects from a repository that is already setup to work with Flare correctly, but you do not want to keep any of the examples, these are the files you should delete:

  • all files in the contracts/ folder
  • all files in the scripts/ folder, except for the scripts/fdcExample/Base.ts which might come in useful

A shell command that does this is:

rm -rf contracts/* & mv scripts/fdcExample/Base.ts ./Base.ts & rm -rf scripts/* & mv ./Base.ts scripts/Base.ts

Resources

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7