Thank you for your interest in contributing to the Flare Hardhat Starter Kit. We welcome contributions that improve the examples, tooling, and developer experience for building on Flare.
- Bug Reports: Found something broken? Open an issue with reproduction steps.
- Feature Requests: Have an idea for a new example or improvement? We'd love to hear it.
- Questions: Stuck on something? Open an issue and we'll help.
- Fix bugs or typos
- Add new contract examples
- Improve existing scripts
- Enhance documentation
Fork the repository and clone your fork locally:
git clone https://github.com/<your-username>/flare-hardhat-starter.git
cd flare-hardhat-starteryarnNote: If you encounter issues with Yarn, you can use
npm install --forceas a fallback.
Use descriptive branch names with appropriate prefixes:
| Prefix | Use Case |
|---|---|
feature/ |
New features or examples |
fix/ |
Bug fixes |
chore/ |
Maintenance, config, dependencies |
docs/ |
Documentation updates |
refactor/ |
Code refactoring |
Example:
git checkout -b feature/new-ftso-exampleEdit files in the appropriate directories:
contracts/- Solidity smart contractsscripts/- TypeScript deployment and interaction scriptsutils/- Shared utility functions
This project enforces consistent code style through automated tooling. All code must pass formatting and linting checks before it can be committed.
| Element | Convention | Example |
|---|---|---|
| Contracts | CamelCase | FTSOConsumer |
| Events | camelCase | priceUpdated |
| Functions | mixedCase | getPrice(), updateFeed() |
| Constants | SNAKE_CASE | MAX_SUPPLY, DEFAULT_TIMEOUT |
| Immutable variables | SNAKE_CASE | OWNER, DECIMALS |
| State variables | mixedCase | totalSupply, feedId |
- Line length: 80 characters maximum
- Indentation: 4 spaces (no tabs)
- Quotes: Double quotes for strings
- Bracket spacing: No spaces inside brackets
- Imports: Must be at the top of the file
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract ExampleContract {
uint256 public constant MAX_VALUE = 1000;
address public immutable OWNER;
uint256 public currentValue;
event valueUpdated(uint256 indexed newValue, address indexed updater);
constructor() {
OWNER = msg.sender;
}
function updateValue(uint256 _newValue) external {
require(_newValue <= MAX_VALUE, "Value exceeds maximum");
currentValue = _newValue;
emit valueUpdated(_newValue, msg.sender);
}
}- Line length: 120 characters maximum
- Indentation: 4 spaces
- Quotes: Double quotes
- Semicolons: Required
- Trailing commas: ES5 style
TypeScript files in scripts/ and test/ are linted with ESLint using the @flarenetwork/eslint-config-flare configuration.
Check formatting and linting:
yarn format:check # Check all formatting
yarn lint:check # Check all lintingAuto-fix issues:
yarn format:fix # Fix formatting issues
yarn lint:fix # Fix linting issuesOr run both:
yarn format:fix && yarn lint:fix| Command | Description |
|---|---|
yarn format:check-solidity |
Check Solidity formatting |
yarn format:fix-solidity |
Fix Solidity formatting |
yarn format:check-typescript |
Check TypeScript formatting |
yarn format:fix-typescript |
Fix TypeScript formatting |
yarn lint:check-solidity |
Check Solidity linting |
yarn lint:fix-solidity |
Fix Solidity linting |
yarn lint:check-typescript |
Check TypeScript linting |
yarn lint:fix-typescript |
Fix TypeScript linting |
This repository uses Husky to run pre-commit hooks. When you attempt to commit, the following checks run automatically:
yarn format:check- Verifies code formattingyarn lint:check- Verifies linting rules
If either check fails, your commit will be blocked. To fix:
# Fix all issues
yarn format:fix
yarn lint:fix
# Re-stage your changes
git add .
# Commit again
git commit -m "your message"In rare cases where you need to bypass hooks:
git commit --no-verify -m "your message"Warning: Only bypass hooks if you have a valid reason.
We follow Conventional Commits format:
<type>(<scope>): <description>
| Type | Description |
|---|---|
feat |
New feature or example |
fix |
Bug fix |
docs |
Documentation changes |
chore |
Maintenance, dependencies, config |
refactor |
Code refactoring (no feature change) |
style |
Code style changes (formatting, etc.) |
test |
Adding or updating tests |
ci |
CI/CD changes |
Use scope to indicate the area of change:
fassets- F-Assets relatedftso- FTSO relatedfdc- FDC relatedscript- Script changescontract- Contract changes
feat(ftso): add anchor feed consumer example
fix(fassets): correct redemption calculation
chore: update dependencies
docs: improve script README
refactor(script): extract common utilities-
Compile contracts:
yarn hardhat compile
-
Run format and lint checks:
yarn format:check yarn lint:check
-
Test your changes (if applicable):
yarn hardhat run scripts/your-script.ts --network coston2
- Keep changes focused: One logical change per PR
- Discuss large changes first: Open an issue before major refactors
- Update documentation: If your change affects usage, update the README
- Ensure CI passes: All checks must pass before review
- Descriptive title: Use conventional commit format for PR titles
When creating a PR, include:
## Summary
Brief description of changes.
## Changes
- Change 1
- Change 2
## Testing
How were these changes tested?
## Checklist
- [ ] Code compiles without errors
- [ ] Formatting and linting pass
- [ ] Documentation updated (if needed)├── contracts/ # Solidity smart contracts
│ ├── fassets/ # F-Assets integration
│ ├── fdcExample/ # FDC attestation examples
│ ├── crossChainFdc/ # Cross-chain FDC examples
│ └── ...
├── scripts/ # TypeScript scripts
│ ├── fassets/ # F-Assets scripts
│ ├── fdcExample/ # FDC scripts
│ └── ...
├── utils/ # Shared utilities
├── typechain-types/ # Generated types (do not edit)
└── artifacts/ # Compiled contracts (do not edit)
-
Copy the example environment file:
cp .env.example .env
-
Configure required variables:
PRIVATE_KEY- Your wallet private key (never commit this)- API keys as needed for your work
| Network | Chain ID | Type |
|---|---|---|
| Coston | 16 | Testnet |
| Coston2 | 114 | Testnet |
| Songbird | 19 | Canary |
| Flare | 14 | Mainnet |
If you run into issues:
- Check existing issues
- Review the Flare Developer Hub
- Open a new issue with details about your problem
By contributing, you agree that your contributions will be licensed under the same license as the project.