The Primitive Protocol is currently using Uniswap for all swapping related operations of the Primitive option tokens. Setting up the full testing environment, Uniswap included, allows for easier option token related swapping and trading.

Table Of Contents

Previous Guide

How to Setup the Primitive Protocol Locally

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.

Since this guide is describing how to set up Uniswap V2 locally, we require both their core and periphery contracts code.

Getting the Uniswap V2 Protocol Code

The core option related smart contract are on github here.

These contracts are also in an npm package here.

You can run either command to get the code:

yarn add @uniswap/v2-core
yarn add @uniswap/v2-periphery

Getting the Primitive Protocol Connector Contracts Code

Primitive uses a connector contract to bridge Uniswap V2 functions with Primitive V1 functions.