【问题标题】:HardHat - Fail - Unable to verify / EtherscanHardHat - 失败 - 无法验证/Etherscan
【发布时间】:2022-12-09 05:10:46
【问题描述】:

这是我的合同。

// SPDX-License-Identifier: MIT

pragma solidity >= 0.7.3;

contract terceiroTest {
    // We pass and old String, a new string and when this event is
    // broadcast everybody is able to see that the even happened.
    // and see the strings exposed too.
    event UpdatedMessages(string oldStr, string newStr);

    string public message;

    // When this contract is deployed we require an argument passed called initMessasge
    constructor (string memory initMessage) {
        message = initMessage;
    }

    function update(string memory newMessage) public {
        string memory oldMsg = message;
        message = newMessage;
        emit UpdatedMessages(oldMsg, newMessage);
    }
} 

它给了我错误:

我试图找到关于此错误的任何描述,甚至更改了 solidity 的版本。我仍在研究智能合约,如果有人有或有同样的错误,我会很乐意启发我。谢谢。

【问题讨论】:

  • 不要发布代码、数据、错误消息等的图像。- 将文本复制或键入问题。 How to Ask

标签: solidity smartcontracts hardhat etherscan


【解决方案1】:

我遇到过类似的问题,都是自己解决的。您的代码中可能没有问题,而问题出在 etherscan 上。

以下是我建议分类的几件事:

  1. 再次提交
  2. 给出提交和验证之间的差距
  3. 尝试不同的环境,如 polygonscan。
  4. 从他们的 UI 手动提交。

【讨论】:

    【解决方案2】:

    我拿了你的合同并在我的安全帽环境中测试了它。一切正常。也许您的本地设置中发生了其他事情?

    使用全新的安全帽设置重试。尝试使用这个“坏蛋安全帽设置”https://github.com/mistersingh179/badass-hardhat-setup

    我使用该设置作为一个干净的平台,启动了我的本地主机链,然后将其连接到我的 sidekik 接口以测试功能。您的代码工作正常。这里的例子:

    【讨论】:

      猜你喜欢
      • 2022-01-20
      • 2021-11-14
      • 2023-01-16
      • 2021-11-15
      • 2013-08-15
      • 1970-01-01
      • 2017-11-26
      • 1970-01-01
      • 2019-11-19
      相关资源
      最近更新 更多