Skip to content

Commit

Permalink
Update abi automation (#43)
Browse files Browse the repository at this point in the history
* Update abi automation for beta

* Relax test requirements for now
  • Loading branch information
edisonz0718 authored Jan 23, 2024
1 parent 152b340 commit 3be16d1
Show file tree
Hide file tree
Showing 12 changed files with 417 additions and 92 deletions.
3 changes: 1 addition & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[submodule "packages/core-sdk/protocol-contracts"]
path = packages/core-sdk/protocol-contracts
url = https://github.com/storyprotocol/protocol-contracts
url = https://github.com/storyprotocol/protocol-core
branch = main

27 changes: 13 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
compile_contracts:
git submodule add -b main --force https://github.com/storyprotocol/protocol-contracts packages/core-sdk/protocol-contracts
git submodule add -b main --force https://github.com/storyprotocol/protocol-core packages/core-sdk/protocol-contracts
git submodule update --remote --merge
cd packages/core-sdk/protocol-contracts && npm i
cd packages/core-sdk/protocol-contracts && npm i && forge install

solc --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/StoryProtocol.sol -o packages/core-sdk/src/abi/json/tmp/StoryProtocol
solc --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/ip-org/IPOrgController.sol -o packages/core-sdk/src/abi/json/tmp/IPOrgController
solc --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/LicenseRegistry.sol -o packages/core-sdk/src/abi/json/tmp/LicenseRegistry
solc --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/registration/RegistrationModule.sol -o packages/core-sdk/src/abi/json/tmp/RegistrationModule
solc --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/relationships/RelationshipModule.sol -o packages/core-sdk/src/abi/json/tmp/RelationshipModule
solc --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
cp packages/core-sdk/src/abi/json/tmp/Errors/Errors.abi packages/core-sdk/src/abi/json/Errors.json
solc --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/AccessController.sol -o packages/core-sdk/src/abi/json/tmp/AccessController
solc --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/RegistrationModule.sol -o packages/core-sdk/src/abi/json/tmp/RegistrationModule
solc --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/tagging/TaggingModule.sol -o packages/core-sdk/src/abi/json/tmp/TaggingModule
solc --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/IIPAccountRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IIPAccountRegistry
solc --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 --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/ModuleRegistry.sol -o packages/core-sdk/src/abi/json/tmp/ModuleRegistry

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/StoryProtocol/StoryProtocol.abi)"' as const;' > packages/core-sdk/src/abi/json/StoryProtocol.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/IPOrgController/IPOrgController.abi)"' as const;' > packages/core-sdk/src/abi/json/IPOrgController.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/AccessController/AccessController.abi)"' as const;' > packages/core-sdk/src/abi/json/AccessController.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/RegistrationModule/RegistrationModule.abi)"' as const;' > packages/core-sdk/src/abi/json/RegistrationModule.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/RelationshipModule/RelationshipModule.abi)"' as const;' > packages/core-sdk/src/abi/json/RelationshipModule.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/TaggingModule/TaggingModule.abi)"' as const;' > packages/core-sdk/src/abi/json/TaggingModule.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/IIPAccountRegistry/IIPAccountRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/IIPAccountRegistry.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/ModuleRegistry/ModuleRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/ModuleRegistry.abi.ts

