For some industries, the weather plays a significant role in determining revenue. In fact, it is estimated that 30% of the US economy is directly tied to the weather - from utilities to transportation to construction companies, the list goes on.
Until recently, weather insurance has been the main tool used by companies for protection against unexpected weather conditions. But insurance provides protection only against catastrophic damage. Insurance does nothing to protect against the reduced demand businesses experience as a result of weather that is slightly warmer or colder than expected. For instance, a few degrees hotter weather can be dangerous for some crops and yield a severe impact on an agriculture business; unseasonably mild winters can similarly diminish the profit margins of energy companies.
So, how can companies – particularly those at the mercy of Mother Nature – protect themselves against the exposure to financial risk?
Enter weather derivates. Weather derivative, in simple terms, is a financial product that protects sales and revenues against unseasonal or bad weather by hedging against the weather. In the Chicago Mercantile Exchange (CME), in 2011 alone, more than $9 billion was spent on hedging against the weather.
The only limiting factor in the weather derivative market is data. As long as both the parties agree or trust upon a good weather data set, then they can trade on it. This is where the decentralized application of Chainlink comes into picture.
What it does
Helios is a decentralized weather futures trading platform where individuals/firms can hedge their weather exposure based on the differences in the recorded average temperatures.
The future contracts come in the form of either Heating Degree Day (HDD) or Cooling Degree Day (CDD) contracts. The payoff of these contracts is based on the cumulated difference in daily temperatures relative to 18⁰C over a fixed period such as a day or a month. The buyer of a HDD or CDD contract benefits from a positive payoff if cumulative temperature is below or above 18⁰C respectively.
In order to calculate the HDD or CDD values, Helios uses the mean aggregate average temperature values from World Weather Online API and the Aeris Weather API, which are both external data sources provided by Honeycomb. The payoff (or settlement) price of the contract is calculated by multiplying the HDD or CDD value by 0.003 ETH.
How I built it
I wrote three smart contracts:
- FuturesFactory - this contract holds all the logic to place an order, fill an order and square off the position.
- Escrow - when the order is filled, the margin amounts of both parties are locked into the escrow contract.
- Oracle - this contract fetches the daily average temperature data from World Weather Online and Aeris Weather. (FuturesFactory contract takes these temperature values and calculates the mean, which is also the median, of the two and treats it as the net average temperature)
All these contracts were deployed on to the Ropsten testnet. For the front-end, I used React and deployed the app on github using gh-pages.
Challenges I ran into
Experience Before the hackathon, I had very less hands on experience with writing smart contracts in solidity and using libraries like truffle to compile and deploy the contracts. I also did not know how derivatives or futures work! But over the course of 10 days, I managed to learn quite a lot about everything!
Working Solo Working on this entire project alone seemed like a daunting task at first but the project turned to be extremely exciting and I just HAD to finish it!
Accomplishments that I'm proud of
- Utilizing the true decentralized application of Chainlink to create an actual working product.
- Learning about derivatives and futures and being able to build a working model to simulate futures trading.
- Creating something that has never been done before in the crypto space!
What I learned
Learned about how futures and derivatives work, good practices to write solidity smart contracts, communicate among multiple smart contracts, trufle to deploy, compile and test and integrating web3 on the frontend to create a fully functional dApp.
P.S. Huge thanks to the Honeycomb team for providing amazing workshops during the hackathon!
What's next for Helios
Right now, Helios supports futures based on temperature indices (HDD and CDD). I plan to add more indices based on pressure, rainfall etc. Update the smart contract to support more APIs as Honeycomb adds them to their market. Deploy contracts to mainnet.