@story-protocol/protocol-periphery v1.3.2
Story Proof-of-Creativity Periphery
Welcome to the Story PoC Periphery repository. This repository contains the peripheral smart contracts for the Story Proof-of-Creativity (PoC) Protocol. These contracts simplify developers’ work by allowing them to bundle multiple interactions with the PoC protocol - like registering an IP Asset and attaching License Terms to that IP Asset - into a single transaction.
For access to the core PoC contracts, please visit the protocol-core-v1 repository.
Documentation
Story PoC Periphery combines multiple common independent interactions with the Story PoC Protocol into a single transaction.
For example, this mintAndRegisterIpAndAttachPILTerms
is one of the functions that allows you to mint an NFT, register it as an IP Asset, attach License Terms, and setting Licensing Configuration all in one call.
function mintAndRegisterIpAndAttachPILTerms(
address spgNftContract,
address recipient,
WorkflowStructs.IPMetadata calldata ipMetadata,
WorkflowStructs.LicenseTermsData[] calldata licenseTermsData,
bool allowDuplicates
) external onlyCallerWithMinterRole(nftContract) returns (address ipId, uint256 tokenId, uint256 licenseTermsId)
Supported Workflows
For a list of currently supported workflows, check out the Workflows documentation.
Batching Calls
Batch calling functions is supported both natively and through the Multicall3
contract. For more information, check out the Multicall documentation.
Audit Reports
Audit reports are available in the ./audits directory.
Deployed Contracts
contracts are deployed on Story. The contract addresses can be found in deployment-1315.json (Story Aeneid Testnet) and deployment-1514.json (Story Homer Mainnet).
Quick Start
Prerequisites
Please install Foundry / Foundryup
Install dependencies
yarn # this installs packages
forge build # this builds
Verify upgrade storage layout (before scripts or tests)
forge clean
forge compile --build-info
Helper script to write an upgradeable contract with ERC7201
- Edit
script/foundry/utils/upgrades/ERC7201Helper.s.sol
- Change
string constant CONTRACT_NAME = "<the contract name>";
- Run the script to generate boilerplate code for storage handling and the namespace hash:
forge script script/utils/upgrades/ERC7201Helper.s.sol
- The log output is the boilerplate code, copy and paste in your contract
Testing
forge test -vvvv
Coverage
forge coverage
Working with a local network
Foundry comes with local network anvil baked in, and allows us to deploy to our local network for quick testing locally.
To start a local network run:
make anvil
This will spin up a local blockchain with a determined private key, so you can use the same private key each time.
Code Style
We employed solhint to check code style. To check code style with solhint run:
make lint
To re-format code with prettier run:
make format
Security
We use slither, a popular security framework from Trail of Bits. To use slither, you'll first need to install python and install slither.
Then, you can run:
make slither
And get your slither output.
Contributing
Please see our contribution guidelines.
Licensing
MIT License, details see: LICENSE.