Skip to content

Commit

Permalink
update to v1.2.3 periphery release
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-tucker committed Oct 1, 2024
1 parent 45aa440 commit 4655c2c
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 869 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ docs/

.idea/
node_modules/
yarn.lock

.vscode
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"@openzeppelin/contracts": "5.0.1",
"@openzeppelin/contracts-upgradeable": "5.0.1",
"@story-protocol/protocol-core": "github:storyprotocol/protocol-core-v1#v1.2.1",
"@story-protocol/protocol-periphery": "github:storyprotocol/protocol-periphery-v1#v1.2.1"
"@story-protocol/protocol-periphery": "github:storyprotocol/protocol-periphery-v1#v1.2.3"
}
}
16 changes: 8 additions & 8 deletions src/IPARegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
pragma solidity ^0.8.23;

import { IPAssetRegistry } from "@storyprotocol/core/registries/IPAssetRegistry.sol";
import { StoryProtocolGateway } from "@storyprotocol/periphery/StoryProtocolGateway.sol";
import { IStoryProtocolGateway as ISPG } from "@storyprotocol/periphery/interfaces/IStoryProtocolGateway.sol";
import { RegistrationWorkflows } from "@storyprotocol/periphery/workflows/RegistrationWorkflows.sol";
import { WorkflowStructs } from "@storyprotocol/periphery/lib/WorkflowStructs.sol";
import { ISPGNFT } from "@storyprotocol/periphery/interfaces/ISPGNFT.sol";

import { SimpleNFT } from "./SimpleNFT.sol";

/// @notice Register an NFT as an IP Account.
contract IPARegistrar {
IPAssetRegistry public immutable IP_ASSET_REGISTRY;
StoryProtocolGateway public immutable SPG;
RegistrationWorkflows public immutable REGISTRATION_WORKFLOWS;
SimpleNFT public immutable SIMPLE_NFT;
ISPGNFT public immutable SPG_NFT;

constructor(address ipAssetRegistry, address storyProtocolGateway) {
constructor(address ipAssetRegistry, address registrationWorkflows) {
IP_ASSET_REGISTRY = IPAssetRegistry(ipAssetRegistry);
SPG = StoryProtocolGateway(storyProtocolGateway);
REGISTRATION_WORKFLOWS = RegistrationWorkflows(registrationWorkflows);
// Create a new Simple NFT collection
SIMPLE_NFT = new SimpleNFT("Simple IP NFT", "SIM");
// Create a new NFT collection via SPG
SPG_NFT = ISPGNFT(
SPG.createCollection(
REGISTRATION_WORKFLOWS.createCollection(
ISPGNFT.InitParams({
name: "Test Collection",
symbol: "TEST",
Expand Down Expand Up @@ -50,10 +50,10 @@ contract IPARegistrar {
/// @notice Mint an IP NFT and register it as an IP Account via Story Protocol Gateway (periphery).
/// @dev Requires the collection to be created via SPG (createCollection).
function spgMintIp() external returns (address ipId, uint256 tokenId) {
(ipId, tokenId) = SPG.mintAndRegisterIp(
(ipId, tokenId) = REGISTRATION_WORKFLOWS.mintAndRegisterIp(
address(SPG_NFT),
msg.sender,
ISPG.IPMetadata({
WorkflowStructs.IPMetadata({
ipMetadataURI: "https://ipfs.io/ipfs/QmZHfQdFA2cb3ASdmeGS5K6rZjz65osUddYMURDx21bT73",
ipMetadataHash: keccak256(
abi.encodePacked(
Expand Down
1 change: 1 addition & 0 deletions test/IPALicenseTerms.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LicenseRegistry } from "@storyprotocol/core/registries/LicenseRegistry.
import { IPALicenseTerms } from "../src/IPALicenseTerms.sol";
import { SimpleNFT } from "../src/SimpleNFT.sol";

// Run this test: forge test --fork-url https://testnet.storyrpc.io/ --match-path test/IPALicenseTerms.t.sol
contract IPALicenseTermsTest is Test {
address internal alice = address(0xa11ce);

Expand Down
1 change: 1 addition & 0 deletions test/IPALicenseToken.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IPAssetRegistry } from "@storyprotocol/core/registries/IPAssetRegistry.
import { IPALicenseToken } from "../src/IPALicenseToken.sol";
import { SimpleNFT } from "../src/SimpleNFT.sol";

// Run this test: forge test --fork-url https://testnet.storyrpc.io/ --match-path test/IPALicenseToken.t.sol
contract IPALicenseTokenTest is Test {
address internal alice = address(0xa11ce);
address internal bob = address(0xb0b);
Expand Down
7 changes: 4 additions & 3 deletions test/IPARegistrar.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import { ISPGNFT } from "@storyprotocol/periphery/interfaces/ISPGNFT.sol";
import { IPARegistrar } from "../src/IPARegistrar.sol";
import { SimpleNFT } from "../src/SimpleNFT.sol";

// Run this test: forge test --fork-url https://testnet.storyrpc.io/ --match-path test/IPARegistrar.t.sol
contract IPARegistrarTest is Test {
address internal alice = address(0xa11ce);

// For addresses, see https://docs.storyprotocol.xyz/docs/deployed-smart-contracts
// Protocol Core - IPAssetRegistry
address internal ipAssetRegistryAddr = 0x1a9d0d28a0422F26D31Be72Edc6f13ea4371E11B;
// Protocol Periphery - SPG
address internal storyProtocolGatewayAddr = 0xAceb5E631d743AF76aF69414eC8D356c13435E59;
// Protocol Periphery - RegistrationWorkflows
address internal registrationWorkflowsAddr = 0x601C24bFA5Ae435162A5dC3cd166280C471d16c8;

IPAssetRegistry public ipAssetRegistry;
ISPGNFT public spgNft;
Expand All @@ -25,7 +26,7 @@ contract IPARegistrarTest is Test {

function setUp() public {
ipAssetRegistry = IPAssetRegistry(ipAssetRegistryAddr);
ipaRegistrar = new IPARegistrar(ipAssetRegistryAddr, storyProtocolGatewayAddr);
ipaRegistrar = new IPARegistrar(ipAssetRegistryAddr, registrationWorkflowsAddr);
simpleNft = SimpleNFT(ipaRegistrar.SIMPLE_NFT());
spgNft = ISPGNFT(ipaRegistrar.SPG_NFT());

Expand Down
1 change: 1 addition & 0 deletions test/IPARemix.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { LicenseRegistry } from "@storyprotocol/core/registries/LicenseRegistry.
import { IPALicenseToken } from "../src/IPALicenseToken.sol";
import { SimpleNFT } from "../src/SimpleNFT.sol";

// Run this test: forge test --fork-url https://testnet.storyrpc.io/ --match-path test/IPARemix.t.sol
contract IPARemixTest is Test {
address internal alice = address(0xa11ce);
address internal bob = address(0xb0b);
Expand Down
Loading

0 comments on commit 4655c2c

Please sign in to comment.