Quick Start

How to start a vault with option strategy

Here we walk you through an example of how do we start a vault with short otoken strategy:

1. Cloning the Perp Vault Templates repository

git clone https://github.com/opynfinance/perp-vault-templates
cd perp-vault-templates

2. Install Dependencies and test build

npm install
# test compile
npx hardhat compile

3. Create env and secret files

Create an .env file from .evn.example, which should look like:


Also create a .secret file in the root directory containing the mnemonic that you want to use to deploy the contracts and be the owner of the vault in this tutorial. We encourage you to use the same mnemonic you have in your metamask wallet just for easier operation.

4. Create a Custom Action

Create a MyAction.sol file in in any folder you want under contracts. In this example, let's copy everything from example-actions/ShortOToken.sol to get started.

After copying ShortOToken.sol we would need to remove something functions that's not supported on Kovan. In this case, we remove everything related to the Gnosis Easy Auction. We will remove the following functions:

  • mintAndBidInAuction

  • mintAndStartAuction

Also you can remove the AuctionUtils dependency. which will also ask you to remove the _easyAuction parameter in the constructor, and the _initAuction called in the constructor.

Also, just to make it easier to test, let's set the MIN_COMMIT_PERIOD in RollOverBase.sol to 0.

Lastly, make sure you rename the contract from ShortOToken to MyAction

5. Run deployment script

npx hardhat run scripts/deploy-example-kovan.ts --network kovan

This command should automatically deploy a new Vault, an Action, a ETHProxy on Kovan and get them verified on Etherscan!

6. Next step

To learn more about how to run a vault as a manager, go to the Managing a Vault chapter for more detail on this example.