Skip to content

Commit 9ecd4c7

Browse files
committed
WIP
1 parent 2be96ed commit 9ecd4c7

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@across-protocol/contracts-v2",
3-
"version": "2.1.0-beta.6",
3+
"version": "2.1.0-beta.7",
44
"author": "UMA Team",
55
"license": "AGPL-3.0-only",
66
"repository": {

scripts/processHardhatExport.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
import fs from "fs";
22
import path from "path";
3+
import * as existingDeployments from "../deployments/deployments.json";
34

5+
export type Deployments = Record<string, Record<string, { address: string; blockNumber: number }>>;
46
// Prunes the hardhat export file sent to the cache directory to only contain the deployment addresses of each contract
57
// over the network of chains the Across v2 contracts are deployed on. Meant to be run as part of a publish process.
68
export async function run(): Promise<void> {
79
try {
810
const deploymentExport = require("../cache/massExport.json");
911
const castExport = deploymentExport as any;
1012
console.log("Generating exports on the following networks(if they have deployments)", Object.keys(castExport));
11-
const processedOutput: { [chainId: string]: { [name: string]: { address: string; blockNumber: number } } } = {};
13+
const processedOutput: Deployments = {};
1214
Object.keys(castExport).forEach((chainId) => {
1315
if (castExport[chainId][0])
1416
Object.keys(castExport[chainId][0].contracts).forEach((contractName) => {
1517
if (!processedOutput[chainId]) processedOutput[chainId] = {};
1618
const address = castExport[chainId][0]?.contracts[contractName].address;
1719
const blockNumber = findDeploymentBlockNumber(castExport[chainId][0].name, contractName);
20+
const existingBlockNumber = (existingDeployments as Deployments)[chainId][contractName].blockNumber;
21+
console.log(
22+
`Not updating ${contractName} as it has a later block number set in deployments.json than the one in deployments/${contractName}.json`
23+
);
24+
const hasLaterBlockNumber = existingBlockNumber > blockNumber;
25+
if (hasLaterBlockNumber) return; // If we have already found a later block number for this contract, then ignore this one.
26+
// As its likely that we manually updated the `deployments` file and we don't want to override it.
1827
if (/.*_SpokePool/.test(contractName)) contractName = "SpokePool"; // Strip the network name from the spoke pool in the contractName.
1928
processedOutput[chainId][contractName] = { address, blockNumber };
2029
});

0 commit comments

Comments
 (0)