diff --git a/src/abi/StoryEventDerivative.json b/src/abi/StoryEventDerivative.json new file mode 100644 index 0000000..e22e13e --- /dev/null +++ b/src/abi/StoryEventDerivative.json @@ -0,0 +1,748 @@ +{ + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "address", + "name": "_storyProtocolGateway", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "target", + "type": "address" + } + ], + "name": "AddressEmptyCode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "AddressInsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "FailedInnerCall", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyOperatorAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyOwnerAllowed", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "SafeERC20FailedOperation", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "nftContract", + "type": "address" + } + ], + "name": "CollectionCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "add", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "value", + "type": "bool" + } + ], + "name": "SetOperator", + "type": "event" + }, + { + "inputs": [], + "name": "SPG_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collectionAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "coreMetadataView", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "colectionName", + "type": "string" + }, + { + "internalType": "string", + "name": "colectionSymbol", + "type": "string" + } + ], + "name": "createCollection", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address payable", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "emergencyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ipAssetRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "licenseRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "licenseTemplate", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "licenseToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "licensingModule", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "components": [ + { + "internalType": "string", + "name": "ipMetadataURI", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "ipMetadataHash", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "nftMetadataURI", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "nftMetadataHash", + "type": "bytes32" + } + ], + "internalType": "struct IPMetadata", + "name": "ipMetadata", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "bool", + "name": "transferable", + "type": "bool" + }, + { + "internalType": "address", + "name": "royaltyPolicy", + "type": "address" + }, + { + "internalType": "uint256", + "name": "defaultMintingFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiration", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "commercialUse", + "type": "bool" + }, + { + "internalType": "bool", + "name": "commercialAttribution", + "type": "bool" + }, + { + "internalType": "address", + "name": "commercializerChecker", + "type": "address" + }, + { + "internalType": "bytes", + "name": "commercializerCheckerData", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "commercialRevShare", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "commercialRevCeiling", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "derivativesAllowed", + "type": "bool" + }, + { + "internalType": "bool", + "name": "derivativesAttribution", + "type": "bool" + }, + { + "internalType": "bool", + "name": "derivativesApproval", + "type": "bool" + }, + { + "internalType": "bool", + "name": "derivativesReciprocal", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "derivativeRevCeiling", + "type": "uint256" + }, + { + "internalType": "address", + "name": "currency", + "type": "address" + }, + { + "internalType": "string", + "name": "uri", + "type": "string" + } + ], + "internalType": "struct PILTerms", + "name": "terms", + "type": "tuple" + } + ], + "name": "mintAndRegisterIpAndAttach", + "outputs": [ + { + "internalType": "address", + "name": "ipId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "licenseTermsId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address[]", + "name": "parentIpIds", + "type": "address[]" + }, + { + "internalType": "address", + "name": "licenseTemplate", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "licenseTermsIds", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "royaltyContext", + "type": "bytes" + } + ], + "internalType": "struct MakeDerivative", + "name": "derivData", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "string", + "name": "ipMetadataURI", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "ipMetadataHash", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "nftMetadataURI", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "nftMetadataHash", + "type": "bytes32" + } + ], + "internalType": "struct IPMetadata", + "name": "ipMetadata", + "type": "tuple" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "mintAndRegisterIpAndMakeDerivative", + "outputs": [ + { + "internalType": "address", + "name": "ipId", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "operators", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address payable", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "royaltyModule", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setCollectionAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setCoreMetadataView", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setIpAssetRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setLicenseRegistry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setLicenseTemplate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setLicenseToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setLicensingModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxIpasset", + "type": "uint256" + } + ], + "name": "setMaxIpasset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_maxParents", + "type": "uint256" + } + ], + "name": "setMaxParents", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "_v", + "type": "bool" + } + ], + "name": "setOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "_newOwner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setRoyaltyModule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setStoryProtocolGateway", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userMintCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ] +} diff --git a/src/modules/story-event/story-event.consumer.ts b/src/modules/story-event/story-event.consumer.ts index a925aa5..7345fd9 100644 --- a/src/modules/story-event/story-event.consumer.ts +++ b/src/modules/story-event/story-event.consumer.ts @@ -9,6 +9,7 @@ import { import { createPublicClient, createWalletClient, http } from 'viem'; import { MasterWalletService } from '../user-wallet/master-wallet.service'; import { abi as storyEventAbi } from './../../abi/StoryEvent.json'; +import { abi as storyEventDerivativeAbi } from './../../abi/StoryEventDerivative.json'; import { IJob } from './interfaces/job.interface'; import { SubmissionStatus, SubmissionType } from './story-event.enum'; import { StoryEventGraphql } from './story-event.graphql'; @@ -198,6 +199,7 @@ export class StoryEventConsumer implements OnModuleInit { const args = [ [ data.ip_asset_ids, + '0x8bb1ade72e21090fc891e1d4b88ac5e57b27cb31', defaultPILTerms.licenseTermsIds, defaultPILTerms.royaltyContext, ], @@ -211,10 +213,10 @@ export class StoryEventConsumer implements OnModuleInit { ]; const address = - `${this.storyChain.contracts.story_event_contract}` as any; + `${this.storyChain.contracts.story_event_derivative_contract}` as any; const hash = await this.walletClient.writeContract({ - abi: storyEventAbi, + abi: storyEventDerivativeAbi, address, functionName: 'mintAndRegisterIpAndMakeDerivative', args,