Skip to content

kamu-data/kamu-demo-2024-08-weather-insurance

Repository files navigation

Kamu Planet-Scale Data Pipeline

Chat

About

This repository contains the code that accompanies "Web3 Data Crash Course" - go through the course to understand the theory and for a step-by step walkthrough.

Tutorial in the video form:

Unified On/Off-Chain Analytics Tutorial

Instructions

The smart contract used in the post is deployed on Ethereum Sepolia Testnet: 0xf52BC7bE133a4CB3799Bfe6399bc576465f28153

Building and testing

You will need the following tools:

  • Nodejs - we recommend installing via nvm
  • Foundry

To initialize the dependencies use:

cd contract
nvm use
npm ci

To build and test the contract use:

foundry test

Deploying and using the contract

You will need 3 blockchain wallets:

  • Admin wallet for deploying the contracts
  • Holder wallet for holder of the insurance
  • Insurer wallet for the insurance provider

Note that you can use just one wallet for all these roles but it may be a bit confusing in Etherscan.

Specify the wallets addresses and their private keys in .env file.

All wallets will need a little bit of Sepolia ETH which you can get from:

To deploy the contract run:

npm run deploy

Note the new contract address and put it into the .env file.

To user the contract run:

npm run applyForCoverage
POLICY_ID=1 npm run bidForCoverage
POLICY_ID=1 npm run settle

The applyForCoverage call will return an incremented policy ID with each call, so don't forget to update it.


About

Web2/Web3 data management and smart contract integration example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published