|
1 | | -// NOTE: The IexecERC20Facet__factory has been removed. |
2 | | -// Remember to manually remove the corresponding facet - contract address is: |
3 | | -// 0xB0152eC6f48E64a92B66D4736aFA1b02d8D45169 |
| 1 | +// SPDX-FileCopyrightText: 2025 IEXEC BLOCKCHAIN TECH <[email protected]> |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +import { |
| 5 | + IexecAccessorsABILegacyFacet__factory, |
| 6 | + IexecCategoryManagerFacet__factory, |
| 7 | + IexecConfigurationExtraFacet__factory, |
| 8 | + IexecConfigurationFacet__factory, |
| 9 | + IexecEscrowTokenFacet__factory, |
| 10 | + IexecOrderManagementFacet__factory, |
| 11 | + IexecPoco1Facet__factory, |
| 12 | + IexecPoco2Facet__factory, |
| 13 | + IexecPocoAccessorsFacet__factory, |
| 14 | + IexecRelayFacet__factory, |
| 15 | +} from '../../typechain'; |
| 16 | +import { |
| 17 | + FacetDetails, |
| 18 | + deployFacets, |
| 19 | + getUpgradeContext, |
| 20 | + linkFacetsToDiamond, |
| 21 | + printOnchainDiamondDescription, |
| 22 | + removeDanglingFacetDeploymentArtifacts, |
| 23 | + removeFacetsFromDiamond, |
| 24 | + saveOnchainDiamondDescription, |
| 25 | +} from '../../utils/proxy-tools'; |
| 26 | +import { tryVerify } from '../verify'; |
| 27 | + |
| 28 | +async function main() { |
| 29 | + console.log('Performing Solidity v8 migration upgrade (v6.2.0)...'); |
| 30 | + const { chainId, networkName, deployer, proxyOwner, proxyAddress, iexecLibOrders } = |
| 31 | + await getUpgradeContext(); |
| 32 | + |
| 33 | + // Define all facets to remove (all existing facets except core diamond facets) |
| 34 | + const facetAddressesPerChain: { [key: string]: { [key: string]: string } } = { |
| 35 | + // Arbitrum Sepolia |
| 36 | + '421614': { |
| 37 | + IexecAccessorsABILegacyFacet: '0x56CDC32332648b1220a89172191798852706EB35', |
| 38 | + IexecCategoryManagerFacet: '0x5f0483b9D7f959816A5CDD4C49E5C91C24561B43', |
| 39 | + IexecConfigurationExtraFacet: '0x7Ff117E7385Ac3E207AF1791fE7e66C7802aeCCd', |
| 40 | + IexecConfigurationFacet: '0x88eb05e62434057d3AA9e41FdaF7300A586b314D', |
| 41 | + IexecERC20Facet: '0xB0152eC6f48E64a92B66D4736aFA1b02d8D45169', // Removed from codebase |
| 42 | + IexecEscrowTokenFacet: '0xd9EB17A161581FBBAD2Ae998c0C19746EaAD0D6E', |
| 43 | + IexecOrderManagementFacet: '0x541d532E6C195Ba044a75325F367342f523627fB', |
| 44 | + IexecPoco1Facet: '0xC8dE3913fcdBC576970dCe24eE416CA25681f65f', |
| 45 | + IexecPoco2Facet: '0x5c7B589E6807B554ed278f335215B93bCB692162', |
| 46 | + IexecPocoAccessorsFacet: '0x56625089E6EB6F058DB163025318575AD38781fa', |
| 47 | + IexecRelayFacet: '0x8cBf58265F74b77f0D9cCA9f7e14685205496d8f', |
| 48 | + }, |
| 49 | + // Arbitrum Mainnet |
| 50 | + '42161': { |
| 51 | + IexecAccessorsABILegacyFacet: '0x56CDC32332648b1220a89172191798852706EB35', |
| 52 | + IexecCategoryManagerFacet: '0x5f0483b9D7f959816A5CDD4C49E5C91C24561B43', |
| 53 | + IexecConfigurationExtraFacet: '0x7Ff117E7385Ac3E207AF1791fE7e66C7802aeCCd', |
| 54 | + IexecConfigurationFacet: '0x88eb05e62434057d3AA9e41FdaF7300A586b314D', |
| 55 | + IexecERC20Facet: '0xB0152eC6f48E64a92B66D4736aFA1b02d8D45169', // Removed from codebase |
| 56 | + IexecEscrowTokenFacet: '0xd9EB17A161581FBBAD2Ae998c0C19746EaAD0D6E', |
| 57 | + IexecOrderManagementFacet: '0x541d532E6C195Ba044a75325F367342f523627fB', |
| 58 | + IexecPoco1Facet: '0x5331c0FC7DD0Cc08047B546675cd1d6d47152AEb', |
| 59 | + IexecPoco2Facet: '0x5c7B589E6807B554ed278f335215B93bCB692162', |
| 60 | + IexecPocoAccessorsFacet: '0x9BCaCA06d5173f4bA02F8ECcb28E227333F1606F', |
| 61 | + IexecRelayFacet: '0x8cBf58265F74b77f0D9cCA9f7e14685205496d8f', |
| 62 | + }, |
| 63 | + }; |
| 64 | + |
| 65 | + const chainIdStr = chainId.toString(); |
| 66 | + const addresses = facetAddressesPerChain[chainIdStr]; |
| 67 | + if (!addresses) { |
| 68 | + throw new Error(`No facet addresses defined for chain ID ${chainId}`); |
| 69 | + } |
| 70 | + |
| 71 | + // Build list of facets to remove |
| 72 | + const facetsToRemove: FacetDetails[] = [ |
| 73 | + { |
| 74 | + name: 'IexecAccessorsABILegacyFacet', |
| 75 | + address: addresses['IexecAccessorsABILegacyFacet'], |
| 76 | + factory: null, |
| 77 | + }, |
| 78 | + { |
| 79 | + name: 'IexecCategoryManagerFacet', |
| 80 | + address: addresses['IexecCategoryManagerFacet'], |
| 81 | + factory: null, |
| 82 | + }, |
| 83 | + { |
| 84 | + name: 'IexecConfigurationExtraFacet', |
| 85 | + address: addresses['IexecConfigurationExtraFacet'], |
| 86 | + factory: null, |
| 87 | + }, |
| 88 | + { |
| 89 | + name: 'IexecConfigurationFacet', |
| 90 | + address: addresses['IexecConfigurationFacet'], |
| 91 | + factory: null, |
| 92 | + }, |
| 93 | + { |
| 94 | + name: 'IexecERC20Facet', |
| 95 | + address: addresses['IexecERC20Facet'], |
| 96 | + factory: null, |
| 97 | + }, |
| 98 | + { |
| 99 | + name: 'IexecEscrowTokenFacet', |
| 100 | + address: addresses['IexecEscrowTokenFacet'], |
| 101 | + factory: null, |
| 102 | + }, |
| 103 | + { |
| 104 | + name: 'IexecOrderManagementFacet', |
| 105 | + address: addresses['IexecOrderManagementFacet'], |
| 106 | + factory: null, |
| 107 | + }, |
| 108 | + { |
| 109 | + name: 'IexecPoco1Facet', |
| 110 | + address: addresses['IexecPoco1Facet'], |
| 111 | + factory: null, |
| 112 | + }, |
| 113 | + { |
| 114 | + name: 'IexecPoco2Facet', |
| 115 | + address: addresses['IexecPoco2Facet'], |
| 116 | + factory: null, |
| 117 | + }, |
| 118 | + { |
| 119 | + name: 'IexecPocoAccessorsFacet', |
| 120 | + address: addresses['IexecPocoAccessorsFacet'], |
| 121 | + factory: null, |
| 122 | + }, |
| 123 | + { |
| 124 | + name: 'IexecRelayFacet', |
| 125 | + address: addresses['IexecRelayFacet'], |
| 126 | + factory: null, |
| 127 | + }, |
| 128 | + ]; |
| 129 | + |
| 130 | + // Build list of facets to add (all with Solidity v8) |
| 131 | + const facetsToAdd: FacetDetails[] = [ |
| 132 | + { |
| 133 | + name: 'IexecAccessorsABILegacyFacet', |
| 134 | + address: null, |
| 135 | + factory: new IexecAccessorsABILegacyFacet__factory(), // TODO: Check with middleware team if this facet is still needed. |
| 136 | + }, |
| 137 | + { |
| 138 | + name: 'IexecCategoryManagerFacet', |
| 139 | + address: null, |
| 140 | + factory: new IexecCategoryManagerFacet__factory(), |
| 141 | + }, |
| 142 | + { |
| 143 | + name: 'IexecConfigurationExtraFacet', |
| 144 | + address: null, |
| 145 | + factory: new IexecConfigurationExtraFacet__factory(), |
| 146 | + }, |
| 147 | + { |
| 148 | + name: 'IexecConfigurationFacet', |
| 149 | + address: null, |
| 150 | + factory: new IexecConfigurationFacet__factory(iexecLibOrders), |
| 151 | + }, |
| 152 | + { |
| 153 | + name: 'IexecEscrowTokenFacet', |
| 154 | + address: null, |
| 155 | + factory: new IexecEscrowTokenFacet__factory(), |
| 156 | + }, |
| 157 | + { |
| 158 | + name: 'IexecOrderManagementFacet', |
| 159 | + address: null, |
| 160 | + factory: new IexecOrderManagementFacet__factory(iexecLibOrders), |
| 161 | + }, |
| 162 | + { |
| 163 | + name: 'IexecPoco1Facet', |
| 164 | + address: null, |
| 165 | + factory: new IexecPoco1Facet__factory(iexecLibOrders), |
| 166 | + }, |
| 167 | + { |
| 168 | + name: 'IexecPoco2Facet', |
| 169 | + address: null, |
| 170 | + factory: new IexecPoco2Facet__factory(), |
| 171 | + }, |
| 172 | + { |
| 173 | + name: 'IexecPocoAccessorsFacet', |
| 174 | + address: null, |
| 175 | + factory: new IexecPocoAccessorsFacet__factory(iexecLibOrders), |
| 176 | + }, |
| 177 | + { |
| 178 | + name: 'IexecRelayFacet', |
| 179 | + address: null, |
| 180 | + factory: new IexecRelayFacet__factory(), |
| 181 | + }, |
| 182 | + ]; |
| 183 | + |
| 184 | + await printOnchainDiamondDescription(proxyAddress); |
| 185 | + await deployFacets(deployer, chainId, facetsToAdd); |
| 186 | + await removeFacetsFromDiamond(proxyAddress, proxyOwner, facetsToRemove); |
| 187 | + await printOnchainDiamondDescription(proxyAddress); |
| 188 | + await linkFacetsToDiamond(proxyAddress, proxyOwner, facetsToAdd); |
| 189 | + await printOnchainDiamondDescription(proxyAddress); |
| 190 | + console.log('Upgrade performed successfully!'); |
| 191 | + await saveOnchainDiamondDescription(proxyAddress, networkName); |
| 192 | + await removeDanglingFacetDeploymentArtifacts(proxyAddress); |
| 193 | + await tryVerify(facetsToAdd.map((facet) => facet.name)); |
| 194 | +} |
| 195 | + |
| 196 | +if (require.main === module) { |
| 197 | + main().catch((error) => { |
| 198 | + console.error(error); |
| 199 | + process.exitCode = 1; |
| 200 | + }); |
| 201 | +} |
0 commit comments