@layerzerolabs/verify-contract 1.0.422 → 1.0.423

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
- ##Verify-Contract
2
-
1
+ # Verify-Contract
3
2
 
3
+ ## Setup
4
4
  - Ensure you fill out the missing API keys inside your .env (copy the values from .env.example)
5
5
 
6
6
 
7
-
7
+ ## Usage
8
8
 
9
9
  - Inside your deploy script:
10
10
 
11
11
  ``const verify = require('@layerzerolabs/verify-contract')``
12
12
 
13
- ``await verify(hre.network.name, [contract name])``
13
+ ``await verify(hre.network.name, ["ContractName1", "ContractName2"])``
14
14
 
15
15
 
16
16
 
@@ -14,8 +14,10 @@
14
14
  "optimism": "api-optimistic.etherscan.io",
15
15
  "optimism-goerli": "api-goerli-optimistic.etherscan.io",
16
16
  "gnosis": "api.gnosisscan.io",
17
- "zkpolygon": "api-zkevm.polygonscan.com",
17
+ "zkpolygon-mainnet": "api-zkevm.polygonscan.com",
18
18
  "base-mainnet": "api.basescan.org",
19
+ "zkconsensys-mainnet": "api.lineascan.build",
20
+
19
21
 
20
22
  "aptos": "",
21
23
  "celo": "",
package/index.js CHANGED
@@ -109,7 +109,7 @@ function getBaseAndRemainingContract(contractName, contractBuildInfo) {
109
109
  }
110
110
 
111
111
 
112
- module.exports = async function (network, contract) {
112
+ module.exports = async function (network, contracts) {
113
113
  if(!BLOCK_EXPLORER_API_URL[network]) {
114
114
  throw `Unsupported block explorer network: ${network}`
115
115
  }
@@ -117,35 +117,38 @@ module.exports = async function (network, contract) {
117
117
  throw `Missing API key for network: ${network}`
118
118
  }
119
119
 
120
- const contractName = `/${contract}.sol`
121
-
122
- // get the build files/artifacts
123
- const contractDeployment = JSON.parse(FileSystem.readFileSync(`./deployments/${network}/${contract}.json`, "utf8"))
124
- // iterate the build-info to find the correct build file
125
- let contractBuildInfo
126
- FileSystem.readdirSync(`./artifacts/build-info/`).forEach(fileName => {
127
- const f = JSON.parse(FileSystem.readFileSync(`./artifacts/build-info/${fileName}`, "utf8"))
128
-
129
- let test = Object.entries(f["input"]["sources"]).filter(([k, v]) => k.includes(contractName))
130
- if (test[0] && test[0][0]) {
131
- if (test[0][0].includes(contractName)) {
132
- contractBuildInfo = f
120
+ for (const contract of contracts) {
121
+ const contractName = `/${contract}.sol`
122
+
123
+ // get the build files/artifacts
124
+ const contractDeployment = JSON.parse(FileSystem.readFileSync(`./deployments/${network}/${contract}.json`, "utf8"))
125
+ // iterate the build-info to find the correct build file
126
+ let contractBuildInfo
127
+ FileSystem.readdirSync(`./artifacts/build-info/`).forEach(fileName => {
128
+ const f = JSON.parse(FileSystem.readFileSync(`./artifacts/build-info/${fileName}`, "utf8"))
129
+
130
+ let test = Object.entries(f["input"]["sources"]).filter(([k, v]) => k.includes(contractName))
131
+ if (test[0] && test[0][0]) {
132
+ if (test[0][0].includes(contractName)) {
133
+ contractBuildInfo = f
134
+ }
133
135
  }
134
- }
135
- })
136
- if (!contractBuildInfo) throw `Could not find contract: ${contractName} inside of build-info!`
136
+ })
137
+ if (!contractBuildInfo) throw `Could not find contract: ${contractName} inside of build-info!`
137
138
 
138
- console.log(`\n\nVerifying... Network: ${network}, contractName: ${contractName}, address: ${contractDeployment["address"]}`)
139
+ console.log(`\n\nVerifying... Network: ${network}, contractName: ${contractName}, address: ${contractDeployment["address"]}`)
139
140
 
140
- // parse and filter out the extra build files, because the verifier freaks out if too many contracts to check
141
- const [baseContract, remainingContracts] = getBaseAndRemainingContract(contractName, contractBuildInfo)
142
- contractBuildInfo["input"]["sources"] = getContractInheritance(baseContract[1]["content"], remainingContracts, Object.fromEntries([baseContract]))
141
+ // parse and filter out the extra build files, because the verifier freaks out if too many contracts to check
142
+ const [baseContract, remainingContracts] = getBaseAndRemainingContract(contractName, contractBuildInfo)
143
+ contractBuildInfo["input"]["sources"] = getContractInheritance(baseContract[1]["content"], remainingContracts, Object.fromEntries([baseContract]))
143
144
 
144
- // format the put request
145
- const putObj = formatPutObj(baseContract, contractBuildInfo, contractDeployment, contract, network)
145
+ // format the put request
146
+ const putObj = formatPutObj(baseContract, contractBuildInfo, contractDeployment, contract, network)
147
+
148
+ const response = await makeRequest(`${BLOCK_EXPLORER_API_URL[network]}`, putObj)
149
+ console.log(JSON.parse(response))
150
+ }
146
151
 
147
- const response = await makeRequest(`${BLOCK_EXPLORER_API_URL[network]}`, putObj)
148
- console.log(JSON.parse(response))
149
152
  }
150
153
 
151
154
  async function makeRequest(url, data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/verify-contract",
3
- "version": "1.0.422",
3
+ "version": "1.0.423",
4
4
  "description": "Verify Solidity contracts on supported block explorers",
5
5
  "main": "index.js",
6
6
  "scripts": {},