The Primitive Protocol is a developer friendly codebase for operating tokenized option contracts on Ethereum. Users deposit tokens as collateral and receive option tokens in return, which have their own mechanics.

This guide assumes there is some prior understanding of what options are. If you are not familiar with options, we recommend you read about them here: Investopedia Option Definition.

Option tokens are implemented as smart contracts on Ethereum with the same functionality as vanilla American option contracts from legacy finance. If a user holds option tokens, they have the right to purchase the underlying collateral at a strike price which is coded into the option token smart contract.

Each option is created with attributes, like the strike price, which cannot be changed or manipulated. They also come with their own functions, which enables them to act like vanilla options.

This guide details the how to set up the Primitive Protocol's contracts in a local development environment. We will be walking through how to copy the code and run it on a local blockchain, as well as how to interact with the contracts that are on live networks.

Table Of Contents

Requirements

This guide assumes an Ethereum development environment has been set up, and a local blockchain (ganache or hardhat-evm) is running. Ganache is a third-party app which can be downloaded to run.

Primitive's contracts are built using the Hardhat, a framework for smart contract development. We interact with Web3 using the ethers.js library. Waffle is used for testing. And finally, Hardhat-deploy is used for managing and deploying smart contracts to live networks. While none of these tools must be used to be able to interact with the protocol, this guide and other guides may use the related tools.

Getting the Primitive Protocol Code

The core option related smart contract are on github here.