Skip to content

Commit f481827

Browse files
authored
fix: do not spam console if impls are not available yet (#184)
1 parent 7a606bf commit f481827

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/reports/diff-reports.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,23 @@ export async function diffReports<A extends AaveV3Snapshot, B extends AaveV3Snap
117117
try {
118118
if (diffResultWithoutUnchanged.poolConfig) {
119119
for (const key of Object.keys(diffResult.poolConfig)) {
120-
if (
121-
typeof (diffResult as any).poolConfig[key] === 'object' &&
122-
(diffResult as any).poolConfig[key].hasOwnProperty('from')
123-
) {
124-
const fromAddress = (diffResult as any).poolConfig[key].from;
125-
const toAddress = (diffResult as any).poolConfig[key].to;
126-
const from = downloadContract(pre.chainId, fromAddress);
127-
const to = downloadContract(pre.chainId, toAddress);
128-
const result = diffCode(from, to);
129-
writeFileSync(`./diffs/${pre.chainId}_${key}_${fromAddress}_${toAddress}.diff`, result);
120+
try {
121+
if (
122+
typeof (diffResult as any).poolConfig[key] === 'object' &&
123+
(diffResult as any).poolConfig[key].hasOwnProperty('from')
124+
) {
125+
const fromAddress = (diffResult as any).poolConfig[key].from;
126+
const toAddress = (diffResult as any).poolConfig[key].to;
127+
const from = downloadContract(pre.chainId, fromAddress);
128+
const to = downloadContract(pre.chainId, toAddress);
129+
const result = diffCode(from, to);
130+
writeFileSync(`./diffs/${pre.chainId}_${key}_${fromAddress}_${toAddress}.diff`, result);
131+
}
132+
} catch (e) {
133+
console.info('error diffing the code');
134+
console.info(
135+
'this can happen if etherscan is not available, the code is not verified or not deployed yet',
136+
);
130137
}
131138
}
132139
}

0 commit comments

Comments
 (0)