Are you a farmer worried about a drought? Or a traveler who wants to hedge against a rainy day? Then Flarinsure is for you!
We use two smart contracts:
- An Oracle contract that interfaces with the Flare Data Connector (FDC) to get rainfall data
- A Policy contract that allows you to buy and redeem policies
See our demo video here: https://www.loom.com/share/929e2d0cf44e42c8b6b8045d39f000aa?sid=a84aad35-5f57-4dc9-897b-e297c943bbab
Team members (from left to right):
Repo: https://github.com/Mushrimpy/blockinsure_flare. We used React, Next.js, and Scaffold-Eth to build the frontend. The frontend FDC button calls a server running with a docker container from this repo: https://github.com/ssocolow/docker-test.
Special thanks to Phillip and the rest of the Flare team for helping us get set up and guiding our build! Also thanks to Adam Spiers for the invaluable mentorship he provided.
It was really fun and interesting working with a data blockchain for the first time and creatively exploring the possibilities associated with it. It was a little difficult getting started with the JQ processor, but after a while it became a lot smoother. Overall appreciated the robustness of the FDC with its flexiblity in taking in different data sources. We realized the large scope of opportunities associated with enshrined protocols.
IMPORTANT!!
The supporting library uses Openzeppelin version 4.9.3, be careful to use the documentation and examples from that library version.
If you are new to Hardhat please check the Hardhat getting started doc
-
Clone and install dependencies:
git clone https://github.com/flare-foundation/flare-hardhat-starter.git cd flare-hardhat-starter
and then run:
yarnor
npm install -
Set up
.envfilemv .env.example .env -
Change the
PRIVATE_KEYin the.envfile to yours -
Compile the project
yarn hardhat compileor
npx hardhat compileThis will compile all
.solfiles in your/contractsfolder. It will also generate artifacts that will be needed for testing. ContractsImports.solimport MockContracts and Flare related mocks, thus enabling mocking of the contracts from typescript. -
Run Tests
yarn hardhat testor
npx hardhat test -
Deploy
Check the
hardhat.config.tsfile, 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
.envfilenpx hardhat run scripts/tryDeployment.ts --network coston2


