Skip to content

Commit

Permalink
Update SDK with royalty updates + test/production config separation (#70
Browse files Browse the repository at this point in the history
)

* ABI import and fix all compile errors

* Fixed all tests except dispute

* Separate test configs and production configs
  • Loading branch information
edisonz0718 authored Feb 18, 2024
1 parent 65212eb commit 6895294
Show file tree
Hide file tree
Showing 31 changed files with 1,017 additions and 687 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ compile_contracts:
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/RegistrationModule.sol -o packages/core-sdk/src/abi/json/tmp/RegistrationModule
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-module/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/licensing/UMLPolicyFrameworkManager.sol -o packages/core-sdk/src/abi/json/tmp/UMLPolicyFrameworkManager
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/PILPolicyFrameworkManager.sol -o packages/core-sdk/src/abi/json/tmp/PILPolicyFrameworkManager
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/tagging/TaggingModule.sol -o packages/core-sdk/src/abi/json/tmp/TaggingModule
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/ModuleRegistry.sol -o packages/core-sdk/src/abi/json/tmp/ModuleRegistry
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
cp packages/core-sdk/src/abi/json/tmp/Errors/Errors.abi packages/core-sdk/src/abi/json/Errors.json

Expand All @@ -22,12 +21,10 @@ compile_contracts:
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/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/UMLPolicyFrameworkManager/UMLPolicyFrameworkManager.abi)"' as const;' > packages/core-sdk/src/abi/json/UMLPolicyFrameworkManager.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/PILPolicyFrameworkManager/PILPolicyFrameworkManager.abi)"' as const;' > packages/core-sdk/src/abi/json/PILPolicyFrameworkManager.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/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/IIPAssetRegistry/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/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
61 changes: 44 additions & 17 deletions packages/core-sdk/src/abi/config.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,86 @@
import { getAddress } from "viem";
import * as dotenv from "dotenv";

import IERC1155ABI from "./json/IERC1155.abi";
import AccessControllerABI from "./json/AccessController.abi";
import DisputeModuleABI from "./json/DisputeModule.abi";
import IPAccountImplABI from "./json/IPAccountImpl.abi";
import IPAssetRegistryABI from "./json/IIPAssetRegistry.abi";
import LicensingModuleABI from "./json/LicensingModule.abi";
import UMLPolicyFrameworkManagerABI from "./json/UMLPolicyFrameworkManager.abi";
import PILPolicyFrameworkManagerABI from "./json/PILPolicyFrameworkManager.abi";
import RegistrationModuleABI from "./json/RegistrationModule.abi";
import TaggingModuleABI from "./json/TaggingModule.abi";
import ErrorsABI from "./json/Errors.abi";

