Skip to content

Decentralized binary call option exchange for inflation with external adapter and Keeper

License

Notifications You must be signed in to change notification settings

bayesdj/2022-Inflation-Hedge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inflation Hedge with Chainlink External Adapter and Keeper

We built a decentralized exchange for binary call options on inflation. If the next release of median consumer price index (CPI) is greater than the strike level, option buyer will receive a fixed payout, otherwise option seller gets the payout. The exchange uses an external adapter to track the underlying (median CPI released monthly by the Federal Reserve Bank of the US), and uses Chainlink Keeper to automatically settle the option contracts. Our smart contracts are fully tested on Polygon Testnet.

Decentralized Exchange for Binary Call Options

In our implementation of exchange, users can place bids, asks to an options struct array. Bids and asks can be canceled as long as they are not taken (transacted). Users can buy or sell options from the bids array and asks array. Option buyers only need to pay the option premium as margin. Option sellers, on the other hand, need to put down the payout amount minus option premium as margin. In our setting, the payout amount is fixed at 1 eth. On Ethereum network, it means one ETH. On Polygon network, it means one MATIC. Premiums are denominated in finneys, or 1/1000 of an eth.

Although our exchange uses median CPI as underlying, it really can be just about any data that has a trusted API as information source. For example, will Novak Djokovic have more than 24 grand slam titles at the end of 2023 is a valid underlying. Will extraterrestrial life be discovered by the end of 2025 is also valid. Will Donald Trump be voted again as the President of the US at the end of 2024 is also interesting. As for inflation, we have many kinds of inflation data with focus on food, energy, housing, or a particular geographic region. We aim to found a decentralized exchange for almost any topic, bounded only by regulation and imagination.

Keeper for automatic contract settlement

In our implementation, the expiration time is set to be Sep 13, 2022, 10 am EDT. This is the announced release time of August median CPI. However, there is no guarantee that the API will be updated at that exact moment. We can rely on the exchange contract owner to manually update the external adapter. However, a more efficient way is to let Chainlink Keeper do the job. Upon expiration, Keeper will examine if the underlying number from the external adapter contract is still the same. If it is, Keeper will request an update from the external adapter every 4 hours until there is a different number. Then, the underlying will be updated to that new number and the expire function will be called and all options will be settled. Once settled, users who have uncancelled bids/asks can withdraw their margins and winners can withdraw their payouts minus a fee.

About

Decentralized binary call option exchange for inflation with external adapter and Keeper

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published