DeFi wave hit 2020 crypto scene with massive impact and brought excitement. High yields attracted everyone includes institutional player attention, but there is another feeling crypto twitter has along with excitement: Anxiety of a single error in an unaudited Solidity code can break the system with a domino effect. Not even mentioning the enormous fees paid to execute just one smart contract.
One of the prospects of CosmWasm is providing a solid base to DeFi dApps.
To prove this bold claim and show CosmWasm is the right path, we will demonstrate a simple option contract and teach you along the way.
Options are financial derivatives that give buyers the right, but not the obligation, to buy or sell an underlying asset at an agreed-upon price and date.
We demo-ed the contract for HackAtom V India participants in a workshop.
You can open the recordings of the workshop to the side and follow the written tutorial as a transcript. In the workshop we start from boiler plate code and build on top of it. In this tutorial you be walked through the finished version. We recommend you to launch a project from template and develop along Ethan's workshop video, you will learn such as development flow and possible errors which you can't learn just by reading a written tutorial.
You can find the complete repo at github/cw-examples.
Pay attention to comments like below in code examples. The details about the code itself is in the comments.
Also the video is recorded using and older version of cosmwasm, but tutorials have been updated to a recent version( 0.13) so there could be minor differences.