Setup Your Own Project

In this guide, we will show you how to setup the Story Protocol smart contract development environment in just a few minutes


Creating a Project

  1. Run the following in a new directory of your choice: yarn init
  2. Set up foundry using the following command: forge init --force
  3. Once done, do some cleaning up on the dependency management side. Remove those conflicting with forge by running the following: rm -rf lib/ .github/
  4. Remove the placeholder test contracts: rm src/Counter.sol test/Counter.t.sol

Installing Dependencies

Now, we are ready to start installing our dependencies. To incorporate the Story Protocol core and periphery modules, run the following to have them added to your package.json. We will also install openzeppelin and erc6551 as a dependency for the contract and test.

# note: you can run them one-by-one, or all at once
yarn add @story-protocol/protocol-core@
yarn add @story-protocol/protocol-periphery@
yarn add @openzeppelin/contracts
yarn add @openzeppelin/contracts-upgradeable
yarn add erc6551

Additionally, for working with Foundry's test kit, we also recommend adding the following devDependencies:

yarn add -D
yarn add -D github:foundry-rs/forge-std#v1.7.6

Run yarn. Then, create a file in the root folder named remappings.txt and paste the following:


Now we are ready to build a simple test registration contract.