Protocol
Guides
Setting up Portfolio

Setting up Portfolio

There are several ways to set up Portfolio into your project, depending on the tools and languages you're using.

Using our template repository

If you're starting a Solidity project from scratch, we recommend using our Forge-based template repository (opens in a new tab), as it contains all the necessary dependencies and configuration to get you started, including a local setup and working examples.

You can get started here (opens in a new tab).

Installing as a submodule

If you're using Forge (opens in a new tab), you might want to install Portfolio as a submodule:

bash
forge install primitivefinance/portfolio

Note that in this case you'll still need to either deploy Portfolio contracts locally (check out this example (opens in a new tab)) or fork a network (opens in a new tab) to interact with the deployed contracts.

Using our npm package

If you're working with Truffle, Hardhat or simply using JavaScript / TypeScript in your project, you can use our npm package:

bash
# Using yarn
yarn add @primitivexyz/portfolio
 
# Using npm
npm i @primitivexyz/portfolio
 
# Using pnpm
pnpm add @primitivexyz/portfolio

In this case you'll also need to either deploy Portfolio contracts locally or interact with deploy contracts on a forked network.

Manual installation

Alternatively, a manual installation is also possible, either by copy-pasting the interfaces from the Portfolio repository (opens in a new tab) or directly by importing them, for example in Remix:

import "https://github.com/primitivefinance/portfolio/blob/main/contracts/interfaces/IPortfolio.sol";

© 2023 Primitive™