4.15.2 How to verify your smart contracts on Stargram
Chain
After you deploy your PRC20 Contract successfully, the next is to verify the source code for your Solidity contracts. This plugin adds the Stargram network to the verify task provided by Hardhat-Etherscan
Step 1. Install the package
We need the Hardhat plugin for integration with Stargram scan's contract verification service. This plugin needs to be used in conjunction with the Hardhat-Etherscan plugin (v3.1.0 or above).
# Install hardhat-etherscan plugin
npm install --save-dev @nomiclabs/hardhat-etherscan@^3.1.0
And make sure you also have the following dependencies:
npm install ethers dotenv @openzeppelin/contracts
npm install --save-dev solidity-coverage
npm install --save-dev hardhat-gas-reporter
Step 2. Import the plugins
Under Hardhat, add the following statement to your hardhat.config.ts:
...
import "@nomiclabs/hardhat";
import "@nomiclabs/hardhat-etherscan";
...
};
Step 3. Check the supported network list:
Check the list of supported networks:
npx hardhat verify --list-networks
Step 4. Verify the Smart Contract
Obtain your deployed contract address when you deployed the contract (Step 8 in the previous section).
In your hardhat project, run the verify task as shown below. Replace DEPLOYED_CONTRACT_ADDRESS with your deployed contract address, and the constructor arguments that were used to deploy it (if any):
Verify on Stargram (Mainnet):
npx hardhat verify --network stargram DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1""Constructor argument 2"
Verify on Stargram Testnet
npx hardhat verify --network stargramTestnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1""Constructor argument 2"
Example:
npx hardhat verify --network stargramTestnet "0x00e9fd0eaea8325dc31a64e23d91607fdd60d2d1" "My token name" "My token symbol"
You should now be able to see your contact is verified on Stargramscan or Testnet Stargramscan and start to read and write your smart contracts.
Last updated