if (typeof process !== "undefined") {
dotenv.config();
// Sepolia
/**
{
"main": {
"AccessController": "0x31dd83a3FebB5fAD7F7bc8D4E05B623461B74a02",
"AncestorsVaultLAP": "0x9Faa4E491a211bFa415d44554120B1b31b6f4e59",
"ArbitrationPolicySP": "0x75e181d5eb307eCccf8d3b4724109eca14719A75",
"DisputeModule": "0x11dAA3F573C4d6673BBE7f2D96B4C91073A0d55d",
"Governance": "0xa18252Aa11Ff1B20b89C10109050CC46A4067b22",
"IPAccountImpl": "0x7BBaB2BD68fd3990c8dA2c26334a6DF8Acc7E96E",
"IPAccountRegistry": "0x7184bAdAdf24dc261C7C27BceFF53d7A25a06846",
"IPAssetRegistry": "0xF59adB67B7CC87436A7CC41040A7dB24AE90aDB8",
"IPAssetRenderer": "0x986d8E96b30b688FCD84e9A5A757C3d4304B47b6",
"IPMetadataProvider": "0xfcD468A72F76e89F2Df517274063ef7210a32e2A",
"IPResolver": "0xF0920314Fb4C375cdEB5b15c4e77277aCf36E3D7",
"LicenseRegistry": "0x4D6a54B467332dF675cFa689cb294A4cB9122866",
"LicensingModule": "0x0C72b24067a15994f91D92Fd9bA23eB5ebcF8378",
"MockERC20": "0xd53C2A80D24F6B3Ff009E48CF88D3b482E8E1457",
"MockERC721": "0xD3719824a768c139AAa7C5eFc8BDb5D1d13A1564",
"MockTokenGatedHook": "0x2d3ED4354eD09B0E6aa252938aEF41920aB6FC40",
"ModuleRegistry": "0x17Ad1cD06d44ae5F5480A675A4D8BD8DAED40410",
"PILPolicyFrameworkManager": "0x49cF5C5523011F8B4A0489969096Eb68C571C197",
"RegistrationModule": "0x248c8CbF469ec7CB22Dc9914E569920b93d717a3",
"RoyaltyModule": "0x512bbF310452cC96E0E9818B0870EcA557b86d4D",
"RoyaltyPolicyLAP": "0x8404061350BA0CA85c4E733B0be78c5519679003",
"TaggingModule": "0xED445f1DeE74Cf470Aab47F4b63734653C4C9537"
}
}

*/
export const IPAccountABI = [...IPAccountImplABI, ...ErrorsABI];

export const IPAssetRegistryConfig = {
abi: IPAssetRegistryABI,
address: getAddress("0xF2c66aAd2287F3fa00C3461862612Eaf1FAAEcDb"),
address: getAddress("0xF59adB67B7CC87436A7CC41040A7dB24AE90aDB8"),
};

export const AccessControllerConfig = {
abi: [...AccessControllerABI, ...ErrorsABI],
address: getAddress("0x069AD174fb6285086b692AC9a6f328DCBcB94FC3"),
address: getAddress("0x31dd83a3FebB5fAD7F7bc8D4E05B623461B74a02"),
};

export const DisputeModuleConfig = {
abi: [...DisputeModuleABI, ...ErrorsABI],
address: getAddress("0x0B935d36516267fc2B4c902449b7D5Cfc2d5102A"),
address: getAddress("0x11dAA3F573C4d6673BBE7f2D96B4C91073A0d55d"),
};

export const LicenseRegistryConfig = {
abi: IERC1155ABI,
address: getAddress("0x051A0441918d7c393ba796dc6754c476324dAdEC"),
address: getAddress("0x4D6a54B467332dF675cFa689cb294A4cB9122866"),
};

export const LicensingModuleConfig = {
abi: [...LicensingModuleABI, ...ErrorsABI],
address: getAddress("0x911415eb87b732443e8FbAd8aC8890Bf73BAa8Ec"),
abi: LicensingModuleABI,
//abi: [...LicensingModuleABI, ...ErrorsABI],
address: getAddress("0x0C72b24067a15994f91D92Fd9bA23eB5ebcF8378"),
};

export const RegistrationModuleConfig = {
abi: [...RegistrationModuleABI, ...ErrorsABI],
address: getAddress("0x1Ad58168Ae7914C3e8aA8c6F5068CFb23490F27F"),
abi: RegistrationModuleABI,
//abi: [...RegistrationModuleABI, ...ErrorsABI],
address: getAddress("0x248c8CbF469ec7CB22Dc9914E569920b93d717a3"),
};

export const TaggingModuleConfig = {
abi: [...TaggingModuleABI, ...ErrorsABI],
address: getAddress("0x333BECf0FF68C02E4387005A89c30De885b8a38F"),
address: getAddress("0xED445f1DeE74Cf470Aab47F4b63734653C4C9537"),
};

export const UMLPolicyFrameworkManagerConfig = {
abi: [...UMLPolicyFrameworkManagerABI, ...ErrorsABI],
address: getAddress("0xae4De58808EB503E9C460C7A852c67C3152D5385"),
export const PILPolicyFrameworkManagerConfig = {
abi: PILPolicyFrameworkManagerABI,
//abi: [...PILPolicyFrameworkManagerABI, ...ErrorsABI],
address: getAddress("0x49cF5C5523011F8B4A0489969096Eb68C571C197"),
};
16 changes: 11 additions & 5 deletions packages/core-sdk/src/abi/json/AccessController.abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ export default [
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "ipAccountOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
Expand Down Expand Up @@ -40,27 +46,27 @@ export default [
inputs: [
{
internalType: "address",
name: "ipAccount_",
name: "ipAccount",
type: "address",
},
{
internalType: "address",
name: "signer_",
name: "signer",
type: "address",
},
{
internalType: "address",
name: "to_",
name: "to",
type: "address",
},
{
internalType: "bytes4",
name: "func_",
name: "func",
type: "bytes4",
},
{
internalType: "uint8",
name: "permission_",
name: "permission",
type: "uint8",
},
],
Expand Down
116 changes: 7 additions & 109 deletions packages/core-sdk/src/abi/json/DisputeModule.abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,6 @@ export default [
name: "DisputeCancelled",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint256",
name: "disputeId",
type: "uint256",
},
{
indexed: false,
internalType: "bool",
name: "decision",
type: "bool",
},
{
indexed: false,
internalType: "bytes",
name: "data",
type: "bytes",
},
],
name: "DisputeJudgementSet",
type: "event",
},
{
anonymous: false,
inputs: [
Expand Down Expand Up @@ -109,12 +84,12 @@ export default [
inputs: [
{
internalType: "uint256",
name: "_disputeId",
name: "disputeId",
type: "uint256",
},
{
internalType: "bytes",
name: "_data",
name: "data",
type: "bytes",
},
],
Expand All @@ -123,39 +98,26 @@ export default [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "name",
outputs: [
{
internalType: "string",
name: "",
type: "string",
},
],
stateMutability: "pure",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_targetIpId",
name: "targetIpId",
type: "address",
},
{
internalType: "string",
name: "_linkToDisputeEvidence",
name: "linkToDisputeEvidence",
type: "string",
},
{
internalType: "bytes32",
name: "_targetTag",
name: "targetTag",
type: "bytes32",
},
{
internalType: "bytes",
name: "_data",
name: "data",
type: "bytes",
},
],
Expand All @@ -174,7 +136,7 @@ export default [
inputs: [
{
internalType: "uint256",
name: "_disputeId",
name: "disputeId",
type: "uint256",
},
],
Expand All @@ -183,68 +145,4 @@ export default [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_disputeId",
type: "uint256",
},
{
internalType: "bool",
name: "_decision",
type: "bool",
},
{
internalType: "bytes",
name: "_data",
type: "bytes",
},
],
name: "setDisputeJudgement",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_arbitrationPolicy",
type: "address",
},
{
internalType: "bool",
name: "_allowed",
type: "bool",
},
],
name: "whitelistArbitrationPolicy",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_arbitrationPolicy",
type: "address",
},
{
internalType: "address",
name: "_arbPolicyRelayer",
type: "address",
},
{
internalType: "bool",
name: "_allowed",
type: "bool",
},
],
name: "whitelistArbitrationRelayer",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
Loading

0 comments on commit 6895294

Please sign in to comment.