-
Notifications
You must be signed in to change notification settings - Fork 32
/
verifyProxy.js
executable file
·41 lines (38 loc) · 1.1 KB
/
verifyProxy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env node
const { getSavedDeployment } = require('./utils/deployments.js')
const { loadEnv } = require('./utils/env.js')
const {
initiateVerifyProxy,
getRequestStatus,
} = require('./utils/etherscan.js')
const { logError, logSuccess } = require('./utils/logger.js')
const { parseCommandLineArgs } = require('./utils/options.js')
loadEnv()
const { positionalArgs } = parseCommandLineArgs({
requiredArgsCount: 2,
usage: 'Usage: "npx vp <chain-name> <contract-alias>"',
})
const [chainName, contractAlias] = positionalArgs
const deployment = getSavedDeployment(chainName, contractAlias)
if (!deployment) {
process.exit(1)
}
const { address } = deployment
if (!address) {
logError(`Missing address in deployment file for ${contractAlias}`)
process.exit(1)
}
const guid = initiateVerifyProxy(chainName, address)
if (!guid) {
process.exit(1)
}
const response = getRequestStatus(chainName, 'checkproxyverification', guid)
if (!response) {
process.exit(1)
}
if (response.status === '0') {
logError(`Verification failed: ${response.result}`)
process.exit(1)
} else {
logSuccess(response.result)
}