Files
semaphore/packages/contracts/scripts/utils.ts
cedoor 7d781dc09b refactor: update verifiers
Former-commit-id: 26195e3944
2024-01-12 10:54:42 +00:00

20 lines
607 B
TypeScript

import { readFileSync, writeFileSync } from "fs"
type DeployedContracts = {
SemaphoreVerifier: string
Poseidon: string
Semaphore: string
}
export function getDeployedContracts(network: string | undefined): DeployedContracts | null {
try {
return JSON.parse(readFileSync(`./deployed-contracts/${network}.json`, "utf8"))
} catch (error) {
return null
}
}
export function saveDeployedContracts(network: string | undefined, deployedContracts: DeployedContracts) {
writeFileSync(`./deployed-contracts/${network}.json`, JSON.stringify(deployedContracts, null, 4))
}