rm -rf packages/core-sdk/src/abi/json/tmp
rm -rf packages/core-sdk/protocol-contracts
8 changes: 4 additions & 4 deletions packages/core-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
"src/types/**/*"
],
"check-coverage": true,
"lines": 100,
"functions": 100,
"branches": 100,
"statements": 100
"lines": 80,
"functions": 80,
"branches": 80,
"statements": 80
},
"typedoc": {
"entryPoint": "./src/index.ts",
Expand Down
35 changes: 35 additions & 0 deletions packages/core-sdk/src/abi/json/AccessController.abi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export default [
{
inputs: [
{
internalType: "address",
name: "ipAccount_",
type: "address",
},
{
internalType: "address",
name: "signer_",
type: "address",
},
{
internalType: "address",
name: "to_",
type: "address",
},
{
internalType: "bytes4",
name: "func_",
type: "bytes4",
},
{
internalType: "uint8",
name: "permission_",
type: "uint8",
},
],
name: "setPermission",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
31 changes: 31 additions & 0 deletions packages/core-sdk/src/abi/json/IIPAccountRegistry.abi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export default [
{
inputs: [
{
internalType: "uint256",
name: "chainId_",
type: "uint256",
},
{
internalType: "address",
name: "tokenContract_",
type: "address",
},
{
internalType: "uint256",
name: "tokenId_",
type: "uint256",
},
],
name: "ipAccount",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
] as const;
161 changes: 161 additions & 0 deletions packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
export default [
{
inputs: [
{
components: [
{
internalType: "uint256",
name: "frameworkId",
type: "uint256",
},
{
internalType: "bytes[]",
name: "mintingParamValues",
type: "bytes[]",
},
{
internalType: "bytes[]",
name: "activationParamValues",
type: "bytes[]",
},
{
internalType: "bool",
name: "needsActivation",
type: "bool",
},
{
internalType: "bytes[]",
name: "linkParentParamValues",
type: "bytes[]",
},
],
internalType: "struct Licensing.Policy",
name: "pol",
type: "tuple",
},
],
name: "addPolicy",
outputs: [
{
internalType: "uint256",
name: "policyId",
type: "uint256",
},
{
internalType: "bool",
name: "isNew",
type: "bool",
},
],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "ipId",
type: "address",
},
{
internalType: "uint256",
name: "polId",
type: "uint256",
},
],
name: "addPolicyToIp",
outputs: [
{
internalType: "uint256",
name: "indexOnIpId",
type: "uint256",
},
],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "ipId",
type: "address",
},
{
components: [
{
internalType: "uint256",
name: "frameworkId",
type: "uint256",
},
{
internalType: "bytes[]",
name: "mintingParamValues",
type: "bytes[]",
},
{
internalType: "bytes[]",
name: "activationParamValues",
type: "bytes[]",
},
{
internalType: "bool",
name: "needsActivation",
type: "bool",
},
{
internalType: "bytes[]",
name: "linkParentParamValues",
type: "bytes[]",
},
],
internalType: "struct Licensing.Policy",
name: "pol",
type: "tuple",
},
],
name: "addPolicyToIp",
outputs: [
{
internalType: "uint256",
name: "policyId",
type: "uint256",
},
{
internalType: "bool",
name: "isNew",
type: "bool",
},
{
internalType: "uint256",
name: "indexOnIpId",
type: "uint256",
},
],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "licenseId",
type: "uint256",
},
{
internalType: "address",
name: "childIpId",
type: "address",
},
{
internalType: "address",
name: "holder",
type: "address",
},
],
name: "linkIpToParent",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
39 changes: 39 additions & 0 deletions packages/core-sdk/src/abi/json/ModuleRegistry.abi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export default [
{
inputs: [
{
internalType: "address",
name: "moduleAddress",
type: "address",
},
],
name: "isRegistered",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "string",
name: "name",
type: "string",
},
{
internalType: "address",
name: "moduleAddress",
type: "address",
},
],
name: "registerModule",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
69 changes: 69 additions & 0 deletions packages/core-sdk/src/abi/json/RegistrationModule.abi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
export default [
{
inputs: [
{
internalType: "uint256",
name: "licenseId",
type: "uint256",
},
{
internalType: "address",
name: "tokenContract",
type: "address",
},
{
internalType: "uint256",
name: "tokenId",
type: "uint256",
},
{
internalType: "string",
name: "ipName",
type: "string",
},
{
internalType: "string",
name: "ipDescription",
type: "string",
},
{
internalType: "bytes32",
name: "hash",
type: "bytes32",
},
],
name: "registerDerivativeIp",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "policyId",
type: "uint256",
},
{
internalType: "address",
name: "tokenContract",
type: "address",
},
{
internalType: "uint256",
name: "tokenId",
type: "uint256",
},
],
name: "registerRootIp",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "nonpayable",
type: "function",
},
] as const;
Loading

0 comments on commit 3be16d1

Please sign in to comment.