From 83befe2c2c77ff4e07bfbffbdcfa02cb86103492 Mon Sep 17 00:00:00 2001 From: Ian He <39037239+ianhe8x@users.noreply.github.com> Date: Wed, 22 May 2024 10:19:05 +1200 Subject: [PATCH] upgrade recent changes --- publish/mainnet.json | 78 +++++++++++++++++++------------------- publish/testnet.json | 78 +++++++++++++++++++------------------- scripts/deployContracts.ts | 4 +- scripts/upgrade.ts | 2 +- test/fixtureLoader.ts | 36 ++++++++++-------- 5 files changed, 102 insertions(+), 96 deletions(-) diff --git a/publish/mainnet.json b/publish/mainnet.json index bc6a9adf..88de0d0e 100644 --- a/publish/mainnet.json +++ b/publish/mainnet.json @@ -81,10 +81,10 @@ "lastUpdate": "Tue, 13 Feb 2024 09:10:08 GMT" }, "Staking": { - "innerAddress": "0xCA0FDf60DE7D7838a8b93ed980b4ecB5d431aCBc", + "innerAddress": "0x6872DdB8a141c7D5dC843Fe799C1E763Ce5DDB53", "address": "0x7A68b10EB116a8b71A9b6f77B32B47EB591B6Ded", - "bytecodeHash": "663a245dcb5ad80536cd8b196413491a96a290848ad12755254421f4ff16e581", - "lastUpdate": "Tue, 07 May 2024 03:09:15 GMT" + "bytecodeHash": "3d1ee8f210e6156fc0e721c764597c2d11cad16237abb1e1e4ccae82ff04369d", + "lastUpdate": "Tue, 21 May 2024 22:15:12 GMT" }, "StakingManager": { "innerAddress": "0xFA00B48a1b7b867FA21bBA14CADf9F971B2Ceb28", @@ -93,16 +93,16 @@ "lastUpdate": "Tue, 07 May 2024 03:09:29 GMT" }, "EraManager": { - "innerAddress": "0xe802a375a2E5AE2d36e4419cB0E7F0570DD3b8F9", + "innerAddress": "0x94A8E45E9D6dCA44A95BEc33E828B9E9257443D6", "address": "0xf80A8E45a13D2C116Aa8cFFEf3dcb6049cd8059e", - "bytecodeHash": "14943c90a30420756a9c848764c00b893ec7b62fa7bb8b53961288efbec9b824", - "lastUpdate": "Wed, 14 Feb 2024 02:38:56 GMT" + "bytecodeHash": "c8a68a5e74d562a7c371897476edb7e2bf3d6e9b6d86fc7641b097b042dea37b", + "lastUpdate": "Tue, 21 May 2024 22:09:11 GMT" }, "IndexerRegistry": { - "innerAddress": "0xE6e13dbaEFEF2Ff4Dbbc74a1EeC3B69B9B18DC96", + "innerAddress": "0x722cf7776Ee4aFf64CB7442Cab854854f10Bb19C", "address": "0xadED5DDFA892250018fE54DB8E8C6CAd45476DC9", - "bytecodeHash": "aa70df43e3a1877bcb55d7ddc6095e44c903aa8d5f51cb724962185b667307b4", - "lastUpdate": "Wed, 03 Apr 2024 22:42:34 GMT" + "bytecodeHash": "1672da0a47ed871d2388708e54efd8cd7f223d7882dd6727d7a9e73b23a91795", + "lastUpdate": "Tue, 21 May 2024 22:14:53 GMT" }, "ProjectRegistry": { "innerAddress": "0xB628D2B8802967732c4A83A52f673de36D53EE51", @@ -111,16 +111,16 @@ "lastUpdate": "Wed, 03 Apr 2024 22:42:57 GMT" }, "PlanManager": { - "innerAddress": "0x32695b2B7aFF2C72E7801A8FC3B8ccAc76498d2c", + "innerAddress": "0x1cdA4E7f07C32527630f372aB8243dB9B5bb3099", "address": "0xbF443a0474AE33C30c2A0dfbc608B0e374A59DcD", - "bytecodeHash": "db1abca98bd4371bf6bd7acfda7399b283d191d6752a5c2643f5e8e547b7729e", - "lastUpdate": "Wed, 14 Feb 2024 02:39:57 GMT" + "bytecodeHash": "6e77a9d1e2714e290c61aaabb832b26ca0057595ceb76d40ebd4c098dcedd174", + "lastUpdate": "Tue, 21 May 2024 22:08:40 GMT" }, "PurchaseOfferMarket": { - "innerAddress": "0xD9c9dc5c4d9ED9Aa89AF4abD0cD7a0c72FA22b53", + "innerAddress": "0x155EdAaFDf167aA0817A9d95ad5cB7E40dEC83eA", "address": "0x72E7333bEdf33dc70021519457f05B096e971f37", - "bytecodeHash": "6700efdf53f69e72790e63db82c2e9026fc5493a1db808be69f1419b5934e865", - "lastUpdate": "Wed, 14 Feb 2024 02:40:21 GMT" + "bytecodeHash": "6879999bef8870768a22ac78643286f5479ed6028019fb7c4e2aa22fd246f113", + "lastUpdate": "Tue, 21 May 2024 22:09:17 GMT" }, "ServiceAgreementRegistry": { "innerAddress": "0xe420f94aA7e8670f997aD67f2A36B08f5bc9364f", @@ -135,22 +135,22 @@ "lastUpdate": "Wed, 14 Feb 2024 02:40:50 GMT" }, "RewardsDistributor": { - "innerAddress": "0x894aF6891E52f0425EC57c355a56Cf240bb15F92", + "innerAddress": "0x7Ab2AaF3bc4fAaA9e5524244C1162B1d99B9431D", "address": "0x18AEC6c407235d446E52Aa243CD1A75421bb264e", - "bytecodeHash": "5f0ec4ef189840288a01e348aca2c721fbd5208e830dd512ed9ad6ecd64c46ff", - "lastUpdate": "Tue, 07 May 2024 03:09:53 GMT" + "bytecodeHash": "1e4a62766686f36e717bf8e75972d0d8dfe436597a1bfb4d6a309fc3331abe3f", + "lastUpdate": "Tue, 21 May 2024 22:14:59 GMT" }, "RewardsPool": { - "innerAddress": "0x81f22D788ED42F6d97809cB314079014a275DD71", + "innerAddress": "0xCa816760aE2d72AC31EB0890f152688BE148Fd31", "address": "0xd2b00e427e3FE06Be815C20039421308f0487d03", - "bytecodeHash": "16f4ccd30885479b353592702013a9875385476824e333054b6714dba791bd8d", - "lastUpdate": "Wed, 14 Feb 2024 02:41:18 GMT" + "bytecodeHash": "e5aad7783b0e5ca7ef172b0d57df79c0aab7f116b6ab0211e7ad83be30c77ec2", + "lastUpdate": "Tue, 21 May 2024 22:08:52 GMT" }, "RewardsStaking": { - "innerAddress": "0xfb5ceFE73Cfff517a35Fd00ABD1F628e2Aef9F3d", + "innerAddress": "0xc5C829C6be6Dcb81af1f9Ef65680a6DCD00AB55F", "address": "0x1c285c5513f2135f8AD12A930E6473dA47581BE8", - "bytecodeHash": "ba0b25deebb4f77bf140d5d3d6987a3df7b943c4f30afd9ad2654845dc1e119b", - "lastUpdate": "Wed, 03 Apr 2024 22:42:38 GMT" + "bytecodeHash": "d09589e100dd83e5200944c2ee776aa1b502299d55a16dd60b82606685762557", + "lastUpdate": "Tue, 21 May 2024 22:15:06 GMT" }, "RewardsHelper": { "innerAddress": "0x6A5E0CDD9695A954B52647145CA98152A1D840e1", @@ -159,22 +159,22 @@ "lastUpdate": "Wed, 14 Feb 2024 02:42:07 GMT" }, "StateChannel": { - "innerAddress": "0x03589d4439d4bc379f5C0FeD42C9419A9304FB4C", + "innerAddress": "0x3437371e67be18c05e370c08797365fcaD0Fcf32", "address": "0x6797Df373589dF2AA37FA353c4254FD7834B751A", - "bytecodeHash": "4de32eb6389933ca1abd5ffa4f6f7afc720974c5ee5659c0ee2d934c51b7e6d9", - "lastUpdate": "Tue, 07 May 2024 03:08:53 GMT" + "bytecodeHash": "577e7bb811e8185c2e9e73f56104ece2eb46846f41110165dac9c61eada232c4", + "lastUpdate": "Tue, 21 May 2024 22:09:23 GMT" }, "ConsumerHost": { - "innerAddress": "0x076E211806Cf624485f6eFbDCF70527a334149b7", + "innerAddress": "0x8EBbDC3e6400ED4584E1D095aDB62366600Dc2ac", "address": "0x1185FD5a8B1dcdea654790219eAfA87105F201C5", - "bytecodeHash": "603904b4ae8e5c50edff60c7affdd7084acfea16cf7a9f854048d710b0ec4155", - "lastUpdate": "Wed, 14 Feb 2024 02:42:57 GMT" + "bytecodeHash": "587e755977f0840b092458302753b869d9caa8bbc3039a162d84df86640b2e5a", + "lastUpdate": "Tue, 21 May 2024 22:09:43 GMT" }, "DisputeManager": { - "innerAddress": "0x5a4eAf6D1b6e196B53d78cf7bC9F97Fd1d50FF5D", + "innerAddress": "0xbec62e17BBF014c748ce2913f8F4108183566a07", "address": "0xd82a8f11645f6FEF2b863CEe19755bA22decD42a", - "bytecodeHash": "60467bb413dfdc4fc8ca85f70af49834a6c0fbe4e8743daafdf9c3c4d5f57176", - "lastUpdate": "Wed, 14 Feb 2024 02:43:20 GMT" + "bytecodeHash": "3d4f2062fcd9f6807b6bfaea7b0b61a202097b70724fc8661384e3fcf4f489e4", + "lastUpdate": "Tue, 21 May 2024 22:09:49 GMT" }, "ConsumerRegistry": { "innerAddress": "0x62A7338594a35075cd12aba67ba42c6cb091FB08", @@ -189,16 +189,16 @@ "lastUpdate": "Wed, 14 Feb 2024 02:44:01 GMT" }, "SQTRedeem": { - "innerAddress": "0xC5441B9bE96A4828c470814f6F9dc0492387EC52", + "innerAddress": "0x9d0Cd61e83D65Ef1cB1bF60591DE80FE7B388eE4", "address": "0x6bC17BaDE85AE02326db4123a339C370e6D06b35", - "bytecodeHash": "fe93463de735091579de9d3ebe7ade0afe8b11c6eb9fd30afd7fb01471f6ca48", - "lastUpdate": "Wed, 14 Feb 2024 02:44:25 GMT" + "bytecodeHash": "3a3cbaedd19d2c3170ec7b739c12b108098b8fe824fe87a73472b80245d7a1c2", + "lastUpdate": "Tue, 21 May 2024 22:09:56 GMT" }, "RewardsBooster": { - "innerAddress": "0x0e1d5a09f2449Eacaa3B9A5CE340873F36f4836b", + "innerAddress": "0x225Ff1b98725D24E449ab9B2cBF247FBb7d7e7EC", "address": "0x7F138D57A5e05b6FBF3bCAdDa9a1252354245464", - "bytecodeHash": "da9fd7024efd0fe8c6324b45ffb30d9504925ee7d39379e07aabc3d9e031c0ea", - "lastUpdate": "Wed, 03 Apr 2024 22:42:45 GMT" + "bytecodeHash": "cecb9005514e54c39a872b7916252e3af8cbb1240ddf318fd6620ec139dbf328", + "lastUpdate": "Tue, 21 May 2024 22:08:59 GMT" }, "StakingAllocation": { "innerAddress": "0xFD80c162B2b3D958EB16588582A93C6731b57874", diff --git a/publish/testnet.json b/publish/testnet.json index 14124b02..1be99b6a 100644 --- a/publish/testnet.json +++ b/publish/testnet.json @@ -81,10 +81,10 @@ "lastUpdate": "Thu, 18 Jan 2024 08:43:36 GMT" }, "Staking": { - "innerAddress": "0x45Cc8a7452B9891883Bb28B0C66cc4220b9c4B69", + "innerAddress": "0xe8DD3fe0FB9888E729739daF1e7e05578Ab0C6d0", "address": "0x520c2A23000D134780a90bd9dec533df434140a2", - "bytecodeHash": "d26ebebcd19b0e8f756471e4c31ce5cfc6330b15b83aa8dd739f306b09f91ce1", - "lastUpdate": "Wed, 01 May 2024 04:31:59 GMT" + "bytecodeHash": "3d1ee8f210e6156fc0e721c764597c2d11cad16237abb1e1e4ccae82ff04369d", + "lastUpdate": "Tue, 21 May 2024 22:11:46 GMT" }, "StakingManager": { "innerAddress": "0xcE63bf7849472b9A2269a77323aefAB41255c06C", @@ -93,16 +93,16 @@ "lastUpdate": "Wed, 01 May 2024 04:32:12 GMT" }, "EraManager": { - "innerAddress": "0xe21610af7bE44Be36c6964EB42Ed478922c4Df18", + "innerAddress": "0xA759196b440e6e46E662E1173c983Eb2A4f8f8Cd", "address": "0x6E98e462c864Fa2D9Cc165bc4bf4fD891Fc2b8b2", - "bytecodeHash": "14943c90a30420756a9c848764c00b893ec7b62fa7bb8b53961288efbec9b824", - "lastUpdate": "Fri, 09 Feb 2024 05:53:37 GMT" + "bytecodeHash": "c8a68a5e74d562a7c371897476edb7e2bf3d6e9b6d86fc7641b097b042dea37b", + "lastUpdate": "Tue, 21 May 2024 22:03:33 GMT" }, "IndexerRegistry": { - "innerAddress": "0xB47dc2C3B1aa93809B264ED0614Dc38e3999d9f5", + "innerAddress": "0x42b8330Eb925f1F6cbDa63b355322A36ce25115d", "address": "0x9b207b3ba85cE57c398d4ca07BA71a46C917EF1A", - "bytecodeHash": "aa70df43e3a1877bcb55d7ddc6095e44c903aa8d5f51cb724962185b667307b4", - "lastUpdate": "Thu, 28 Mar 2024 07:11:35 GMT" + "bytecodeHash": "1672da0a47ed871d2388708e54efd8cd7f223d7882dd6727d7a9e73b23a91795", + "lastUpdate": "Tue, 21 May 2024 22:11:11 GMT" }, "ProjectRegistry": { "innerAddress": "0x53b5Df226E16191664258c73EF8631Cd075E7D0b", @@ -111,16 +111,16 @@ "lastUpdate": "Mon, 25 Mar 2024 01:44:29 GMT" }, "PlanManager": { - "innerAddress": "0x21055A3d3F0Edf2c623dEB3dB37B0747e03dB5B2", + "innerAddress": "0xfA719F8f1ed171483264Bf27DDCeF57416aCECC8", "address": "0x61562768175432072cdD6C25De9ED74e24f1a458", - "bytecodeHash": "a77505a315df32cec2f97a8e26873cf7e716fead0b0e2406944440bebe8e5e40", - "lastUpdate": "Fri, 09 Feb 2024 05:51:08 GMT" + "bytecodeHash": "6e77a9d1e2714e290c61aaabb832b26ca0057595ceb76d40ebd4c098dcedd174", + "lastUpdate": "Tue, 21 May 2024 22:02:21 GMT" }, "PurchaseOfferMarket": { - "innerAddress": "0xa03eadC076e28f719A75d68e4ff1d07DaB6bC726", + "innerAddress": "0x8d8de913CdE20509DabaE1eF42AD3E295Fac4E08", "address": "0x60060511d0dfC7B3a6013B7E565aeC8F353639a9", - "bytecodeHash": "951028f71b5ac1d6a4b8b03e5aba97be7a9cea812f58a390399982ad970197d2", - "lastUpdate": "Fri, 09 Feb 2024 05:53:52 GMT" + "bytecodeHash": "6879999bef8870768a22ac78643286f5479ed6028019fb7c4e2aa22fd246f113", + "lastUpdate": "Tue, 21 May 2024 22:03:45 GMT" }, "ServiceAgreementRegistry": { "innerAddress": "0xa76612Fc5a21def88a94111131D1325740B661fc", @@ -129,22 +129,22 @@ "lastUpdate": "Fri, 09 Feb 2024 05:52:49 GMT" }, "RewardsDistributor": { - "innerAddress": "0x979DAdE3cAd7b843A1F30a09cf81f97F151A61D4", + "innerAddress": "0x5625e26c70bA1D9AD24b47A40E56d86801a66d8a", "address": "0x5c0d1F22C4D7aaF35Ade34CA7c7491dBB0A91Cb7", - "bytecodeHash": "3ef9c5b38940dffea34b442e6b7eda6bddb1f0f88c13f8fb6d225281c465996c", - "lastUpdate": "Wed, 01 May 2024 04:34:13 GMT" + "bytecodeHash": "1e4a62766686f36e717bf8e75972d0d8dfe436597a1bfb4d6a309fc3331abe3f", + "lastUpdate": "Tue, 21 May 2024 22:11:22 GMT" }, "RewardsPool": { - "innerAddress": "0x6fC7869eE2411863b810a8A4bc0Ca6e7d1a06244", + "innerAddress": "0x6C7F6Cd6A4295D74897ae19Ab01Ea04821979d80", "address": "0x15b64D7036667695Ee68D6619CEb162aEaFAdbA6", - "bytecodeHash": "16f4ccd30885479b353592702013a9875385476824e333054b6714dba791bd8d", - "lastUpdate": "Fri, 09 Feb 2024 05:52:10 GMT" + "bytecodeHash": "e5aad7783b0e5ca7ef172b0d57df79c0aab7f116b6ab0211e7ad83be30c77ec2", + "lastUpdate": "Tue, 21 May 2024 22:02:45 GMT" }, "RewardsStaking": { - "innerAddress": "0x04Cd739fE7E1a684f3c97F1EE09894c66F51a104", + "innerAddress": "0xD2453Ef535F0100F63aEDF372Ed76B9A79C2FA81", "address": "0xB64D73B96358855075576D66746D2a88e043CC1E", - "bytecodeHash": "973d6f56de547f460b966b06a0189163146471417c3d8d25e47217315fd78b26", - "lastUpdate": "Mon, 06 May 2024 21:47:28 GMT" + "bytecodeHash": "d09589e100dd83e5200944c2ee776aa1b502299d55a16dd60b82606685762557", + "lastUpdate": "Tue, 21 May 2024 22:11:34 GMT" }, "RewardsHelper": { "innerAddress": "0xa7eE3bFD854bd609D1485FE845d996EEDE87aF7B", @@ -153,22 +153,22 @@ "lastUpdate": "Fri, 09 Feb 2024 05:52:35 GMT" }, "StateChannel": { - "innerAddress": "0x649D78096760271884af5c501466Ff97095e065c", + "innerAddress": "0xFa627a11BC56515305a01450cADCa285efe2C774", "address": "0x8C3d312291CC666757daFbb6eD20874Ae573C895", - "bytecodeHash": "4de32eb6389933ca1abd5ffa4f6f7afc720974c5ee5659c0ee2d934c51b7e6d9", - "lastUpdate": "Tue, 07 May 2024 02:29:05 GMT" + "bytecodeHash": "577e7bb811e8185c2e9e73f56104ece2eb46846f41110165dac9c61eada232c4", + "lastUpdate": "Tue, 21 May 2024 22:03:57 GMT" }, "ConsumerHost": { - "innerAddress": "0x75a3f1acE851EF7A1f998063d65C10DC3AAd840a", + "innerAddress": "0xd3eD793797e0C8E08D57D875a41e17DFd50a732e", "address": "0xeD5fc5a4AD3e952291FE02B223b137C5d212266f", - "bytecodeHash": "603904b4ae8e5c50edff60c7affdd7084acfea16cf7a9f854048d710b0ec4155", - "lastUpdate": "Fri, 09 Feb 2024 05:54:21 GMT" + "bytecodeHash": "587e755977f0840b092458302753b869d9caa8bbc3039a162d84df86640b2e5a", + "lastUpdate": "Tue, 21 May 2024 22:04:09 GMT" }, "DisputeManager": { - "innerAddress": "0x9AEed230bdfc4d37EB84dF351CF863CF53fB179b", + "innerAddress": "0xEF9BB723F81f553C2b54A3EE6015aA6403981AEC", "address": "0x7c244A53E57aaBEfF7Fb93745AA8993DB307788d", - "bytecodeHash": "60467bb413dfdc4fc8ca85f70af49834a6c0fbe4e8743daafdf9c3c4d5f57176", - "lastUpdate": "Fri, 09 Feb 2024 05:54:31 GMT" + "bytecodeHash": "3d4f2062fcd9f6807b6bfaea7b0b61a202097b70724fc8661384e3fcf4f489e4", + "lastUpdate": "Tue, 21 May 2024 22:04:21 GMT" }, "ConsumerRegistry": { "innerAddress": "0xa64be2f2B4e69eA270cD9B93722f9BC7AD678C67", @@ -189,16 +189,16 @@ "lastUpdate": "Tue, 13 Feb 2024 04:16:15 GMT" }, "SQTRedeem": { - "innerAddress": "0x4d2a8006619AbeE3D6a10D240c964B78176cfB87", + "innerAddress": "0xa1C3f3672023786a77a5a02e0F2f60449af26259", "address": "0x7c2c254a7Ae5642Af32F17e46601019C089a90ff", - "bytecodeHash": "fe93463de735091579de9d3ebe7ade0afe8b11c6eb9fd30afd7fb01471f6ca48", - "lastUpdate": "Mon, 26 Feb 2024 06:59:47 GMT" + "bytecodeHash": "3a3cbaedd19d2c3170ec7b739c12b108098b8fe824fe87a73472b80245d7a1c2", + "lastUpdate": "Tue, 21 May 2024 22:04:33 GMT" }, "RewardsBooster": { - "innerAddress": "0x899D217264C8E56Cb956D40A7F262a16d70860e9", + "innerAddress": "0x94943B544661eca769aeFc05B086776A9a7A09Df", "address": "0x4f6A1045A56EeD1D2795b5f6F6713972B67C09C2", - "bytecodeHash": "da9fd7024efd0fe8c6324b45ffb30d9504925ee7d39379e07aabc3d9e031c0ea", - "lastUpdate": "Mon, 25 Mar 2024 01:44:04 GMT" + "bytecodeHash": "cecb9005514e54c39a872b7916252e3af8cbb1240ddf318fd6620ec139dbf328", + "lastUpdate": "Tue, 21 May 2024 22:03:09 GMT" }, "StakingAllocation": { "innerAddress": "0x6d987b33a149e44098A9096C57e74068882Ef6D6", diff --git a/scripts/deployContracts.ts b/scripts/deployContracts.ts index adce6e6b..d4dd5339 100644 --- a/scripts/deployContracts.ts +++ b/scripts/deployContracts.ts @@ -640,7 +640,7 @@ export async function upgradeContracts(configs: { checkOnly: boolean; implementationOnly: boolean; target: string; - matcher: string; + matcher?: string[]; network: SubqueryNetwork; }): Promise { const { deployment, confirms, checkOnly, implementationOnly, target, matcher } = configs; @@ -661,7 +661,7 @@ export async function upgradeContracts(configs: { const changed: (keyof typeof CONTRACTS)[] = []; for (const contract of Object.keys(UPGRADEBAL_CONTRACTS)) { - if (matcher && contract !== matcher) { + if (matcher && !matcher.includes(contract)) { continue; } const bytecodeHash = codeToHash(CONTRACTS[contract].bytecode); diff --git a/scripts/upgrade.ts b/scripts/upgrade.ts index 55219939..d7b08b38 100644 --- a/scripts/upgrade.ts +++ b/scripts/upgrade.ts @@ -21,7 +21,7 @@ const main = async () => { checkOnly, implementationOnly, target, - matcher, + matcher: matcher ? matcher.split(',') : undefined, network: name, }); diff --git a/test/fixtureLoader.ts b/test/fixtureLoader.ts index 9b048cbf..bf14c09f 100644 --- a/test/fixtureLoader.ts +++ b/test/fixtureLoader.ts @@ -166,25 +166,31 @@ export const loaders = { deploymentId = deploymentCid.toString(); } // update metadata + let projectId = id; if (id) { const tx = await sdk.projectRegistry.connect(author).updateProjectMetadata(id, metadataCid.toString()); await tx.wait(); - return; - } - const tx = await sdk.projectRegistry - .connect(author) - .createProject( - metadataCid.toString(), - cidToBytes32(deploymentMetadata.toString()), - cidToBytes32(deploymentId), - projectType + } else { + const tx = await sdk.projectRegistry + .connect(author) + .createProject( + metadataCid.toString(), + cidToBytes32(deploymentMetadata.toString()), + cidToBytes32(deploymentId), + projectType + ); + const receipt = await tx.wait(); + const evt = receipt.events.find( + (log) => log.topics[0] === utils.id('ProjectCreated(address,uint256,string,uint8,bytes32,bytes32)') ); - const receipt = await tx.wait(); - const evt = receipt.events.find( - (log) => log.topics[0] === utils.id('ProjectCreated(address,uint256,string,uint8,bytes32,bytes32)') - ); - const { projectId } = evt.args; - for (const { deploymentId, version } of restDeploy) { + projectId = evt.args.projectId; + } + for (const { deploymentId: _d, deployment, version } of restDeploy) { + let deploymentId = _d; + if (!deploymentId) { + const { cid: deploymentCid } = await ipfs.add(deployment, { pin: true }); + deploymentId = deploymentCid.toString(); + } const { cid } = await ipfs.add(JSON.stringify(version), { pin: true }); await sdk.projectRegistry .connect(author)