What it does

Our Tracking and Delay Insurance (TADI) Contract makes use of Chainlink Functions to get tracking data from the DHL API. The user (shipper) can store information about their shipments (containers) and their respective tracking data. And, the user can purchase delay protection which will earn them a payout in the event of a delay in their shipment's delivery.

The contract is set up to be a Functions consumer. executeRequest() is called to send the DON our DHL API request to compute. fulfillRequest() decodes and records the response to a state variable

DHLRequest.js

After deploying to Mumbai, this JS script summons an instance of our contract. After setting up the environment we note the contract's starting balance. Create a new shipper and a new container. Then we buy delay protection by paying the premium, and rig a delay to make the due date yesterday. We check for any delays, notice an overdue shipment was insured, and triggered a payout. We then check our contract's balance again to see, that it indeed went down after we paid out. Then we send an executeRequest() call to the DON and get a response with tracking data. We update our state variables with that data. We return the container's latest location and timestamp in the console log. We could also call the contract’s helper function for getting to latest location and timestamp to confirm the info was brought on-chain.

Contract Interaction: https://youtu.be/FfbKldDj86k

Contract address: https://mumbai.polygonscan.com/address/0xcc41Ab26194DB106c5Ab4eb442FEdea261703904

Challenges we ran into

Getting executeRequest() and fulfillRequest() to go through. They were reverting for various reasons that took some time to fix. In the end it started to work which is great. The video showed above was recorded before the problem was fixed. We kept hacking away at this project even after the hackathon was done.

Accomplishments that we're proud of

We were able to string together robust, and decentralized parametric shipment delay product using Chainlink functions... An application which we believe holds significant value, especially when reflecting upon past supply chain interruptions caused by COVID-19 and what impact that had on the world.

What we learned

We learned a lot along the way and had plenty of late nights (our time zones are 9 hours apart), plenty of questions on discord and ethereumstackexchange, mainly surrounding Chainlink functions but also you know. Solidity errors, .... Overall it was an awesome experience to learn how to use Functions and we are grateful to have such an amazing community like Chainlink to be a resource for us, and putting out plenty of helpful content to harness

What's next for Parametric Shipment Delay Insurance

Fine tuning everything for production, awaiting Chainlink functions to go live, and getting the product out into the world.

Built With

Share this project:

Updates