## Inspiration

Traditionally weather derivatives are expensive, obscure and hard to access. Only institutions have the capability of trading these products while they can be useful for anyone that wants to hedge against weather based events. After doing research I found HDD (Heating Day Degree) swaps are the most traded weather exchange derivative in the US. The protocol that I built optimizes the existing HDD swaps further by supplying the collateral to Aave in order to incentivise liquidity.

## What it does

HDD swaps are a type of derivative in which the user can hedge against the weather. A HDD is the number of degrees that a day's average temperature is below 65 Fahrenheit (18 Celsius), which is the temperature below which buildings need to be heated.

The product that we currently offer is a 1 month HDD swap in New York. Users can choose a tick size, a strike rate for a 1 month period.

Example

Use Case:

• Person A is a miner, when the temperature is hot outside he needs to cool his facility and this costs him money, He wants to hedge himself against hot weather. Low amount of HDD = bad for miner so he wants to get paid when HDD reach below a certain threshold.

• Person B is a farmer and grows sweet potatoes, when the weather outside is too cold they will not grow properly. He wants to ensure that the weather stays warm. High amount of HDD = bad for farmer so he wants to get paid when HDD reach above a certain threshold.

Action:

• Person A creates a HDD swap on Vulcan. He chooses a tick size of 50 USDC with a fixed strike rate of 90 HDD. This means that person A will get paid 50 USDC per HDD when there are less than 90 cumulative HDD’s.

• Person B buys the HDD swap from Person A. Person B will get paid 50 USDC per HDD when there are more than 90 cumulative HDDs

Since there isn't a miner for every farmer and vice-versa I built an incentive mechanic that rewards users for taking the opposite bet.

Incentivised Liquidity Bonus

To incentivise liquidity the protocol will take the collateral of person A and Person B and send it to Aave. (eg 4500\$ + 4500\$) Aave's pool will generate interest in the duration of the swap. After the month is over the buyer will receive all the interest of the collateral. (20% APY).

## How we built it

Custom Adapter First thing that I had to build is the custom adapter to retrieve the historic weather data. I found an adapter that had implemented OpenWeatherMap but it didn't implement the endpoints I needed and required different API keys.

I built a new adapter using the Chainlink Node Template and implemented the OpenWeatherMap history API, after this I set up a Chainlink node and tested it through Remix. I then deployed it as a lambda on AWS and connected it to their API gateway.

Smart Contract

After the adapter was working I started on the smart contract itself. I created a factory pattern as this would optimize gas, allow its instances (the derivatives) to be automatically funded with link as well as keep track of all derivatives using a mapping. Each derivative has its own unique contract.

The derivatives contract holds the user collateral. The contract also receives Link upon creation from the derivatives factory. The derivatives contract also contains the logic for sending the funds to Aave and retrieving the funds back when the swap had ended.

Frontend

After the first version of the smart contract and adapter was built I started on the UX for the frontend. Since I want to build more of these derivatives in the future I created an exchange frontend and named it Vulcan. I wanted the exchange to feel polished while also explaining to users how the swap would work.

I created the exchange with VueJS and Vuex and implemented a simple messaging system to notify the user when an action is required (such as signing a message).

## Challenges we ran into

I hadn't setup a chainlink node or built an adapter before so it took a bit of time figuring out how to host it and set everything up from scratch. I also accidentally used the Aave lendingpoolprovider address from mainnet on kovan which took quite some time to debug. Overall there were no major blockers in the project.

## Accomplishments that we're proud of

Building the adapter and getting to see the data in the smart contract was very satisfying. The project turned out the way I originally envisioned it so that is definitely something I am proud of. Implementing Aave was a breeze .

## What we learned

It is really easy to incorporate real data in smart contracts, even when building an adapter, setting up a node and building the contract I always felt there was enough documentation to keep me going.

## What's next for Vulcan Exchange

I am currently working on expanding the products that are offered through Vulcan, the next product will be a rainfall derivative. I am also exploring different EVM's to optimise the transaction costs.