Smart Contracts
Setup
Set up your development environment for Story Protocol smart contracts
In this guide, we will show you how to setup the Story smart contract development environment in just a few minutes.
Prerequisites
Creating a Project
- Run
foundryup
to automatically install the latest stable version of the precompiled binaries: forge, cast, anvil, and chisel - Run the following command in a new directory:
forge init
. This will create afoundry.toml
and example project files in the project root. By default, forge init will also initialize a new git repository. - Initialize a new yarn project:
yarn init
. Alternatively, you can usenpm init
orpnpm init
. - Open up your
foundry.toml
file and replace it with this:
- Remove the example contract files:
rm src/Counter.sol script/Counter.s.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.
Additionally, for working with Foundry’s test kit, we also recommend adding the following devDependencies
:
Now we are ready to build a simple test registration contract!