Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPG Initialization #161

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[submodule "packages/core-sdk/protocol-contracts"]
path = packages/core-sdk/protocol-contracts
[submodule "packages/core-sdk/protocol-periphery-contracts"]
path = packages/core-sdk/protocol-periphery-contracts
url = https://github.com/storyprotocol/protocol-periphery-v1
branch = release-v1.x.x
[submodule "packages/core-sdk/protocol-core-contracts"]
path = packages/core-sdk/protocol-core-contracts
url = https://github.com/storyprotocol/protocol-core-v1
branch = main
branch = release-v1.x.x
49 changes: 24 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
.PHONY: compile_contracts

compile_contracts:
git submodule add -b main --force https://github.com/storyprotocol/protocol-core-v1 packages/core-sdk/protocol-contracts
rm -rf packages/core-sdk/src/abi/json/tmp

git submodule add -b release-v1.x.x --force https://github.com/storyprotocol/protocol-core-v1 packages/core-sdk/protocol-core-contracts
git submodule add -b release-v1.x.x --force https://github.com/storyprotocol/protocol-periphery-v1 packages/core-sdk/protocol-periphery-contracts
git submodule update --remote --merge
cd packages/core-sdk/protocol-contracts && yarn install

solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/IPAccountImpl.sol -o packages/core-sdk/src/abi/json/tmp/IPAccountImpl
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/access/AccessController.sol -o packages/core-sdk/src/abi/json/tmp/AccessController
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/dispute/DisputeModule.sol -o packages/core-sdk/src/abi/json/tmp/DisputeModule
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/licensing/LicensingModule.sol -o packages/core-sdk/src/abi/json/tmp/LicensingModule
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/royalty/policies/IpRoyaltyVault.sol -o packages/core-sdk/src/abi/json/tmp/Royalty
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/interfaces/registries/IIPAssetRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IIPAssetRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/registries/LicenseRegistry.sol -o packages/core-sdk/src/abi/json/tmp/LicenseRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/registries/IPAssetRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IPAssetRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/licensing/PILicenseTemplate.sol -o packages/core-sdk/src/abi/json/tmp/PILicenseTemplate
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/lib/Errors.sol -o packages/core-sdk/src/abi/json/tmp/Errors
cd packages/core-sdk/protocol-core-contracts && yarn install

solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/IPAccountImpl.sol -o packages/core-sdk/src/abi/json/tmp/IPAccountImpl
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/access/AccessController.sol -o packages/core-sdk/src/abi/json/tmp/AccessController
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/modules/dispute/DisputeModule.sol -o packages/core-sdk/src/abi/json/tmp/DisputeModule
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/modules/licensing/LicensingModule.sol -o packages/core-sdk/src/abi/json/tmp/LicensingModule
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/modules/royalty/policies/IpRoyaltyVault.sol -o packages/core-sdk/src/abi/json/tmp/Royalty
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/interfaces/registries/IIPAssetRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IIPAssetRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/registries/LicenseRegistry.sol -o packages/core-sdk/src/abi/json/tmp/LicenseRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/registries/IPAssetRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IPAssetRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/modules/licensing/PILicenseTemplate.sol -o packages/core-sdk/src/abi/json/tmp/PILicenseTemplate
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-core-contracts --include-path packages/core-sdk/protocol-core-contracts/node_modules/ --abi packages/core-sdk/protocol-core-contracts/contracts/lib/Errors.sol -o packages/core-sdk/src/abi/json/tmp/Errors
cp packages/core-sdk/src/abi/json/tmp/Errors/Errors.abi packages/core-sdk/src/abi/json/Errors.json

echo 'export default '"$$(jq '.' packages/core-sdk/src/abi/json/Errors.json)"' as const;' > packages/core-sdk/src/abi/json/Errors.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/IPAccountImpl/IPAccountImpl.abi)"' as const;' > packages/core-sdk/src/abi/json/IPAccountImpl.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/DisputeModule/DisputeModule.abi)"' as const;' > packages/core-sdk/src/abi/json/DisputeModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicensingModule/LicensingModule.abi)"' as const;' > packages/core-sdk/src/abi/json/LicensingModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/Royalty/IpRoyaltyVault.abi)"' as const;' > packages/core-sdk/src/abi/json/IpRoyaltyVault.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/Royalty/IRoyaltyPolicyLAP.abi)"' as const;' > packages/core-sdk/src/abi/json/IRoyaltyPolicyLAP.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicensingModule/IRoyaltyModule.abi)"' as const;' > packages/core-sdk/src/abi/json/IRoyaltyModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/IPAssetRegistry/IIPAssetRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/IIPAssetRegistry.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicenseRegistry/LicenseRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/PILicenseTemplate/IPILicenseTemplate.abi)"' as const;' > packages/core-sdk/src/abi/json/IPILicenseTemplate.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicensingModule/LicensingModule.abi)"' as const;' > packages/core-sdk/src/abi/json/LicensingModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicensingModule/ILicenseToken.abi)"' as const;' > packages/core-sdk/src/abi/json/ILicenseToken.abi.ts
cd packages/core-sdk/protocol-periphery-contracts && yarn install

solc @storyprotocol/core/=node_modules/@story-protocol/protocol-core/contracts/ --pretty-json --base-path packages/core-sdk/protocol-periphery-contracts --include-path packages/core-sdk/protocol-periphery-contracts/node_modules/ --abi packages/core-sdk/protocol-periphery-contracts/contracts/StoryProtocolGateway.sol -o packages/core-sdk/src/abi/json/tmp/StoryProtocolGateway
solc @storyprotocol/core/=node_modules/@story-protocol/protocol-core/contracts/ --pretty-json --base-path packages/core-sdk/protocol-periphery-contracts --include-path packages/core-sdk/protocol-periphery-contracts/node_modules/ --abi packages/core-sdk/protocol-periphery-contracts/contracts/SPGNFT.sol -o packages/core-sdk/src/abi/json/tmp/SPGNFT

rm -rf packages/core-sdk/src/abi/json/tmp
rm -rf packages/core-sdk/protocol-contracts
rm -rf packages/core-sdk/protocol-core-contracts
rm -rf packages/core-sdk/protocol-periphery-contracts
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ In your testing environment:

- Run `yalc update` to pull the latest changes.

## Steps to pull and compile latest smart contract ABIs (Currently pulls from the protocol-contracts `dev` branch)
## Steps to pull and compile latest Protocol Core & Periphery v1 Smart Contract ABIs (Currently pulls from the protocol-core-v1 and protocol-periphery-v1 `release-v1.x.x` branch)

Must have `solc` installed (https://docs.soliditylang.org/en/v0.8.9/installing-solidity.html)
Must have `solc` installed (https://docs.soliditylang.org/en/v0.8.23/installing-solidity.html)

- run `make compile_contracts`

Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@story-protocol/core-sdk",
"version": "1.0.0-rc.6",
"version": "1.0.0-rc.7",
"description": "Story Protocol Core SDK",
"main": "dist/story-protocol-core-sdk.cjs.js",
"module": "dist/story-protocol-core-sdk.esm.js",
Expand Down
Loading
Loading