Skip to content

Commit 3bbaefc

Browse files
committed
Save IexecLibOrders_v5 address in config
1 parent 7a21f7d commit 3bbaefc

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

scripts/tools/update-config.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ async function main(): Promise<void> {
2525
if (!localConfig.chains) {
2626
localConfig.chains = {};
2727
}
28-
2928
if (!localConfig.chains[chainId]) {
3029
localConfig.chains[chainId] = {
3130
_comment: `Chain ${networkName} (${chainId})`,
@@ -39,21 +38,29 @@ async function main(): Promise<void> {
3938
v5: {},
4039
};
4140
}
42-
4341
if (!localConfig.chains[chainId].v5) {
4442
localConfig.chains[chainId].v5 = {};
4543
}
46-
47-
const contractKey = 'DiamondProxy';
48-
const previousValue = localConfig.chains[chainId].v5[contractKey] || 'null';
49-
localConfig.chains[chainId].v5[contractKey] = contractAddress;
50-
44+
// Save the Diamond proxy address.
45+
const diamondProxyName = 'DiamondProxy';
46+
const previousDiamondAddress = localConfig.chains[chainId].v5[diamondProxyName] || 'null';
47+
localConfig.chains[chainId].v5[diamondProxyName] = contractAddress;
48+
console.log(
49+
`Updated ${chainId}.v5.${diamondProxyName} from ${previousDiamondAddress} to ${contractAddress}`,
50+
);
51+
// Save `IexecLibOrders_v5` address if it exists
52+
const iexecLibOrdersName = 'IexecLibOrders_v5';
53+
const iexecLibOrdersDeployment = await deployments.get(iexecLibOrdersName);
54+
if (iexecLibOrdersDeployment && iexecLibOrdersDeployment.address) {
55+
const previousLibAddress = localConfig.chains[chainId].v5[iexecLibOrdersName] || 'null';
56+
localConfig.chains[chainId].v5[iexecLibOrdersName] = iexecLibOrdersDeployment.address;
57+
console.log(
58+
`Updated ${chainId}.v5.${iexecLibOrdersName} from ${previousLibAddress} to ${iexecLibOrdersDeployment.address}`,
59+
);
60+
}
5161
// Write the updated config back to file
5262
fs.writeFileSync(configPath, JSON.stringify(localConfig, null, 2));
53-
54-
console.log(`Updated ${chainId}.v5.${contractKey}:`);
55-
console.log(`Previous: ${previousValue}`);
56-
console.log(`New: ${contractAddress}`);
63+
console.log(`Configuration updated successfully in ${configPath}`);
5764
}
5865

5966
// Execute the main function and handle any errors

0 commit comments

Comments
 (0)