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:
The smart contract used in the post is deployed on Ethereum Sepolia Testnet: 0xf52BC7bE133a4CB3799Bfe6399bc576465f28153
You will need the following tools:
To initialize the dependencies use:
cd contract
nvm use
npm ci
To build and test the contract use:
foundry test
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:
- ChainLink faucet (requires GitHub account)
- Infura faucet (requires Infura account)
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.
Website | Docs | Tutorials | Examples | FAQ | Chat | Contributing | Developer Guide | License