-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from ayo-klaytn/add/kaiascan-hardhat-verify
kaiascan verification guide added
- Loading branch information
Showing
8 changed files
with
3,803 additions
and
1,925 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
--- | ||
id: hardhat | ||
title: Using Hardhat | ||
--- | ||
|
||
import Tabs from '@theme/Tabs' | ||
import TabItem from '@theme/TabItem' | ||
|
||
# How to Verify Smart Contracts Using Hardhat | ||
|
||
This guide allows you to automatically verify your smart contracts' source code on Kaiascope straight from your CLI using the Hardhat Verify Plugin. | ||
|
||
To verify your contract on Kaia, you need to add the following configuration to your `hardhat.config.js`: | ||
|
||
## Kaiascan | ||
|
||
<Tabs> | ||
<TabItem value="kaia-mainnet" label="Mainnet"> | ||
```js | ||
module.exports = { | ||
etherscan: { | ||
apiKey: { | ||
kaia: "unnecessary", | ||
}, | ||
customChains: [ | ||
{ | ||
network: "kaia", | ||
chainId: 8217, | ||
urls: { | ||
apiURL: "https://mainnet-api.kaiascan.io/hardhat-verify", | ||
browserURL: "https://kaiascan.io", | ||
} | ||
}, | ||
] | ||
} | ||
} | ||
``` | ||
</TabItem> | ||
|
||
<TabItem value="kairos-testnet" label="Kairos"> | ||
```js | ||
module.exports = { | ||
etherscan: { | ||
apiKey: { | ||
kairos: "unnecessary", | ||
}, | ||
customChains: [ | ||
{ | ||
network: "kairos", | ||
chainId: 1001, | ||
urls: { | ||
apiURL: "https://kairos-api.kaiascan.io/hardhat-verify", | ||
browserURL: "https://kairos.kaiascan.io", | ||
} | ||
}, | ||
] | ||
} | ||
} | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
## Kaiascope | ||
|
||
<Tabs> | ||
<TabItem value="kaia-mainnet" label="Mainnet"> | ||
```js | ||
module.exports = { | ||
networks: { | ||
kaia: { | ||
chainId: 8217, | ||
url: "RPC_URL", | ||
}, | ||
}, | ||
etherscan: { | ||
apiKey: { | ||
kaia: "unnecessary", | ||
}, | ||
customChains: [ | ||
{ | ||
network: "kaia", | ||
chainId: 8217, | ||
urls: { | ||
apiURL: "https://api-cypress.klaytnscope.com/api", | ||
browserURL: "https://kaiascope.com/", | ||
}, | ||
}, | ||
] | ||
} | ||
} | ||
``` | ||
</TabItem> | ||
|
||
<TabItem value="kairos-testnet" label="Kairos"> | ||
```js | ||
module.exports = { | ||
networks: { | ||
kairos: { | ||
chainId: 1001, | ||
url: "RPC_URL", | ||
}, | ||
}, | ||
etherscan: { | ||
apiKey: { | ||
kairos: "unnecessary", | ||
}, | ||
customChains: [ | ||
{ | ||
network: "kairos", | ||
chainId: 1001, | ||
urls: { | ||
apiURL: "https://api-baobab.klaytnscope.com/api", | ||
browserURL: "https://kairos.kaiascope.com", | ||
}, | ||
}, | ||
] | ||
} | ||
} | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
To verify the contract, you will run the verify command and pass in the address of the deployed contract, network and parameters if any. | ||
|
||
```bash | ||
npx hardhat verify –network <network> <deployed_address> <parameters> | ||
|
||
// example | ||
|
||
npx hardhat verify --network kairos 0x3e360fC99c4383e3adaAE9742c0fC983fDAa0535 | ||
``` | ||
|
||
In your terminal you should see the source code for your contract was successfully submitted for verification. | ||
|
||
If the verification was successful, you should see Successfully verified contract and there will be a link to the contract code on [Kaiascan](https://kairos.kaiascan.io/address/0x3e360fC99c4383e3adaAE9742c0fC983fDAa0535?tabId=contract&page=1) and [Kaiascope](https://baobab.klaytnscope.com/account/0x3e360fC99c4383e3adaAE9742c0fC983fDAa0535?tabId=contractCode) respectively. | ||
|
||
**Kaiascan** | ||
|
||
 | ||
 | ||
|
||
**Kaiascope** | ||
|
||
 | ||
 | ||
|
||
## Useful links | ||
|
||
- [Configuration for Hardhat Verify Plugin on Kaiascan](https://docs.kaiascan.io/hardhat-verify) | ||
- [Configuration for Hardhat Verify Plugin on Kaiascope](https://docs.klaytnscope.com/contract/configuration-for-hardhat-verify-plugin) | ||
- [Verifying contracts using Hardhat on Kaiascan](https://klaytn.foundation/verifying-contracts-using-hardhat-on-klaytnscope) | ||
|
||
|
Oops, something went wrong.