Skip to content

Commit 27c6dbd

Browse files
committed
feat: deploy and update IexecPocoAccessorsFacet and IexecPoco1Facet
Introduced a new script to deploy and update the IexecPocoAccessorsFacet and IexecPoco1Facet. The script handles the deployment of new facets, removal of old facets, and updates the diamond proxy accordingly. It includes checks for required deployment options and logs the process for better traceability.
1 parent d3686d5 commit 27c6dbd

File tree

1 file changed

+38
-17
lines changed

1 file changed

+38
-17
lines changed

scripts/upgrades/accessors/deploy-and-update-accessor-facet.ts renamed to scripts/upgrades/deploy-and-update-some-facet.ts

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
import { ZeroAddress } from 'ethers';
55
import { ethers } from 'hardhat';
66
import { FacetCutAction } from 'hardhat-deploy/dist/types';
7-
import type { IDiamond } from '../../../typechain';
7+
import type { IDiamond } from '../../typechain';
88
import {
99
DiamondCutFacet__factory,
1010
DiamondLoupeFacet__factory,
11+
IexecPoco1Facet__factory,
1112
IexecPocoAccessorsFacet__factory,
12-
} from '../../../typechain';
13-
import { Ownable__factory } from '../../../typechain/factories/rlc-faucet-contract/contracts';
14-
import { FactoryDeployer } from '../../../utils/FactoryDeployer';
15-
import config from '../../../utils/config';
16-
import { linkContractToProxy } from '../../../utils/proxy-tools';
17-
import { printFunctions } from '../upgrade-helper';
13+
} from '../../typechain';
14+
import { Ownable__factory } from '../../typechain/factories/rlc-faucet-contract/contracts';
15+
import { FactoryDeployer } from '../../utils/FactoryDeployer';
16+
import config from '../../utils/config';
17+
import { linkContractToProxy } from '../../utils/proxy-tools';
18+
import { printFunctions } from './upgrade-helper';
1819

1920
(async () => {
20-
console.log('Deploying and updating IexecPocoAccessorsFacet...');
21+
console.log('Deploying and updating IexecPocoAccessorsFacet & IexecPoco1Facet...');
2122

2223
const [account] = await ethers.getSigners();
2324
const chainId = (await ethers.provider.getNetwork()).chainId;
@@ -47,18 +48,26 @@ import { printFunctions } from '../upgrade-helper';
4748
proxyOwnerSigner,
4849
);
4950

50-
console.log('\n=== Step 1: Deploying new IexecPocoAccessorsFacet ===');
51+
console.log('\n=== Step 1: Deploying all new facets ===');
5152
const factoryDeployer = new FactoryDeployer(account, chainId);
5253
const iexecLibOrders = {
5354
['contracts/libs/IexecLibOrders_v5.sol:IexecLibOrders_v5']:
5455
deploymentOptions.IexecLibOrders_v5,
5556
};
5657

58+
console.log('Deploying new IexecPocoAccessorsFacet...');
5759
const newFacetFactory = new IexecPocoAccessorsFacet__factory(iexecLibOrders);
5860
const newFacetAddress = await factoryDeployer.deployContract(newFacetFactory);
61+
console.log(`IexecPocoAccessorsFacet deployed at: ${newFacetAddress}`);
62+
63+
console.log('Deploying new IexecPoco1Facet...');
64+
const newIexecPoco1FacetFactory = new IexecPoco1Facet__factory(iexecLibOrders);
65+
const newIexecPoco1FacetAddress =
66+
await factoryDeployer.deployContract(newIexecPoco1FacetFactory);
67+
console.log(`IexecPoco1Facet deployed at: ${newIexecPoco1FacetAddress}`);
5968

6069
console.log(
61-
'\n=== Step 2: Remove old facets (remove all functions of old accessors facets) ===',
70+
'\n=== Step 2: Remove old facets (IexecAccessorsFacet & IexecPocoAccessorsFacet & IexecPoco1Facet) ===',
6271
);
6372

6473
const diamondLoupe = DiamondLoupeFacet__factory.connect(diamondProxyAddress, account);
@@ -99,16 +108,17 @@ import { printFunctions } from '../upgrade-helper';
99108
});
100109
}
101110

102-
const oldAccessorFacets = [
111+
const oldFacets = [
103112
'0xEa232be31ab0112916505Aeb7A2a94b5571DCc6b', //IexecAccessorsFacet
104113
'0xeb40697b275413241d9b31dE568C98B3EA12FFF0', //IexecPocoAccessorsFacet
114+
'0x46b555fE117DFd8D4eAC2470FA2d739c6c3a0152', //IexecPoco1Facet
105115
];
106-
// Remove ALL functions from the old accessor facets using diamondLoupe.facetFunctionSelectors() except of constant founctions
107-
for (const facetAddress of oldAccessorFacets) {
116+
// Remove ALL functions from the old facets using diamondLoupe.facetFunctionSelectors() except of constant founctions
117+
for (const facetAddress of oldFacets) {
108118
const selectors = await diamondLoupe.facetFunctionSelectors(facetAddress);
109119
if (selectors.length > 0) {
110120
console.log(
111-
`Removing old accessor facet ${facetAddress} with ${selectors.length} functions - will remove ALL`,
121+
`Removing old facet ${facetAddress} with ${selectors.length} functions - will remove ALL`,
112122
);
113123
removalCuts.push({
114124
facetAddress: ZeroAddress,
@@ -131,12 +141,23 @@ import { printFunctions } from '../upgrade-helper';
131141
console.log('Diamond functions after removing old facets:');
132142
await printFunctions(diamondProxyAddress);
133143
}
134-
console.log('\n=== Step 3: Updating diamond proxy with new facet ===');
144+
console.log('\n=== Step 3: Updating diamond proxy with all new facets ===');
145+
console.log('Adding new IexecPocoAccessorsFacet...');
135146
await linkContractToProxy(diamondProxyAsOwner, newFacetAddress, newFacetFactory);
136-
console.log('New functions added successfully');
147+
console.log('New IexecPocoAccessorsFacet added successfully');
148+
149+
console.log('Adding new IexecPoco1Facet ...');
150+
await linkContractToProxy(
151+
diamondProxyAsOwner,
152+
newIexecPoco1FacetAddress,
153+
newIexecPoco1FacetFactory,
154+
);
155+
console.log('New IexecPoco1Facet with isDatasetCompatibleWithDeal added successfully');
137156

138-
console.log('Diamond functions after adding new facet:');
157+
console.log('Diamond functions after adding new facets:');
139158
await printFunctions(diamondProxyAddress);
140159

141160
console.log('\nUpgrade completed successfully!');
161+
console.log(`New IexecPocoAccessorsFacet deployed at: ${newFacetAddress}`);
162+
console.log(`New IexecPoco1Facet deployed at: ${newIexecPoco1FacetAddress}`);
142163
})();

0 commit comments

Comments
 (0)