6-4
//记不住这个之前提到过没,反正这个方法没了
simpleStorage.deployed()
//现在是这样的
simpleStorage.waitForDeployment()
地址,这个之前提过
const address = await simpleStorage.getAddress()
console.log("SimpleStorage deployed to:", address);
6-6
@nomiclabs/hardhat-etherscan无了
网址:https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify#hardhat-etherscan
npm install --save-dev @nomicfoundation/hardhat-verify
不过我看package.json,现在配置hardhat的时候好像就自动装了
6-7
verify()函数一直不调用,因为network.chaid一直返回undefined,后来发现
await simpleStorage.deploymentTransaction().wait(6);
这个鬼东西不能wait(1),可能只等一个块时间太短了,在那之前connection就断开了。
然后在调用的过程中好像又断开了,解决不了,不管了先。
不过github代码仓库的代码倒是能正常运行,我比较不出来我问题在哪。