Skip to content

Commit

Permalink
Verify contracts on Bellecour Blockscout(s) v5 & v6
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyjams committed Oct 3, 2024
1 parent c2f6bfe commit 764b477
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ Run:
npx hardhat deploy --network <name>
```

## Local Bellecour fork
#### Local Bellecour fork

```
LOCAL_FORK=true MNEMONIC=<mnemonic> npx hardhat deploy --network hardhat
```

## Bellecour
#### Bellecour

With appropriate deployer key:
```
npx hardhat deploy --network bellecour
```

- Logs
```
Deploying all contracts related to voucher..
ChainId: 134
Expand All @@ -55,4 +55,18 @@ VoucherImpl: 0xf59b25A6149f1DA76470A6300aEc420540127E62
VoucherUpgradeableBeacon: 0xFC43930c7bFb6499A692fcFC7199Ea5E68a3d9F8
VoucherHubImpl: 0x7b5947B5e49eB2F17f35f55cB48C2a3637F7c80F
VoucherHubERC1967Proxy: 0x3137B6DF4f36D338b82260eDBB2E7bab034AFEda
```
```

### Verify contracts

- Blockscout v5

```
BLOCKSCOUT_VERSION=v5 npx hardhat run ./scripts/verify.ts --network bellecour
```

- Blockscout v6

```
npx hardhat run ./scripts/verify.ts --network bellecour
```
19 changes: 19 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import 'solidity-docgen';
const managerAccount = Number(process.env.IEXEC_VOUCHER_MANAGER_ACCOUNT_INDEX) || null;
const minterAccount = Number(process.env.IEXEC_VOUCHER_MINTER_ACCOUNT_INDEX) || null;
export const isLocalFork = process.env.LOCAL_FORK == 'true';
const bellecourBlockscoutUrl =
process.env.BLOCKSCOUT_VERSION == 'v5'
? 'https://blockscout.bellecour.iex.ec'
: 'https://blockscout-v6.bellecour.iex.ec'; // Use Blockscout v6 by default

const config: HardhatUserConfig = {
solidity: {
Expand Down Expand Up @@ -87,6 +91,21 @@ const config: HardhatUserConfig = {
gas: 6700000,
},
},
etherscan: {
apiKey: {
bellecour: '<>', // a non-empty string is needed by the plugin.
},
customChains: [
{
network: 'bellecour',
chainId: 134,
urls: {
apiURL: `${bellecourBlockscoutUrl}/api`,
browserURL: bellecourBlockscoutUrl,
},
},
],
},
namedAccounts: {
deployer: {
default: 0,
Expand Down
20 changes: 20 additions & 0 deletions scripts/verify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import fs from 'fs';
import hre, { deployments } from 'hardhat';
import path from 'path';

(async () => {
const jsonExtension = '.json';
const contractNames = fs
.readdirSync(path.resolve(__dirname, `../deployments/${hre.network.name}`))
.filter((file) => file.endsWith(jsonExtension))
.map((filePath) => filePath.replace(jsonExtension, ''));
console.log(`Contracts to verify: ${contractNames}`);
for (const contractName of contractNames) {
console.log(`Verifying ${contractName}..`);
const { address, args } = await deployments.get(contractName);
await hre.run('verify:verify', {
address,
constructorArguments: args,
});
}
})();

0 comments on commit 764b477

Please sign in to comment.