- Define private key of the deployer in
.env
- Define RPC of the networks (public or paid)
- Install mmodules:
$ npm i -D
A single test of catching emitted event is done.
$ npm test
We named the networks in hardhat.config.js
as they are named by etherscan plugin, e.g. polygonMumbai
for mumbai test network. For the names of supported networks by the etherscan plugin:
$ npx hardhat verify --list-networks
Deploy:
$ npx hardhat --network skaletest deploy --reset
deploying "DefaultProxyAdmin" (tx: 0xf9a0992b40ba2ad13a31a55da52948150c1b4e8432429e984bda17d9a3820616)...: deployed at 0xC689b663E0d0E66465e3E7dfC4777E007A3567E6 with 642683 gas
deploying "TestContract_Implementation" (tx: 0xf2c5245467749dd958f3594a51fb20f565ba6c4a3e56cd4c31f459519991aa3e)...: deployed at 0x6B187a7b4439FD0C8128D72EB79Ef621AC6A60cc with 95577 gas
deploying "TestContract_Proxy" (tx: 0xf9286731d8d04ca91d0360ffe9d0af8ae3b3951eb99c53a330843bcdf6330c44)...: deployed at 0x19933c2ffb1c1aD6e124406A91D87C49C2F113C0 with 716618 gas
Deployed
Verification of implementation:
$ npx hardhat --network skaletest verify 0x6B187a7b4439FD0C8128D72EB79Ef621AC6A60cc
(node:1068661) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Nothing to compile
Successfully submitted source code for contract
contracts/TestContract.sol:TestContract at 0x6B187a7b4439FD0C8128D72EB79Ef621AC6A60cc
for verification on the block explorer. Waiting for verification result...
Successfully verified contract TestContract on Etherscan.
https://attractive-merope.explorer.staging-v2.skalenodes.com/address/0x6B187a7b4439FD0C8128D72EB79Ef621AC6A60cc#code
How to verify proxy on https://attractive-merope.explorer.staging-v2.skalenodes.com/address/0x19933c2ffb1c1aD6e124406A91D87C49C2F113C0/contracts
The proxy information is in deployments/skaletest/TestContract_Proxy.json
created by hardhat-deploy plugin (https://github.com/wighawag/hardhat-deploy)
For example, args of the contructor:
"args": [
"0x6B187a7b4439FD0C8128D72EB79Ef621AC6A60cc",
"0xC689b663E0d0E66465e3E7dfC4777E007A3567E6",
"0x"
],
The flattened contract of the proxy is in contracts-flat/TransparentUpgradeableProxy-flat.sol
. The flattened contract was generated by hardhat flatten
command on open zeppelin upgradeable proxy contract used by the plugin and copied to OZ
folder.
END