Smart Tokens

Primitive
6 min readMay 8, 2020

--

Prometheus Carrying Fire — Jan Cossiers (1600–1671) — Prado Museum

tl:dr: Smart tokens are ERC-20 tokens with extra features.

The ERC-20 standard is powerful for a few reasons, but one of them is how easy it is to build liquidity around. These tokens are plugged into liquidity models with ease, and what we get is a more liquid market that is better for all parties. Liquidity models will continue to grow and iterate towards zero impermanent loss, but what about the tokens?

System Tokens

Many of the most liquid tokens have their value derived from the system it is embedded in. For example, Dai is derived from the Dai Stablecoin System. However, Dai as a token isn’t unique, it’s not even called Dai on the Kovan testnet.

Maker Dao’s Dai Stablecoin System — https://github.com/makerdao/dss

Smart Tokens

A smart token has a small and simple system baked into it on the contract level. It’s a primitive that has its value derived from itself rather than an external system. In this way, it’s ignorant to every other contract on the EVM and this gives the primitive strength from flexibility.

The Primitive Protocol is designing smart tokens that can be used as pieces to more complex systems. In addition, we design extension contracts which make interactions with the smart tokens easier. These pieces will be an additional set in our arsenal of DeFi legos.

We’ve designed our first smart token with the options market of DeFi in mind. This is because options on tokens will be one of the fundamental steps in the growth of DeFi. An option is the right to swap a strike token for an underlying token; its a limit order frozen in time but only available over a fixed time period.

The Prime Smart Token

The Prime is a smart token we’ve designed that matches the specification of a vanilla option. It has the critical attributes of a vanilla option: optionality and a fixed lifetime. Users who hold Primes have the ability to swap their strike tokens into underlying tokens until the Prime expires (fixed lifetime). We’ve baked these properties into the ERC-20 token.

The Prime Smart Token —Vanilla Option Specification

The functionality of a vanilla option from legacy finance is: the right to buy or sell the underlying asset for the strike price. To match this specification, the Prime has a ‘swap’ function which does this action. It will swap the tokens at a fixed ratio, which is specified when the Prime is deployed to the EVM (created). Since Primes could be options on any token, and the denomination could be any token, the ratio between those two quantities is called the strike ratio.

Legacy options are denominated in local currencies like the US Dollar and this is called the strike price. Primes are denominated in any strike token, so we have a strike ratio rather than a strike price.

Extension Contracts

Extension contracts are designed to use the Prime or any smart token as a part to a larger system. They are built specifically with the user in mind.

Liquidity Pool

We’ve designed a pool to act as a supply side counter-party. This pool will be able to meet demand of users who want to buy specific Primes (vanilla options).

Its capable of doing this because it has logic to do three tasks: (1) Accept deposits of underlying tokens from liquidity providers, (2) Mint Primes using the underlying tokens, (3) Sell those Primes for a premium to buyers.

The first task is like any other pool depositing method. When an LP deposits funds they get a proportional share of liquidity tokens which can be redeemed for a portion of the pool.

The second task is where the flexibility of the Prime comes in. The Prime contract knows how to output Primes based on the amount of input underlying tokens. The pool sends underlying tokens, calls the mint function, and then receives Prime tokens, which can then be sold.

The third task is more complex. The premium, the value of a vanilla option, is derived from its intrinsic and extrinsic values. The intrinsic value is the difference between the strike ratio and the market ratio between the underlying and strike tokens. To calculate this value, an oracle is needed. The second difficulty is estimating the extrinsic value, which is based on the time until expiry and the implied volatility of the option.

An Oracle

We offload this premium calculation work to another contract called the Prime Oracle. In the case that the pricing model is inaccurate or the contract has a bug, we can redeploy a new version of the oracle without affecting the pool. This is an extension contract that the pool uses as an upgrade-able bridge to a pricing model.

To calculate the intrinsic value, the pool will use an oracle to get the current market ratio between the underlying and strike token. It then compares this amount to the strike ratio, the ratio defined in the Prime contract. The difference is the intrinsic value. At this stage, we are using Compound’s oracle, but the final decision on what oracle to use will come down to the security it can provide.

To calculate the extrinsic value we use the following formula:

Implied Volatility is a difficult value to get and we have not found it. What we can do is use a proxy for it, and we do that by using the utilization of the pool; a proxy for demand.

When we combine the intrinsic and extrinsic value, we get the premium. This premium is fed to the pool, and the pool will sell the Primes to buyers for this value.

Systems

This combination of smart tokens and extension contracts is the Primitive Protocol. With all these parts, such as the pool, oracle, and the base primitive the Prime, we have a more complex system that was designed to meet a goal.

Pools, or even other tokens, can design around the specification of the Prime to create new products, and we expect teams to do this.

That is why we are here to help. If you have a suggestion, request, or question you can join the protocol’s developers and users in the Discord.

Next Steps

As you know, the pool contract that was initially deployed to mainnet had a bug in it, which led us to pause the contract. We have been making changes to the pool contract and testing it for the past seven days. We are hoping we could have a limited alpha version of this contract ready to go for a small amount of test funds to go through it within the next week.

Currently, the Prime smart token is on mainnet with a Trader contract that makes it easy to interact with the Prime. Keep in mind, these contracts have not been secured yet. Any funds that are held in these contracts are effectively 100% at risk.

Our priority is security and we are taking the steps to secure the contracts for the V1 release.

Twitter

Follow us on twitter to get the latest updates.

Documentation

Our documentation has the details of the protocol! The contract documentation is currently being added. The contracts are still subject to many more changes.

--

--