limit getAbi() to only look for IVault.sol.

This commit is contained in:
7400
2023-12-06 10:48:48 -08:00
parent 5936f920be
commit c260cf5f8d

16
abi.js
View File

@@ -41,13 +41,15 @@ export async function getAbi(className) {
let found = abi[className]
if (found === undefined) {
console.log('warning: loading ABI from filesystem for '+className)
// const data = await readFile(ABI_BASE_PATH + `/${className}.sol/${className}.json`)
let data
try {
data = await readFile(ABI_BASE_PATH + `/I${className}.sol/I${className}.json`)
}
catch (e) {
data = await readFile(ABI_BASE_PATH + `/${className}.sol/${className}.json`)
let data = await readFile(ABI_BASE_PATH + `/${className}.sol/${className}.json`)
// Tricky code to handle proxy Vault where interface file is needed instead of class file
if (className == 'Vault') {
try {
data = await readFile(ABI_BASE_PATH + `/I${className}.sol/I${className}.json`)
}
catch (e) {
if (e.code !== 'ENOENT') throw e;
}
}
found = JSON.parse(data.toString())['abi']
abi[className] = found