Skip to content

Commit

Permalink
Merge pull request #144 from P4-Games/feature/doc-verify
Browse files Browse the repository at this point in the history
[docs] 📝 add guide to verify contracts source code
  • Loading branch information
dappsar authored Apr 11, 2024
2 parents e4ed9be + 0a276c6 commit 3a5d34b
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 6 deletions.
44 changes: 44 additions & 0 deletions .doc/development-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Development Guide


## Verify source code of deployed Contracts

1. Create an account in polygonscan.com
2. Create un API Key in your Polygon's account
3. Copy your API Key from Polygonscan
4. Create a .env file with the API Key

```sh
POLYGON_MUMBAI_RPC_PROVIDER = 'RPC Node URL'
PRIVATE_KEY = 'your wallet private key'
POLYGONSCAN_API_KEY = 'your polygonscan api key'
```

5. Install hardhat-etherscan dependency


```sh
npm install --save-dev @nomiclabs/hardhat-etherscan
or
yarn add --dev @nomiclabs/hardhat-etherscan
```

6. Update your hardhat.config.js with etherscan


```sh
module.exports = {
solidity: ...
defaultNetwork: ...
networks: { ...}
etherscan: {
apiKey: POLYGONSCAN_API_KEY
}
}
```
7. Verify the deployed contract address
```sh
npx hardhat verify CONTRACT_ADDR --network polygon
```
8 changes: 8 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const INFURA_API_KEY = process.env.INFURA_API_KEY || 'INFURA_API_KEY'
const ALCHEMY_API_KEY = process.env.ALCHEMY_API_KEY || 'ALCHEMY_API_KEY'
const PRIVATE_KEY = process.env.PRIVATE_KEY
const MNEMONIC = process.env.MNEMONIC
const POLYGONSCAN_KEY = process.env.POLYGONSCAN_API_KEY || ''
const solidityVersions = ["0.6.0", "0.6.2", "0.6.6", "0.8.18", "0.8.20"]
const compilers = solidityVersions.map((version) => ({
version,
Expand Down Expand Up @@ -72,6 +73,13 @@ const config: HardhatUserConfig = {
tests: './test',
cache: './cache',
artifacts: './artifacts'
},
etherscan: {
// your API Key from PolygonScan
// Obtain one at https://polygonscan.com/
apiKey: {
polygon: POLYGONSCAN_KEY
}
}
}

Expand Down
Loading

0 comments on commit 3a5d34b

Please sign in to comment.