The making of ohmydai — part 1

Willian Mitsuda
ohmydai
Published in
3 min readDec 14, 2019

Overview

In this series we are going to explain the inner details of ohmydai.

ohmydai is an on-chain implementation of American put options based on the Convexity Protocol for fungible ERC20 options contracts.

For more details, check this.

First, let's take a look at some design decisions. ohmydai's smart contract is written in Solidity and deployed in the Ethereum blockchain. As practically all DeFi ecosystem is currently Ethereum-based, this choice was no big deal.

Every option series in deployed as a unique ERC20 smart contract. The option tokens are fungible inside its own series.This choice highly influenced many of the following decisions.

The Convexity whitepaper describe 8 basic parameters, let's go a little deep at each one of them and which decision we have made.

Expiry time

The expiration of each option series is immutable and set into the contract at the deployment time. However, the expiration is represented as a future block number instead of a fixed time at the future.

We've made this decision because the expiration time is a critical business rule of an option series. It determines whether an option buyer can or can't exercise his options. However the block timestamp doesn't seem to be a reliable source of information so far. We were not able to find a reliable source stating that a smart contract could trust the block timestamp for such important business rule.

So the best we could do right now is at deployment time estimate the block number of the moment we want the series to expire. Note that even the block number is just an estimate, but at least we will be sure that all blocks until the expiration will be continuous and be mined in ~15 seconds.

European vs American options

A European option limits the execution to the expiration date, while an American option can be exercised at any time until the expiration date.

Trying to translate the concept of European options to a 24/7 global blockchain based system raises some questions. Let's say the option expires on 10/31, end of the day. But which timezone? PST? UTC? Even if we make this decision, we should them allow some time window for people to be able to exercise their options, but how long should this window be? 1 hour? 1 day?

To keep things simple, we've just decided to go on with American options + expiration time denominated as a block number, so anyone familiar with the Ethereum blockchain can estimate how far the series is from being expired just by checking on any block explorer and can exercise the option at any time until the expiration.

Underlying asset

It is the asset that the option buyer has the right to sell. In our case it’s DAI.

Strike price/asset

It’s the price that the option buyer will sell the underlying asset. In our case, it’s 1 USDC.

Call or put

We decided to start with put options so that the collateral requirement would be imitated to the amount of ohtokens minted. Call options will be implemented in the future.

Collateral/margin

Similarly to the Convexity Protocol, we kept the collateral asset the same as the strike asset. So by locking 1 USDC, the option seller can mint 1 put option (minting 1 ohtoken) and giving the buyer the right to sell the underlying asset for exactly 1 USDC.

In the next post we'll explore how these decisions affected the inner economics of the smart contract.

--

--