Decentralized, Automated Parametric Crop Insurance on the Flare Network.
Live Demo: https://crop-guard-jade.vercel.app/
Repository: https://github.com/Atul-Chahar/CropGuard
CropGuard solves the inefficiency of traditional agriculture insurance by automating the entire lifecycle—from policy purchase to weather verification and payout—using the Flare Blockchain.
We leverage Flare's enshrined protocols to build a system that is both trustless and economically sound.
| Technology | Implementation in Project | Why it matters? |
|---|---|---|
| FTSO (Flare Time Series Oracle) | PayoutModule.sol: Calls getCurrentPriceWithDecimals("C2FLR"). |
Ensures payouts are pegged to real-world USD value, unaffected by FLR price volatility. |
| FDC (Flare Data Connector) | WeatherOracleAdapter.sol: Receives off-chain attestation data. |
Allows the blockchain to verify "Did it rain?" without trusting a central server. |
| Smart Contracts | CollateralPool.sol & PolicyManager.sol |
Automated logic for risk management, premiums, and liquidations. |
| Next.js & Tailwind | packages/app |
A modern, high-performance UI for farmers to interact with the blockchain. |
CropGuard is designed for 100% Automation and Reliability.
- Farmer selects Crop (e.g., Wheat) and Location.
- Pays a Premium in FLR (e.g., 10 FLR).
- Reliability: The premium is instantly locked in the
CollateralPool.
- Our Off-Chain Oracle (
scripts/oracle/weather-oracle.js) runs continuously. - It checks OpenWeatherMap data against the policy's location.
- Automation: If Adverse Weather (Drought/Flood) is detected, the script automatically submits a transaction to the blockchain. No human claim filing needed.
PayoutModulereceives the weather trigger.- It queries FTSO for the current FLR price.
- It calculates the payout:
(Insured USD Amount / FLR Price). - Funds are sent directly to the farmer.
We built a Shared Risk/Reward Protocol so the community can enable this insurance.
- Stake: Anyone can deposit FLR into the
CollateralPool. - Earn: Every time a farmer buys a policy, the premium (e.g., 10 FLR) is added to the pool.
- Reward: This premium is distributed pro-rata to all Stakers over time.
- Example: If you own 10% of the pool, you earn 10% of every premium paid.
- Risk: If a payout happens, it comes from the pool. Stakers effectively become the "Insurance Company," earning steady yield in exchange for covering disaster risk.
- Reentrancy Guard: Protected against reentrancy attacks using OpenZeppelin's
ReentrancyGuard. - Module Separation: Logic is split into
PolicyManager(Data),PayoutModule(Logic), andCollateralPool(Money) for better security and upgradability.
Contracts:
- PolicyManager:
0x4aDEea1FEa03a462720C38BAb146934cfd96F924 - CollateralPool:
0x5Ed6CF1ADf3330F61D666D3336a2d59eeeA7E0fE - PayoutModule:
0xCF8B54c0D4f10a05254a007f24F099aBFEd585c7 - WeatherAdapter:
0x0Fd10bb23f3D17a149FFC0c0e7AA4eBE82eD9226
# 1. Clone
git clone https://github.com/Atul-Chahar/CropGuard.git
# 2. Install
npm install
cd packages/contract && npm install
cd ../app && npm install
# 3. Configure .env (See .env.example)
# 4. Run App
cd packages/app
npm run devBuilt with ❤️ for the Flare Hackathon.